diff options
Diffstat (limited to 'tests')
1737 files changed, 15540 insertions, 11040 deletions
diff --git a/tests/assembly/asm/aarch64-types.rs b/tests/assembly/asm/aarch64-types.rs index 3e2a4773703..f36345670e3 100644 --- a/tests/assembly/asm/aarch64-types.rs +++ b/tests/assembly/asm/aarch64-types.rs @@ -5,10 +5,12 @@ //@ [arm64ec] compile-flags: --target arm64ec-pc-windows-msvc //@ [arm64ec] needs-llvm-components: aarch64 -#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch)] +#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch, f16, f128)] #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] +// FIXME(f16_f128): Only needed for FIXME in check! and check_reg! +#![feature(auto_traits)] #[rustc_builtin_macro] macro_rules! asm { @@ -39,6 +41,8 @@ pub struct i32x2(i32, i32); #[repr(simd)] pub struct i64x1(i64); #[repr(simd)] +pub struct f16x4(f16, f16, f16, f16); +#[repr(simd)] pub struct f32x2(f32, f32); #[repr(simd)] pub struct f64x1(f64); @@ -51,30 +55,42 @@ pub struct i32x4(i32, i32, i32, i32); #[repr(simd)] pub struct i64x2(i64, i64); #[repr(simd)] +pub struct f16x8(f16, f16, f16, f16, f16, f16, f16, f16); +#[repr(simd)] pub struct f32x4(f32, f32, f32, f32); #[repr(simd)] pub struct f64x2(f64, f64); impl Copy for i8 {} impl Copy for i16 {} +impl Copy for f16 {} impl Copy for i32 {} impl Copy for f32 {} impl Copy for i64 {} impl Copy for f64 {} +impl Copy for f128 {} impl Copy for ptr {} impl Copy for i8x8 {} impl Copy for i16x4 {} impl Copy for i32x2 {} impl Copy for i64x1 {} +impl Copy for f16x4 {} impl Copy for f32x2 {} impl Copy for f64x1 {} impl Copy for i8x16 {} impl Copy for i16x8 {} impl Copy for i32x4 {} impl Copy for i64x2 {} +impl Copy for f16x8 {} impl Copy for f32x4 {} impl Copy for f64x2 {} +// FIXME(f16_f128): Only needed for FIXME in check! and check_reg! +#[lang = "freeze"] +unsafe auto trait Freeze {} +#[lang = "unpin"] +auto trait Unpin {} + extern "C" { fn extern_func(); static extern_static: u8; @@ -111,38 +127,44 @@ pub unsafe fn issue_75761() { macro_rules! check { ($func:ident $ty:ident $class:ident $mov:literal $modifier:literal) => { + // FIXME(f16_f128): Change back to `$func(x: $ty) -> $ty` once arm64ec can pass and return + // `f16` and `f128` without LLVM erroring. + // LLVM issue: <https://github.com/llvm/llvm-project/issues/94434> #[no_mangle] - pub unsafe fn $func(x: $ty) -> $ty { + pub unsafe fn $func(inp: &$ty, out: &mut $ty) { // Hack to avoid function merging extern "Rust" { fn dont_merge(s: &str); } dont_merge(stringify!($func)); + let x = *inp; let y; asm!( concat!($mov, " {:", $modifier, "}, {:", $modifier, "}"), out($class) y, in($class) x ); - y + *out = y; } }; } macro_rules! check_reg { ($func:ident $ty:ident $reg:tt $mov:literal) => { + // FIXME(f16_f128): See FIXME in `check!` #[no_mangle] - pub unsafe fn $func(x: $ty) -> $ty { + pub unsafe fn $func(inp: &$ty, out: &mut $ty) { // Hack to avoid function merging extern "Rust" { fn dont_merge(s: &str); } dont_merge(stringify!($func)); + let x = *inp; let y; asm!(concat!($mov, " ", $reg, ", ", $reg), lateout($reg) y, in($reg) x); - y + *out = y; } }; } @@ -159,6 +181,12 @@ check!(reg_i8 i8 reg "mov" ""); // CHECK: //NO_APP check!(reg_i16 i16 reg "mov" ""); +// CHECK-LABEL: {{("#)?}}reg_f16{{"?}} +// CHECK: //APP +// CHECK: mov x{{[0-9]+}}, x{{[0-9]+}} +// CHECK: //NO_APP +check!(reg_f16 f16 reg "mov" ""); + // CHECK-LABEL: {{("#)?}}reg_i32{{"?}} // CHECK: //APP // CHECK: mov x{{[0-9]+}}, x{{[0-9]+}} @@ -201,6 +229,12 @@ check!(vreg_i8 i8 vreg "fmov" "s"); // CHECK: //NO_APP check!(vreg_i16 i16 vreg "fmov" "s"); +// CHECK-LABEL: {{("#)?}}vreg_f16{{"?}} +// CHECK: //APP +// CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} +// CHECK: //NO_APP +check!(vreg_f16 f16 vreg "fmov" "s"); + // CHECK-LABEL: {{("#)?}}vreg_i32{{"?}} // CHECK: //APP // CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} @@ -225,6 +259,12 @@ check!(vreg_i64 i64 vreg "fmov" "s"); // CHECK: //NO_APP check!(vreg_f64 f64 vreg "fmov" "s"); +// CHECK-LABEL: {{("#)?}}vreg_f128{{"?}} +// CHECK: //APP +// CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} +// CHECK: //NO_APP +check!(vreg_f128 f128 vreg "fmov" "s"); + // CHECK-LABEL: {{("#)?}}vreg_ptr{{"?}} // CHECK: //APP // CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} @@ -255,6 +295,12 @@ check!(vreg_i32x2 i32x2 vreg "fmov" "s"); // CHECK: //NO_APP check!(vreg_i64x1 i64x1 vreg "fmov" "s"); +// CHECK-LABEL: {{("#)?}}vreg_f16x4{{"?}} +// CHECK: //APP +// CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} +// CHECK: //NO_APP +check!(vreg_f16x4 f16x4 vreg "fmov" "s"); + // CHECK-LABEL: {{("#)?}}vreg_f32x2{{"?}} // CHECK: //APP // CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} @@ -291,6 +337,12 @@ check!(vreg_i32x4 i32x4 vreg "fmov" "s"); // CHECK: //NO_APP check!(vreg_i64x2 i64x2 vreg "fmov" "s"); +// CHECK-LABEL: {{("#)?}}vreg_f16x8{{"?}} +// CHECK: //APP +// CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} +// CHECK: //NO_APP +check!(vreg_f16x8 f16x8 vreg "fmov" "s"); + // CHECK-LABEL: {{("#)?}}vreg_f32x4{{"?}} // CHECK: //APP // CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} @@ -315,6 +367,12 @@ check!(vreg_low16_i8 i8 vreg_low16 "fmov" "s"); // CHECK: //NO_APP check!(vreg_low16_i16 i16 vreg_low16 "fmov" "s"); +// CHECK-LABEL: {{("#)?}}vreg_low16_f16{{"?}} +// CHECK: //APP +// CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} +// CHECK: //NO_APP +check!(vreg_low16_f16 f16 vreg_low16 "fmov" "s"); + // CHECK-LABEL: {{("#)?}}vreg_low16_f32{{"?}} // CHECK: //APP // CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} @@ -333,6 +391,12 @@ check!(vreg_low16_i64 i64 vreg_low16 "fmov" "s"); // CHECK: //NO_APP check!(vreg_low16_f64 f64 vreg_low16 "fmov" "s"); +// CHECK-LABEL: {{("#)?}}vreg_low16_f128{{"?}} +// CHECK: //APP +// CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} +// CHECK: //NO_APP +check!(vreg_low16_f128 f128 vreg_low16 "fmov" "s"); + // CHECK-LABEL: {{("#)?}}vreg_low16_ptr{{"?}} // CHECK: //APP // CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} @@ -363,6 +427,12 @@ check!(vreg_low16_i32x2 i32x2 vreg_low16 "fmov" "s"); // CHECK: //NO_APP check!(vreg_low16_i64x1 i64x1 vreg_low16 "fmov" "s"); +// CHECK-LABEL: {{("#)?}}vreg_low16_f16x4{{"?}} +// CHECK: //APP +// CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} +// CHECK: //NO_APP +check!(vreg_low16_f16x4 f16x4 vreg_low16 "fmov" "s"); + // CHECK-LABEL: {{("#)?}}vreg_low16_f32x2{{"?}} // CHECK: //APP // CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} @@ -399,6 +469,12 @@ check!(vreg_low16_i32x4 i32x4 vreg_low16 "fmov" "s"); // CHECK: //NO_APP check!(vreg_low16_i64x2 i64x2 vreg_low16 "fmov" "s"); +// CHECK-LABEL: {{("#)?}}vreg_low16_f16x8{{"?}} +// CHECK: //APP +// CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} +// CHECK: //NO_APP +check!(vreg_low16_f16x8 f16x8 vreg_low16 "fmov" "s"); + // CHECK-LABEL: {{("#)?}}vreg_low16_f32x4{{"?}} // CHECK: //APP // CHECK: fmov s{{[0-9]+}}, s{{[0-9]+}} @@ -423,6 +499,12 @@ check_reg!(x0_i8 i8 "x0" "mov"); // CHECK: //NO_APP check_reg!(x0_i16 i16 "x0" "mov"); +// CHECK-LABEL: {{("#)?}}x0_f16{{"?}} +// CHECK: //APP +// CHECK: mov x{{[0-9]+}}, x{{[0-9]+}} +// CHECK: //NO_APP +check_reg!(x0_f16 f16 "x0" "mov"); + // CHECK-LABEL: {{("#)?}}x0_i32{{"?}} // CHECK: //APP // CHECK: mov x{{[0-9]+}}, x{{[0-9]+}} @@ -465,6 +547,12 @@ check_reg!(v0_i8 i8 "s0" "fmov"); // CHECK: //NO_APP check_reg!(v0_i16 i16 "s0" "fmov"); +// CHECK-LABEL: {{("#)?}}v0_f16{{"?}} +// CHECK: //APP +// CHECK: fmov s0, s0 +// CHECK: //NO_APP +check_reg!(v0_f16 f16 "s0" "fmov"); + // CHECK-LABEL: {{("#)?}}v0_i32{{"?}} // CHECK: //APP // CHECK: fmov s0, s0 @@ -489,6 +577,12 @@ check_reg!(v0_i64 i64 "s0" "fmov"); // CHECK: //NO_APP check_reg!(v0_f64 f64 "s0" "fmov"); +// CHECK-LABEL: {{("#)?}}v0_f128{{"?}} +// CHECK: //APP +// CHECK: fmov s0, s0 +// CHECK: //NO_APP +check_reg!(v0_f128 f128 "s0" "fmov"); + // CHECK-LABEL: {{("#)?}}v0_ptr{{"?}} // CHECK: //APP // CHECK: fmov s0, s0 @@ -519,6 +613,12 @@ check_reg!(v0_i32x2 i32x2 "s0" "fmov"); // CHECK: //NO_APP check_reg!(v0_i64x1 i64x1 "s0" "fmov"); +// CHECK-LABEL: {{("#)?}}v0_f16x4{{"?}} +// CHECK: //APP +// CHECK: fmov s0, s0 +// CHECK: //NO_APP +check_reg!(v0_f16x4 f16x4 "s0" "fmov"); + // CHECK-LABEL: {{("#)?}}v0_f32x2{{"?}} // CHECK: //APP // CHECK: fmov s0, s0 @@ -555,6 +655,12 @@ check_reg!(v0_i32x4 i32x4 "s0" "fmov"); // CHECK: //NO_APP check_reg!(v0_i64x2 i64x2 "s0" "fmov"); +// CHECK-LABEL: {{("#)?}}v0_f16x8{{"?}} +// CHECK: //APP +// CHECK: fmov s0, s0 +// CHECK: //NO_APP +check_reg!(v0_f16x8 f16x8 "s0" "fmov"); + // CHECK-LABEL: {{("#)?}}v0_f32x4{{"?}} // CHECK: //APP // CHECK: fmov s0, s0 diff --git a/tests/assembly/asm/global_asm.rs b/tests/assembly/asm/global_asm.rs index 22cf4bdb15b..8a4bf98c745 100644 --- a/tests/assembly/asm/global_asm.rs +++ b/tests/assembly/asm/global_asm.rs @@ -4,7 +4,6 @@ //@ compile-flags: -C llvm-args=--x86-asm-syntax=intel //@ compile-flags: -C symbol-mangling-version=v0 -#![feature(asm_const)] #![crate_type = "rlib"] use std::arch::global_asm; diff --git a/tests/assembly/asm/msp430-types.rs b/tests/assembly/asm/msp430-types.rs index 4f51d4020a6..ae09b8b070d 100644 --- a/tests/assembly/asm/msp430-types.rs +++ b/tests/assembly/asm/msp430-types.rs @@ -2,7 +2,7 @@ //@ compile-flags: --target msp430-none-elf //@ needs-llvm-components: msp430 -#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch, asm_const)] +#![feature(no_core, lang_items, rustc_attrs, asm_experimental_arch)] #![crate_type = "rlib"] #![no_core] #![allow(non_camel_case_types)] diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly/targets/targets-elf.rs index 762df40a44b..b0c5eec1fe4 100644 --- a/tests/assembly/targets/targets-elf.rs +++ b/tests/assembly/targets/targets-elf.rs @@ -54,6 +54,9 @@ //@ revisions: aarch64_unknown_none_softfloat //@ [aarch64_unknown_none_softfloat] compile-flags: --target aarch64-unknown-none-softfloat //@ [aarch64_unknown_none_softfloat] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_nto_qnx700 +//@ [aarch64_unknown_nto_qnx700] compile-flags: --target aarch64-unknown-nto-qnx700 +//@ [aarch64_unknown_nto_qnx700] needs-llvm-components: aarch64 //@ revisions: aarch64_unknown_nto_qnx710 //@ [aarch64_unknown_nto_qnx710] compile-flags: --target aarch64-unknown-nto-qnx710 //@ [aarch64_unknown_nto_qnx710] needs-llvm-components: aarch64 @@ -66,6 +69,9 @@ //@ revisions: aarch64_unknown_teeos //@ [aarch64_unknown_teeos] compile-flags: --target aarch64-unknown-teeos //@ [aarch64_unknown_teeos] needs-llvm-components: aarch64 +//@ revisions: aarch64_unknown_trusty +//@ [aarch64_unknown_trusty] compile-flags: --target aarch64-unknown-trusty +//@ [aarch64_unknown_trusty] needs-llvm-components: aarch64 //@ revisions: aarch64_wrs_vxworks //@ [aarch64_wrs_vxworks] compile-flags: --target aarch64-wrs-vxworks //@ [aarch64_wrs_vxworks] needs-llvm-components: aarch64 @@ -153,6 +159,9 @@ //@ revisions: armv7_unknown_netbsd_eabihf //@ [armv7_unknown_netbsd_eabihf] compile-flags: --target armv7-unknown-netbsd-eabihf //@ [armv7_unknown_netbsd_eabihf] needs-llvm-components: arm +//@ revisions: armv7_unknown_trusty +//@ [armv7_unknown_trusty] compile-flags: --target armv7-unknown-trusty +//@ [armv7_unknown_trusty] needs-llvm-components: arm //@ revisions: armv7_wrs_vxworks_eabihf //@ [armv7_wrs_vxworks_eabihf] compile-flags: --target armv7-wrs-vxworks-eabihf //@ [armv7_wrs_vxworks_eabihf] needs-llvm-components: arm @@ -345,6 +354,9 @@ //@ revisions: powerpc_unknown_linux_musl //@ [powerpc_unknown_linux_musl] compile-flags: --target powerpc-unknown-linux-musl //@ [powerpc_unknown_linux_musl] needs-llvm-components: powerpc +//@ revisions: powerpc_unknown_linux_muslspe +//@ [powerpc_unknown_linux_muslspe] compile-flags: --target powerpc-unknown-linux-muslspe +//@ [powerpc_unknown_linux_muslspe] needs-llvm-components: powerpc //@ revisions: powerpc_unknown_netbsd //@ [powerpc_unknown_netbsd] compile-flags: --target powerpc-unknown-netbsd //@ [powerpc_unknown_netbsd] needs-llvm-components: powerpc diff --git a/tests/assembly/x86_64-cmp.rs b/tests/assembly/x86_64-cmp.rs index 31efdda1bfa..67b7ff99ae2 100644 --- a/tests/assembly/x86_64-cmp.rs +++ b/tests/assembly/x86_64-cmp.rs @@ -1,6 +1,9 @@ -//@ revisions: DEBUG OPTIM +//@ revisions: DEBUG LLVM-PRE-20-OPTIM LLVM-20-OPTIM //@ [DEBUG] compile-flags: -C opt-level=0 -//@ [OPTIM] compile-flags: -C opt-level=3 +//@ [LLVM-PRE-20-OPTIM] compile-flags: -C opt-level=3 +//@ [LLVM-PRE-20-OPTIM] ignore-llvm-version: 20 - 99 +//@ [LLVM-20-OPTIM] compile-flags: -C opt-level=3 +//@ [LLVM-20-OPTIM] min-llvm-version: 20 //@ assembly-output: emit-asm //@ compile-flags: --crate-type=lib -C llvm-args=-x86-asm-syntax=intel //@ only-x86_64 @@ -21,12 +24,18 @@ pub fn signed_cmp(a: i16, b: i16) -> std::cmp::Ordering { // DEBUG: and // DEBUG: sub - // OPTIM: xor - // OPTIM: cmp - // OPTIM: setne - // OPTIM: mov - // OPTIM: cmovge - // OPTIM: ret + // LLVM-PRE-20-OPTIM: xor + // LLVM-PRE-20-OPTIM: cmp + // LLVM-PRE-20-OPTIM: setne + // LLVM-PRE-20-OPTIM: mov + // LLVM-PRE-20-OPTIM: cmovge + // LLVM-PRE-20-OPTIM: ret + // + // LLVM-20-OPTIM: cmp + // LLVM-20-OPTIM: setl + // LLVM-20-OPTIM: setg + // LLVM-20-OPTIM: sub + // LLVM-20-OPTIM: ret three_way_compare(a, b) } @@ -41,11 +50,16 @@ pub fn unsigned_cmp(a: u16, b: u16) -> std::cmp::Ordering { // DEBUG: and // DEBUG: sub - // OPTIM: xor - // OPTIM: cmp - // OPTIM: setne - // OPTIM: mov - // OPTIM: cmovae - // OPTIM: ret + // LLVM-PRE-20-OPTIM: xor + // LLVM-PRE-20-OPTIM: cmp + // LLVM-PRE-20-OPTIM: setne + // LLVM-PRE-20-OPTIM: mov + // LLVM-PRE-20-OPTIM: cmovae + // LLVM-PRE-20-OPTIM: ret + // + // LLVM-20-OPTIM: cmp + // LLVM-20-OPTIM: seta + // LLVM-20-OPTIM: sbb + // LLVM-20-OPTIM: ret three_way_compare(a, b) } diff --git a/tests/codegen/cast-target-abi.rs b/tests/codegen/cast-target-abi.rs index 34e52d38bbe..db76aae3dd0 100644 --- a/tests/codegen/cast-target-abi.rs +++ b/tests/codegen/cast-target-abi.rs @@ -1,7 +1,7 @@ // ignore-tidy-linelength //@ revisions:aarch64 loongarch64 powerpc64 sparc64 x86_64 -// FIXME: Add `-Cllvm-args=--lint-abort-on-error` after LLVM 19 -//@ compile-flags: -O -C no-prepopulate-passes -C passes=lint +//@ min-llvm-version: 19 +//@ compile-flags: -O -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu //@[aarch64] needs-llvm-components: arm diff --git a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs index a4b7c0caa6d..ae8d8383f5b 100644 --- a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs +++ b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs @@ -1,5 +1,6 @@ //@ revisions: linux apple -//@ compile-flags: -C opt-level=0 -C no-prepopulate-passes -C passes=lint +//@ min-llvm-version: 19 +//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error //@[linux] compile-flags: --target x86_64-unknown-linux-gnu //@[linux] needs-llvm-components: x86 diff --git a/tests/codegen/debuginfo-inline-callsite-location.rs b/tests/codegen/debuginfo-inline-callsite-location.rs index aee07b4eb8c..c31788d82db 100644 --- a/tests/codegen/debuginfo-inline-callsite-location.rs +++ b/tests/codegen/debuginfo-inline-callsite-location.rs @@ -9,13 +9,12 @@ // CHECK: tail call void @{{[A-Za-z0-9_]+4core6option13unwrap_failed}} // CHECK-SAME: !dbg ![[#second_dbg:]] -// CHECK-DAG: ![[#func_dbg:]] = distinct !DISubprogram(name: "unwrap<i32>" -// CHECK-DAG: ![[#first_scope:]] = distinct !DILexicalBlock(scope: ![[#func_dbg]], -// CHECK: ![[#second_scope:]] = distinct !DILexicalBlock(scope: ![[#func_dbg]], +// CHECK-DAG: ![[#func_scope:]] = distinct !DISubprogram(name: "unwrap<i32>" +// CHECK-DAG: ![[#]] = !DILocalVariable(name: "self",{{( arg: 1,)?}} scope: ![[#func_scope]] // CHECK: ![[#first_dbg]] = !DILocation(line: [[#]] -// CHECK-SAME: scope: ![[#first_scope]], inlinedAt: ![[#]]) +// CHECK-SAME: scope: ![[#func_scope]], inlinedAt: ![[#]]) // CHECK: ![[#second_dbg]] = !DILocation(line: [[#]] -// CHECK-SAME: scope: ![[#second_scope]], inlinedAt: ![[#]]) +// CHECK-SAME: scope: ![[#func_scope]], inlinedAt: ![[#]]) #![crate_type = "lib"] diff --git a/tests/codegen/inline-function-args-debug-info.rs b/tests/codegen/inline-function-args-debug-info.rs index 7263374b22e..53a179160dc 100644 --- a/tests/codegen/inline-function-args-debug-info.rs +++ b/tests/codegen/inline-function-args-debug-info.rs @@ -15,6 +15,7 @@ pub fn outer_function(x: usize, y: usize) -> usize { fn inner_function(aaaa: usize, bbbb: usize) -> usize { // CHECK: !DILocalVariable(name: "aaaa", arg: 1 // CHECK-SAME: line: 15 + // CHECK-NOT: !DILexicalBlock( // CHECK: !DILocalVariable(name: "bbbb", arg: 2 // CHECK-SAME: line: 15 aaaa + bbbb diff --git a/tests/codegen/integer-cmp.rs b/tests/codegen/integer-cmp.rs index bba112b246f..8df68d8d490 100644 --- a/tests/codegen/integer-cmp.rs +++ b/tests/codegen/integer-cmp.rs @@ -1,6 +1,9 @@ // This is test for more optimal Ord implementation for integers. // See <https://github.com/rust-lang/rust/issues/63758> for more info. +//@ revisions: llvm-pre-20 llvm-20 +//@ [llvm-20] min-llvm-version: 20 +//@ [llvm-pre-20] ignore-llvm-version: 20 - 99 //@ compile-flags: -C opt-level=3 #![crate_type = "lib"] @@ -10,19 +13,21 @@ use std::cmp::Ordering; // CHECK-LABEL: @cmp_signed #[no_mangle] pub fn cmp_signed(a: i64, b: i64) -> Ordering { - // CHECK: icmp slt - // CHECK: icmp ne - // CHECK: zext i1 - // CHECK: select i1 + // llvm-20: @llvm.scmp.i8.i64 + // llvm-pre-20: icmp slt + // llvm-pre-20: icmp ne + // llvm-pre-20: zext i1 + // llvm-pre-20: select i1 a.cmp(&b) } // CHECK-LABEL: @cmp_unsigned #[no_mangle] pub fn cmp_unsigned(a: u32, b: u32) -> Ordering { - // CHECK: icmp ult - // CHECK: icmp ne - // CHECK: zext i1 - // CHECK: select i1 + // llvm-20: @llvm.ucmp.i8.i32 + // llvm-pre-20: icmp ult + // llvm-pre-20: icmp ne + // llvm-pre-20: zext i1 + // llvm-pre-20: select i1 a.cmp(&b) } diff --git a/tests/codegen/intrinsics/rustc_intrinsic_must_be_overridden.rs b/tests/codegen/intrinsics/rustc_intrinsic_must_be_overridden.rs new file mode 100644 index 00000000000..b41e441d309 --- /dev/null +++ b/tests/codegen/intrinsics/rustc_intrinsic_must_be_overridden.rs @@ -0,0 +1,14 @@ +//@ revisions: OPT0 OPT1 +//@ [OPT0] compile-flags: -Copt-level=0 +//@ [OPT1] compile-flags: -Copt-level=1 +//@ compile-flags: -Cno-prepopulate-passes + +#![crate_type = "lib"] +#![feature(core_intrinsics)] + +// CHECK-NOT: core::intrinsics::size_of_val + +#[no_mangle] +pub unsafe fn size_of_val(ptr: *const i32) -> usize { + core::intrinsics::size_of_val(ptr) +} diff --git a/tests/codegen/is_val_statically_known.rs b/tests/codegen/is_val_statically_known.rs index 6af4f353a48..fe432d3bcc4 100644 --- a/tests/codegen/is_val_statically_known.rs +++ b/tests/codegen/is_val_statically_known.rs @@ -1,6 +1,7 @@ //@ compile-flags: --crate-type=lib -Zmerge-functions=disabled -O #![feature(core_intrinsics)] +#![feature(f16, f128)] use std::intrinsics::is_val_statically_known; @@ -49,7 +50,7 @@ pub fn _bool_false(b: bool) -> i32 { #[inline] pub fn _iref(a: &u8) -> i32 { - if unsafe { is_val_statically_known(a) } { 5 } else { 4 } + if is_val_statically_known(a) { 5 } else { 4 } } // CHECK-LABEL: @_iref_borrow( @@ -68,7 +69,7 @@ pub fn _iref_arg(a: &u8) -> i32 { #[inline] pub fn _slice_ref(a: &[u8]) -> i32 { - if unsafe { is_val_statically_known(a) } { 7 } else { 6 } + if is_val_statically_known(a) { 7 } else { 6 } } // CHECK-LABEL: @_slice_ref_borrow( @@ -84,3 +85,79 @@ pub fn _slice_ref_arg(a: &[u8]) -> i32 { // CHECK: ret i32 6 _slice_ref(a) } + +#[inline] +pub fn _f16(a: f16) -> i32 { + if is_val_statically_known(a) { 1 } else { 0 } +} + +// CHECK-LABEL: @_f16_true( +#[no_mangle] +pub fn _f16_true() -> i32 { + // CHECK: ret i32 1 + _f16(1.0) +} + +// CHECK-LABEL: @_f16_false( +#[no_mangle] +pub fn _f16_false(a: f16) -> i32 { + // CHECK: ret i32 0 + _f16(a) +} + +#[inline] +pub fn _f32(a: f32) -> i32 { + if is_val_statically_known(a) { 1 } else { 0 } +} + +// CHECK-LABEL: @_f32_true( +#[no_mangle] +pub fn _f32_true() -> i32 { + // CHECK: ret i32 1 + _f32(1.0) +} + +// CHECK-LABEL: @_f32_false( +#[no_mangle] +pub fn _f32_false(a: f32) -> i32 { + // CHECK: ret i32 0 + _f32(a) +} + +#[inline] +pub fn _f64(a: f64) -> i32 { + if is_val_statically_known(a) { 1 } else { 0 } +} + +// CHECK-LABEL: @_f64_true( +#[no_mangle] +pub fn _f64_true() -> i32 { + // CHECK: ret i32 1 + _f64(1.0) +} + +// CHECK-LABEL: @_f64_false( +#[no_mangle] +pub fn _f64_false(a: f64) -> i32 { + // CHECK: ret i32 0 + _f64(a) +} + +#[inline] +pub fn _f128(a: f128) -> i32 { + if is_val_statically_known(a) { 1 } else { 0 } +} + +// CHECK-LABEL: @_f128_true( +#[no_mangle] +pub fn _f128_true() -> i32 { + // CHECK: ret i32 1 + _f128(1.0) +} + +// CHECK-LABEL: @_f128_false( +#[no_mangle] +pub fn _f128_false(a: f128) -> i32 { + // CHECK: ret i32 0 + _f128(a) +} diff --git a/tests/codegen/issues/str-to-string-128690.rs b/tests/codegen/issues/str-to-string-128690.rs new file mode 100644 index 00000000000..8b416306ba6 --- /dev/null +++ b/tests/codegen/issues/str-to-string-128690.rs @@ -0,0 +1,36 @@ +//@ compile-flags: -C opt-level=3 -Z merge-functions=disabled +#![crate_type = "lib"] + +//! Make sure str::to_string is specialized not to use fmt machinery. + +// CHECK-LABEL: define {{(dso_local )?}}void @one_ref +#[no_mangle] +pub fn one_ref(input: &str) -> String { + // CHECK-NOT: {{(call|invoke).*}}fmt + input.to_string() +} + +// CHECK-LABEL: define {{(dso_local )?}}void @two_ref +#[no_mangle] +pub fn two_ref(input: &&str) -> String { + // CHECK-NOT: {{(call|invoke).*}}fmt + input.to_string() +} + +// CHECK-LABEL: define {{(dso_local )?}}void @thirteen_ref +#[no_mangle] +pub fn thirteen_ref(input: &&&&&&&&&&&&&str) -> String { + // CHECK-NOT: {{(call|invoke).*}}fmt + input.to_string() +} + +// This is a known performance cliff because of the macro-generated +// specialized impl. If this test suddenly starts failing, +// consider removing the `to_string_str!` macro in `alloc/str/string.rs`. +// +// CHECK-LABEL: define {{(dso_local )?}}void @fourteen_ref +#[no_mangle] +pub fn fourteen_ref(input: &&&&&&&&&&&&&&str) -> String { + // CHECK: {{(call|invoke).*}}fmt + input.to_string() +} diff --git a/tests/codegen/naked-fn/aligned.rs b/tests/codegen/naked-fn/aligned.rs new file mode 100644 index 00000000000..d5faac44836 --- /dev/null +++ b/tests/codegen/naked-fn/aligned.rs @@ -0,0 +1,20 @@ +//@ compile-flags: -C no-prepopulate-passes -Copt-level=0 +//@ needs-asm-support +//@ ignore-arm no "ret" mnemonic + +#![crate_type = "lib"] +#![feature(naked_functions, fn_align)] +use std::arch::asm; + +// CHECK: Function Attrs: naked +// CHECK-NEXT: define{{.*}}void @naked_empty() +// CHECK: align 16 +#[repr(align(16))] +#[no_mangle] +#[naked] +pub unsafe extern "C" fn naked_empty() { + // CHECK-NEXT: start: + // CHECK-NEXT: call void asm + // CHECK-NEXT: unreachable + asm!("ret", options(noreturn)); +} diff --git a/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs b/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs new file mode 100644 index 00000000000..e2e14ab14a8 --- /dev/null +++ b/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs @@ -0,0 +1,19 @@ +//@ revisions: aarch64 android +//@[aarch64] compile-flags: --target aarch64-unknown-none -Zfixed-x18 -Zsanitizer=shadow-call-stack +//@[aarch64] needs-llvm-components: aarch64 +//@[android] compile-flags: --target aarch64-linux-android -Zsanitizer=shadow-call-stack +//@[android] needs-llvm-components: aarch64 + +#![allow(internal_features)] +#![crate_type = "rlib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +// CHECK: ; Function Attrs:{{.*}}shadowcallstack +#[no_mangle] +pub fn foo() {} + +// CHECK: attributes #0 = {{.*}}shadowcallstack{{.*}} diff --git a/tests/codegen/sanitizer/cfi/add-cfi-normalize-integers-flag.rs b/tests/codegen/sanitizer/cfi/add-cfi-normalize-integers-flag.rs new file mode 100644 index 00000000000..a54a6d84a80 --- /dev/null +++ b/tests/codegen/sanitizer/cfi/add-cfi-normalize-integers-flag.rs @@ -0,0 +1,10 @@ +// Verifies that "cfi-normalize-integers" module flag is added. +// +//@ needs-sanitizer-cfi +//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers + +#![crate_type = "lib"] + +pub fn foo() {} + +// CHECK: !{{[0-9]+}} = !{i32 4, !"cfi-normalize-integers", i32 1} diff --git a/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs b/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs new file mode 100644 index 00000000000..d48e4016a16 --- /dev/null +++ b/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs @@ -0,0 +1,21 @@ +// Verifies that "cfi-normalize-integers" module flag is added. +// +//@ 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: x86 +//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers + +#![feature(no_core, lang_items)] +#![crate_type = "lib"] +#![no_core] + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +pub fn foo() {} + +// CHECK: !{{[0-9]+}} = !{i32 4, !"cfi-normalize-integers", i32 1} diff --git a/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs b/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs new file mode 100644 index 00000000000..b4924719f4c --- /dev/null +++ b/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs @@ -0,0 +1,21 @@ +// Verifies that "kcfi-offset" module flag is added. +// +//@ 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: x86 +//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi -Z patchable-function-entry=4,3 + +#![feature(no_core, lang_items, patchable_function_entry)] +#![crate_type = "lib"] +#![no_core] + +#[lang = "sized"] +trait Sized {} +#[lang = "copy"] +trait Copy {} + +pub fn foo() {} + +// CHECK: !{{[0-9]+}} = !{i32 4, !"kcfi-offset", i32 3} diff --git a/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs b/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs new file mode 100644 index 00000000000..5833b832ba4 --- /dev/null +++ b/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs @@ -0,0 +1,17 @@ +//@ compile-flags: --target riscv64imac-unknown-none-elf -Zsanitizer=shadow-call-stack +//@ needs-llvm-components: riscv + +#![allow(internal_features)] +#![crate_type = "rlib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +// CHECK: ; Function Attrs:{{.*}}shadowcallstack +// CHECK: define dso_local void @foo() unnamed_addr #0 +#[no_mangle] +pub fn foo() {} + +// CHECK: attributes #0 = {{.*}}shadowcallstack{{.*}} diff --git a/tests/codegen/tied-features-strength.rs b/tests/codegen/tied-features-strength.rs index 1b4596ae2cb..1b2b63c3d1a 100644 --- a/tests/codegen/tied-features-strength.rs +++ b/tests/codegen/tied-features-strength.rs @@ -3,21 +3,21 @@ //@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 -// The "+v8a" feature is matched as optional as it isn't added when we -// are targeting older LLVM versions. Once the min supported version -// is LLVM-14 we can remove the optional regex matching for this feature. +// The "+fpmr" feature is matched as optional as it is only an explicit +// feature in LLVM 18. Once the min supported version is LLVM-19 the optional +// regex matching for this feature can be removed. //@ [ENABLE_SVE] compile-flags: -C target-feature=+sve -Copt-level=0 -// ENABLE_SVE: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(\+sve,?)|(\+neon,?)|(\+fp-armv8,?))*}}" } +// ENABLE_SVE: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)|(\+fpmr,?)?|(\+sve,?)|(\+neon,?)|(\+fp-armv8,?))*}}" } //@ [DISABLE_SVE] compile-flags: -C target-feature=-sve -Copt-level=0 -// DISABLE_SVE: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(-sve,?)|(\+neon,?))*}}" } +// DISABLE_SVE: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)|(\+fpmr,?)?|(-sve,?)|(\+neon,?))*}}" } //@ [DISABLE_NEON] compile-flags: -C target-feature=-neon -Copt-level=0 -// DISABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(-fp-armv8,?)|(-neon,?))*}}" } +// DISABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)|(\+fpmr,?)?|(-fp-armv8,?)|(-neon,?))*}}" } //@ [ENABLE_NEON] compile-flags: -C target-feature=+neon -Copt-level=0 -// ENABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)?|(\+fp-armv8,?)|(\+neon,?))*}}" } +// ENABLE_NEON: attributes #0 = { {{.*}} "target-features"="{{((\+outline-atomics,?)|(\+v8a,?)|(\+fpmr,?)?|(\+fp-armv8,?)|(\+neon,?))*}}" } #![feature(no_core, lang_items)] #![no_core] diff --git a/tests/crashes/117460.rs b/tests/crashes/117460.rs new file mode 100644 index 00000000000..4878a35ffe5 --- /dev/null +++ b/tests/crashes/117460.rs @@ -0,0 +1,8 @@ +//@ known-bug: #117460 +#![feature(generic_const_exprs)] + +struct Matrix<D = [(); 2 + 2]> { + d: D, +} + +impl Matrix {} diff --git a/tests/crashes/119095.rs b/tests/crashes/119095.rs new file mode 100644 index 00000000000..28742e0d5da --- /dev/null +++ b/tests/crashes/119095.rs @@ -0,0 +1,48 @@ +//@ known-bug: #119095 +//@ compile-flags: --edition=2021 + +fn any<T>() -> T { + loop {} +} + +trait Acquire { + type Connection; +} + +impl Acquire for &'static () { + type Connection = (); +} + +trait Unit {} +impl Unit for () {} + +fn get_connection<T>() -> impl Unit +where + T: Acquire, + T::Connection: Unit, +{ + any::<T::Connection>() +} + +fn main() { + let future = async { async { get_connection::<&'static ()>() }.await }; + + future.resolve_me(); +} + +trait ResolveMe { + fn resolve_me(self); +} + +impl<S> ResolveMe for S +where + (): CheckSend<S>, +{ + fn resolve_me(self) {} +} + +trait CheckSend<F> {} +impl<F> CheckSend<F> for () where F: Send {} + +trait NeverImplemented {} +impl<E, F> CheckSend<F> for E where E: NeverImplemented {} diff --git a/tests/crashes/123693.rs b/tests/crashes/123693.rs index c2e192092be..c3236322c6e 100644 --- a/tests/crashes/123693.rs +++ b/tests/crashes/123693.rs @@ -3,11 +3,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::NOTHING }>, + Dst: TransmuteFrom<Src, { Assume::NOTHING }>, { } } diff --git a/tests/crashes/124207.rs b/tests/crashes/124207.rs index a4e1c551890..a11eedb140a 100644 --- a/tests/crashes/124207.rs +++ b/tests/crashes/124207.rs @@ -4,6 +4,6 @@ trait OpaqueTrait {} type OpaqueType = impl OpaqueTrait; trait AnotherTrait {} -impl<T: std::mem::BikeshedIntrinsicFrom<(), ()>> AnotherTrait for T {} +impl<T: std::mem::TransmuteFrom<(), ()>> AnotherTrait for T {} impl AnotherTrait for OpaqueType {} pub fn main() {} diff --git a/tests/crashes/125881.rs b/tests/crashes/125881.rs index 98331d3c974..a38f1891b61 100644 --- a/tests/crashes/125881.rs +++ b/tests/crashes/125881.rs @@ -3,6 +3,6 @@ #![feature(transmutability)] #![feature(unboxed_closures,effects)] -const fn test() -> impl std::mem::BikeshedIntrinsicFrom() { +const fn test() -> impl std::mem::TransmuteFrom() { || {} } diff --git a/tests/crashes/126267.rs b/tests/crashes/126267.rs index c0604b90a67..728578179ed 100644 --- a/tests/crashes/126267.rs +++ b/tests/crashes/126267.rs @@ -14,11 +14,11 @@ pub enum Error { } mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src>, // safety is NOT assumed + Dst: TransmuteFrom<Src>, // safety is NOT assumed { } } diff --git a/tests/crashes/126377.rs b/tests/crashes/126377.rs index f8b9b693b65..f6727bcc0a4 100644 --- a/tests/crashes/126377.rs +++ b/tests/crashes/126377.rs @@ -4,7 +4,7 @@ #![feature(generic_const_exprs)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable< Src, @@ -15,7 +15,7 @@ mod assert { const ASSUME_VALIDITY: bool, >() where - Dst: BikeshedIntrinsicFrom< + Dst: TransmuteFrom< Src, { } >, diff --git a/tests/crashes/126443.rs b/tests/crashes/126443.rs new file mode 100644 index 00000000000..fba779444f9 --- /dev/null +++ b/tests/crashes/126443.rs @@ -0,0 +1,15 @@ +//@ known-bug: #126443 +//@ compile-flags: -Copt-level=0 +#![feature(generic_const_exprs)] + +fn double_up<const M: usize>() -> [(); M * 2] { + todo!() +} + +fn quadruple_up<const N: usize>() -> [(); N * 2 * 2] { + double_up() +} + +fn main() { + quadruple_up::<0>(); +} diff --git a/tests/crashes/126966.rs b/tests/crashes/126966.rs index edeedc68c40..2c9f1a70f4f 100644 --- a/tests/crashes/126966.rs +++ b/tests/crashes/126966.rs @@ -1,10 +1,10 @@ //@ known-bug: rust-lang/rust#126966 mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src>, + Dst: TransmuteFrom<Src>, { } } diff --git a/tests/crashes/127972.rs b/tests/crashes/127972.rs index d0764f875db..797dd7e6020 100644 --- a/tests/crashes/127972.rs +++ b/tests/crashes/127972.rs @@ -1,5 +1,5 @@ //@ known-bug: #127962 -#![feature(generic_const_exprs)] +#![feature(generic_const_exprs, const_arg_path)] fn zero_init<const usize: usize>() -> Substs1<{ (N) }> { Substs1([0; { (usize) }]) diff --git a/tests/crashes/128016.rs b/tests/crashes/128016.rs deleted file mode 100644 index d23721ae14e..00000000000 --- a/tests/crashes/128016.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ known-bug: #128016 -macro_rules! len { - () => { - target - }; -} - -fn main() { - let val: [str; len!()] = []; -} diff --git a/tests/crashes/128097.rs b/tests/crashes/128097.rs new file mode 100644 index 00000000000..6ffca640cbd --- /dev/null +++ b/tests/crashes/128097.rs @@ -0,0 +1,6 @@ +//@ known-bug: #128097 +#![feature(explicit_tail_calls)] +fn f(x: &mut ()) { + let _y: String; + become f(x); +} diff --git a/tests/crashes/128695.rs b/tests/crashes/128695.rs new file mode 100644 index 00000000000..661f427dc0e --- /dev/null +++ b/tests/crashes/128695.rs @@ -0,0 +1,11 @@ +//@ known-bug: rust-lang/rust#128695 +//@ edition: 2021 + +use core::pin::{pin, Pin}; + +fn main() { + let fut = pin!(async { + let async_drop_fut = pin!(core::future::async_drop(async {})); + (async_drop_fut).await; + }); +} diff --git a/tests/crashes/128848.rs b/tests/crashes/128848.rs new file mode 100644 index 00000000000..636811fc6b5 --- /dev/null +++ b/tests/crashes/128848.rs @@ -0,0 +1,5 @@ +//@ known-bug: rust-lang/rust#128848 + +fn f<T>(a: T, b: T, c: T) { + f.call_once() +} diff --git a/tests/crashes/128870.rs b/tests/crashes/128870.rs new file mode 100644 index 00000000000..2b731962144 --- /dev/null +++ b/tests/crashes/128870.rs @@ -0,0 +1,18 @@ +//@ known-bug: rust-lang/rust#128870 +//@ compile-flags: -Zvalidate-mir + +#[repr(packed)] +#[repr(u32)] +enum E { + A, + B, + C, +} + +fn main() { + union InvalidTag { + int: u32, + e: E, + } + let _invalid_tag = InvalidTag { int: 4 }; +} diff --git a/tests/crashes/129075.rs b/tests/crashes/129075.rs new file mode 100644 index 00000000000..4a0e920914c --- /dev/null +++ b/tests/crashes/129075.rs @@ -0,0 +1,16 @@ +//@ known-bug: rust-lang/rust#129075 +//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes + +struct Foo<T>([T; 2]); + +impl<T: Default + Copy> Default for Foo<T> { + fn default(&mut self) -> Self { + Foo([Default::default(); 2]) + } +} + +fn field_array() { + let a: i32; + let b; + Foo([a, b]) = Default::default(); +} diff --git a/tests/crashes/129095.rs b/tests/crashes/129095.rs new file mode 100644 index 00000000000..ea70c0565fc --- /dev/null +++ b/tests/crashes/129095.rs @@ -0,0 +1,10 @@ +//@ known-bug: rust-lang/rust#129095 +//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir + +pub fn function_with_bytes<const BYTES: &'static [u8; 4]>() -> &'static [u8] { + BYTES +} + +pub fn main() { + assert_eq!(function_with_bytes::<b"AAAAb">(), &[0x41, 0x41, 0x41, 0x41]); +} diff --git a/tests/crashes/129099.rs b/tests/crashes/129099.rs new file mode 100644 index 00000000000..9aaab756b5b --- /dev/null +++ b/tests/crashes/129099.rs @@ -0,0 +1,15 @@ +//@ known-bug: rust-lang/rust#129099 + +#![feature(type_alias_impl_trait)] + +fn dyn_hoops<T: Sized>() -> dyn for<'a> Iterator<Item = impl Captures<'a>> { + loop {} +} + +pub fn main() { + type Opaque = impl Sized; + fn define() -> Opaque { + let x: Opaque = dyn_hoops::<()>(0); + x + } +} diff --git a/tests/crashes/129109.rs b/tests/crashes/129109.rs new file mode 100644 index 00000000000..8b9ebdf03c7 --- /dev/null +++ b/tests/crashes/129109.rs @@ -0,0 +1,10 @@ +//@ known-bug: rust-lang/rust#129109 +//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir + +extern "C" { + pub static mut symbol: [i8]; +} + +fn main() { + println!("C", unsafe { &symbol }); +} diff --git a/tests/crashes/129127.rs b/tests/crashes/129127.rs new file mode 100644 index 00000000000..8ec848dbd05 --- /dev/null +++ b/tests/crashes/129127.rs @@ -0,0 +1,21 @@ +//@ known-bug: rust-lang/rust#129127 +//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir -Zcross-crate-inline-threshold=always + + + + +pub struct Rows<'a>(); + +impl<'a> Iterator for Rows<'a> { + type Item = (); + + fn next() -> Option<Self::Item> { + let mut rows = Rows(); + rows.map(|row| row).next() + } +} + +fn main() { + let mut rows = Rows(); + rows.next(); +} diff --git a/tests/crashes/129150.rs b/tests/crashes/129150.rs new file mode 100644 index 00000000000..9f8c2ba1739 --- /dev/null +++ b/tests/crashes/129150.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#129150 +//@ only-x86_64 +use std::arch::x86_64::_mm_blend_ps; + +pub fn main() { + _mm_blend_ps(1, 2, &const {} ); +} diff --git a/tests/crashes/129166.rs b/tests/crashes/129166.rs new file mode 100644 index 00000000000..d3635d410db --- /dev/null +++ b/tests/crashes/129166.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#129166 + +fn main() { + #[cfg_eval] + #[cfg] + 0 +} diff --git a/tests/crashes/129209.rs b/tests/crashes/129209.rs new file mode 100644 index 00000000000..249fa41552e --- /dev/null +++ b/tests/crashes/129209.rs @@ -0,0 +1,11 @@ +//@ known-bug: rust-lang/rust#129209 + +impl< + const N: usize = { + static || { + Foo([0; X]); + } + }, + > PartialEq for True +{ +} diff --git a/tests/crashes/129214.rs b/tests/crashes/129214.rs new file mode 100644 index 00000000000..e14b9f379d6 --- /dev/null +++ b/tests/crashes/129214.rs @@ -0,0 +1,30 @@ +//@ known-bug: rust-lang/rust#129214 +//@ compile-flags: -Zvalidate-mir -Copt-level=3 --crate-type=lib + +trait to_str {} + +trait map<T> { + fn map<U, F>(&self, f: F) -> Vec<U> + where + F: FnMut(&Box<usize>) -> U; +} +impl<T> map<T> for Vec<T> { + fn map<U, F>(&self, mut f: F) -> Vec<U> + where + F: FnMut(&T) -> U, + { + let mut r = Vec::new(); + for i in self { + r.push(f(i)); + } + r + } +} + +fn foo<U, T: map<U>>(x: T) -> Vec<String> { + x.map(|_e| "hi".to_string()) +} + +pub fn main() { + assert_eq!(foo(vec![1]), ["hi".to_string()]); +} diff --git a/tests/crashes/129219.rs b/tests/crashes/129219.rs new file mode 100644 index 00000000000..effbfcd8b8e --- /dev/null +++ b/tests/crashes/129219.rs @@ -0,0 +1,26 @@ +//@ known-bug: rust-lang/rust#129219 +//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir --edition=2018 + +use core::marker::Unsize; + +pub trait CastTo<T: ?Sized>: Unsize<T> {} + +impl<T: ?Sized, U: ?Sized> CastTo<T> for U {} + +impl<T: ?Sized> Cast for T {} +pub trait Cast { + fn cast<T: ?Sized>(&self) -> &T + where + Self: CastTo<T>, + { + self + } +} + +pub trait Foo {} +impl Foo for [i32; 0] {} + +fn main() { + let x: &dyn Foo = &[]; + let x = x.cast::<[i32]>(); +} diff --git a/tests/crashes/129425.rs b/tests/crashes/129425.rs new file mode 100644 index 00000000000..ac7dc007847 --- /dev/null +++ b/tests/crashes/129425.rs @@ -0,0 +1,6 @@ +//@ known-bug: rust-lang/rust#129425 + +//@compile-flags: --crate-type=lib + +#![feature(generic_const_exprs)] +fn foo<'a, T: 'a>(_: [(); std::mem::offset_of!((T,), 0)]) {} diff --git a/tests/crashes/129444.rs b/tests/crashes/129444.rs new file mode 100644 index 00000000000..b1b547b5191 --- /dev/null +++ b/tests/crashes/129444.rs @@ -0,0 +1,15 @@ +//@ known-bug: rust-lang/rust#129444 + +//@ compile-flags: -Znext-solver=coherence + +trait Trait { + type Assoc; +} + +struct W<T: Trait>(*mut T); +impl<T: ?Trait> Trait for W<W<W<T>>> {} + +trait NoOverlap {} +impl<T: Trait<W<T>>> NoOverlap for T {} + +impl<T: Trait<Assoc = u32>> NoOverlap for W<T> {} diff --git a/tests/crashes/129503.rs b/tests/crashes/129503.rs new file mode 100644 index 00000000000..c1ed46e5955 --- /dev/null +++ b/tests/crashes/129503.rs @@ -0,0 +1,7 @@ +//@ known-bug: rust-lang/rust#129503 + +use std::arch::asm; + +unsafe fn f6() { + asm!(concat!(r#"lJÆ�.�"#, "r} {}")); +} diff --git a/tests/crashes/129556.rs b/tests/crashes/129556.rs new file mode 100644 index 00000000000..364827e9444 --- /dev/null +++ b/tests/crashes/129556.rs @@ -0,0 +1,26 @@ +//@ known-bug: rust-lang/rust#129556 + +#![feature(adt_const_params)] +#![feature(generic_const_exprs)] + +use core::marker::ConstParamTy; + +// #[derive(ConstParamTy, PartialEq, Eq)] +// struct StructOrEnum; + +#[derive(ConstParamTy, PartialEq, Eq)] +enum StructOrEnum { + A, +} + +trait TraitParent<const SMTH: StructOrEnum = { StructOrEnum::A }> {} + +trait TraitChild<const SMTH: StructOrEnum = { StructOrEnum::A }>: TraitParent<SMTH> {} + +impl TraitParent for StructOrEnum {} + +// ICE occurs +impl TraitChild for StructOrEnum {} + +// ICE does not occur +// impl TraitChild<{ StructOrEnum::A }> for StructOrEnum {} diff --git a/tests/debuginfo/associated-types.rs b/tests/debuginfo/associated-types.rs index d1d4e320b05..b20bd520936 100644 --- a/tests/debuginfo/associated-types.rs +++ b/tests/debuginfo/associated-types.rs @@ -1,15 +1,10 @@ -// Some versions of the non-rust-enabled LLDB print the wrong generic -// parameter type names in this test. -//@ needs-rust-lldb - //@ compile-flags:-g // === GDB TESTS =================================================================================== // gdb-command:run // gdb-command:print arg -// gdbg-check:$1 = {b = -1, b1 = 0} -// gdbr-check:$1 = associated_types::Struct<i32> {b: -1, b1: 0} +// gdb-check:$1 = associated_types::Struct<i32> {b: -1, b1: 0} // gdb-command:continue // gdb-command:print inferred @@ -23,8 +18,7 @@ // gdb-command:continue // gdb-command:print arg -// gdbg-check:$5 = {__0 = 4, __1 = 5} -// gdbr-check:$5 = (4, 5) +// gdb-check:$5 = (4, 5) // gdb-command:continue // gdb-command:print a @@ -43,42 +37,33 @@ // lldb-command:run // lldb-command:v arg -// lldbg-check:[...] { b = -1, b1 = 0 } -// lldbr-check:(associated_types::Struct<i32>) arg = { b = -1, b1 = 0 } +// lldb-check:[...] { b = -1 b1 = 0 } // lldb-command:continue // lldb-command:v inferred -// lldbg-check:[...] 1 -// lldbr-check:(i64) inferred = 1 +// lldb-check:[...] 1 // lldb-command:v explicitly -// lldbg-check:[...] 1 -// lldbr-check:(i64) explicitly = 1 +// lldb-check:[...] 1 // lldb-command:continue // lldb-command:v arg -// lldbg-check:[...] 2 -// lldbr-check:(i64) arg = 2 +// lldb-check:[...] 2 // lldb-command:continue // lldb-command:v arg -// lldbg-check:[...] (4, 5) -// lldbr-check:((i32, i64)) arg = { = 4 = 5 } +// lldb-check:[...] { 0 = 4 1 = 5 } // lldb-command:continue // lldb-command:v a -// lldbg-check:[...] 6 -// lldbr-check:(i32) a = 6 +// lldb-check:[...] 6 // lldb-command:v b -// lldbg-check:[...] 7 -// lldbr-check:(i64) b = 7 +// lldb-check:[...] 7 // lldb-command:continue // lldb-command:v a -// lldbg-check:[...] 8 -// lldbr-check:(i64) a = 8 +// lldb-check:[...] 8 // lldb-command:v b -// lldbg-check:[...] 9 -// lldbr-check:(i32) b = 9 +// lldb-check:[...] 9 // lldb-command:continue #![allow(unused_variables)] diff --git a/tests/debuginfo/basic-types-globals-metadata.rs b/tests/debuginfo/basic-types-globals-metadata.rs index d346b405555..53fc550a2dc 100644 --- a/tests/debuginfo/basic-types-globals-metadata.rs +++ b/tests/debuginfo/basic-types-globals-metadata.rs @@ -1,52 +1,35 @@ -//@ min-lldb-version: 310 -//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 - //@ compile-flags:-g + // gdb-command:run -// gdbg-command:whatis 'basic_types_globals_metadata::B' -// gdbr-command:whatis basic_types_globals_metadata::B +// gdb-command:whatis basic_types_globals_metadata::B // gdb-check:type = bool -// gdbg-command:whatis 'basic_types_globals_metadata::I' -// gdbr-command:whatis basic_types_globals_metadata::I +// gdb-command:whatis basic_types_globals_metadata::I // gdb-check:type = isize -// gdbg-command:whatis 'basic_types_globals_metadata::C' -// gdbr-command:whatis basic_types_globals_metadata::C +// gdb-command:whatis basic_types_globals_metadata::C // gdb-check:type = char -// gdbg-command:whatis 'basic_types_globals_metadata::I8' -// gdbr-command:whatis basic_types_globals_metadata::I8 +// gdb-command:whatis basic_types_globals_metadata::I8 // gdb-check:type = i8 -// gdbg-command:whatis 'basic_types_globals_metadata::I16' -// gdbr-command:whatis basic_types_globals_metadata::I16 +// gdb-command:whatis basic_types_globals_metadata::I16 // gdb-check:type = i16 -// gdbg-command:whatis 'basic_types_globals_metadata::I32' -// gdbr-command:whatis basic_types_globals_metadata::I32 +// gdb-command:whatis basic_types_globals_metadata::I32 // gdb-check:type = i32 -// gdbg-command:whatis 'basic_types_globals_metadata::I64' -// gdbr-command:whatis basic_types_globals_metadata::I64 +// gdb-command:whatis basic_types_globals_metadata::I64 // gdb-check:type = i64 -// gdbg-command:whatis 'basic_types_globals_metadata::U' -// gdbr-command:whatis basic_types_globals_metadata::U +// gdb-command:whatis basic_types_globals_metadata::U // gdb-check:type = usize -// gdbg-command:whatis 'basic_types_globals_metadata::U8' -// gdbr-command:whatis basic_types_globals_metadata::U8 +// gdb-command:whatis basic_types_globals_metadata::U8 // gdb-check:type = u8 -// gdbg-command:whatis 'basic_types_globals_metadata::U16' -// gdbr-command:whatis basic_types_globals_metadata::U16 +// gdb-command:whatis basic_types_globals_metadata::U16 // gdb-check:type = u16 -// gdbg-command:whatis 'basic_types_globals_metadata::U32' -// gdbr-command:whatis basic_types_globals_metadata::U32 +// gdb-command:whatis basic_types_globals_metadata::U32 // gdb-check:type = u32 -// gdbg-command:whatis 'basic_types_globals_metadata::U64' -// gdbr-command:whatis basic_types_globals_metadata::U64 +// gdb-command:whatis basic_types_globals_metadata::U64 // gdb-check:type = u64 -// gdbg-command:whatis 'basic_types_globals_metadata::F16' -// gdbr-command:whatis basic_types_globals_metadata::F16 +// gdb-command:whatis basic_types_globals_metadata::F16 // gdb-check:type = f16 -// gdbg-command:whatis 'basic_types_globals_metadata::F32' -// gdbr-command:whatis basic_types_globals_metadata::F32 +// gdb-command:whatis basic_types_globals_metadata::F32 // gdb-check:type = f32 -// gdbg-command:whatis 'basic_types_globals_metadata::F64' -// gdbr-command:whatis basic_types_globals_metadata::F64 +// gdb-command:whatis basic_types_globals_metadata::F64 // gdb-check:type = f64 // gdb-command:continue diff --git a/tests/debuginfo/basic-types-globals.rs b/tests/debuginfo/basic-types-globals.rs index 0425d14fa5a..41b69939650 100644 --- a/tests/debuginfo/basic-types-globals.rs +++ b/tests/debuginfo/basic-types-globals.rs @@ -1,9 +1,3 @@ -// Caveat - gdb doesn't know about UTF-32 character encoding and will print a -// rust char as only its numerical value. - -//@ min-lldb-version: 310 -//@ min-gdb-version: 8.0 - //@ revisions: lto no-lto //@ compile-flags:-g @@ -12,51 +6,35 @@ //@ [lto] no-prefer-dynamic // gdb-command:run -// gdbg-command:print 'basic_types_globals::B' -// gdbr-command:print B +// gdb-command:print B // gdb-check:$1 = false -// gdbg-command:print 'basic_types_globals::I' -// gdbr-command:print I +// gdb-command:print I // gdb-check:$2 = -1 -// gdbg-command:print 'basic_types_globals::C' -// gdbr-command:print/d C -// gdbg-check:$3 = 97 -// gdbr-check:$3 = 97 -// gdbg-command:print/d 'basic_types_globals::I8' -// gdbr-command:print I8 +// gdb-command:print/d C +// gdb-check:$3 = 97 +// gdb-command:print I8 // gdb-check:$4 = 68 -// gdbg-command:print 'basic_types_globals::I16' -// gdbr-command:print I16 +// gdb-command:print I16 // gdb-check:$5 = -16 -// gdbg-command:print 'basic_types_globals::I32' -// gdbr-command:print I32 +// gdb-command:print I32 // gdb-check:$6 = -32 -// gdbg-command:print 'basic_types_globals::I64' -// gdbr-command:print I64 +// gdb-command:print I64 // gdb-check:$7 = -64 -// gdbg-command:print 'basic_types_globals::U' -// gdbr-command:print U +// gdb-command:print U // gdb-check:$8 = 1 -// gdbg-command:print/d 'basic_types_globals::U8' -// gdbr-command:print U8 +// gdb-command:print U8 // gdb-check:$9 = 100 -// gdbg-command:print 'basic_types_globals::U16' -// gdbr-command:print U16 +// gdb-command:print U16 // gdb-check:$10 = 16 -// gdbg-command:print 'basic_types_globals::U32' -// gdbr-command:print U32 +// gdb-command:print U32 // gdb-check:$11 = 32 -// gdbg-command:print 'basic_types_globals::U64' -// gdbr-command:print U64 +// gdb-command:print U64 // gdb-check:$12 = 64 -// gdbg-command:print 'basic_types_globals::F16' -// gdbr-command:print F16 +// gdb-command:print F16 // gdb-check:$13 = 1.5 -// gdbg-command:print 'basic_types_globals::F32' -// gdbr-command:print F32 +// gdb-command:print F32 // gdb-check:$14 = 2.5 -// gdbg-command:print 'basic_types_globals::F64' -// gdbr-command:print F64 +// gdb-command:print F64 // gdb-check:$15 = 3.5 // gdb-command:continue diff --git a/tests/debuginfo/basic-types-metadata.rs b/tests/debuginfo/basic-types-metadata.rs index 5f953c81a13..6b7cfbdebca 100644 --- a/tests/debuginfo/basic-types-metadata.rs +++ b/tests/debuginfo/basic-types-metadata.rs @@ -1,7 +1,5 @@ -//@ min-lldb-version: 310 -//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 - //@ compile-flags:-g + // gdb-command:run // gdb-command:whatis unit // gdb-check:type = () @@ -36,31 +34,20 @@ // gdb-command:whatis f64 // gdb-check:type = f64 // gdb-command:whatis fnptr -// gdb-check:type = [...] (*)([...]) +// gdb-check:type = *mut fn () // gdb-command:info functions _yyy -// gdbg-check:[...]![...]_yyy([...]); -// gdbr-check:static fn basic_types_metadata::_yyy() -> !; +// gdb-check:static fn basic_types_metadata::_yyy(); // gdb-command:ptype closure_0 -// gdbr-check: type = struct closure -// gdbg-check: type = struct closure { -// gdbg-check: <no data fields> -// gdbg-check: } +// gdb-check: type = struct basic_types_metadata::main::{closure_env#0} // gdb-command:ptype closure_1 -// gdbg-check: type = struct closure { -// gdbg-check: bool *__0; -// gdbg-check: } -// gdbr-check: type = struct closure ( -// gdbr-check: bool *, -// gdbr-check: ) +// gdb-check: type = struct basic_types_metadata::main::{closure_env#1} { +// gdb-check: *mut bool, +// gdb-check: } // gdb-command:ptype closure_2 -// gdbg-check: type = struct closure { -// gdbg-check: bool *__0; -// gdbg-check: isize *__1; -// gdbg-check: } -// gdbr-check: type = struct closure ( -// gdbr-check: bool *, -// gdbr-check: isize *, -// gdbr-check: ) +// gdb-check: type = struct basic_types_metadata::main::{closure_env#2} { +// gdb-check: *mut bool, +// gdb-check: *mut isize, +// gdb-check: } // // gdb-command:continue diff --git a/tests/debuginfo/basic-types-mut-globals.rs b/tests/debuginfo/basic-types-mut-globals.rs index c676fd73771..f6a2399d230 100644 --- a/tests/debuginfo/basic-types-mut-globals.rs +++ b/tests/debuginfo/basic-types-mut-globals.rs @@ -4,107 +4,73 @@ // about UTF-32 character encoding and will print a rust char as only // its numerical value. -//@ min-lldb-version: 310 - //@ compile-flags:-g // gdb-command:run // Check initializers -// gdbg-command:print 'basic_types_mut_globals::B' -// gdbr-command:print B +// gdb-command:print B // gdb-check:$1 = false -// gdbg-command:print 'basic_types_mut_globals::I' -// gdbr-command:print I +// gdb-command:print I // gdb-check:$2 = -1 -// gdbg-command:print/d 'basic_types_mut_globals::C' -// gdbr-command:print C -// gdbg-check:$3 = 97 -// gdbr-check:$3 = 97 'a' -// gdbg-command:print/d 'basic_types_mut_globals::I8' -// gdbr-command:print I8 +// gdb-command:print C +// gdb-check:$3 = 97 'a' +// gdb-command:print I8 // gdb-check:$4 = 68 -// gdbg-command:print 'basic_types_mut_globals::I16' -// gdbr-command:print I16 +// gdb-command:print I16 // gdb-check:$5 = -16 -// gdbg-command:print 'basic_types_mut_globals::I32' -// gdbr-command:print I32 +// gdb-command:print I32 // gdb-check:$6 = -32 -// gdbg-command:print 'basic_types_mut_globals::I64' -// gdbr-command:print I64 +// gdb-command:print I64 // gdb-check:$7 = -64 -// gdbg-command:print 'basic_types_mut_globals::U' -// gdbr-command:print U +// gdb-command:print U // gdb-check:$8 = 1 -// gdbg-command:print/d 'basic_types_mut_globals::U8' -// gdbr-command:print U8 +// gdb-command:print U8 // gdb-check:$9 = 100 -// gdbg-command:print 'basic_types_mut_globals::U16' -// gdbr-command:print U16 +// gdb-command:print U16 // gdb-check:$10 = 16 -// gdbg-command:print 'basic_types_mut_globals::U32' -// gdbr-command:print U32 +// gdb-command:print U32 // gdb-check:$11 = 32 -// gdbg-command:print 'basic_types_mut_globals::U64' -// gdbr-command:print U64 +// gdb-command:print U64 // gdb-check:$12 = 64 -// gdbg-command:print 'basic_types_mut_globals::F16' -// gdbr-command:print F16 +// gdb-command:print F16 // gdb-check:$13 = 1.5 -// gdbg-command:print 'basic_types_mut_globals::F32' -// gdbr-command:print F32 +// gdb-command:print F32 // gdb-check:$14 = 2.5 -// gdbg-command:print 'basic_types_mut_globals::F64' -// gdbr-command:print F64 +// gdb-command:print F64 // gdb-check:$15 = 3.5 // gdb-command:continue // Check new values -// gdbg-command:print 'basic_types_mut_globals'::B -// gdbr-command:print B +// gdb-command:print B // gdb-check:$16 = true -// gdbg-command:print 'basic_types_mut_globals'::I -// gdbr-command:print I +// gdb-command:print I // gdb-check:$17 = 2 -// gdbg-command:print/d 'basic_types_mut_globals'::C -// gdbr-command:print C -// gdbg-check:$18 = 102 -// gdbr-check:$18 = 102 'f' -// gdbg-command:print/d 'basic_types_mut_globals'::I8 -// gdbr-command:print/d I8 +// gdb-command:print C +// gdb-check:$18 = 102 'f' +// gdb-command:print/d I8 // gdb-check:$19 = 78 -// gdbg-command:print 'basic_types_mut_globals'::I16 -// gdbr-command:print I16 +// gdb-command:print I16 // gdb-check:$20 = -26 -// gdbg-command:print 'basic_types_mut_globals'::I32 -// gdbr-command:print I32 +// gdb-command:print I32 // gdb-check:$21 = -12 -// gdbg-command:print 'basic_types_mut_globals'::I64 -// gdbr-command:print I64 +// gdb-command:print I64 // gdb-check:$22 = -54 -// gdbg-command:print 'basic_types_mut_globals'::U -// gdbr-command:print U +// gdb-command:print U // gdb-check:$23 = 5 -// gdbg-command:print/d 'basic_types_mut_globals'::U8 -// gdbr-command:print/d U8 +// gdb-command:print/d U8 // gdb-check:$24 = 20 -// gdbg-command:print 'basic_types_mut_globals'::U16 -// gdbr-command:print U16 +// gdb-command:print U16 // gdb-check:$25 = 32 -// gdbg-command:print 'basic_types_mut_globals'::U32 -// gdbr-command:print U32 +// gdb-command:print U32 // gdb-check:$26 = 16 -// gdbg-command:print 'basic_types_mut_globals'::U64 -// gdbr-command:print U64 +// gdb-command:print U64 // gdb-check:$27 = 128 -// gdbg-command:print 'basic_types_mut_globals'::F16 -// gdbr-command:print F16 +// gdb-command:print F16 // gdb-check:$28 = 2.25 -// gdbg-command:print 'basic_types_mut_globals'::F32 -// gdbr-command:print F32 +// gdb-command:print F32 // gdb-check:$29 = 5.75 -// gdbg-command:print 'basic_types_mut_globals'::F64 -// gdbr-command:print F64 +// gdb-command:print F64 // gdb-check:$30 = 9.25 #![allow(unused_variables)] diff --git a/tests/debuginfo/basic-types.rs b/tests/debuginfo/basic-types.rs index 10ffd74d3e9..fea5262bc41 100644 --- a/tests/debuginfo/basic-types.rs +++ b/tests/debuginfo/basic-types.rs @@ -4,11 +4,6 @@ // about UTF-32 character encoding and will print a rust char as only // its numerical value. -//@ min-lldb-version: 310 - -// This fails on lldb 6.0.1 on x86-64 Fedora 28; so ignore Linux for now. -//@ ignore-linux - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -19,8 +14,7 @@ // gdb-command:print i // gdb-check:$2 = -1 // gdb-command:print c -// gdbg-check:$3 = 97 -// gdbr-check:$3 = 97 'a' +// gdb-check:$3 = 97 'a' // gdb-command:print/d i8 // gdb-check:$4 = 68 // gdb-command:print i16 @@ -46,56 +40,38 @@ // gdb-command:print f64 // gdb-check:$15 = 3.5 // gdb-command:print s -// gdbg-check:$16 = {data_ptr = [...] "Hello, World!", length = 13} -// gdbr-check:$16 = "Hello, World!" +// gdb-check:$16 = "Hello, World!" // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v b -// lldbg-check:[...] false -// lldbr-check:(bool) b = false +// lldb-check:[...] false // lldb-command:v i -// lldbg-check:[...] -1 -// lldbr-check:(isize) i = -1 - -// NOTE: only rust-enabled lldb supports 32bit chars -// lldbr-command:print c -// lldbr-check:(char) c = 'a' +// lldb-check:[...] -1 // lldb-command:v i8 -// lldbg-check:[...] 'D' -// lldbr-check:(i8) i8 = 68 +// lldb-check:[...] 'D' // lldb-command:v i16 -// lldbg-check:[...] -16 -// lldbr-check:(i16) i16 = -16 +// lldb-check:[...] -16 // lldb-command:v i32 -// lldbg-check:[...] -32 -// lldbr-check:(i32) i32 = -32 +// lldb-check:[...] -32 // lldb-command:v i64 -// lldbg-check:[...] -64 -// lldbr-check:(i64) i64 = -64 +// lldb-check:[...] -64 // lldb-command:v u -// lldbg-check:[...] 1 -// lldbr-check:(usize) u = 1 +// lldb-check:[...] 1 // lldb-command:v u8 -// lldbg-check:[...] 'd' -// lldbr-check:(u8) u8 = 100 +// lldb-check:[...] 'd' // lldb-command:v u16 -// lldbg-check:[...] 16 -// lldbr-check:(u16) u16 = 16 +// lldb-check:[...] 16 // lldb-command:v u32 -// lldbg-check:[...] 32 -// lldbr-check:(u32) u32 = 32 +// lldb-check:[...] 32 // lldb-command:v u64 -// lldbg-check:[...] 64 -// lldbr-check:(u64) u64 = 64 +// lldb-check:[...] 64 // lldb-command:v f32 -// lldbg-check:[...] 2.5 -// lldbr-check:(f32) f32 = 2.5 +// lldb-check:[...] 2.5 // lldb-command:v f64 -// lldbg-check:[...] 3.5 -// lldbr-check:(f64) f64 = 3.5 +// lldb-check:[...] 3.5 // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/borrowed-basic.rs b/tests/debuginfo/borrowed-basic.rs index e3cf74dab1e..91de691e78e 100644 --- a/tests/debuginfo/borrowed-basic.rs +++ b/tests/debuginfo/borrowed-basic.rs @@ -1,5 +1,4 @@ //@ compile-flags:-g -//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== @@ -14,8 +13,7 @@ // gdb-check:$3 = 97 // gdb-command:print *i8_ref -// gdbg-check:$4 = 68 'D' -// gdbr-check:$4 = 68 +// gdb-check:$4 = 68 // gdb-command:print *i16_ref // gdb-check:$5 = -16 @@ -30,8 +28,7 @@ // gdb-check:$8 = 1 // gdb-command:print *u8_ref -// gdbg-check:$9 = 100 'd' -// gdbr-check:$9 = 100 +// gdb-check:$9 = 100 // gdb-command:print *u16_ref // gdb-check:$10 = 16 @@ -56,64 +53,47 @@ // lldb-command:run // lldb-command:v *bool_ref -// lldbg-check:[...] true -// lldbr-check:(bool) *bool_ref = true +// lldb-check:[...] true // lldb-command:v *int_ref -// lldbg-check:[...] -1 -// lldbr-check:(isize) *int_ref = -1 +// lldb-check:[...] -1 -// NOTE: only rust-enabled lldb supports 32bit chars -// lldbr-command:print *char_ref -// lldbr-check:(char) *char_ref = 'a' // lldb-command:v *i8_ref -// lldbg-check:[...] 'D' -// lldbr-check:(i8) *i8_ref = 68 +// lldb-check:[...] 'D' // lldb-command:v *i16_ref -// lldbg-check:[...] -16 -// lldbr-check:(i16) *i16_ref = -16 +// lldb-check:[...] -16 // lldb-command:v *i32_ref -// lldbg-check:[...] -32 -// lldbr-check:(i32) *i32_ref = -32 +// lldb-check:[...] -32 // lldb-command:v *i64_ref -// lldbg-check:[...] -64 -// lldbr-check:(i64) *i64_ref = -64 +// lldb-check:[...] -64 // lldb-command:v *uint_ref -// lldbg-check:[...] 1 -// lldbr-check:(usize) *uint_ref = 1 +// lldb-check:[...] 1 // lldb-command:v *u8_ref -// lldbg-check:[...] 'd' -// lldbr-check:(u8) *u8_ref = 100 +// lldb-check:[...] 'd' // lldb-command:v *u16_ref -// lldbg-check:[...] 16 -// lldbr-check:(u16) *u16_ref = 16 +// lldb-check:[...] 16 // lldb-command:v *u32_ref -// lldbg-check:[...] 32 -// lldbr-check:(u32) *u32_ref = 32 +// lldb-check:[...] 32 // lldb-command:v *u64_ref -// lldbg-check:[...] 64 -// lldbr-check:(u64) *u64_ref = 64 +// lldb-check:[...] 64 // lldb-command:v *f16_ref -// lldbg-check:[...] 1.5 -// lldbr-check:(f16) *f16_ref = 1.5 +// lldb-check:[...] 1.5 // lldb-command:v *f32_ref -// lldbg-check:[...] 2.5 -// lldbr-check:(f32) *f32_ref = 2.5 +// lldb-check:[...] 2.5 // lldb-command:v *f64_ref -// lldbg-check:[...] 3.5 -// lldbr-check:(f64) *f64_ref = 3.5 +// lldb-check:[...] 3.5 #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/borrowed-c-style-enum.rs b/tests/debuginfo/borrowed-c-style-enum.rs index 1a582e8a6d9..6a91d4f9650 100644 --- a/tests/debuginfo/borrowed-c-style-enum.rs +++ b/tests/debuginfo/borrowed-c-style-enum.rs @@ -1,21 +1,17 @@ //@ compile-flags:-g -//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== // gdb-command:run // gdb-command:print *the_a_ref -// gdbg-check:$1 = TheA -// gdbr-check:$1 = borrowed_c_style_enum::ABC::TheA +// gdb-check:$1 = borrowed_c_style_enum::ABC::TheA // gdb-command:print *the_b_ref -// gdbg-check:$2 = TheB -// gdbr-check:$2 = borrowed_c_style_enum::ABC::TheB +// gdb-check:$2 = borrowed_c_style_enum::ABC::TheB // gdb-command:print *the_c_ref -// gdbg-check:$3 = TheC -// gdbr-check:$3 = borrowed_c_style_enum::ABC::TheC +// gdb-check:$3 = borrowed_c_style_enum::ABC::TheC // === LLDB TESTS ================================================================================== @@ -23,16 +19,13 @@ // lldb-command:run // lldb-command:v *the_a_ref -// lldbg-check:[...] TheA -// lldbr-check:(borrowed_c_style_enum::ABC) *the_a_ref = borrowed_c_style_enum::ABC::TheA +// lldb-check:[...] TheA // lldb-command:v *the_b_ref -// lldbg-check:[...] TheB -// lldbr-check:(borrowed_c_style_enum::ABC) *the_b_ref = borrowed_c_style_enum::ABC::TheB +// lldb-check:[...] TheB // lldb-command:v *the_c_ref -// lldbg-check:[...] TheC -// lldbr-check:(borrowed_c_style_enum::ABC) *the_c_ref = borrowed_c_style_enum::ABC::TheC +// lldb-check:[...] TheC #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/borrowed-enum.rs b/tests/debuginfo/borrowed-enum.rs index fc2ab62a21c..c5a795fdede 100644 --- a/tests/debuginfo/borrowed-enum.rs +++ b/tests/debuginfo/borrowed-enum.rs @@ -1,5 +1,3 @@ -// Require a gdb or lldb that can read DW_TAG_variant_part. -//@ min-gdb-version: 8.2 //@ min-lldb-version: 1800 //@ compile-flags:-g @@ -9,13 +7,13 @@ // gdb-command:run // gdb-command:print *the_a_ref -// gdbr-check:$1 = borrowed_enum::ABC::TheA{x: 0, y: 8970181431921507452} +// gdb-check:$1 = borrowed_enum::ABC::TheA{x: 0, y: 8970181431921507452} // gdb-command:print *the_b_ref -// gdbr-check:$2 = borrowed_enum::ABC::TheB(0, 286331153, 286331153) +// gdb-check:$2 = borrowed_enum::ABC::TheB(0, 286331153, 286331153) // gdb-command:print *univariant_ref -// gdbr-check:$3 = borrowed_enum::Univariant::TheOnlyCase(4820353753753434) +// gdb-check:$3 = borrowed_enum::Univariant::TheOnlyCase(4820353753753434) // === LLDB TESTS ================================================================================== @@ -23,14 +21,11 @@ // lldb-command:run // lldb-command:v *the_a_ref -// lldbg-check:(borrowed_enum::ABC) *the_a_ref = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } -// lldbr-check:(borrowed_enum::ABC::TheA) *the_a_ref = TheA { TheA: 0, TheB: 8970181431921507452 } +// lldb-check:(borrowed_enum::ABC) *the_a_ref = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } // lldb-command:v *the_b_ref -// lldbg-check:(borrowed_enum::ABC) *the_b_ref = { value = { 0 = 0 1 = 286331153 2 = 286331153 } $discr$ = 1 } -// lldbr-check:(borrowed_enum::ABC::TheB) *the_b_ref = { = 0 = 286331153 = 286331153 } +// lldb-check:(borrowed_enum::ABC) *the_b_ref = { value = { 0 = 0 1 = 286331153 2 = 286331153 } $discr$ = 1 } // lldb-command:v *univariant_ref -// lldbg-check:(borrowed_enum::Univariant) *univariant_ref = { value = { 0 = 4820353753753434 } } -// lldbr-check:(borrowed_enum::Univariant) *univariant_ref = { TheOnlyCase = { = 4820353753753434 } } +// lldb-check:(borrowed_enum::Univariant) *univariant_ref = { value = { 0 = 4820353753753434 } } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/borrowed-struct.rs b/tests/debuginfo/borrowed-struct.rs index d108a29592b..245af35f505 100644 --- a/tests/debuginfo/borrowed-struct.rs +++ b/tests/debuginfo/borrowed-struct.rs @@ -1,13 +1,11 @@ //@ compile-flags:-g -//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== // gdb-command:run // gdb-command:print *stack_val_ref -// gdbg-check:$1 = {x = 10, y = 23.5} -// gdbr-check:$1 = borrowed_struct::SomeStruct {x: 10, y: 23.5} +// gdb-check:$1 = borrowed_struct::SomeStruct {x: 10, y: 23.5} // gdb-command:print *stack_val_interior_ref_1 // gdb-check:$2 = 10 @@ -16,12 +14,10 @@ // gdb-check:$3 = 23.5 // gdb-command:print *ref_to_unnamed -// gdbg-check:$4 = {x = 11, y = 24.5} -// gdbr-check:$4 = borrowed_struct::SomeStruct {x: 11, y: 24.5} +// gdb-check:$4 = borrowed_struct::SomeStruct {x: 11, y: 24.5} // gdb-command:print *unique_val_ref -// gdbg-check:$5 = {x = 13, y = 26.5} -// gdbr-check:$5 = borrowed_struct::SomeStruct {x: 13, y: 26.5} +// gdb-check:$5 = borrowed_struct::SomeStruct {x: 13, y: 26.5} // gdb-command:print *unique_val_interior_ref_1 // gdb-check:$6 = 13 @@ -35,32 +31,25 @@ // lldb-command:run // lldb-command:v *stack_val_ref -// lldbg-check:[...] { x = 10 y = 23.5 } -// lldbr-check:(borrowed_struct::SomeStruct) *stack_val_ref = (x = 10, y = 23.5) +// lldb-check:[...] { x = 10 y = 23.5 } // lldb-command:v *stack_val_interior_ref_1 -// lldbg-check:[...] 10 -// lldbr-check:(isize) *stack_val_interior_ref_1 = 10 +// lldb-check:[...] 10 // lldb-command:v *stack_val_interior_ref_2 -// lldbg-check:[...] 23.5 -// lldbr-check:(f64) *stack_val_interior_ref_2 = 23.5 +// lldb-check:[...] 23.5 // lldb-command:v *ref_to_unnamed -// lldbg-check:[...] { x = 11 y = 24.5 } -// lldbr-check:(borrowed_struct::SomeStruct) *ref_to_unnamed = (x = 11, y = 24.5) +// lldb-check:[...] { x = 11 y = 24.5 } // lldb-command:v *unique_val_ref -// lldbg-check:[...] { x = 13 y = 26.5 } -// lldbr-check:(borrowed_struct::SomeStruct) *unique_val_ref = (x = 13, y = 26.5) +// lldb-check:[...] { x = 13 y = 26.5 } // lldb-command:v *unique_val_interior_ref_1 -// lldbg-check:[...] 13 -// lldbr-check:(isize) *unique_val_interior_ref_1 = 13 +// lldb-check:[...] 13 // lldb-command:v *unique_val_interior_ref_2 -// lldbg-check:[...] 26.5 -// lldbr-check:(f64) *unique_val_interior_ref_2 = 26.5 +// lldb-check:[...] 26.5 #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/borrowed-tuple.rs b/tests/debuginfo/borrowed-tuple.rs index 4c5643deb9d..9e4ceec033e 100644 --- a/tests/debuginfo/borrowed-tuple.rs +++ b/tests/debuginfo/borrowed-tuple.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -7,16 +5,13 @@ // gdb-command:run // gdb-command:print *stack_val_ref -// gdbg-check:$1 = {__0 = -14, __1 = -19} -// gdbr-check:$1 = (-14, -19) +// gdb-check:$1 = (-14, -19) // gdb-command:print *ref_to_unnamed -// gdbg-check:$2 = {__0 = -15, __1 = -20} -// gdbr-check:$2 = (-15, -20) +// gdb-check:$2 = (-15, -20) // gdb-command:print *unique_val_ref -// gdbg-check:$3 = {__0 = -17, __1 = -22} -// gdbr-check:$3 = (-17, -22) +// gdb-check:$3 = (-17, -22) // === LLDB TESTS ================================================================================== @@ -24,16 +19,13 @@ // lldb-command:run // lldb-command:v *stack_val_ref -// lldbg-check:[...] { 0 = -14 1 = -19 } -// lldbr-check:((i16, f32)) *stack_val_ref = { 0 = -14 1 = -19 } +// lldb-check:[...] { 0 = -14 1 = -19 } // lldb-command:v *ref_to_unnamed -// lldbg-check:[...] { 0 = -15 1 = -20 } -// lldbr-check:((i16, f32)) *ref_to_unnamed = { 0 = -15 1 = -20 } +// lldb-check:[...] { 0 = -15 1 = -20 } // lldb-command:v *unique_val_ref -// lldbg-check:[...] { 0 = -17 1 = -22 } -// lldbr-check:((i16, f32)) *unique_val_ref = { 0 = -17 1 = -22 } +// lldb-check:[...] { 0 = -17 1 = -22 } #![allow(unused_variables)] diff --git a/tests/debuginfo/borrowed-unique-basic.rs b/tests/debuginfo/borrowed-unique-basic.rs index e952ec8cebb..7a9b4d1df82 100644 --- a/tests/debuginfo/borrowed-unique-basic.rs +++ b/tests/debuginfo/borrowed-unique-basic.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -59,64 +57,47 @@ // lldb-command:run // lldb-command:v *bool_ref -// lldbg-check:[...] true -// lldbr-check:(bool) *bool_ref = true +// lldb-check:[...] true // lldb-command:v *int_ref -// lldbg-check:[...] -1 -// lldbr-check:(isize) *int_ref = -1 +// lldb-check:[...] -1 -// NOTE: only rust-enabled lldb supports 32bit chars -// lldbr-command:print *char_ref -// lldbr-check:(char) *char_ref = 97 // lldb-command:v *i8_ref -// lldbg-check:[...] 68 -// lldbr-check:(i8) *i8_ref = 68 +// lldb-check:[...] 68 // lldb-command:v *i16_ref -// lldbg-check:[...] -16 -// lldbr-check:(i16) *i16_ref = -16 +// lldb-check:[...] -16 // lldb-command:v *i32_ref -// lldbg-check:[...] -32 -// lldbr-check:(i32) *i32_ref = -32 +// lldb-check:[...] -32 // lldb-command:v *i64_ref -// lldbg-check:[...] -64 -// lldbr-check:(i64) *i64_ref = -64 +// lldb-check:[...] -64 // lldb-command:v *uint_ref -// lldbg-check:[...] 1 -// lldbr-check:(usize) *uint_ref = 1 +// lldb-check:[...] 1 // lldb-command:v *u8_ref -// lldbg-check:[...] 100 -// lldbr-check:(u8) *u8_ref = 100 +// lldb-check:[...] 100 // lldb-command:v *u16_ref -// lldbg-check:[...] 16 -// lldbr-check:(u16) *u16_ref = 16 +// lldb-check:[...] 16 // lldb-command:v *u32_ref -// lldbg-check:[...] 32 -// lldbr-check:(u32) *u32_ref = 32 +// lldb-check:[...] 32 // lldb-command:v *u64_ref -// lldbg-check:[...] 64 -// lldbr-check:(u64) *u64_ref = 64 +// lldb-check:[...] 64 // lldb-command:v *f16_ref -// lldbg-check:[...] 1.5 -// lldbr-check:(f16) *f16_ref = 1.5 +// lldb-check:[...] 1.5 // lldb-command:v *f32_ref -// lldbg-check:[...] 2.5 -// lldbr-check:(f32) *f32_ref = 2.5 +// lldb-check:[...] 2.5 // lldb-command:v *f64_ref -// lldbg-check:[...] 3.5 -// lldbr-check:(f64) *f64_ref = 3.5 +// lldb-check:[...] 3.5 #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/box.rs b/tests/debuginfo/box.rs index 46019bcb1a7..d22566c0b17 100644 --- a/tests/debuginfo/box.rs +++ b/tests/debuginfo/box.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -9,19 +7,16 @@ // gdb-command:print *a // gdb-check:$1 = 1 // gdb-command:print *b -// gdbg-check:$2 = {__0 = 2, __1 = 3.5} -// gdbr-check:$2 = (2, 3.5) +// gdb-check:$2 = (2, 3.5) // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v *a -// lldbg-check:[...] 1 -// lldbr-check:(i32) *a = 1 +// lldb-check:[...] 1 // lldb-command:v *b -// lldbg-check:[...] { 0 = 2 1 = 3.5 } -// lldbr-check:((i32, f64)) *b = { 0 = 2 1 = 3.5 } +// lldb-check:[...] { 0 = 2 1 = 3.5 } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/boxed-struct.rs b/tests/debuginfo/boxed-struct.rs index 1ee639690ea..158609fb2ed 100644 --- a/tests/debuginfo/boxed-struct.rs +++ b/tests/debuginfo/boxed-struct.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -7,12 +5,10 @@ // gdb-command:run // gdb-command:print *boxed_with_padding -// gdbg-check:$1 = {x = 99, y = 999, z = 9999, w = 99999} -// gdbr-check:$1 = boxed_struct::StructWithSomePadding {x: 99, y: 999, z: 9999, w: 99999} +// gdb-check:$1 = boxed_struct::StructWithSomePadding {x: 99, y: 999, z: 9999, w: 99999} // gdb-command:print *boxed_with_dtor -// gdbg-check:$2 = {x = 77, y = 777, z = 7777, w = 77777} -// gdbr-check:$2 = boxed_struct::StructWithDestructor {x: 77, y: 777, z: 7777, w: 77777} +// gdb-check:$2 = boxed_struct::StructWithDestructor {x: 77, y: 777, z: 7777, w: 77777} // === LLDB TESTS ================================================================================== @@ -20,12 +16,10 @@ // lldb-command:run // lldb-command:v *boxed_with_padding -// lldbg-check:[...] { x = 99 y = 999 z = 9999 w = 99999 } -// lldbr-check:(boxed_struct::StructWithSomePadding) *boxed_with_padding = { x = 99 y = 999 z = 9999 w = 99999 } +// lldb-check:[...] { x = 99 y = 999 z = 9999 w = 99999 } // lldb-command:v *boxed_with_dtor -// lldbg-check:[...] { x = 77 y = 777 z = 7777 w = 77777 } -// lldbr-check:(boxed_struct::StructWithDestructor) *boxed_with_dtor = { x = 77 y = 777 z = 7777 w = 77777 } +// lldb-check:[...] { x = 77 y = 777 z = 7777 w = 77777 } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/by-value-non-immediate-argument.rs b/tests/debuginfo/by-value-non-immediate-argument.rs index e0ae4458d03..f0a39a45195 100644 --- a/tests/debuginfo/by-value-non-immediate-argument.rs +++ b/tests/debuginfo/by-value-non-immediate-argument.rs @@ -1,6 +1,5 @@ -//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -//@ min-lldb-version: 310 - +//@ min-lldb-version: 1800 +//@ min-gdb-version: 13.0 //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -8,13 +7,11 @@ // gdb-command:run // gdb-command:print s -// gdbg-check:$1 = {a = 1, b = 2.5} -// gdbr-check:$1 = by_value_non_immediate_argument::Struct {a: 1, b: 2.5} +// gdb-check:$1 = by_value_non_immediate_argument::Struct {a: 1, b: 2.5} // gdb-command:continue // gdb-command:print x -// gdbg-check:$2 = {a = 3, b = 4.5} -// gdbr-check:$2 = by_value_non_immediate_argument::Struct {a: 3, b: 4.5} +// gdb-check:$2 = by_value_non_immediate_argument::Struct {a: 3, b: 4.5} // gdb-command:print y // gdb-check:$3 = 5 // gdb-command:print z @@ -22,18 +19,15 @@ // gdb-command:continue // gdb-command:print a -// gdbg-check:$5 = {__0 = 7, __1 = 8, __2 = 9.5, __3 = 10.5} -// gdbr-check:$5 = (7, 8, 9.5, 10.5) +// gdb-check:$5 = (7, 8, 9.5, 10.5) // gdb-command:continue // gdb-command:print a -// gdbg-check:$6 = {__0 = 11.5, __1 = 12.5, __2 = 13, __3 = 14} -// gdbr-check:$6 = by_value_non_immediate_argument::Newtype (11.5, 12.5, 13, 14) +// gdb-check:$6 = by_value_non_immediate_argument::Newtype (11.5, 12.5, 13, 14) // gdb-command:continue // gdb-command:print x -// gdbg-check:$7 = {{RUST$ENUM$DISR = Case1, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = Case1, [...]}} -// gdbr-check:$7 = by_value_non_immediate_argument::Enum::Case1{x: 0, y: 8970181431921507452} +// gdb-check:$7 = by_value_non_immediate_argument::Enum::Case1{x: 0, y: 8970181431921507452} // gdb-command:continue @@ -42,11 +36,11 @@ // lldb-command:run // lldb-command:v s -// lldb-check:[...] Struct { a: 1, b: 2.5 } +// lldb-check:[...] Struct { a = 1 b = 2.5 } // lldb-command:continue // lldb-command:v x -// lldb-check:[...] Struct { a: 3, b: 4.5 } +// lldb-check:[...] Struct { a = 3 b = 4.5 } // lldb-command:v y // lldb-check:[...] 5 // lldb-command:v z diff --git a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs index 5276ec82733..6981fdfc9e1 100644 --- a/tests/debuginfo/by-value-self-argument-in-trait-impl.rs +++ b/tests/debuginfo/by-value-self-argument-in-trait-impl.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -11,13 +9,11 @@ // gdb-command:continue // gdb-command:print self -// gdbg-check:$2 = {x = 2222, y = 3333} -// gdbr-check:$2 = by_value_self_argument_in_trait_impl::Struct {x: 2222, y: 3333} +// gdb-check:$2 = by_value_self_argument_in_trait_impl::Struct {x: 2222, y: 3333} // gdb-command:continue // gdb-command:print self -// gdbg-check:$3 = {__0 = 4444.5, __1 = 5555, __2 = 6666, __3 = 7777.5} -// gdbr-check:$3 = (4444.5, 5555, 6666, 7777.5) +// gdb-check:$3 = (4444.5, 5555, 6666, 7777.5) // gdb-command:continue @@ -26,18 +22,15 @@ // lldb-command:run // lldb-command:v self -// lldbg-check:[...] 1111 -// lldbr-check:(isize) self = 1111 +// lldb-check:[...] 1111 // lldb-command:continue // lldb-command:v self -// lldbg-check:[...] { x = 2222 y = 3333 } -// lldbr-check:(by_value_self_argument_in_trait_impl::Struct) self = { x = 2222 y = 3333 } +// lldb-check:[...] { x = 2222 y = 3333 } // lldb-command:continue // lldb-command:v self -// lldbg-check:[...] { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } -// lldbr-check:((f64, isize, isize, f64)) self = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } +// lldb-check:[...] { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 } // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/c-style-enum-in-composite.rs b/tests/debuginfo/c-style-enum-in-composite.rs index ec11d5f4655..642879cf3b6 100644 --- a/tests/debuginfo/c-style-enum-in-composite.rs +++ b/tests/debuginfo/c-style-enum-in-composite.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -7,64 +5,50 @@ // gdb-command:run // gdb-command:print tuple_interior_padding -// gdbg-check:$1 = {__0 = 0, __1 = OneHundred} -// gdbr-check:$1 = (0, c_style_enum_in_composite::AnEnum::OneHundred) +// gdb-check:$1 = (0, c_style_enum_in_composite::AnEnum::OneHundred) // gdb-command:print tuple_padding_at_end -// gdbg-check:$2 = {__0 = {__0 = 1, __1 = OneThousand}, __1 = 2} -// gdbr-check:$2 = ((1, c_style_enum_in_composite::AnEnum::OneThousand), 2) +// gdb-check:$2 = ((1, c_style_enum_in_composite::AnEnum::OneThousand), 2) // gdb-command:print tuple_different_enums -// gdbg-check:$3 = {__0 = OneThousand, __1 = MountainView, __2 = OneMillion, __3 = Vienna} -// gdbr-check:$3 = (c_style_enum_in_composite::AnEnum::OneThousand, c_style_enum_in_composite::AnotherEnum::MountainView, c_style_enum_in_composite::AnEnum::OneMillion, c_style_enum_in_composite::AnotherEnum::Vienna) +// gdb-check:$3 = (c_style_enum_in_composite::AnEnum::OneThousand, c_style_enum_in_composite::AnotherEnum::MountainView, c_style_enum_in_composite::AnEnum::OneMillion, c_style_enum_in_composite::AnotherEnum::Vienna) // gdb-command:print padded_struct -// gdbg-check:$4 = {a = 3, b = OneMillion, c = 4, d = Toronto, e = 5} -// gdbr-check:$4 = c_style_enum_in_composite::PaddedStruct {a: 3, b: c_style_enum_in_composite::AnEnum::OneMillion, c: 4, d: c_style_enum_in_composite::AnotherEnum::Toronto, e: 5} +// gdb-check:$4 = c_style_enum_in_composite::PaddedStruct {a: 3, b: c_style_enum_in_composite::AnEnum::OneMillion, c: 4, d: c_style_enum_in_composite::AnotherEnum::Toronto, e: 5} // gdb-command:print packed_struct -// gdbg-check:$5 = {a = 6, b = OneHundred, c = 7, d = Vienna, e = 8} -// gdbr-check:$5 = c_style_enum_in_composite::PackedStruct {a: 6, b: c_style_enum_in_composite::AnEnum::OneHundred, c: 7, d: c_style_enum_in_composite::AnotherEnum::Vienna, e: 8} +// gdb-check:$5 = c_style_enum_in_composite::PackedStruct {a: 6, b: c_style_enum_in_composite::AnEnum::OneHundred, c: 7, d: c_style_enum_in_composite::AnotherEnum::Vienna, e: 8} // gdb-command:print non_padded_struct -// gdbg-check:$6 = {a = OneMillion, b = MountainView, c = OneThousand, d = Toronto} -// gdbr-check:$6 = c_style_enum_in_composite::NonPaddedStruct {a: c_style_enum_in_composite::AnEnum::OneMillion, b: c_style_enum_in_composite::AnotherEnum::MountainView, c: c_style_enum_in_composite::AnEnum::OneThousand, d: c_style_enum_in_composite::AnotherEnum::Toronto} +// gdb-check:$6 = c_style_enum_in_composite::NonPaddedStruct {a: c_style_enum_in_composite::AnEnum::OneMillion, b: c_style_enum_in_composite::AnotherEnum::MountainView, c: c_style_enum_in_composite::AnEnum::OneThousand, d: c_style_enum_in_composite::AnotherEnum::Toronto} // gdb-command:print struct_with_drop -// gdbg-check:$7 = {__0 = {a = OneHundred, b = Vienna}, __1 = 9} -// gdbr-check:$7 = (c_style_enum_in_composite::StructWithDrop {a: c_style_enum_in_composite::AnEnum::OneHundred, b: c_style_enum_in_composite::AnotherEnum::Vienna}, 9) +// gdb-check:$7 = (c_style_enum_in_composite::StructWithDrop {a: c_style_enum_in_composite::AnEnum::OneHundred, b: c_style_enum_in_composite::AnotherEnum::Vienna}, 9) // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v tuple_interior_padding -// lldbg-check:[...] { 0 = 0 1 = OneHundred } -// lldbr-check:((i16, c_style_enum_in_composite::AnEnum)) tuple_interior_padding = { 0 = 0 1 = OneHundred } +// lldb-check:[...] { 0 = 0 1 = OneHundred } // lldb-command:v tuple_padding_at_end -// lldbg-check:[...] { 0 = { 0 = 1 1 = OneThousand } 1 = 2 } -// lldbr-check:(((u64, c_style_enum_in_composite::AnEnum), u64)) tuple_padding_at_end = { 0 = { 0 = 1 1 = OneThousand } 1 = 2 } +// lldb-check:[...] { 0 = { 0 = 1 1 = OneThousand } 1 = 2 } // lldb-command:v tuple_different_enums -// lldbg-check:[...] { 0 = OneThousand 1 = MountainView 2 = OneMillion 3 = Vienna } -// lldbr-check:((c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum, c_style_enum_in_composite::AnEnum, c_style_enum_in_composite::AnotherEnum)) tuple_different_enums = { 0 = c_style_enum_in_composite::AnEnum::OneThousand 1 = c_style_enum_in_composite::AnotherEnum::MountainView 2 = c_style_enum_in_composite::AnEnum::OneMillion 3 = c_style_enum_in_composite::AnotherEnum::Vienna } +// lldb-check:[...] { 0 = OneThousand 1 = MountainView 2 = OneMillion 3 = Vienna } // lldb-command:v padded_struct -// lldbg-check:[...] { a = 3 b = OneMillion c = 4 d = Toronto e = 5 } -// lldbr-check:(c_style_enum_in_composite::PaddedStruct) padded_struct = { a = 3 b = c_style_enum_in_composite::AnEnum::OneMillion c = 4 d = Toronto e = 5 } +// lldb-check:[...] { a = 3 b = OneMillion c = 4 d = Toronto e = 5 } // lldb-command:v packed_struct -// lldbg-check:[...] { a = 6 b = OneHundred c = 7 d = Vienna e = 8 } -// lldbr-check:(c_style_enum_in_composite::PackedStruct) packed_struct = { a = 6 b = c_style_enum_in_composite::AnEnum::OneHundred c = 7 d = Vienna e = 8 } +// lldb-check:[...] { a = 6 b = OneHundred c = 7 d = Vienna e = 8 } // lldb-command:v non_padded_struct -// lldbg-check:[...] { a = OneMillion b = MountainView c = OneThousand d = Toronto } -// lldbr-check:(c_style_enum_in_composite::NonPaddedStruct) non_padded_struct = { a = c_style_enum_in_composite::AnEnum::OneMillion, b = c_style_enum_in_composite::AnotherEnum::MountainView, c = c_style_enum_in_composite::AnEnum::OneThousand, d = c_style_enum_in_composite::AnotherEnum::Toronto } +// lldb-check:[...] { a = OneMillion b = MountainView c = OneThousand d = Toronto } // lldb-command:v struct_with_drop -// lldbg-check:[...] { 0 = { a = OneHundred b = Vienna } 1 = 9 } -// lldbr-check:((c_style_enum_in_composite::StructWithDrop, i64)) struct_with_drop = { 0 = { a = c_style_enum_in_composite::AnEnum::OneHundred b = c_style_enum_in_composite::AnotherEnum::Vienna } 1 = 9 } +// lldb-check:[...] { 0 = { a = OneHundred b = Vienna } 1 = 9 } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/c-style-enum.rs b/tests/debuginfo/c-style-enum.rs index 395b94c59a4..08378f7af18 100644 --- a/tests/debuginfo/c-style-enum.rs +++ b/tests/debuginfo/c-style-enum.rs @@ -1,95 +1,64 @@ //@ ignore-aarch64 -//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -//@ min-lldb-version: 310 //@ compile-flags:-g // === GDB TESTS =================================================================================== -// gdbg-command:print 'c_style_enum::SINGLE_VARIANT' -// gdbr-command:print c_style_enum::SINGLE_VARIANT -// gdbg-check:$1 = TheOnlyVariant -// gdbr-check:$1 = c_style_enum::SingleVariant::TheOnlyVariant - -// gdbg-command:print 'c_style_enum::AUTO_ONE' -// gdbr-command:print c_style_enum::AUTO_ONE -// gdbg-check:$2 = One -// gdbr-check:$2 = c_style_enum::AutoDiscriminant::One - -// gdbg-command:print 'c_style_enum::AUTO_TWO' -// gdbr-command:print c_style_enum::AUTO_TWO -// gdbg-check:$3 = One -// gdbr-check:$3 = c_style_enum::AutoDiscriminant::One - -// gdbg-command:print 'c_style_enum::AUTO_THREE' -// gdbr-command:print c_style_enum::AUTO_THREE -// gdbg-check:$4 = One -// gdbr-check:$4 = c_style_enum::AutoDiscriminant::One - -// gdbg-command:print 'c_style_enum::MANUAL_ONE' -// gdbr-command:print c_style_enum::MANUAL_ONE -// gdbg-check:$5 = OneHundred -// gdbr-check:$5 = c_style_enum::ManualDiscriminant::OneHundred - -// gdbg-command:print 'c_style_enum::MANUAL_TWO' -// gdbr-command:print c_style_enum::MANUAL_TWO -// gdbg-check:$6 = OneHundred -// gdbr-check:$6 = c_style_enum::ManualDiscriminant::OneHundred - -// gdbg-command:print 'c_style_enum::MANUAL_THREE' -// gdbr-command:print c_style_enum::MANUAL_THREE -// gdbg-check:$7 = OneHundred -// gdbr-check:$7 = c_style_enum::ManualDiscriminant::OneHundred +// gdb-command:print c_style_enum::SINGLE_VARIANT +// gdb-check:$1 = c_style_enum::SingleVariant::TheOnlyVariant + +// gdb-command:print c_style_enum::AUTO_ONE +// gdb-check:$2 = c_style_enum::AutoDiscriminant::One + +// gdb-command:print c_style_enum::AUTO_TWO +// gdb-check:$3 = c_style_enum::AutoDiscriminant::One + +// gdb-command:print c_style_enum::AUTO_THREE +// gdb-check:$4 = c_style_enum::AutoDiscriminant::One + +// gdb-command:print c_style_enum::MANUAL_ONE +// gdb-check:$5 = c_style_enum::ManualDiscriminant::OneHundred + +// gdb-command:print c_style_enum::MANUAL_TWO +// gdb-check:$6 = c_style_enum::ManualDiscriminant::OneHundred + +// gdb-command:print c_style_enum::MANUAL_THREE +// gdb-check:$7 = c_style_enum::ManualDiscriminant::OneHundred // gdb-command:run // gdb-command:print auto_one -// gdbg-check:$8 = One -// gdbr-check:$8 = c_style_enum::AutoDiscriminant::One +// gdb-check:$8 = c_style_enum::AutoDiscriminant::One // gdb-command:print auto_two -// gdbg-check:$9 = Two -// gdbr-check:$9 = c_style_enum::AutoDiscriminant::Two +// gdb-check:$9 = c_style_enum::AutoDiscriminant::Two // gdb-command:print auto_three -// gdbg-check:$10 = Three -// gdbr-check:$10 = c_style_enum::AutoDiscriminant::Three +// gdb-check:$10 = c_style_enum::AutoDiscriminant::Three // gdb-command:print manual_one_hundred -// gdbg-check:$11 = OneHundred -// gdbr-check:$11 = c_style_enum::ManualDiscriminant::OneHundred +// gdb-check:$11 = c_style_enum::ManualDiscriminant::OneHundred // gdb-command:print manual_one_thousand -// gdbg-check:$12 = OneThousand -// gdbr-check:$12 = c_style_enum::ManualDiscriminant::OneThousand +// gdb-check:$12 = c_style_enum::ManualDiscriminant::OneThousand // gdb-command:print manual_one_million -// gdbg-check:$13 = OneMillion -// gdbr-check:$13 = c_style_enum::ManualDiscriminant::OneMillion +// gdb-check:$13 = c_style_enum::ManualDiscriminant::OneMillion // gdb-command:print single_variant -// gdbg-check:$14 = TheOnlyVariant -// gdbr-check:$14 = c_style_enum::SingleVariant::TheOnlyVariant +// gdb-check:$14 = c_style_enum::SingleVariant::TheOnlyVariant -// gdbg-command:print 'c_style_enum::AUTO_TWO' -// gdbr-command:print AUTO_TWO -// gdbg-check:$15 = Two -// gdbr-check:$15 = c_style_enum::AutoDiscriminant::Two +// gdb-command:print AUTO_TWO +// gdb-check:$15 = c_style_enum::AutoDiscriminant::Two -// gdbg-command:print 'c_style_enum::AUTO_THREE' -// gdbr-command:print AUTO_THREE -// gdbg-check:$16 = Three -// gdbr-check:$16 = c_style_enum::AutoDiscriminant::Three +// gdb-command:print AUTO_THREE +// gdb-check:$16 = c_style_enum::AutoDiscriminant::Three -// gdbg-command:print 'c_style_enum::MANUAL_TWO' -// gdbr-command:print MANUAL_TWO -// gdbg-check:$17 = OneThousand -// gdbr-check:$17 = c_style_enum::ManualDiscriminant::OneThousand +// gdb-command:print MANUAL_TWO +// gdb-check:$17 = c_style_enum::ManualDiscriminant::OneThousand -// gdbg-command:print 'c_style_enum::MANUAL_THREE' -// gdbr-command:print MANUAL_THREE -// gdbg-check:$18 = OneMillion -// gdbr-check:$18 = c_style_enum::ManualDiscriminant::OneMillion +// gdb-command:print MANUAL_THREE +// gdb-check:$18 = c_style_enum::ManualDiscriminant::OneMillion // === LLDB TESTS ================================================================================== @@ -97,32 +66,25 @@ // lldb-command:run // lldb-command:v auto_one -// lldbg-check:[...] One -// lldbr-check:(c_style_enum::AutoDiscriminant) auto_one = c_style_enum::AutoDiscriminant::One +// lldb-check:[...] One // lldb-command:v auto_two -// lldbg-check:[...] Two -// lldbr-check:(c_style_enum::AutoDiscriminant) auto_two = c_style_enum::AutoDiscriminant::Two +// lldb-check:[...] Two // lldb-command:v auto_three -// lldbg-check:[...] Three -// lldbr-check:(c_style_enum::AutoDiscriminant) auto_three = c_style_enum::AutoDiscriminant::Three +// lldb-check:[...] Three // lldb-command:v manual_one_hundred -// lldbg-check:[...] OneHundred -// lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_hundred = c_style_enum::ManualDiscriminant::OneHundred +// lldb-check:[...] OneHundred // lldb-command:v manual_one_thousand -// lldbg-check:[...] OneThousand -// lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_thousand = c_style_enum::ManualDiscriminant::OneThousand +// lldb-check:[...] OneThousand // lldb-command:v manual_one_million -// lldbg-check:[...] OneMillion -// lldbr-check:(c_style_enum::ManualDiscriminant) manual_one_million = c_style_enum::ManualDiscriminant::OneMillion +// lldb-check:[...] OneMillion // lldb-command:v single_variant -// lldbg-check:[...] TheOnlyVariant -// lldbr-check:(c_style_enum::SingleVariant) single_variant = c_style_enum::SingleVariant::TheOnlyVariant +// lldb-check:[...] TheOnlyVariant #![allow(unused_variables)] #![allow(dead_code)] diff --git a/tests/debuginfo/captured-fields-1.rs b/tests/debuginfo/captured-fields-1.rs index d96f2590570..69ca3ecd812 100644 --- a/tests/debuginfo/captured-fields-1.rs +++ b/tests/debuginfo/captured-fields-1.rs @@ -4,44 +4,44 @@ // gdb-command:run // gdb-command:print test -// gdbr-check:$1 = captured_fields_1::main::{closure_env#0} {_ref__my_ref__my_field1: 0x[...]} +// gdb-check:$1 = captured_fields_1::main::{closure_env#0} {_ref__my_ref__my_field1: 0x[...]} // gdb-command:continue // gdb-command:print test -// gdbr-check:$2 = captured_fields_1::main::{closure_env#1} {_ref__my_ref__my_field2: 0x[...]} +// gdb-check:$2 = captured_fields_1::main::{closure_env#1} {_ref__my_ref__my_field2: 0x[...]} // gdb-command:continue // gdb-command:print test -// gdbr-check:$3 = captured_fields_1::main::{closure_env#2} {_ref__my_ref: 0x[...]} +// gdb-check:$3 = captured_fields_1::main::{closure_env#2} {_ref__my_ref: 0x[...]} // gdb-command:continue // gdb-command:print test -// gdbr-check:$4 = captured_fields_1::main::{closure_env#3} {my_ref: 0x[...]} +// gdb-check:$4 = captured_fields_1::main::{closure_env#3} {my_ref: 0x[...]} // gdb-command:continue // gdb-command:print test -// gdbr-check:$5 = captured_fields_1::main::{closure_env#4} {my_var__my_field2: 22} +// gdb-check:$5 = captured_fields_1::main::{closure_env#4} {my_var__my_field2: 22} // gdb-command:continue // gdb-command:print test -// gdbr-check:$6 = captured_fields_1::main::{closure_env#5} {my_var: captured_fields_1::MyStruct {my_field1: 11, my_field2: 22}} +// gdb-check:$6 = captured_fields_1::main::{closure_env#5} {my_var: captured_fields_1::MyStruct {my_field1: 11, my_field2: 22}} // gdb-command:continue // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v test -// lldbg-check:(captured_fields_1::main::{closure_env#0}) test = { _ref__my_ref__my_field1 = 0x[...] } +// lldb-check:(captured_fields_1::main::{closure_env#0}) test = { _ref__my_ref__my_field1 = 0x[...] } // lldb-command:continue // lldb-command:v test -// lldbg-check:(captured_fields_1::main::{closure_env#1}) test = { _ref__my_ref__my_field2 = 0x[...] } +// lldb-check:(captured_fields_1::main::{closure_env#1}) test = { _ref__my_ref__my_field2 = 0x[...] } // lldb-command:continue // lldb-command:v test -// lldbg-check:(captured_fields_1::main::{closure_env#2}) test = { _ref__my_ref = 0x[...] } +// lldb-check:(captured_fields_1::main::{closure_env#2}) test = { _ref__my_ref = 0x[...] } // lldb-command:continue // lldb-command:v test -// lldbg-check:(captured_fields_1::main::{closure_env#3}) test = { my_ref = 0x[...] } +// lldb-check:(captured_fields_1::main::{closure_env#3}) test = { my_ref = 0x[...] } // lldb-command:continue // lldb-command:v test -// lldbg-check:(captured_fields_1::main::{closure_env#4}) test = { my_var__my_field2 = 22 } +// lldb-check:(captured_fields_1::main::{closure_env#4}) test = { my_var__my_field2 = 22 } // lldb-command:continue // lldb-command:v test -// lldbg-check:(captured_fields_1::main::{closure_env#5}) test = { my_var = { my_field1 = 11 my_field2 = 22 } } +// lldb-check:(captured_fields_1::main::{closure_env#5}) test = { my_var = { my_field1 = 11 my_field2 = 22 } } // lldb-command:continue #![allow(unused)] diff --git a/tests/debuginfo/captured-fields-2.rs b/tests/debuginfo/captured-fields-2.rs index 446c5c70fef..24bff1d3f35 100644 --- a/tests/debuginfo/captured-fields-2.rs +++ b/tests/debuginfo/captured-fields-2.rs @@ -4,20 +4,20 @@ // gdb-command:run // gdb-command:print my_ref__my_field1 -// gdbr-check:$1 = 11 +// gdb-check:$1 = 11 // gdb-command:continue // gdb-command:print my_var__my_field2 -// gdbr-check:$2 = 22 +// gdb-check:$2 = 22 // gdb-command:continue // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v my_ref__my_field1 -// lldbg-check:(unsigned int) my_ref__my_field1 = 11 +// lldb-check:(unsigned int) my_ref__my_field1 = 11 // lldb-command:continue // lldb-command:v my_var__my_field2 -// lldbg-check:(unsigned int) my_var__my_field2 = 22 +// lldb-check:(unsigned int) my_var__my_field2 = 22 // lldb-command:continue #![allow(unused)] diff --git a/tests/debuginfo/closure-in-generic-function.rs b/tests/debuginfo/closure-in-generic-function.rs index ef0f2b0b464..0c6a6fdfca1 100644 --- a/tests/debuginfo/closure-in-generic-function.rs +++ b/tests/debuginfo/closure-in-generic-function.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -24,19 +22,15 @@ // lldb-command:run // lldb-command:v x -// lldbg-check:[...] 0.5 -// lldbr-check:(f64) x = 0.5 +// lldb-check:[...] 0.5 // lldb-command:v y -// lldbg-check:[...] 10 -// lldbr-check:(i32) y = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v *x -// lldbg-check:[...] 29 -// lldbr-check:(i32) *x = 29 +// lldb-check:[...] 29 // lldb-command:v *y -// lldbg-check:[...] 110 -// lldbr-check:(i32) *y = 110 +// lldb-check:[...] 110 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/constant-debug-locs.rs b/tests/debuginfo/constant-debug-locs.rs index d834d990985..81115fc3c38 100644 --- a/tests/debuginfo/constant-debug-locs.rs +++ b/tests/debuginfo/constant-debug-locs.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g #![allow(dead_code, unused_variables)] diff --git a/tests/debuginfo/constant-in-match-pattern.rs b/tests/debuginfo/constant-in-match-pattern.rs index f34284be164..952db216deb 100644 --- a/tests/debuginfo/constant-in-match-pattern.rs +++ b/tests/debuginfo/constant-in-match-pattern.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g #![allow(dead_code, unused_variables)] diff --git a/tests/debuginfo/coroutine-locals.rs b/tests/debuginfo/coroutine-locals.rs index c019998040b..f3593adc945 100644 --- a/tests/debuginfo/coroutine-locals.rs +++ b/tests/debuginfo/coroutine-locals.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/coroutine-objects.rs b/tests/debuginfo/coroutine-objects.rs index 746b7e40eda..242c76c2989 100644 --- a/tests/debuginfo/coroutine-objects.rs +++ b/tests/debuginfo/coroutine-objects.rs @@ -1,5 +1,3 @@ -// Require a gdb that can read DW_TAG_variant_part. -//@ min-gdb-version: 8.2 //@ min-lldb-version: 1800 // LLDB (18.1+) now supports DW_TAG_variant_part, but there is some bug in either compiler or LLDB diff --git a/tests/debuginfo/cross-crate-spans.rs b/tests/debuginfo/cross-crate-spans.rs index cf3f8e1eadf..e337aaf5a6c 100644 --- a/tests/debuginfo/cross-crate-spans.rs +++ b/tests/debuginfo/cross-crate-spans.rs @@ -1,12 +1,6 @@ #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] -//@ min-lldb-version: 310 - -// This fails on lldb 6.0.1 on x86-64 Fedora 28; so mark it macOS-only -// for now. -//@ only-macos - //@ aux-build:cross_crate_spans.rs extern crate cross_crate_spans; @@ -19,8 +13,7 @@ extern crate cross_crate_spans; // gdb-command:run // gdb-command:print result -// gdbg-check:$1 = {__0 = 17, __1 = 17} -// gdbr-check:$1 = (17, 17) +// gdb-check:$1 = (17, 17) // gdb-command:print a_variable // gdb-check:$2 = 123456789 // gdb-command:print another_variable @@ -28,8 +21,7 @@ extern crate cross_crate_spans; // gdb-command:continue // gdb-command:print result -// gdbg-check:$4 = {__0 = 1212, __1 = 1212} -// gdbr-check:$4 = (1212, 1212) +// gdb-check:$4 = (1212, 1212) // gdb-command:print a_variable // gdb-check:$5 = 123456789 // gdb-command:print another_variable @@ -44,25 +36,19 @@ extern crate cross_crate_spans; // lldb-command:run // lldb-command:v result -// lldbg-check:[...] { 0 = 17 1 = 17 } -// lldbr-check:((u32, u32)) result = { 0 = 17 1 = 17 } +// lldb-check:[...] { 0 = 17 1 = 17 } // lldb-command:v a_variable -// lldbg-check:[...] 123456789 -// lldbr-check:(u32) a_variable = 123456789 +// lldb-check:[...] 123456789 // lldb-command:v another_variable -// lldbg-check:[...] 123456789.5 -// lldbr-check:(f64) another_variable = 123456789.5 +// lldb-check:[...] 123456789.5 // lldb-command:continue // lldb-command:v result -// lldbg-check:[...] { 0 = 1212 1 = 1212 } -// lldbr-check:((i16, i16)) result = { 0 = 1212 1 = 1212 } +// lldb-check:[...] { 0 = 1212 1 = 1212 } // lldb-command:v a_variable -// lldbg-check:[...] 123456789 -// lldbr-check:(u32) a_variable = 123456789 +// lldb-check:[...] 123456789 // lldb-command:v another_variable -// lldbg-check:[...] 123456789.5 -// lldbr-check:(f64) another_variable = 123456789.5 +// lldb-check:[...] 123456789.5 // lldb-command:continue diff --git a/tests/debuginfo/cross-crate-type-uniquing.rs b/tests/debuginfo/cross-crate-type-uniquing.rs index 88f8bac5d6f..28ebc343884 100644 --- a/tests/debuginfo/cross-crate-type-uniquing.rs +++ b/tests/debuginfo/cross-crate-type-uniquing.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ aux-build:cross_crate_debuginfo_type_uniquing.rs extern crate cross_crate_debuginfo_type_uniquing; diff --git a/tests/debuginfo/destructured-fn-argument.rs b/tests/debuginfo/destructured-fn-argument.rs index 74e18a594d7..37a7bb2b778 100644 --- a/tests/debuginfo/destructured-fn-argument.rs +++ b/tests/debuginfo/destructured-fn-argument.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -23,15 +21,13 @@ // gdb-command:print a // gdb-check:$6 = 5 // gdb-command:print b -// gdbg-check:$7 = {__0 = 6, __1 = 7} -// gdbr-check:$7 = (6, 7) +// gdb-check:$7 = (6, 7) // gdb-command:continue // gdb-command:print h // gdb-check:$8 = 8 // gdb-command:print i -// gdbg-check:$9 = {a = 9, b = 10} -// gdbr-check:$9 = destructured_fn_argument::Struct {a: 9, b: 10} +// gdb-check:$9 = destructured_fn_argument::Struct {a: 9, b: 10} // gdb-command:print j // gdb-check:$10 = 11 // gdb-command:continue @@ -57,8 +53,7 @@ // gdb-command:print q // gdb-check:$17 = 20 // gdb-command:print r -// gdbg-check:$18 = {a = 21, b = 22} -// gdbr-check:$18 = destructured_fn_argument::Struct {a: 21, b: 22} +// gdb-check:$18 = destructured_fn_argument::Struct {a: 21, b: 22} // gdb-command:continue // gdb-command:print s @@ -88,13 +83,11 @@ // gdb-command:continue // gdb-command:print aa -// gdbg-check:$30 = {__0 = 34, __1 = 35} -// gdbr-check:$30 = (34, 35) +// gdb-check:$30 = (34, 35) // gdb-command:continue // gdb-command:print bb -// gdbg-check:$31 = {__0 = 36, __1 = 37} -// gdbr-check:$31 = (36, 37) +// gdb-check:$31 = (36, 37) // gdb-command:continue // gdb-command:print cc @@ -102,20 +95,17 @@ // gdb-command:continue // gdb-command:print dd -// gdbg-check:$33 = {__0 = 40, __1 = 41, __2 = 42} -// gdbr-check:$33 = (40, 41, 42) +// gdb-check:$33 = (40, 41, 42) // gdb-command:continue // gdb-command:print *ee -// gdbg-check:$34 = {__0 = 43, __1 = 44, __2 = 45} -// gdbr-check:$34 = (43, 44, 45) +// gdb-check:$34 = (43, 44, 45) // gdb-command:continue // gdb-command:print *ff // gdb-check:$35 = 46 // gdb-command:print gg -// gdbg-check:$36 = {__0 = 47, __1 = 48} -// gdbr-check:$36 = (47, 48) +// gdb-check:$36 = (47, 48) // gdb-command:continue // gdb-command:print *hh @@ -164,196 +154,147 @@ // lldb-command:run // lldb-command:v a -// lldbg-check:[...] 1 -// lldbr-check:(isize) a = 1 +// lldb-check:[...] 1 // lldb-command:v b -// lldbg-check:[...] false -// lldbr-check:(bool) b = false +// lldb-check:[...] false // lldb-command:continue // lldb-command:v a -// lldbg-check:[...] 2 -// lldbr-check:(isize) a = 2 +// lldb-check:[...] 2 // lldb-command:v b -// lldbg-check:[...] 3 -// lldbr-check:(u16) b = 3 +// lldb-check:[...] 3 // lldb-command:v c -// lldbg-check:[...] 4 -// lldbr-check:(u16) c = 4 +// lldb-check:[...] 4 // lldb-command:continue // lldb-command:v a -// lldbg-check:[...] 5 -// lldbr-check:(isize) a = 5 +// lldb-check:[...] 5 // lldb-command:v b -// lldbg-check:[...] { 0 = 6 1 = 7 } -// lldbr-check:((u32, u32)) b = { 0 = 6 1 = 7 } +// lldb-check:[...] { 0 = 6 1 = 7 } // lldb-command:continue // lldb-command:v h -// lldbg-check:[...] 8 -// lldbr-check:(i16) h = 8 +// lldb-check:[...] 8 // lldb-command:v i -// lldbg-check:[...] { a = 9 b = 10 } -// lldbr-check:(destructured_fn_argument::Struct) i = { a = 9 b = 10 } +// lldb-check:[...] { a = 9 b = 10 } // lldb-command:v j -// lldbg-check:[...] 11 -// lldbr-check:(i16) j = 11 +// lldb-check:[...] 11 // lldb-command:continue // lldb-command:v k -// lldbg-check:[...] 12 -// lldbr-check:(i64) k = 12 +// lldb-check:[...] 12 // lldb-command:v l -// lldbg-check:[...] 13 -// lldbr-check:(i32) l = 13 +// lldb-check:[...] 13 // lldb-command:continue // lldb-command:v m -// lldbg-check:[...] 14 -// lldbr-check:(isize) m = 14 +// lldb-check:[...] 14 // lldb-command:v n -// lldbg-check:[...] 16 -// lldbr-check:(i32) n = 16 +// lldb-check:[...] 16 // lldb-command:continue // lldb-command:v o -// lldbg-check:[...] 18 -// lldbr-check:(i32) o = 18 +// lldb-check:[...] 18 // lldb-command:continue // lldb-command:v p -// lldbg-check:[...] 19 -// lldbr-check:(i64) p = 19 +// lldb-check:[...] 19 // lldb-command:v q -// lldbg-check:[...] 20 -// lldbr-check:(i32) q = 20 +// lldb-check:[...] 20 // lldb-command:v r -// lldbg-check:[...] { a = 21 b = 22 } -// lldbr-check:(destructured_fn_argument::Struct) r = { a = 21, b = 22 } +// lldb-check:[...] { a = 21 b = 22 } // lldb-command:continue // lldb-command:v s -// lldbg-check:[...] 24 -// lldbr-check:(i32) s = 24 +// lldb-check:[...] 24 // lldb-command:v t -// lldbg-check:[...] 23 -// lldbr-check:(i64) t = 23 +// lldb-check:[...] 23 // lldb-command:continue // lldb-command:v u -// lldbg-check:[...] 25 -// lldbr-check:(i16) u = 25 +// lldb-check:[...] 25 // lldb-command:v v -// lldbg-check:[...] 26 -// lldbr-check:(i32) v = 26 +// lldb-check:[...] 26 // lldb-command:v w -// lldbg-check:[...] 27 -// lldbr-check:(i64) w = 27 +// lldb-check:[...] 27 // lldb-command:v x -// lldbg-check:[...] 28 -// lldbr-check:(i32) x = 28 +// lldb-check:[...] 28 // lldb-command:v y -// lldbg-check:[...] 29 -// lldbr-check:(i64) y = 29 +// lldb-check:[...] 29 // lldb-command:v z -// lldbg-check:[...] 30 -// lldbr-check:(i32) z = 30 +// lldb-check:[...] 30 // lldb-command:v ae -// lldbg-check:[...] 31 -// lldbr-check:(i64) ae = 31 +// lldb-check:[...] 31 // lldb-command:v oe -// lldbg-check:[...] 32 -// lldbr-check:(i32) oe = 32 +// lldb-check:[...] 32 // lldb-command:v ue -// lldbg-check:[...] 33 -// lldbr-check:(u16) ue = 33 +// lldb-check:[...] 33 // lldb-command:continue // lldb-command:v aa -// lldbg-check:[...] { 0 = 34 1 = 35 } -// lldbr-check:((isize, isize)) aa = { 0 = 34 1 = 35 } +// lldb-check:[...] { 0 = 34 1 = 35 } // lldb-command:continue // lldb-command:v bb -// lldbg-check:[...] { 0 = 36 1 = 37 } -// lldbr-check:((isize, isize)) bb = { 0 = 36 1 = 37 } +// lldb-check:[...] { 0 = 36 1 = 37 } // lldb-command:continue // lldb-command:v cc -// lldbg-check:[...] 38 -// lldbr-check:(isize) cc = 38 +// lldb-check:[...] 38 // lldb-command:continue // lldb-command:v dd -// lldbg-check:[...] { 0 = 40 1 = 41 2 = 42 } -// lldbr-check:((isize, isize, isize)) dd = { 0 = 40 1 = 41 2 = 42 } +// lldb-check:[...] { 0 = 40 1 = 41 2 = 42 } // lldb-command:continue // lldb-command:v *ee -// lldbg-check:[...] { 0 = 43 1 = 44 2 = 45 } -// lldbr-check:((isize, isize, isize)) *ee = { 0 = 43 1 = 44 2 = 45 } +// lldb-check:[...] { 0 = 43 1 = 44 2 = 45 } // lldb-command:continue // lldb-command:v *ff -// lldbg-check:[...] 46 -// lldbr-check:(isize) *ff = 46 +// lldb-check:[...] 46 // lldb-command:v gg -// lldbg-check:[...] { 0 = 47 1 = 48 } -// lldbr-check:((isize, isize)) gg = { 0 = 47 1 = 48 } +// lldb-check:[...] { 0 = 47 1 = 48 } // lldb-command:continue // lldb-command:v *hh -// lldbg-check:[...] 50 -// lldbr-check:(i32) *hh = 50 +// lldb-check:[...] 50 // lldb-command:continue // lldb-command:v ii -// lldbg-check:[...] 51 -// lldbr-check:(i32) ii = 51 +// lldb-check:[...] 51 // lldb-command:continue // lldb-command:v *jj -// lldbg-check:[...] 52 -// lldbr-check:(i32) *jj = 52 +// lldb-check:[...] 52 // lldb-command:continue // lldb-command:v kk -// lldbg-check:[...] 53 -// lldbr-check:(f64) kk = 53 +// lldb-check:[...] 53 // lldb-command:v ll -// lldbg-check:[...] 54 -// lldbr-check:(isize) ll = 54 +// lldb-check:[...] 54 // lldb-command:continue // lldb-command:v mm -// lldbg-check:[...] 55 -// lldbr-check:(f64) mm = 55 +// lldb-check:[...] 55 // lldb-command:v *nn -// lldbg-check:[...] 56 -// lldbr-check:(isize) *nn = 56 +// lldb-check:[...] 56 // lldb-command:continue // lldb-command:v oo -// lldbg-check:[...] 57 -// lldbr-check:(isize) oo = 57 +// lldb-check:[...] 57 // lldb-command:v pp -// lldbg-check:[...] 58 -// lldbr-check:(isize) pp = 58 +// lldb-check:[...] 58 // lldb-command:v qq -// lldbg-check:[...] 59 -// lldbr-check:(isize) qq = 59 +// lldb-check:[...] 59 // lldb-command:continue // lldb-command:v rr -// lldbg-check:[...] 60 -// lldbr-check:(isize) rr = 60 +// lldb-check:[...] 60 // lldb-command:v ss -// lldbg-check:[...] 61 -// lldbr-check:(isize) ss = 61 +// lldb-check:[...] 61 // lldb-command:v tt -// lldbg-check:[...] 62 -// lldbr-check:(isize) tt = 62 +// lldb-check:[...] 62 // lldb-command:continue #![allow(unused_variables)] diff --git a/tests/debuginfo/destructured-for-loop-variable.rs b/tests/debuginfo/destructured-for-loop-variable.rs index 1cad8bcfacb..cc16be1268a 100644 --- a/tests/debuginfo/destructured-for-loop-variable.rs +++ b/tests/debuginfo/destructured-for-loop-variable.rs @@ -1,9 +1,3 @@ -//@ min-lldb-version: 310 - -// This fails on lldb 6.0.1 on x86-64 Fedora 28; so mark it macOS-only -// for now. -//@ only-macos - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -67,13 +61,11 @@ // gdb-command:continue // gdb-command:print simple_struct_ident -// gdbg-check:$23 = {x = 3537, y = 35437.5, z = true} -// gdbr-check:$23 = destructured_for_loop_variable::Struct {x: 3537, y: 35437.5, z: true} +// gdb-check:$23 = destructured_for_loop_variable::Struct {x: 3537, y: 35437.5, z: true} // gdb-command:continue // gdb-command:print simple_tuple_ident -// gdbg-check:$24 = {__0 = 34903493, __1 = 232323} -// gdbr-check:$24 = (34903493, 232323) +// gdb-check:$24 = (34903493, 232323) // gdb-command:continue // === LLDB TESTS ================================================================================== @@ -85,90 +77,66 @@ // DESTRUCTURED STRUCT // lldb-command:v x -// lldbg-check:[...] 400 -// lldbr-check:(i16) x = 400 +// lldb-check:[...] 400 // lldb-command:v y -// lldbg-check:[...] 401.5 -// lldbr-check:(f32) y = 401.5 +// lldb-check:[...] 401.5 // lldb-command:v z -// lldbg-check:[...] true -// lldbr-check:(bool) z = true +// lldb-check:[...] true // lldb-command:continue // DESTRUCTURED TUPLE // lldb-command:v _i8 -// lldbg-check:[...] 0x6f -// lldbr-check:(i8) _i8 = 111 +// lldb-check:[...] 0x6f // lldb-command:v _u8 -// lldbg-check:[...] 0x70 -// lldbr-check:(u8) _u8 = 112 +// lldb-check:[...] 0x70 // lldb-command:v _i16 -// lldbg-check:[...] -113 -// lldbr-check:(i16) _i16 = -113 +// lldb-check:[...] -113 // lldb-command:v _u16 -// lldbg-check:[...] 114 -// lldbr-check:(u16) _u16 = 114 +// lldb-check:[...] 114 // lldb-command:v _i32 -// lldbg-check:[...] -115 -// lldbr-check:(i32) _i32 = -115 +// lldb-check:[...] -115 // lldb-command:v _u32 -// lldbg-check:[...] 116 -// lldbr-check:(u32) _u32 = 116 +// lldb-check:[...] 116 // lldb-command:v _i64 -// lldbg-check:[...] -117 -// lldbr-check:(i64) _i64 = -117 +// lldb-check:[...] -117 // lldb-command:v _u64 -// lldbg-check:[...] 118 -// lldbr-check:(u64) _u64 = 118 +// lldb-check:[...] 118 // lldb-command:v _f32 -// lldbg-check:[...] 119.5 -// lldbr-check:(f32) _f32 = 119.5 +// lldb-check:[...] 119.5 // lldb-command:v _f64 -// lldbg-check:[...] 120.5 -// lldbr-check:(f64) _f64 = 120.5 +// lldb-check:[...] 120.5 // lldb-command:continue // MORE COMPLEX CASE // lldb-command:v v1 -// lldbg-check:[...] 80000 -// lldbr-check:(i32) v1 = 80000 +// lldb-check:[...] 80000 // lldb-command:v x1 -// lldbg-check:[...] 8000 -// lldbr-check:(i16) x1 = 8000 +// lldb-check:[...] 8000 // lldb-command:v *y1 -// lldbg-check:[...] 80001.5 -// lldbr-check:(f32) *y1 = 80001.5 +// lldb-check:[...] 80001.5 // lldb-command:v z1 -// lldbg-check:[...] false -// lldbr-check:(bool) z1 = false +// lldb-check:[...] false // lldb-command:v *x2 -// lldbg-check:[...] -30000 -// lldbr-check:(i16) *x2 = -30000 +// lldb-check:[...] -30000 // lldb-command:v y2 -// lldbg-check:[...] -300001.5 -// lldbr-check:(f32) y2 = -300001.5 +// lldb-check:[...] -300001.5 // lldb-command:v *z2 -// lldbg-check:[...] true -// lldbr-check:(bool) *z2 = true +// lldb-check:[...] true // lldb-command:v v2 -// lldbg-check:[...] 854237.5 -// lldbr-check:(f64) v2 = 854237.5 +// lldb-check:[...] 854237.5 // lldb-command:continue // SIMPLE IDENTIFIER // lldb-command:v i -// lldbg-check:[...] 1234 -// lldbr-check:(i32) i = 1234 +// lldb-check:[...] 1234 // lldb-command:continue // lldb-command:v simple_struct_ident -// lldbg-check:[...] { x = 3537 y = 35437.5 z = true } -// lldbr-check:(destructured_for_loop_variable::Struct) simple_struct_ident = { x = 3537 y = 35437.5 z = true } +// lldb-check:[...] { x = 3537 y = 35437.5 z = true } // lldb-command:continue // lldb-command:v simple_tuple_ident -// lldbg-check:[...] { 0 = 34903493 1 = 232323 } -// lldbr-check:((u32, i64)) simple_tuple_ident = { 0 = 34903493 1 = 232323 } +// lldb-check:[...] { 0 = 34903493 1 = 232323 } // lldb-command:continue #![allow(unused_variables)] diff --git a/tests/debuginfo/destructured-local.rs b/tests/debuginfo/destructured-local.rs index 8d62fe5db03..fad96ca7d4b 100644 --- a/tests/debuginfo/destructured-local.rs +++ b/tests/debuginfo/destructured-local.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -21,14 +19,12 @@ // gdb-command:print f // gdb-check:$6 = 5 // gdb-command:print g -// gdbg-check:$7 = {__0 = 6, __1 = 7} -// gdbr-check:$7 = (6, 7) +// gdb-check:$7 = (6, 7) // gdb-command:print h // gdb-check:$8 = 8 // gdb-command:print i -// gdbg-check:$9 = {a = 9, b = 10} -// gdbr-check:$9 = destructured_local::Struct {a: 9, b: 10} +// gdb-check:$9 = destructured_local::Struct {a: 9, b: 10} // gdb-command:print j // gdb-check:$10 = 11 @@ -50,8 +46,7 @@ // gdb-command:print q // gdb-check:$17 = 20 // gdb-command:print r -// gdbg-check:$18 = {a = 21, b = 22} -// gdbr-check:$18 = destructured_local::Struct {a: 21, b: 22} +// gdb-check:$18 = destructured_local::Struct {a: 21, b: 22} // gdb-command:print s // gdb-check:$19 = 24 @@ -78,30 +73,25 @@ // gdb-check:$29 = 33 // gdb-command:print aa -// gdbg-check:$30 = {__0 = 34, __1 = 35} -// gdbr-check:$30 = (34, 35) +// gdb-check:$30 = (34, 35) // gdb-command:print bb -// gdbg-check:$31 = {__0 = 36, __1 = 37} -// gdbr-check:$31 = (36, 37) +// gdb-check:$31 = (36, 37) // gdb-command:print cc // gdb-check:$32 = 38 // gdb-command:print dd -// gdbg-check:$33 = {__0 = 40, __1 = 41, __2 = 42} -// gdbr-check:$33 = (40, 41, 42) +// gdb-check:$33 = (40, 41, 42) // gdb-command:print *ee -// gdbg-check:$34 = {__0 = 43, __1 = 44, __2 = 45} -// gdbr-check:$34 = (43, 44, 45) +// gdb-check:$34 = (43, 44, 45) // gdb-command:print *ff // gdb-check:$35 = 46 // gdb-command:print gg -// gdbg-check:$36 = {__0 = 47, __1 = 48} -// gdbr-check:$36 = (47, 48) +// gdb-check:$36 = (47, 48) // gdb-command:print *hh // gdb-check:$37 = 50 @@ -130,157 +120,114 @@ // lldb-command:run // lldb-command:v a -// lldbg-check:[...] 1 -// lldbr-check:(isize) a = 1 +// lldb-check:[...] 1 // lldb-command:v b -// lldbg-check:[...] false -// lldbr-check:(bool) b = false +// lldb-check:[...] false // lldb-command:v c -// lldbg-check:[...] 2 -// lldbr-check:(isize) c = 2 +// lldb-check:[...] 2 // lldb-command:v d -// lldbg-check:[...] 3 -// lldbr-check:(u16) d = 3 +// lldb-check:[...] 3 // lldb-command:v e -// lldbg-check:[...] 4 -// lldbr-check:(u16) e = 4 +// lldb-check:[...] 4 // lldb-command:v f -// lldbg-check:[...] 5 -// lldbr-check:(isize) f = 5 +// lldb-check:[...] 5 // lldb-command:v g -// lldbg-check:[...] { 0 = 6 1 = 7 } -// lldbr-check:((u32, u32)) g = { 0 = 6 1 = 7 } +// lldb-check:[...] { 0 = 6 1 = 7 } // lldb-command:v h -// lldbg-check:[...] 8 -// lldbr-check:(i16) h = 8 +// lldb-check:[...] 8 // lldb-command:v i -// lldbg-check:[...] { a = 9 b = 10 } -// lldbr-check:(destructured_local::Struct) i = { a = 9 b = 10 } +// lldb-check:[...] { a = 9 b = 10 } // lldb-command:v j -// lldbg-check:[...] 11 -// lldbr-check:(i16) j = 11 +// lldb-check:[...] 11 // lldb-command:v k -// lldbg-check:[...] 12 -// lldbr-check:(i64) k = 12 +// lldb-check:[...] 12 // lldb-command:v l -// lldbg-check:[...] 13 -// lldbr-check:(i32) l = 13 +// lldb-check:[...] 13 // lldb-command:v m -// lldbg-check:[...] 14 -// lldbr-check:(i32) m = 14 +// lldb-check:[...] 14 // lldb-command:v n -// lldbg-check:[...] 16 -// lldbr-check:(i32) n = 16 +// lldb-check:[...] 16 // lldb-command:v o -// lldbg-check:[...] 18 -// lldbr-check:(i32) o = 18 +// lldb-check:[...] 18 // lldb-command:v p -// lldbg-check:[...] 19 -// lldbr-check:(i64) p = 19 +// lldb-check:[...] 19 // lldb-command:v q -// lldbg-check:[...] 20 -// lldbr-check:(i32) q = 20 +// lldb-check:[...] 20 // lldb-command:v r -// lldbg-check:[...] { a = 21 b = 22 } -// lldbr-check:(destructured_local::Struct) r = { a = 21 b = 22 } +// lldb-check:[...] { a = 21 b = 22 } // lldb-command:v s -// lldbg-check:[...] 24 -// lldbr-check:(i32) s = 24 +// lldb-check:[...] 24 // lldb-command:v t -// lldbg-check:[...] 23 -// lldbr-check:(i64) t = 23 +// lldb-check:[...] 23 // lldb-command:v u -// lldbg-check:[...] 25 -// lldbr-check:(i32) u = 25 +// lldb-check:[...] 25 // lldb-command:v v -// lldbg-check:[...] 26 -// lldbr-check:(i32) v = 26 +// lldb-check:[...] 26 // lldb-command:v w -// lldbg-check:[...] 27 -// lldbr-check:(i32) w = 27 +// lldb-check:[...] 27 // lldb-command:v x -// lldbg-check:[...] 28 -// lldbr-check:(i32) x = 28 +// lldb-check:[...] 28 // lldb-command:v y -// lldbg-check:[...] 29 -// lldbr-check:(i64) y = 29 +// lldb-check:[...] 29 // lldb-command:v z -// lldbg-check:[...] 30 -// lldbr-check:(i32) z = 30 +// lldb-check:[...] 30 // lldb-command:v ae -// lldbg-check:[...] 31 -// lldbr-check:(i64) ae = 31 +// lldb-check:[...] 31 // lldb-command:v oe -// lldbg-check:[...] 32 -// lldbr-check:(i32) oe = 32 +// lldb-check:[...] 32 // lldb-command:v ue -// lldbg-check:[...] 33 -// lldbr-check:(i32) ue = 33 +// lldb-check:[...] 33 // lldb-command:v aa -// lldbg-check:[...] { 0 = 34 1 = 35 } -// lldbr-check:((i32, i32)) aa = { 0 = 34 1 = 35 } +// lldb-check:[...] { 0 = 34 1 = 35 } // lldb-command:v bb -// lldbg-check:[...] { 0 = 36 1 = 37 } -// lldbr-check:((i32, i32)) bb = { 0 = 36 1 = 37 } +// lldb-check:[...] { 0 = 36 1 = 37 } // lldb-command:v cc -// lldbg-check:[...] 38 -// lldbr-check:(i32) cc = 38 +// lldb-check:[...] 38 // lldb-command:v dd -// lldbg-check:[...] { 0 = 40 1 = 41 2 = 42 } -// lldbr-check:((i32, i32, i32)) dd = { 0 = 40 1 = 41 2 = 42} +// lldb-check:[...] { 0 = 40 1 = 41 2 = 42 } // lldb-command:v *ee -// lldbg-check:[...] { 0 = 43 1 = 44 2 = 45 } -// lldbr-check:((i32, i32, i32)) *ee = { 0 = 43 1 = 44 2 = 45} +// lldb-check:[...] { 0 = 43 1 = 44 2 = 45 } // lldb-command:v *ff -// lldbg-check:[...] 46 -// lldbr-check:(i32) *ff = 46 +// lldb-check:[...] 46 // lldb-command:v gg -// lldbg-check:[...] { 0 = 47 1 = 48 } -// lldbr-check:((i32, i32)) gg = { 0 = 47 1 = 48 } +// lldb-check:[...] { 0 = 47 1 = 48 } // lldb-command:v *hh -// lldbg-check:[...] 50 -// lldbr-check:(i32) *hh = 50 +// lldb-check:[...] 50 // lldb-command:v ii -// lldbg-check:[...] 51 -// lldbr-check:(i32) ii = 51 +// lldb-check:[...] 51 // lldb-command:v *jj -// lldbg-check:[...] 52 -// lldbr-check:(i32) *jj = 52 +// lldb-check:[...] 52 // lldb-command:v kk -// lldbg-check:[...] 53 -// lldbr-check:(f64) kk = 53 +// lldb-check:[...] 53 // lldb-command:v ll -// lldbg-check:[...] 54 -// lldbr-check:(isize) ll = 54 +// lldb-check:[...] 54 // lldb-command:v mm -// lldbg-check:[...] 55 -// lldbr-check:(f64) mm = 55 +// lldb-check:[...] 55 // lldb-command:v *nn -// lldbg-check:[...] 56 -// lldbr-check:(isize) *nn = 56 +// lldb-check:[...] 56 #![allow(unused_variables)] diff --git a/tests/debuginfo/drop-locations.rs b/tests/debuginfo/drop-locations.rs index 15b2d0de7fe..a55cf7b50a8 100644 --- a/tests/debuginfo/drop-locations.rs +++ b/tests/debuginfo/drop-locations.rs @@ -1,12 +1,9 @@ -//@ ignore-windows //@ ignore-android -//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -//@ min-lldb-version: 310 +//@ ignore-test: #128971 #![allow(unused)] -//@ compile-flags:-g -O -C no-prepopulate-passes -// -O -C no-prepopulate-passes added to work around https://bugs.llvm.org/show_bug.cgi?id=32123 +//@ compile-flags:-g // This test checks that drop glue code gets attributed to scope's closing brace, // and function epilogues - to function's closing brace. diff --git a/tests/debuginfo/dummy_span.rs b/tests/debuginfo/dummy_span.rs new file mode 100644 index 00000000000..d02eead470f --- /dev/null +++ b/tests/debuginfo/dummy_span.rs @@ -0,0 +1,45 @@ +//@ min-lldb-version: 310 + +//@ compile-flags:-g + +// === GDB TESTS =================================================================================== + +// gdb-command:run 7 + +// gdb-command:next +// gdb-command:next +// gdb-check:[...]#loc1[...] +// gdb-command:next +// gdb-check:[...]#loc2[...] + +// === LLDB TESTS ================================================================================== + +// lldb-command:run 7 + +// lldb-command:next +// lldb-command:next +// lldb-command:frame select +// lldb-check:[...]#loc1[...] +// lldb-command:next +// lldb-command:frame select +// lldb-check:[...]#loc2[...] + +use std::env; +use std::num::ParseIntError; + +fn main() -> Result<(), ParseIntError> { + let args = env::args(); + let number_str = args.skip(1).next().unwrap(); + let number = number_str.parse::<i32>()?; + zzz(); // #break + if number % 7 == 0 { + // This generates code with a dummy span for + // some reason. If that ever changes this + // test will not test what it wants to test. + return Ok(()); // #loc1 + } + println!("{}", number); + Ok(()) +} // #loc2 + +fn zzz() { () } diff --git a/tests/debuginfo/embedded-visualizer.rs b/tests/debuginfo/embedded-visualizer.rs index 69afd273f77..cbd8691394d 100644 --- a/tests/debuginfo/embedded-visualizer.rs +++ b/tests/debuginfo/embedded-visualizer.rs @@ -1,7 +1,6 @@ //@ compile-flags:-g -//@ min-gdb-version: 8.1 //@ ignore-lldb -//@ ignore-windows-gnu // emit_debug_gdb_scripts is disabled on Windows +//@ ignore-windows-gnu: #128981 // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/empty-string.rs b/tests/debuginfo/empty-string.rs index 35b68ed91c0..014465c27ca 100644 --- a/tests/debuginfo/empty-string.rs +++ b/tests/debuginfo/empty-string.rs @@ -1,9 +1,6 @@ -//@ ignore-windows failing on win32 bot +//@ ignore-windows-gnu: #128981 //@ ignore-android: FIXME(#10381) //@ compile-flags:-g -//@ min-gdb-version: 8.1 -//@ ignore-gdb-version: 7.11.90 - 8.0.9 -//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/enum-thinlto.rs b/tests/debuginfo/enum-thinlto.rs index 42a0d1e28f8..af77145c312 100644 --- a/tests/debuginfo/enum-thinlto.rs +++ b/tests/debuginfo/enum-thinlto.rs @@ -1,5 +1,3 @@ -// Require a gdb that can read DW_TAG_variant_part. -//@ min-gdb-version: 8.2 //@ min-lldb-version: 1800 //@ compile-flags:-g -Z thinlto @@ -8,15 +6,14 @@ // gdb-command:run // gdb-command:print *abc -// gdbr-check:$1 = enum_thinlto::ABC::TheA{x: 0, y: 8970181431921507452} +// gdb-check:$1 = enum_thinlto::ABC::TheA{x: 0, y: 8970181431921507452} // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v *abc -// lldbg-check:(enum_thinlto::ABC) *abc = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } -// lldbr-check:(enum_thinlto::ABC) *abc = (x = 0, y = 8970181431921507452) +// lldb-check:(enum_thinlto::ABC) *abc = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/evec-in-struct.rs b/tests/debuginfo/evec-in-struct.rs index 2283e96c0ad..303669cf06c 100644 --- a/tests/debuginfo/evec-in-struct.rs +++ b/tests/debuginfo/evec-in-struct.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -7,23 +5,18 @@ // gdb-command:run // gdb-command:print no_padding1 -// gdbg-check:$1 = {x = {0, 1, 2}, y = -3, z = {4.5, 5.5}} -// gdbr-check:$1 = evec_in_struct::NoPadding1 {x: [0, 1, 2], y: -3, z: [4.5, 5.5]} +// gdb-check:$1 = evec_in_struct::NoPadding1 {x: [0, 1, 2], y: -3, z: [4.5, 5.5]} // gdb-command:print no_padding2 -// gdbg-check:$2 = {x = {6, 7, 8}, y = {{9, 10}, {11, 12}}} -// gdbr-check:$2 = evec_in_struct::NoPadding2 {x: [6, 7, 8], y: [[9, 10], [11, 12]]} +// gdb-check:$2 = evec_in_struct::NoPadding2 {x: [6, 7, 8], y: [[9, 10], [11, 12]]} // gdb-command:print struct_internal_padding -// gdbg-check:$3 = {x = {13, 14}, y = {15, 16}} -// gdbr-check:$3 = evec_in_struct::StructInternalPadding {x: [13, 14], y: [15, 16]} +// gdb-check:$3 = evec_in_struct::StructInternalPadding {x: [13, 14], y: [15, 16]} // gdb-command:print single_vec -// gdbg-check:$4 = {x = {17, 18, 19, 20, 21}} -// gdbr-check:$4 = evec_in_struct::SingleVec {x: [17, 18, 19, 20, 21]} +// gdb-check:$4 = evec_in_struct::SingleVec {x: [17, 18, 19, 20, 21]} // gdb-command:print struct_padded_at_end -// gdbg-check:$5 = {x = {22, 23}, y = {24, 25}} -// gdbr-check:$5 = evec_in_struct::StructPaddedAtEnd {x: [22, 23], y: [24, 25]} +// gdb-check:$5 = evec_in_struct::StructPaddedAtEnd {x: [22, 23], y: [24, 25]} // === LLDB TESTS ================================================================================== @@ -31,23 +24,18 @@ // lldb-command:run // lldb-command:v no_padding1 -// lldbg-check:[...] { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } -// lldbr-check:(evec_in_struct::NoPadding1) no_padding1 = { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } +// lldb-check:[...] { x = { [0] = 0 [1] = 1 [2] = 2 } y = -3 z = { [0] = 4.5 [1] = 5.5 } } // lldb-command:v no_padding2 -// lldbg-check:[...] { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } -// lldbr-check:(evec_in_struct::NoPadding2) no_padding2 = { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } +// lldb-check:[...] { x = { [0] = 6 [1] = 7 [2] = 8 } y = { [0] = { [0] = 9 [1] = 10 } [1] = { [0] = 11 [1] = 12 } } } // lldb-command:v struct_internal_padding -// lldbg-check:[...] { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } -// lldbr-check:(evec_in_struct::StructInternalPadding) struct_internal_padding = { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } +// lldb-check:[...] { x = { [0] = 13 [1] = 14 } y = { [0] = 15 [1] = 16 } } // lldb-command:v single_vec -// lldbg-check:[...] { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } -// lldbr-check:(evec_in_struct::SingleVec) single_vec = { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } +// lldb-check:[...] { x = { [0] = 17 [1] = 18 [2] = 19 [3] = 20 [4] = 21 } } // lldb-command:v struct_padded_at_end -// lldbg-check:[...] { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } -// lldbr-check:(evec_in_struct::StructPaddedAtEnd) struct_padded_at_end = { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } +// lldb-check:[...] { x = { [0] = 22 [1] = 23 } y = { [0] = 24 [1] = 25 } } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/extern-c-fn.rs b/tests/debuginfo/extern-c-fn.rs index b45a073ed05..4642073faab 100644 --- a/tests/debuginfo/extern-c-fn.rs +++ b/tests/debuginfo/extern-c-fn.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -22,17 +20,13 @@ // lldb-command:run // lldb-command:v len -// lldbg-check:[...] 20 -// lldbr-check:(i32) len = 20 +// lldb-check:[...] 20 // lldb-command:v local0 -// lldbg-check:[...] 19 -// lldbr-check:(i32) local0 = 19 +// lldb-check:[...] 19 // lldb-command:v local1 -// lldbg-check:[...] true -// lldbr-check:(bool) local1 = true +// lldb-check:[...] true // lldb-command:v local2 -// lldbg-check:[...] 20.5 -// lldbr-check:(f64) local2 = 20.5 +// lldb-check:[...] 20.5 // lldb-command:continue diff --git a/tests/debuginfo/function-arg-initialization.rs b/tests/debuginfo/function-arg-initialization.rs index 05935c30bea..ae54d56623c 100644 --- a/tests/debuginfo/function-arg-initialization.rs +++ b/tests/debuginfo/function-arg-initialization.rs @@ -1,6 +1,3 @@ -//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 -//@ min-lldb-version: 310 - // This test case checks if function arguments already have the correct value // when breaking at the first line of the function, that is if the function // prologue has already been executed at the first line. Note that because of @@ -8,7 +5,9 @@ // arguments have been properly loaded when setting the breakpoint via the // function name. -//@ compile-flags:-g +//@ min-lldb-version: 1800 +//@ compile-flags:-g -Zmir-enable-passes=-SingleUseConsts +// SingleUseConsts shouldn't need to be disabled, see #128945 // === GDB TESTS =================================================================================== @@ -25,10 +24,8 @@ // NON IMMEDIATE ARGS // gdb-command:print a -// gdbg-check:$4 = {a = 3, b = 4, c = 5, d = 6, e = 7, f = 8, g = 9, h = 10} // gdbt-check:$4 = function_arg_initialization::BigStruct {a: 3, b: 4, c: 5, d: 6, e: 7, f: 8, g: 9, h: 10} // gdb-command:print b -// gdbg-check:$5 = {a = 11, b = 12, c = 13, d = 14, e = 15, f = 16, g = 17, h = 18} // gdbt-check:$5 = function_arg_initialization::BigStruct {a: 11, b: 12, c: 13, d: 14, e: 15, f: 16, g: 17, h: 18} // gdb-command:continue diff --git a/tests/debuginfo/function-arguments.rs b/tests/debuginfo/function-arguments.rs index b0afa1d0772..21c0c7d859c 100644 --- a/tests/debuginfo/function-arguments.rs +++ b/tests/debuginfo/function-arguments.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -23,19 +21,15 @@ // lldb-command:run // lldb-command:v x -// lldbg-check:[...] 111102 -// lldbr-check:(isize) x = 111102 +// lldb-check:[...] 111102 // lldb-command:v y -// lldbg-check:[...] true -// lldbr-check:(bool) y = true +// lldb-check:[...] true // lldb-command:continue // lldb-command:v a -// lldbg-check:[...] 2000 -// lldbr-check:(i32) a = 2000 +// lldb-check:[...] 2000 // lldb-command:v b -// lldbg-check:[...] 3000 -// lldbr-check:(i64) b = 3000 +// lldb-check:[...] 3000 // lldb-command:continue diff --git a/tests/debuginfo/function-prologue-stepping-regular.rs b/tests/debuginfo/function-prologue-stepping-regular.rs index a1f44105bb9..07b9356fb50 100644 --- a/tests/debuginfo/function-prologue-stepping-regular.rs +++ b/tests/debuginfo/function-prologue-stepping-regular.rs @@ -1,9 +1,8 @@ // This test case checks if function arguments already have the correct value when breaking at the // beginning of a function. -//@ min-lldb-version: 310 +//@ min-lldb-version: 1800 //@ ignore-gdb -//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 //@ compile-flags:-g // lldb-command:breakpoint set --name immediate_args diff --git a/tests/debuginfo/gdb-pretty-struct-and-enums.rs b/tests/debuginfo/gdb-pretty-struct-and-enums.rs index 235295e887c..08e01333a37 100644 --- a/tests/debuginfo/gdb-pretty-struct-and-enums.rs +++ b/tests/debuginfo/gdb-pretty-struct-and-enums.rs @@ -1,30 +1,24 @@ //@ ignore-lldb //@ ignore-android: FIXME(#10381) -//@ min-gdb-version: 8.1 //@ compile-flags:-g // gdb-command: run // gdb-command: print regular_struct -// gdbg-check:$1 = {the_first_field = 101, the_second_field = 102.5, the_third_field = false} -// gdbr-check:$1 = gdb_pretty_struct_and_enums::RegularStruct {the_first_field: 101, the_second_field: 102.5, the_third_field: false} +// gdb-check:$1 = gdb_pretty_struct_and_enums::RegularStruct {the_first_field: 101, the_second_field: 102.5, the_third_field: false} // gdb-command: print empty_struct -// gdbg-check:$2 = EmptyStruct -// gdbr-check:$2 = gdb_pretty_struct_and_enums::EmptyStruct +// gdb-check:$2 = gdb_pretty_struct_and_enums::EmptyStruct // gdb-command: print c_style_enum1 -// gdbg-check:$3 = CStyleEnumVar1 -// gdbr-check:$3 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar1 +// gdb-check:$3 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar1 // gdb-command: print c_style_enum2 -// gdbg-check:$4 = CStyleEnumVar2 -// gdbr-check:$4 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar2 +// gdb-check:$4 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar2 // gdb-command: print c_style_enum3 -// gdbg-check:$5 = CStyleEnumVar3 -// gdbr-check:$5 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar3 +// gdb-check:$5 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar3 #![allow(dead_code, unused_variables)] diff --git a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs index 7b23221213a..e723543a37b 100644 --- a/tests/debuginfo/generic-enum-with-different-disr-sizes.rs +++ b/tests/debuginfo/generic-enum-with-different-disr-sizes.rs @@ -1,8 +1,4 @@ //@ ignore-lldb: FIXME(#27089) -//@ min-lldb-version: 310 - -// Require a gdb that can read DW_TAG_variant_part. -//@ min-gdb-version: 8.2 //@ compile-flags:-g @@ -10,29 +6,29 @@ // gdb-command:run // gdb-command:print eight_bytes1 -// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant1(100) +// gdb-check:$1 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant1(100) // gdb-command:print four_bytes1 -// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant1(101) +// gdb-check:$2 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant1(101) // gdb-command:print two_bytes1 -// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant1(102) +// gdb-check:$3 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant1(102) // gdb-command:print one_byte1 -// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant1(65) +// gdb-check:$4 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant1(65) // gdb-command:print eight_bytes2 -// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant2(100) +// gdb-check:$5 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant2(100) // gdb-command:print four_bytes2 -// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant2(101) +// gdb-check:$6 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant2(101) // gdb-command:print two_bytes2 -// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant2(102) +// gdb-check:$7 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant2(102) // gdb-command:print one_byte2 -// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant2(65) +// gdb-check:$8 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant2(65) // gdb-command:continue diff --git a/tests/debuginfo/generic-function.rs b/tests/debuginfo/generic-function.rs index e131ebfa306..4be8d5ad45a 100644 --- a/tests/debuginfo/generic-function.rs +++ b/tests/debuginfo/generic-function.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -21,8 +19,7 @@ // gdb-command:print *t0 // gdb-check:$5 = 5 // gdb-command:print *t1 -// gdbg-check:$6 = {a = 6, b = 7.5} -// gdbr-check:$6 = generic_function::Struct {a: 6, b: 7.5} +// gdb-check:$6 = generic_function::Struct {a: 6, b: 7.5} // gdb-command:continue // === LLDB TESTS ================================================================================== @@ -30,27 +27,21 @@ // lldb-command:run // lldb-command:v *t0 -// lldbg-check:[...] 1 -// lldbr-check:(i32) *t0 = 1 +// lldb-check:[...] 1 // lldb-command:v *t1 -// lldbg-check:[...] 2.5 -// lldbr-check:(f64) *t1 = 2.5 +// lldb-check:[...] 2.5 // lldb-command:continue // lldb-command:v *t0 -// lldbg-check:[...] 3.5 -// lldbr-check:(f64) *t0 = 3.5 +// lldb-check:[...] 3.5 // lldb-command:v *t1 -// lldbg-check:[...] 4 -// lldbr-check:(u16) *t1 = 4 +// lldb-check:[...] 4 // lldb-command:continue // lldb-command:v *t0 -// lldbg-check:[...] 5 -// lldbr-check:(i32) *t0 = 5 +// lldb-check:[...] 5 // lldb-command:v *t1 -// lldbg-check:[...] { a = 6 b = 7.5 } -// lldbr-check:(generic_function::Struct) *t1 = { a = 6 b = 7.5 } +// lldb-check:[...] { a = 6 b = 7.5 } // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/generic-functions-nested.rs b/tests/debuginfo/generic-functions-nested.rs index eee0c151182..7e0c20f8903 100644 --- a/tests/debuginfo/generic-functions-nested.rs +++ b/tests/debuginfo/generic-functions-nested.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -36,35 +34,27 @@ // lldb-command:run // lldb-command:v x -// lldbg-check:[...] -1 -// lldbr-check:(i32) x = -1 +// lldb-check:[...] -1 // lldb-command:v y -// lldbg-check:[...] 1 -// lldbr-check:(i32) y = 1 +// lldb-check:[...] 1 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] -1 -// lldbr-check:(i32) x = -1 +// lldb-check:[...] -1 // lldb-command:v y -// lldbg-check:[...] 2.5 -// lldbr-check:(f64) y = 2.5 +// lldb-check:[...] 2.5 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] -2.5 -// lldbr-check:(f64) x = -2.5 +// lldb-check:[...] -2.5 // lldb-command:v y -// lldbg-check:[...] 1 -// lldbr-check:(i32) y = 1 +// lldb-check:[...] 1 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] -2.5 -// lldbr-check:(f64) x = -2.5 +// lldb-check:[...] -2.5 // lldb-command:v y -// lldbg-check:[...] 2.5 -// lldbr-check:(f64) y = 2.5 +// lldb-check:[...] 2.5 // lldb-command:continue diff --git a/tests/debuginfo/generic-method-on-generic-struct.rs b/tests/debuginfo/generic-method-on-generic-struct.rs index 0f706740410..9c587ca2839 100644 --- a/tests/debuginfo/generic-method-on-generic-struct.rs +++ b/tests/debuginfo/generic-method-on-generic-struct.rs @@ -1,17 +1,12 @@ //@ compile-flags:-g -// Some versions of the non-rust-enabled LLDB print the wrong generic -// parameter type names in this test. -//@ needs-rust-lldb - // === GDB TESTS =================================================================================== // gdb-command:run // STACK BY REF // gdb-command:print *self -// gdbg-check:$1 = {x = {__0 = 8888, __1 = -8888}} -// gdbr-check:$1 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)} +// gdb-check:$1 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)} // gdb-command:print arg1 // gdb-check:$2 = -1 // gdb-command:print arg2 @@ -20,8 +15,7 @@ // STACK BY VAL // gdb-command:print self -// gdbg-check:$4 = {x = {__0 = 8888, __1 = -8888}} -// gdbr-check:$4 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)} +// gdb-check:$4 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)} // gdb-command:print arg1 // gdb-check:$5 = -3 // gdb-command:print arg2 @@ -30,8 +24,7 @@ // OWNED BY REF // gdb-command:print *self -// gdbg-check:$7 = {x = 1234.5} -// gdbr-check:$7 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5} +// gdb-check:$7 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5} // gdb-command:print arg1 // gdb-check:$8 = -5 // gdb-command:print arg2 @@ -40,8 +33,7 @@ // OWNED BY VAL // gdb-command:print self -// gdbg-check:$10 = {x = 1234.5} -// gdbr-check:$10 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5} +// gdb-check:$10 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5} // gdb-command:print arg1 // gdb-check:$11 = -7 // gdb-command:print arg2 @@ -50,8 +42,7 @@ // OWNED MOVED // gdb-command:print *self -// gdbg-check:$13 = {x = 1234.5} -// gdbr-check:$13 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5} +// gdb-check:$13 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5} // gdb-command:print arg1 // gdb-check:$14 = -9 // gdb-command:print arg2 @@ -65,62 +56,47 @@ // STACK BY REF // lldb-command:v *self -// lldbg-check:[...] { x = { 0 = 8888, 1 = -8888 } } -// lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { 0 = 8888 1 = -8888 } } +// lldb-check:[...] { x = { 0 = 8888 1 = -8888 } } // lldb-command:v arg1 -// lldbg-check:[...] -1 -// lldbr-check:(isize) arg1 = -1 +// lldb-check:[...] -1 // lldb-command:v arg2 -// lldbg-check:[...] 2 -// lldbr-check:(u16) arg2 = 2 +// lldb-check:[...] 2 // lldb-command:continue // STACK BY VAL // lldb-command:v self -// lldbg-check:[...] { x = { 0 = 8888, 1 = -8888 } } -// lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) self = { x = { 0 = 8888, 1 = -8888 } } +// lldb-check:[...] { x = { 0 = 8888 1 = -8888 } } // lldb-command:v arg1 -// lldbg-check:[...] -3 -// lldbr-check:(isize) arg1 = -3 +// lldb-check:[...] -3 // lldb-command:v arg2 -// lldbg-check:[...] -4 -// lldbr-check:(i16) arg2 = -4 +// lldb-check:[...] -4 // lldb-command:continue // OWNED BY REF // lldb-command:v *self -// lldbg-check:[...] { x = 1234.5 } -// lldbr-check:(generic_method_on_generic_struct::Struct<f64>) *self = { x = 1234.5 } +// lldb-check:[...] { x = 1234.5 } // lldb-command:v arg1 -// lldbg-check:[...] -5 -// lldbr-check:(isize) arg1 = -5 +// lldb-check:[...] -5 // lldb-command:v arg2 -// lldbg-check:[...] -6 -// lldbr-check:(i32) arg2 = -6 +// lldb-check:[...] -6 // lldb-command:continue // OWNED BY VAL // lldb-command:v self -// lldbg-check:[...] { x = 1234.5 } -// lldbr-check:(generic_method_on_generic_struct::Struct<f64>) self = { x = 1234.5 } +// lldb-check:[...] { x = 1234.5 } // lldb-command:v arg1 -// lldbg-check:[...] -7 -// lldbr-check:(isize) arg1 = -7 +// lldb-check:[...] -7 // lldb-command:v arg2 -// lldbg-check:[...] -8 -// lldbr-check:(i64) arg2 = -8 +// lldb-check:[...] -8 // lldb-command:continue // OWNED MOVED // lldb-command:v *self -// lldbg-check:[...] { x = 1234.5 } -// lldbr-check:(generic_method_on_generic_struct::Struct<f64>) *self = { x = 1234.5 } +// lldb-check:[...] { x = 1234.5 } // lldb-command:v arg1 -// lldbg-check:[...] -9 -// lldbr-check:(isize) arg1 = -9 +// lldb-check:[...] -9 // lldb-command:v arg2 -// lldbg-check:[...] -10.5 -// lldbr-check:(f32) arg2 = -10.5 +// lldb-check:[...] -10.5 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/generic-static-method-on-struct-and-enum.rs b/tests/debuginfo/generic-static-method-on-struct-and-enum.rs index 98608e32914..79fe2144cf4 100644 --- a/tests/debuginfo/generic-static-method-on-struct-and-enum.rs +++ b/tests/debuginfo/generic-static-method-on-struct-and-enum.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // gdb-command:run diff --git a/tests/debuginfo/generic-struct-style-enum.rs b/tests/debuginfo/generic-struct-style-enum.rs index 7d929b91064..a5529ab8027 100644 --- a/tests/debuginfo/generic-struct-style-enum.rs +++ b/tests/debuginfo/generic-struct-style-enum.rs @@ -1,24 +1,19 @@ -//@ min-lldb-version: 310 - -// Require a gdb that can read DW_TAG_variant_part. -//@ min-gdb-version: 8.2 - //@ compile-flags:-g // gdb-command:set print union on // gdb-command:run // gdb-command:print case1 -// gdbr-check:$1 = generic_struct_style_enum::Regular<u16, u32, i64>::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868} +// gdb-check:$1 = generic_struct_style_enum::Regular<u16, u32, i64>::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868} // gdb-command:print case2 -// gdbr-check:$2 = generic_struct_style_enum::Regular<i16, u32, i64>::Case2{a: 0, b: 286331153, c: 286331153} +// gdb-check:$2 = generic_struct_style_enum::Regular<i16, u32, i64>::Case2{a: 0, b: 286331153, c: 286331153} // gdb-command:print case3 -// gdbr-check:$3 = generic_struct_style_enum::Regular<u16, i32, u64>::Case3{a: 0, b: 6438275382588823897} +// gdb-check:$3 = generic_struct_style_enum::Regular<u16, i32, u64>::Case3{a: 0, b: 6438275382588823897} // gdb-command:print univariant -// gdbr-check:$4 = generic_struct_style_enum::Univariant<i32>::TheOnlyCase{a: -1} +// gdb-check:$4 = generic_struct_style_enum::Univariant<i32>::TheOnlyCase{a: -1} #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/generic-struct.rs b/tests/debuginfo/generic-struct.rs index 8c74aa42d2c..f26d823d4f2 100644 --- a/tests/debuginfo/generic-struct.rs +++ b/tests/debuginfo/generic-struct.rs @@ -1,7 +1,3 @@ -// Some versions of the non-rust-enabled LLDB print the wrong generic -// parameter type names in this test. -//@ needs-rust-lldb - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -9,35 +5,27 @@ // gdb-command:run // gdb-command:print int_int -// gdbg-check:$1 = {key = 0, value = 1} -// gdbr-check:$1 = generic_struct::AGenericStruct<i32, i32> {key: 0, value: 1} +// gdb-check:$1 = generic_struct::AGenericStruct<i32, i32> {key: 0, value: 1} // gdb-command:print int_float -// gdbg-check:$2 = {key = 2, value = 3.5} -// gdbr-check:$2 = generic_struct::AGenericStruct<i32, f64> {key: 2, value: 3.5} +// gdb-check:$2 = generic_struct::AGenericStruct<i32, f64> {key: 2, value: 3.5} // gdb-command:print float_int -// gdbg-check:$3 = {key = 4.5, value = 5} -// gdbr-check:$3 = generic_struct::AGenericStruct<f64, i32> {key: 4.5, value: 5} +// gdb-check:$3 = generic_struct::AGenericStruct<f64, i32> {key: 4.5, value: 5} // gdb-command:print float_int_float -// gdbg-check:$4 = {key = 6.5, value = {key = 7, value = 8.5}} -// gdbr-check:$4 = generic_struct::AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>> {key: 6.5, value: generic_struct::AGenericStruct<i32, f64> {key: 7, value: 8.5}} +// gdb-check:$4 = generic_struct::AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>> {key: 6.5, value: generic_struct::AGenericStruct<i32, f64> {key: 7, value: 8.5}} // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v int_int -// lldbg-check:[...] AGenericStruct<i32, i32> { key: 0, value: 1 } -// lldbr-check:(generic_struct::AGenericStruct<i32, i32>) int_int = AGenericStruct<i32, i32> { key: 0, value: 1 } +// lldb-check:[...]AGenericStruct<int, int>) int_int = { key = 0 value = 1 } // lldb-command:v int_float -// lldbg-check:[...] AGenericStruct<i32, f64> { key: 2, value: 3.5 } -// lldbr-check:(generic_struct::AGenericStruct<i32, f64>) int_float = AGenericStruct<i32, f64> { key: 2, value: 3.5 } +// lldb-check:[...]AGenericStruct<int, double>) int_float = { key = 2 value = 3.5 } // lldb-command:v float_int -// lldbg-check:[...] AGenericStruct<f64, i32> { key: 4.5, value: 5 } -// lldbr-check:(generic_struct::AGenericStruct<f64, i32>) float_int = AGenericStruct<f64, i32> { key: 4.5, value: 5 } +// lldb-check:[...]AGenericStruct<double, int>) float_int = { key = 4.5 value = 5 } // lldb-command:v float_int_float -// lldbg-check:[...] AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>> { key: 6.5, value: AGenericStruct<i32, f64> { key: 7, value: 8.5 } } -// lldbr-check:(generic_struct::AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>>) float_int_float = AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>> { key: 6.5, value: AGenericStruct<i32, f64> { key: 7, value: 8.5 } } +// lldb-check:[...]AGenericStruct<double, generic_struct::AGenericStruct<int, double> >) float_int_float = { key = 6.5 value = { key = 7 value = 8.5 } } // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/generic-tuple-style-enum.rs b/tests/debuginfo/generic-tuple-style-enum.rs index af90c6ce30e..4a5996645cb 100644 --- a/tests/debuginfo/generic-tuple-style-enum.rs +++ b/tests/debuginfo/generic-tuple-style-enum.rs @@ -1,7 +1,3 @@ -// Require a gdb or lldb that can read DW_TAG_variant_part. -//@ min-gdb-version: 8.2 -//@ needs-rust-lldb - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -10,16 +6,16 @@ // gdb-command:run // gdb-command:print case1 -// gdbr-check:$1 = generic_tuple_style_enum::Regular<u16, u32, u64>::Case1(0, 31868, 31868, 31868, 31868) +// gdb-check:$1 = generic_tuple_style_enum::Regular<u16, u32, u64>::Case1(0, 31868, 31868, 31868, 31868) // gdb-command:print case2 -// gdbr-check:$2 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case2(0, 286331153, 286331153) +// gdb-check:$2 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case2(0, 286331153, 286331153) // gdb-command:print case3 -// gdbr-check:$3 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case3(0, 6438275382588823897) +// gdb-check:$3 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case3(0, 6438275382588823897) // gdb-command:print univariant -// gdbr-check:$4 = generic_tuple_style_enum::Univariant<i64>::TheOnlyCase(-1) +// gdb-check:$4 = generic_tuple_style_enum::Univariant<i64>::TheOnlyCase(-1) // === LLDB TESTS ================================================================================== @@ -27,16 +23,12 @@ // lldb-command:run // lldb-command:v case1 -// lldbr-check:(generic_tuple_style_enum::Regular<u16, u32, u64>::Case1) case1 = { __0 = 0 __1 = 31868 __2 = 31868 __3 = 31868 __4 = 31868 } // lldb-command:v case2 -// lldbr-check:(generic_tuple_style_enum::Regular<i16, i32, i64>::Case2) case2 = Regular<i16, i32, i64>::Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 } // lldb-command:v case3 -// lldbr-check:(generic_tuple_style_enum::Regular<i16, i32, i64>::Case3) case3 = Regular<i16, i32, i64>::Case3 { Case1: 0, Case2: 6438275382588823897 } // lldb-command:v univariant -// lldbr-check:(generic_tuple_style_enum::Univariant<i64>) univariant = Univariant<i64> { TheOnlyCase: Univariant<i64>::TheOnlyCase(-1) } #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] diff --git a/tests/debuginfo/include_string.rs b/tests/debuginfo/include_string.rs index 628ac92fe34..704b85e1ac2 100644 --- a/tests/debuginfo/include_string.rs +++ b/tests/debuginfo/include_string.rs @@ -1,4 +1,3 @@ -//@ min-lldb-version: 310 //@ ignore-gdb-version: 15.0 - 99.0 // ^ test temporarily disabled as it fails under gdb 15 @@ -18,14 +17,11 @@ // lldb-command:run // lldb-command:v string1.length -// lldbg-check:[...] 48 -// lldbr-check:(usize) length = 48 +// lldb-check:[...] 48 // lldb-command:v string2.length -// lldbg-check:[...] 49 -// lldbr-check:(usize) length = 49 +// lldb-check:[...] 49 // lldb-command:v string3.length -// lldbg-check:[...] 50 -// lldbr-check:(usize) length = 50 +// lldb-check:[...] 50 // lldb-command:continue diff --git a/tests/debuginfo/issue-12886.rs b/tests/debuginfo/issue-12886.rs index c6cf0dd4e05..48250e88537 100644 --- a/tests/debuginfo/issue-12886.rs +++ b/tests/debuginfo/issue-12886.rs @@ -1,4 +1,3 @@ -//@ ignore-windows failing on 64-bit bots FIXME #17638 //@ ignore-lldb //@ ignore-aarch64 @@ -6,7 +5,7 @@ // gdb-command:run // gdb-command:next -// gdb-check:[...]24[...]let s = Some(5).unwrap(); // #break +// gdb-check:[...]23[...]let s = Some(5).unwrap(); // #break // gdb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/issue-13213.rs b/tests/debuginfo/issue-13213.rs index 7ef9178ce9d..b43a6f90ffc 100644 --- a/tests/debuginfo/issue-13213.rs +++ b/tests/debuginfo/issue-13213.rs @@ -1,4 +1,3 @@ -//@ min-lldb-version: 310 //@ ignore-cdb: Fails with exit code 0xc0000135 ("the application failed to initialize properly") //@ aux-build:issue-13213-aux.rs diff --git a/tests/debuginfo/issue-14411.rs b/tests/debuginfo/issue-14411.rs index 3258fec1e87..7da5fb16d44 100644 --- a/tests/debuginfo/issue-14411.rs +++ b/tests/debuginfo/issue-14411.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // No debugger interaction required: just make sure it compiles without diff --git a/tests/debuginfo/issue-22656.rs b/tests/debuginfo/issue-22656.rs index 5a5442acd95..eb0b38cfa4d 100644 --- a/tests/debuginfo/issue-22656.rs +++ b/tests/debuginfo/issue-22656.rs @@ -2,7 +2,6 @@ // when trying to handle a Vec<> or anything else that contains zero-sized // fields. -//@ min-lldb-version: 310 //@ ignore-gdb //@ compile-flags:-g @@ -11,12 +10,9 @@ // lldb-command:run // lldb-command:v v -// lldbg-check:[...] size=3 { [0] = 1 [1] = 2 [2] = 3 } -// lldbr-check:(alloc::vec::Vec<i32>) v = size=3 { [0] = 1 [1] = 2 [2] = 3 } +// lldb-check:[...] size=3 { [0] = 1 [1] = 2 [2] = 3 } // lldb-command:v zs -// lldbg-check:[...] { x = y = 123 z = w = 456 } -// lldbr-check:(issue_22656::StructWithZeroSizedField) zs = { x = y = 123 z = w = 456 } -// lldbr-command:continue +// lldb-check:[...] { x = y = 123 z = w = 456 } #![allow(unused_variables)] #![allow(dead_code)] diff --git a/tests/debuginfo/issue-57822.rs b/tests/debuginfo/issue-57822.rs index cadd9b542e9..7abac1c14d3 100644 --- a/tests/debuginfo/issue-57822.rs +++ b/tests/debuginfo/issue-57822.rs @@ -1,8 +1,6 @@ // This test makes sure that the LLDB pretty printer does not throw an exception // for nested closures and coroutines. -// Require a gdb that can read DW_TAG_variant_part. -//@ min-gdb-version: 8.2 //@ min-lldb-version: 1800 //@ compile-flags:-g @@ -21,10 +19,10 @@ // lldb-command:run // lldb-command:v g -// lldbg-check:(issue_57822::main::{closure_env#1}) g = { f = { x = 1 } } +// lldb-check:(issue_57822::main::{closure_env#1}) g = { f = { x = 1 } } // lldb-command:v b -// lldbg-check:(issue_57822::main::{coroutine_env#3}) b = { value = { a = { value = { y = 2 } $discr$ = '\x02' } } $discr$ = '\x02' } +// lldb-check:(issue_57822::main::{coroutine_env#3}) b = { value = { a = { value = { y = 2 } $discr$ = '\x02' } } $discr$ = '\x02' } #![feature(omit_gdb_pretty_printer_section, coroutines, coroutine_trait, stmt_expr_attributes)] #![omit_gdb_pretty_printer_section] diff --git a/tests/debuginfo/issue-7712.rs b/tests/debuginfo/issue-7712.rs index 35e6b10c4e5..11143f79161 100644 --- a/tests/debuginfo/issue-7712.rs +++ b/tests/debuginfo/issue-7712.rs @@ -1,5 +1,4 @@ //@ compile-flags:-C debuginfo=1 -//@ min-lldb-version: 310 pub trait TraitWithDefaultMethod : Sized { fn method(self) { diff --git a/tests/debuginfo/lexical-scope-in-for-loop.rs b/tests/debuginfo/lexical-scope-in-for-loop.rs index 1b1f106fece..08f244f89a0 100644 --- a/tests/debuginfo/lexical-scope-in-for-loop.rs +++ b/tests/debuginfo/lexical-scope-in-for-loop.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -45,41 +43,34 @@ // FIRST ITERATION // lldb-command:v x -// lldbg-check:[...] 1 -// lldbr-check:(i32) x = 1 +// lldb-check:[...] 1 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] -1 -// lldbr-check:(i32) x = -1 +// lldb-check:[...] -1 // lldb-command:continue // SECOND ITERATION // lldb-command:v x -// lldbg-check:[...] 2 -// lldbr-check:(i32) x = 2 +// lldb-check:[...] 2 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] -2 -// lldbr-check:(i32) x = -2 +// lldb-check:[...] -2 // lldb-command:continue // THIRD ITERATION // lldb-command:v x -// lldbg-check:[...] 3 -// lldbr-check:(i32) x = 3 +// lldb-check:[...] 3 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] -3 -// lldbr-check:(i32) x = -3 +// lldb-check:[...] -3 // lldb-command:continue // AFTER LOOP // lldb-command:v x -// lldbg-check:[...] 1000000 -// lldbr-check:(i32) x = 1000000 +// lldb-check:[...] 1000000 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/lexical-scope-in-if.rs b/tests/debuginfo/lexical-scope-in-if.rs index d472a50f697..c0e1f2f3e05 100644 --- a/tests/debuginfo/lexical-scope-in-if.rs +++ b/tests/debuginfo/lexical-scope-in-if.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -69,74 +67,58 @@ // BEFORE if // lldb-command:v x -// lldbg-check:[...] 999 -// lldbr-check:(i32) x = 999 +// lldb-check:[...] 999 // lldb-command:v y -// lldbg-check:[...] -1 -// lldbr-check:(i32) y = -1 +// lldb-check:[...] -1 // lldb-command:continue // AT BEGINNING of 'then' block // lldb-command:v x -// lldbg-check:[...] 999 -// lldbr-check:(i32) x = 999 +// lldb-check:[...] 999 // lldb-command:v y -// lldbg-check:[...] -1 -// lldbr-check:(i32) y = -1 +// lldb-check:[...] -1 // lldb-command:continue // AFTER 1st redeclaration of 'x' // lldb-command:v x -// lldbg-check:[...] 1001 -// lldbr-check:(i32) x = 1001 +// lldb-check:[...] 1001 // lldb-command:v y -// lldbg-check:[...] -1 -// lldbr-check:(i32) y = -1 +// lldb-check:[...] -1 // lldb-command:continue // AFTER 2st redeclaration of 'x' // lldb-command:v x -// lldbg-check:[...] 1002 -// lldbr-check:(i32) x = 1002 +// lldb-check:[...] 1002 // lldb-command:v y -// lldbg-check:[...] 1003 -// lldbr-check:(i32) y = 1003 +// lldb-check:[...] 1003 // lldb-command:continue // AFTER 1st if expression // lldb-command:v x -// lldbg-check:[...] 999 -// lldbr-check:(i32) x = 999 +// lldb-check:[...] 999 // lldb-command:v y -// lldbg-check:[...] -1 -// lldbr-check:(i32) y = -1 +// lldb-check:[...] -1 // lldb-command:continue // BEGINNING of else branch // lldb-command:v x -// lldbg-check:[...] 999 -// lldbr-check:(i32) x = 999 +// lldb-check:[...] 999 // lldb-command:v y -// lldbg-check:[...] -1 -// lldbr-check:(i32) y = -1 +// lldb-check:[...] -1 // lldb-command:continue // BEGINNING of else branch // lldb-command:v x -// lldbg-check:[...] 1004 -// lldbr-check:(i32) x = 1004 +// lldb-check:[...] 1004 // lldb-command:v y -// lldbg-check:[...] 1005 -// lldbr-check:(i32) y = 1005 +// lldb-check:[...] 1005 // lldb-command:continue // BEGINNING of else branch // lldb-command:v x -// lldbg-check:[...] 999 -// lldbr-check:(i32) x = 999 +// lldb-check:[...] 999 // lldb-command:v y -// lldbg-check:[...] -1 -// lldbr-check:(i32) y = -1 +// lldb-check:[...] -1 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/lexical-scope-in-match.rs b/tests/debuginfo/lexical-scope-in-match.rs index d5f0fcbe892..9169c19c6a3 100644 --- a/tests/debuginfo/lexical-scope-in-match.rs +++ b/tests/debuginfo/lexical-scope-in-match.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -64,73 +62,55 @@ // lldb-command:run // lldb-command:v shadowed -// lldbg-check:[...] 231 -// lldbr-check:(i32) shadowed = 231 +// lldb-check:[...] 231 // lldb-command:v not_shadowed -// lldbg-check:[...] 232 -// lldbr-check:(i32) not_shadowed = 232 +// lldb-check:[...] 232 // lldb-command:continue // lldb-command:v shadowed -// lldbg-check:[...] 233 -// lldbr-check:(i32) shadowed = 233 +// lldb-check:[...] 233 // lldb-command:v not_shadowed -// lldbg-check:[...] 232 -// lldbr-check:(i32) not_shadowed = 232 +// lldb-check:[...] 232 // lldb-command:v local_to_arm -// lldbg-check:[...] 234 -// lldbr-check:(i32) local_to_arm = 234 +// lldb-check:[...] 234 // lldb-command:continue // lldb-command:v shadowed -// lldbg-check:[...] 236 -// lldbr-check:(i32) shadowed = 236 +// lldb-check:[...] 236 // lldb-command:v not_shadowed -// lldbg-check:[...] 232 -// lldbr-check:(i32) not_shadowed = 232 +// lldb-check:[...] 232 // lldb-command:continue // lldb-command:v shadowed -// lldbg-check:[...] 237 -// lldbr-check:(isize) shadowed = 237 +// lldb-check:[...] 237 // lldb-command:v not_shadowed -// lldbg-check:[...] 232 -// lldbr-check:(i32) not_shadowed = 232 +// lldb-check:[...] 232 // lldb-command:v local_to_arm -// lldbg-check:[...] 238 -// lldbr-check:(isize) local_to_arm = 238 +// lldb-check:[...] 238 // lldb-command:continue // lldb-command:v shadowed -// lldbg-check:[...] 239 -// lldbr-check:(isize) shadowed = 239 +// lldb-check:[...] 239 // lldb-command:v not_shadowed -// lldbg-check:[...] 232 -// lldbr-check:(i32) not_shadowed = 232 +// lldb-check:[...] 232 // lldb-command:continue // lldb-command:v shadowed -// lldbg-check:[...] 241 -// lldbr-check:(isize) shadowed = 241 +// lldb-check:[...] 241 // lldb-command:v not_shadowed -// lldbg-check:[...] 232 -// lldbr-check:(i32) not_shadowed = 232 +// lldb-check:[...] 232 // lldb-command:continue // lldb-command:v shadowed -// lldbg-check:[...] 243 -// lldbr-check:(i32) shadowed = 243 +// lldb-check:[...] 243 // lldb-command:v *local_to_arm -// lldbg-check:[...] 244 -// lldbr-check:(i32) *local_to_arm = 244 +// lldb-check:[...] 244 // lldb-command:continue // lldb-command:v shadowed -// lldbg-check:[...] 231 -// lldbr-check:(i32) shadowed = 231 +// lldb-check:[...] 231 // lldb-command:v not_shadowed -// lldbg-check:[...] 232 -// lldbr-check:(i32) not_shadowed = 232 +// lldb-check:[...] 232 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/lexical-scope-in-parameterless-closure.rs b/tests/debuginfo/lexical-scope-in-parameterless-closure.rs index fa2cd281c80..dd6da95d388 100644 --- a/tests/debuginfo/lexical-scope-in-parameterless-closure.rs +++ b/tests/debuginfo/lexical-scope-in-parameterless-closure.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-C debuginfo=1 // gdb-command:run diff --git a/tests/debuginfo/lexical-scope-in-stack-closure.rs b/tests/debuginfo/lexical-scope-in-stack-closure.rs index 92582e10c42..d01162c39d6 100644 --- a/tests/debuginfo/lexical-scope-in-stack-closure.rs +++ b/tests/debuginfo/lexical-scope-in-stack-closure.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -36,33 +34,27 @@ // lldb-command:run // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 1000 -// lldbr-check:(isize) x = 1000 +// lldb-check:[...] 1000 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 2.5 -// lldbr-check:(f64) x = 2.5 +// lldb-check:[...] 2.5 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] true -// lldbr-check:(bool) x = true +// lldb-check:[...] true // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs index b1af018f3eb..dfec570218f 100644 --- a/tests/debuginfo/lexical-scope-in-unconditional-loop.rs +++ b/tests/debuginfo/lexical-scope-in-unconditional-loop.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -68,70 +66,57 @@ // FIRST ITERATION // lldb-command:v x -// lldbg-check:[...] 0 -// lldbr-check:(i32) x = 0 +// lldb-check:[...] 0 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 1 -// lldbr-check:(i32) x = 1 +// lldb-check:[...] 1 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 101 -// lldbr-check:(i32) x = 101 +// lldb-check:[...] 101 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 101 -// lldbr-check:(i32) x = 101 +// lldb-check:[...] 101 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] -987 -// lldbr-check:(i32) x = -987 +// lldb-check:[...] -987 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 101 -// lldbr-check:(i32) x = 101 +// lldb-check:[...] 101 // lldb-command:continue // SECOND ITERATION // lldb-command:v x -// lldbg-check:[...] 1 -// lldbr-check:(i32) x = 1 +// lldb-check:[...] 1 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 2 -// lldbr-check:(i32) x = 2 +// lldb-check:[...] 2 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 102 -// lldbr-check:(i32) x = 102 +// lldb-check:[...] 102 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 102 -// lldbr-check:(i32) x = 102 +// lldb-check:[...] 102 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] -987 -// lldbr-check:(i32) x = -987 +// lldb-check:[...] -987 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 102 -// lldbr-check:(i32) x = 102 +// lldb-check:[...] 102 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 2 -// lldbr-check:(i32) x = 2 +// lldb-check:[...] 2 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/lexical-scope-in-unique-closure.rs b/tests/debuginfo/lexical-scope-in-unique-closure.rs index a08c2af05cc..db84005121a 100644 --- a/tests/debuginfo/lexical-scope-in-unique-closure.rs +++ b/tests/debuginfo/lexical-scope-in-unique-closure.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -36,33 +34,27 @@ // lldb-command:run // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 1000 -// lldbr-check:(isize) x = 1000 +// lldb-check:[...] 1000 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 2.5 -// lldbr-check:(f64) x = 2.5 +// lldb-check:[...] 2.5 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] true -// lldbr-check:(bool) x = true +// lldb-check:[...] true // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:continue diff --git a/tests/debuginfo/lexical-scope-in-while.rs b/tests/debuginfo/lexical-scope-in-while.rs index bd885b5b10c..d6536d77545 100644 --- a/tests/debuginfo/lexical-scope-in-while.rs +++ b/tests/debuginfo/lexical-scope-in-while.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -68,70 +66,57 @@ // FIRST ITERATION // lldb-command:v x -// lldbg-check:[...] 0 -// lldbr-check:(i32) x = 0 +// lldb-check:[...] 0 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 1 -// lldbr-check:(i32) x = 1 +// lldb-check:[...] 1 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 101 -// lldbr-check:(i32) x = 101 +// lldb-check:[...] 101 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 101 -// lldbr-check:(i32) x = 101 +// lldb-check:[...] 101 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] -987 -// lldbr-check:(i32) x = -987 +// lldb-check:[...] -987 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 101 -// lldbr-check:(i32) x = 101 +// lldb-check:[...] 101 // lldb-command:continue // SECOND ITERATION // lldb-command:v x -// lldbg-check:[...] 1 -// lldbr-check:(i32) x = 1 +// lldb-check:[...] 1 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 2 -// lldbr-check:(i32) x = 2 +// lldb-check:[...] 2 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 102 -// lldbr-check:(i32) x = 102 +// lldb-check:[...] 102 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 102 -// lldbr-check:(i32) x = 102 +// lldb-check:[...] 102 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] -987 -// lldbr-check:(i32) x = -987 +// lldb-check:[...] -987 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 102 -// lldbr-check:(i32) x = 102 +// lldb-check:[...] 102 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 2 -// lldbr-check:(i32) x = 2 +// lldb-check:[...] 2 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/lexical-scope-with-macro.rs b/tests/debuginfo/lexical-scope-with-macro.rs index 7ea3dc62e45..6e8fef201ea 100644 --- a/tests/debuginfo/lexical-scope-with-macro.rs +++ b/tests/debuginfo/lexical-scope-with-macro.rs @@ -1,6 +1,3 @@ -//@ min-lldb-version: 310 -//@ ignore-lldb FIXME #48807 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -57,58 +54,48 @@ // lldb-command:run // lldb-command:v a -// lldbg-check:[...] 10 -// lldbr-check:(i32) a = 10 +// lldb-check:[...] 10 // lldb-command:v b -// lldbg-check:[...] 34 -// lldbr-check:(i32) b = 34 +// lldb-check:[...] 34 // lldb-command:continue // lldb-command:v a -// lldbg-check:[...] 890242 -// lldbr-check:(i32) a = 10 +// lldb-check:[...] 890242 // lldb-command:v b -// lldbg-check:[...] 34 -// lldbr-check:(i32) b = 34 +// lldb-check:[...] 34 // lldb-command:continue // lldb-command:v a -// lldbg-check:[...] 10 -// lldbr-check:(i32) a = 10 +// lldb-check:[...] 10 // lldb-command:v b -// lldbg-check:[...] 34 -// lldbr-check:(i32) b = 34 +// lldb-check:[...] 34 // lldb-command:continue // lldb-command:v a -// lldbg-check:[...] 102 -// lldbr-check:(i32) a = 10 +// lldb-check:[...] 102 // lldb-command:v b -// lldbg-check:[...] 34 -// lldbr-check:(i32) b = 34 +// lldb-check:[...] 34 // lldb-command:continue -// Don't test this with rust-enabled lldb for now; see issue #48807 -// lldbg-command:print a -// lldbg-check:[...] 110 -// lldbg-command:print b -// lldbg-check:[...] 34 -// lldbg-command:continue - -// lldbg-command:print a -// lldbg-check:[...] 10 -// lldbg-command:print b -// lldbg-check:[...] 34 -// lldbg-command:continue - -// lldbg-command:print a -// lldbg-check:[...] 10 -// lldbg-command:print b -// lldbg-check:[...] 34 -// lldbg-command:print c -// lldbg-check:[...] 400 -// lldbg-command:continue +// lldb-command:print a +// lldb-check:[...] 110 +// lldb-command:print b +// lldb-check:[...] 34 +// lldb-command:continue +// lldb-command:print a +// lldb-check:[...] 10 +// lldb-command:print b +// lldb-check:[...] 34 +// lldb-command:continue + +// lldb-command:print a +// lldb-check:[...] 10 +// lldb-command:print b +// lldb-check:[...] 34 +// lldb-command:print c +// lldb-check:[...] 400 +// lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] diff --git a/tests/debuginfo/lexical-scopes-in-block-expression.rs b/tests/debuginfo/lexical-scopes-in-block-expression.rs index 5ff70270ea6..cd27c88db58 100644 --- a/tests/debuginfo/lexical-scopes-in-block-expression.rs +++ b/tests/debuginfo/lexical-scopes-in-block-expression.rs @@ -1,14 +1,10 @@ -//@ min-lldb-version: 310 -//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 - //@ compile-flags:-g // === GDB TESTS =================================================================================== // gdb-command:run -// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT' -// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT +// gdb-command:print lexical_scopes_in_block_expression::MUT_INT // gdb-check:$1 = 0 // STRUCT EXPRESSION @@ -20,8 +16,7 @@ // gdb-command:print val // gdb-check:$4 = 11 -// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT' -// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT +// gdb-command:print lexical_scopes_in_block_expression::MUT_INT // gdb-check:$5 = 1 // gdb-command:print ten // gdb-check:$6 = 10 @@ -42,8 +37,7 @@ // gdb-command:print val // gdb-check:$11 = 12 -// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT' -// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT +// gdb-command:print lexical_scopes_in_block_expression::MUT_INT // gdb-check:$12 = 2 // gdb-command:print ten // gdb-check:$13 = 10 @@ -64,8 +58,7 @@ // gdb-command:print val // gdb-check:$18 = 13 -// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT' -// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT +// gdb-command:print lexical_scopes_in_block_expression::MUT_INT // gdb-check:$19 = 3 // gdb-command:print ten // gdb-check:$20 = 10 @@ -86,8 +79,7 @@ // gdb-command:print val // gdb-check:$25 = 14 -// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT' -// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT +// gdb-command:print lexical_scopes_in_block_expression::MUT_INT // gdb-check:$26 = 4 // gdb-command:print ten // gdb-check:$27 = 10 @@ -108,8 +100,7 @@ // gdb-command:print val // gdb-check:$32 = 15 -// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT' -// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT +// gdb-command:print lexical_scopes_in_block_expression::MUT_INT // gdb-check:$33 = 5 // gdb-command:print ten // gdb-check:$34 = 10 @@ -130,8 +121,7 @@ // gdb-command:print val // gdb-check:$39 = 16 -// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT' -// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT +// gdb-command:print lexical_scopes_in_block_expression::MUT_INT // gdb-check:$40 = 6 // gdb-command:print ten // gdb-check:$41 = 10 @@ -153,8 +143,7 @@ // gdb-command:print val // gdb-check:$46 = 17 -// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT' -// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT +// gdb-command:print lexical_scopes_in_block_expression::MUT_INT // gdb-check:$47 = 7 // gdb-command:print ten // gdb-check:$48 = 10 @@ -175,8 +164,7 @@ // gdb-command:print val // gdb-check:$53 = 18 -// gdbg-command:print 'lexical_scopes_in_block_expression::MUT_INT' -// gdbr-command:print lexical_scopes_in_block_expression::MUT_INT +// gdb-command:print lexical_scopes_in_block_expression::MUT_INT // gdb-check:$54 = 8 // gdb-command:print ten // gdb-check:$55 = 10 @@ -195,203 +183,155 @@ // STRUCT EXPRESSION // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] 11 -// lldbr-check:(isize) val = 11 +// lldb-check:[...] 11 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // FUNCTION CALL // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] 12 -// lldbr-check:(isize) val = 12 +// lldb-check:[...] 12 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // TUPLE EXPRESSION // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] 13 -// lldbr-check:(isize) val = 13 +// lldb-check:[...] 13 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // VEC EXPRESSION // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] 14 -// lldbr-check:(isize) val = 14 +// lldb-check:[...] 14 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // REPEAT VEC EXPRESSION // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] 15 -// lldbr-check:(isize) val = 15 +// lldb-check:[...] 15 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // ASSIGNMENT EXPRESSION // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] 16 -// lldbr-check:(isize) val = 16 +// lldb-check:[...] 16 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // ARITHMETIC EXPRESSION // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] 17 -// lldbr-check:(isize) val = 17 +// lldb-check:[...] 17 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // INDEX EXPRESSION // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] 18 -// lldbr-check:(isize) val = 18 +// lldb-check:[...] 18 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v val -// lldbg-check:[...] -1 -// lldbr-check:(i32) val = -1 +// lldb-check:[...] -1 // lldb-command:v ten -// lldbg-check:[...] 10 -// lldbr-check:(isize) ten = 10 +// lldb-check:[...] 10 // lldb-command:continue #![allow(unused_variables)] diff --git a/tests/debuginfo/limited-debuginfo.rs b/tests/debuginfo/limited-debuginfo.rs index 32f14955bfa..fb453d8078c 100644 --- a/tests/debuginfo/limited-debuginfo.rs +++ b/tests/debuginfo/limited-debuginfo.rs @@ -1,18 +1,13 @@ //@ ignore-lldb -//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 //@ compile-flags:-C debuginfo=1 // Make sure functions have proper names // gdb-command:info functions -// gdbg-check:[...]void[...]main([...]); -// gdbr-check:fn limited_debuginfo::main(); -// gdbg-check:[...]void[...]some_function([...]); -// gdbr-check:fn limited_debuginfo::some_function(); -// gdbg-check:[...]void[...]some_other_function([...]); -// gdbr-check:fn limited_debuginfo::some_other_function(); -// gdbg-check:[...]void[...]zzz([...]); -// gdbr-check:fn limited_debuginfo::zzz(); +// gdb-check:fn limited_debuginfo::main(); +// gdb-check:fn limited_debuginfo::some_function(); +// gdb-check:fn limited_debuginfo::some_other_function(); +// gdb-check:fn limited_debuginfo::zzz(); // gdb-command:run diff --git a/tests/debuginfo/macro-stepping.rs b/tests/debuginfo/macro-stepping.rs index 5f8d8287168..35bb6de4fef 100644 --- a/tests/debuginfo/macro-stepping.rs +++ b/tests/debuginfo/macro-stepping.rs @@ -1,8 +1,7 @@ -//@ ignore-windows //@ ignore-android //@ ignore-aarch64 -//@ min-lldb-version: 310 -//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 1800 +//@ min-gdb-version: 13.0 //@ aux-build:macro-stepping.rs @@ -11,7 +10,8 @@ #[macro_use] extern crate macro_stepping; // exports new_scope!() -//@ compile-flags:-g +//@ compile-flags:-g -Zmir-enable-passes=-SingleUseConsts +// SingleUseConsts shouldn't need to be disabled, see #128945 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/method-on-enum.rs b/tests/debuginfo/method-on-enum.rs index 8a57060717e..a570144450d 100644 --- a/tests/debuginfo/method-on-enum.rs +++ b/tests/debuginfo/method-on-enum.rs @@ -1,5 +1,5 @@ -//@ min-lldb-version: 310 -//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 1800 +//@ min-gdb-version: 13.0 //@ compile-flags:-g @@ -9,8 +9,7 @@ // STACK BY REF // gdb-command:print *self -// gdbg-check:$1 = {{RUST$ENUM$DISR = Variant2, [...]}, {RUST$ENUM$DISR = Variant2, __0 = 117901063}} -// gdbr-check:$1 = method_on_enum::Enum::Variant2(117901063) +// gdb-check:$1 = method_on_enum::Enum::Variant2(117901063) // gdb-command:print arg1 // gdb-check:$2 = -1 // gdb-command:print arg2 @@ -19,8 +18,7 @@ // STACK BY VAL // gdb-command:print self -// gdbg-check:$4 = {{RUST$ENUM$DISR = Variant2, [...]}, {RUST$ENUM$DISR = Variant2, __0 = 117901063}} -// gdbr-check:$4 = method_on_enum::Enum::Variant2(117901063) +// gdb-check:$4 = method_on_enum::Enum::Variant2(117901063) // gdb-command:print arg1 // gdb-check:$5 = -3 // gdb-command:print arg2 @@ -29,8 +27,7 @@ // OWNED BY REF // gdb-command:print *self -// gdbg-check:$7 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}} -// gdbr-check:$7 = method_on_enum::Enum::Variant1{x: 1799, y: 1799} +// gdb-check:$7 = method_on_enum::Enum::Variant1{x: 1799, y: 1799} // gdb-command:print arg1 // gdb-check:$8 = -5 // gdb-command:print arg2 @@ -39,8 +36,7 @@ // OWNED BY VAL // gdb-command:print self -// gdbg-check:$10 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}} -// gdbr-check:$10 = method_on_enum::Enum::Variant1{x: 1799, y: 1799} +// gdb-check:$10 = method_on_enum::Enum::Variant1{x: 1799, y: 1799} // gdb-command:print arg1 // gdb-check:$11 = -7 // gdb-command:print arg2 @@ -49,8 +45,7 @@ // OWNED MOVED // gdb-command:print *self -// gdbg-check:$13 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}} -// gdbr-check:$13 = method_on_enum::Enum::Variant1{x: 1799, y: 1799} +// gdb-check:$13 = method_on_enum::Enum::Variant1{x: 1799, y: 1799} // gdb-command:print arg1 // gdb-check:$14 = -9 // gdb-command:print arg2 diff --git a/tests/debuginfo/method-on-generic-struct.rs b/tests/debuginfo/method-on-generic-struct.rs index 64ef0e6bb0c..1e6c9d66178 100644 --- a/tests/debuginfo/method-on-generic-struct.rs +++ b/tests/debuginfo/method-on-generic-struct.rs @@ -1,7 +1,3 @@ -// Some versions of the non-rust-enabled LLDB print the wrong generic -// parameter type names in this test. -//@ needs-rust-lldb - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -10,8 +6,7 @@ // STACK BY REF // gdb-command:print *self -// gdbg-check:$1 = {x = {__0 = 8888, __1 = -8888}} -// gdbr-check:$1 = method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)} +// gdb-check:$1 = method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)} // gdb-command:print arg1 // gdb-check:$2 = -1 // gdb-command:print arg2 @@ -20,8 +15,7 @@ // STACK BY VAL // gdb-command:print self -// gdbg-check:$4 = {x = {__0 = 8888, __1 = -8888}} -// gdbr-check:$4 = method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)} +// gdb-check:$4 = method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)} // gdb-command:print arg1 // gdb-check:$5 = -3 // gdb-command:print arg2 @@ -30,8 +24,7 @@ // OWNED BY REF // gdb-command:print *self -// gdbg-check:$7 = {x = 1234.5} -// gdbr-check:$7 = method_on_generic_struct::Struct<f64> {x: 1234.5} +// gdb-check:$7 = method_on_generic_struct::Struct<f64> {x: 1234.5} // gdb-command:print arg1 // gdb-check:$8 = -5 // gdb-command:print arg2 @@ -40,8 +33,7 @@ // OWNED BY VAL // gdb-command:print self -// gdbg-check:$10 = {x = 1234.5} -// gdbr-check:$10 = method_on_generic_struct::Struct<f64> {x: 1234.5} +// gdb-check:$10 = method_on_generic_struct::Struct<f64> {x: 1234.5} // gdb-command:print arg1 // gdb-check:$11 = -7 // gdb-command:print arg2 @@ -50,8 +42,7 @@ // OWNED MOVED // gdb-command:print *self -// gdbg-check:$13 = {x = 1234.5} -// gdbr-check:$13 = method_on_generic_struct::Struct<f64> {x: 1234.5} +// gdb-check:$13 = method_on_generic_struct::Struct<f64> {x: 1234.5} // gdb-command:print arg1 // gdb-check:$14 = -9 // gdb-command:print arg2 @@ -65,62 +56,47 @@ // STACK BY REF // lldb-command:v *self -// lldbg-check:[...] Struct<(u32, i32)> { x: (8888, -8888) } -// lldbr-check:(method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { = 8888 = -8888 } } +// lldb-check:[...]Struct<(u32, i32)>) *self = { x = { 0 = 8888 1 = -8888 } } // lldb-command:v arg1 -// lldbg-check:[...] -1 -// lldbr-check:(isize) arg1 = -1 +// lldb-check:[...] -1 // lldb-command:v arg2 -// lldbg-check:[...] -2 -// lldbr-check:(isize) arg2 = -2 +// lldb-check:[...] -2 // lldb-command:continue // STACK BY VAL // lldb-command:v self -// lldbg-check:[...] Struct<(u32, i32)> { x: (8888, -8888) } -// lldbr-check:(method_on_generic_struct::Struct<(u32, i32)>) self = { x = { = 8888 = -8888 } } +// lldb-check:[...]Struct<(u32, i32)>) self = { x = { 0 = 8888 1 = -8888 } } // lldb-command:v arg1 -// lldbg-check:[...] -3 -// lldbr-check:(isize) arg1 = -3 +// lldb-check:[...] -3 // lldb-command:v arg2 -// lldbg-check:[...] -4 -// lldbr-check:(isize) arg2 = -4 +// lldb-check:[...] -4 // lldb-command:continue // OWNED BY REF // lldb-command:v *self -// lldbg-check:[...] Struct<f64> { x: 1234.5 } -// lldbr-check:(method_on_generic_struct::Struct<f64>) *self = Struct<f64> { x: 1234.5 } +// lldb-check:[...]Struct<double>) *self = { x = 1234.5 } // lldb-command:v arg1 -// lldbg-check:[...] -5 -// lldbr-check:(isize) arg1 = -5 +// lldb-check:[...] -5 // lldb-command:v arg2 -// lldbg-check:[...] -6 -// lldbr-check:(isize) arg2 = -6 +// lldb-check:[...] -6 // lldb-command:continue // OWNED BY VAL // lldb-command:v self -// lldbg-check:[...] Struct<f64> { x: 1234.5 } -// lldbr-check:(method_on_generic_struct::Struct<f64>) self = Struct<f64> { x: 1234.5 } +// lldb-check:[...]Struct<double>) self = { x = 1234.5 } // lldb-command:v arg1 -// lldbg-check:[...] -7 -// lldbr-check:(isize) arg1 = -7 +// lldb-check:[...] -7 // lldb-command:v arg2 -// lldbg-check:[...] -8 -// lldbr-check:(isize) arg2 = -8 +// lldb-check:[...] -8 // lldb-command:continue // OWNED MOVED // lldb-command:v *self -// lldbg-check:[...] Struct<f64> { x: 1234.5 } -// lldbr-check:(method_on_generic_struct::Struct<f64>) *self = Struct<f64> { x: 1234.5 } +// lldb-check:[...]Struct<double>) *self = { x = 1234.5 } // lldb-command:v arg1 -// lldbg-check:[...] -9 -// lldbr-check:(isize) arg1 = -9 +// lldb-check:[...] -9 // lldb-command:v arg2 -// lldbg-check:[...] -10 -// lldbr-check:(isize) arg2 = -10 +// lldb-check:[...] -10 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/method-on-struct.rs b/tests/debuginfo/method-on-struct.rs index a4129af5429..91f609365e9 100644 --- a/tests/debuginfo/method-on-struct.rs +++ b/tests/debuginfo/method-on-struct.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -8,8 +6,7 @@ // STACK BY REF // gdb-command:print *self -// gdbg-check:$1 = {x = 100} -// gdbr-check:$1 = method_on_struct::Struct {x: 100} +// gdb-check:$1 = method_on_struct::Struct {x: 100} // gdb-command:print arg1 // gdb-check:$2 = -1 // gdb-command:print arg2 @@ -18,8 +15,7 @@ // STACK BY VAL // gdb-command:print self -// gdbg-check:$4 = {x = 100} -// gdbr-check:$4 = method_on_struct::Struct {x: 100} +// gdb-check:$4 = method_on_struct::Struct {x: 100} // gdb-command:print arg1 // gdb-check:$5 = -3 // gdb-command:print arg2 @@ -28,8 +24,7 @@ // OWNED BY REF // gdb-command:print *self -// gdbg-check:$7 = {x = 200} -// gdbr-check:$7 = method_on_struct::Struct {x: 200} +// gdb-check:$7 = method_on_struct::Struct {x: 200} // gdb-command:print arg1 // gdb-check:$8 = -5 // gdb-command:print arg2 @@ -38,8 +33,7 @@ // OWNED BY VAL // gdb-command:print self -// gdbg-check:$10 = {x = 200} -// gdbr-check:$10 = method_on_struct::Struct {x: 200} +// gdb-check:$10 = method_on_struct::Struct {x: 200} // gdb-command:print arg1 // gdb-check:$11 = -7 // gdb-command:print arg2 @@ -48,8 +42,7 @@ // OWNED MOVED // gdb-command:print *self -// gdbg-check:$13 = {x = 200} -// gdbr-check:$13 = method_on_struct::Struct {x: 200} +// gdb-check:$13 = method_on_struct::Struct {x: 200} // gdb-command:print arg1 // gdb-check:$14 = -9 // gdb-command:print arg2 @@ -63,62 +56,47 @@ // STACK BY REF // lldb-command:v *self -// lldbg-check:[...] { x = 100 } -// lldbr-check:(method_on_struct::Struct) *self = Struct { x: 100 } +// lldb-check:[...] { x = 100 } // lldb-command:v arg1 -// lldbg-check:[...] -1 -// lldbr-check:(isize) arg1 = -1 +// lldb-check:[...] -1 // lldb-command:v arg2 -// lldbg-check:[...] -2 -// lldbr-check:(isize) arg2 = -2 +// lldb-check:[...] -2 // lldb-command:continue // STACK BY VAL // lldb-command:v self -// lldbg-check:[...] { x = 100 } -// lldbr-check:(method_on_struct::Struct) self = Struct { x: 100 } +// lldb-check:[...] { x = 100 } // lldb-command:v arg1 -// lldbg-check:[...] -3 -// lldbr-check:(isize) arg1 = -3 +// lldb-check:[...] -3 // lldb-command:v arg2 -// lldbg-check:[...] -4 -// lldbr-check:(isize) arg2 = -4 +// lldb-check:[...] -4 // lldb-command:continue // OWNED BY REF // lldb-command:v *self -// lldbg-check:[...] { x = 200 } -// lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 } +// lldb-check:[...] { x = 200 } // lldb-command:v arg1 -// lldbg-check:[...] -5 -// lldbr-check:(isize) arg1 = -5 +// lldb-check:[...] -5 // lldb-command:v arg2 -// lldbg-check:[...] -6 -// lldbr-check:(isize) arg2 = -6 +// lldb-check:[...] -6 // lldb-command:continue // OWNED BY VAL // lldb-command:v self -// lldbg-check:[...] { x = 200 } -// lldbr-check:(method_on_struct::Struct) self = Struct { x: 200 } +// lldb-check:[...] { x = 200 } // lldb-command:v arg1 -// lldbg-check:[...] -7 -// lldbr-check:(isize) arg1 = -7 +// lldb-check:[...] -7 // lldb-command:v arg2 -// lldbg-check:[...] -8 -// lldbr-check:(isize) arg2 = -8 +// lldb-check:[...] -8 // lldb-command:continue // OWNED MOVED // lldb-command:v *self -// lldbg-check:[...] { x = 200 } -// lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 } +// lldb-check:[...] { x = 200 } // lldb-command:v arg1 -// lldbg-check:[...] -9 -// lldbr-check:(isize) arg1 = -9 +// lldb-check:[...] -9 // lldb-command:v arg2 -// lldbg-check:[...] -10 -// lldbr-check:(isize) arg2 = -10 +// lldb-check:[...] -10 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/method-on-trait.rs b/tests/debuginfo/method-on-trait.rs index 0934c267ab1..7b95e1f81c7 100644 --- a/tests/debuginfo/method-on-trait.rs +++ b/tests/debuginfo/method-on-trait.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -8,8 +6,7 @@ // STACK BY REF // gdb-command:print *self -// gdbg-check:$1 = {x = 100} -// gdbr-check:$1 = method_on_trait::Struct {x: 100} +// gdb-check:$1 = method_on_trait::Struct {x: 100} // gdb-command:print arg1 // gdb-check:$2 = -1 // gdb-command:print arg2 @@ -18,8 +15,7 @@ // STACK BY VAL // gdb-command:print self -// gdbg-check:$4 = {x = 100} -// gdbr-check:$4 = method_on_trait::Struct {x: 100} +// gdb-check:$4 = method_on_trait::Struct {x: 100} // gdb-command:print arg1 // gdb-check:$5 = -3 // gdb-command:print arg2 @@ -28,8 +24,7 @@ // OWNED BY REF // gdb-command:print *self -// gdbg-check:$7 = {x = 200} -// gdbr-check:$7 = method_on_trait::Struct {x: 200} +// gdb-check:$7 = method_on_trait::Struct {x: 200} // gdb-command:print arg1 // gdb-check:$8 = -5 // gdb-command:print arg2 @@ -38,8 +33,7 @@ // OWNED BY VAL // gdb-command:print self -// gdbg-check:$10 = {x = 200} -// gdbr-check:$10 = method_on_trait::Struct {x: 200} +// gdb-check:$10 = method_on_trait::Struct {x: 200} // gdb-command:print arg1 // gdb-check:$11 = -7 // gdb-command:print arg2 @@ -48,8 +42,7 @@ // OWNED MOVED // gdb-command:print *self -// gdbg-check:$13 = {x = 200} -// gdbr-check:$13 = method_on_trait::Struct {x: 200} +// gdb-check:$13 = method_on_trait::Struct {x: 200} // gdb-command:print arg1 // gdb-check:$14 = -9 // gdb-command:print arg2 @@ -63,62 +56,47 @@ // STACK BY REF // lldb-command:v *self -// lldbg-check:[...] { x = 100 } -// lldbr-check:(method_on_trait::Struct) *self = { x = 100 } +// lldb-check:[...] { x = 100 } // lldb-command:v arg1 -// lldbg-check:[...] -1 -// lldbr-check:(isize) arg1 = -1 +// lldb-check:[...] -1 // lldb-command:v arg2 -// lldbg-check:[...] -2 -// lldbr-check:(isize) arg2 = -2 +// lldb-check:[...] -2 // lldb-command:continue // STACK BY VAL // lldb-command:v self -// lldbg-check:[...] { x = 100 } -// lldbr-check:(method_on_trait::Struct) self = { x = 100 } +// lldb-check:[...] { x = 100 } // lldb-command:v arg1 -// lldbg-check:[...] -3 -// lldbr-check:(isize) arg1 = -3 +// lldb-check:[...] -3 // lldb-command:v arg2 -// lldbg-check:[...] -4 -// lldbr-check:(isize) arg2 = -4 +// lldb-check:[...] -4 // lldb-command:continue // OWNED BY REF // lldb-command:v *self -// lldbg-check:[...] { x = 200 } -// lldbr-check:(method_on_trait::Struct) *self = { x = 200 } +// lldb-check:[...] { x = 200 } // lldb-command:v arg1 -// lldbg-check:[...] -5 -// lldbr-check:(isize) arg1 = -5 +// lldb-check:[...] -5 // lldb-command:v arg2 -// lldbg-check:[...] -6 -// lldbr-check:(isize) arg2 = -6 +// lldb-check:[...] -6 // lldb-command:continue // OWNED BY VAL // lldb-command:v self -// lldbg-check:[...] { x = 200 } -// lldbr-check:(method_on_trait::Struct) self = { x = 200 } +// lldb-check:[...] { x = 200 } // lldb-command:v arg1 -// lldbg-check:[...] -7 -// lldbr-check:(isize) arg1 = -7 +// lldb-check:[...] -7 // lldb-command:v arg2 -// lldbg-check:[...] -8 -// lldbr-check:(isize) arg2 = -8 +// lldb-check:[...] -8 // lldb-command:continue // OWNED MOVED // lldb-command:v *self -// lldbg-check:[...] { x = 200 } -// lldbr-check:(method_on_trait::Struct) *self = { x = 200 } +// lldb-check:[...] { x = 200 } // lldb-command:v arg1 -// lldbg-check:[...] -9 -// lldbr-check:(isize) arg1 = -9 +// lldb-check:[...] -9 // lldb-command:v arg2 -// lldbg-check:[...] -10 -// lldbr-check:(isize) arg2 = -10 +// lldb-check:[...] -10 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/method-on-tuple-struct.rs b/tests/debuginfo/method-on-tuple-struct.rs index 9cf9c6d7fba..04c00d88302 100644 --- a/tests/debuginfo/method-on-tuple-struct.rs +++ b/tests/debuginfo/method-on-tuple-struct.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -8,8 +6,7 @@ // STACK BY REF // gdb-command:print *self -// gdbg-check:$1 = {__0 = 100, __1 = -100.5} -// gdbr-check:$1 = method_on_tuple_struct::TupleStruct (100, -100.5) +// gdb-check:$1 = method_on_tuple_struct::TupleStruct (100, -100.5) // gdb-command:print arg1 // gdb-check:$2 = -1 // gdb-command:print arg2 @@ -18,8 +15,7 @@ // STACK BY VAL // gdb-command:print self -// gdbg-check:$4 = {__0 = 100, __1 = -100.5} -// gdbr-check:$4 = method_on_tuple_struct::TupleStruct (100, -100.5) +// gdb-check:$4 = method_on_tuple_struct::TupleStruct (100, -100.5) // gdb-command:print arg1 // gdb-check:$5 = -3 // gdb-command:print arg2 @@ -28,8 +24,7 @@ // OWNED BY REF // gdb-command:print *self -// gdbg-check:$7 = {__0 = 200, __1 = -200.5} -// gdbr-check:$7 = method_on_tuple_struct::TupleStruct (200, -200.5) +// gdb-check:$7 = method_on_tuple_struct::TupleStruct (200, -200.5) // gdb-command:print arg1 // gdb-check:$8 = -5 // gdb-command:print arg2 @@ -38,8 +33,7 @@ // OWNED BY VAL // gdb-command:print self -// gdbg-check:$10 = {__0 = 200, __1 = -200.5} -// gdbr-check:$10 = method_on_tuple_struct::TupleStruct (200, -200.5) +// gdb-check:$10 = method_on_tuple_struct::TupleStruct (200, -200.5) // gdb-command:print arg1 // gdb-check:$11 = -7 // gdb-command:print arg2 @@ -48,8 +42,7 @@ // OWNED MOVED // gdb-command:print *self -// gdbg-check:$13 = {__0 = 200, __1 = -200.5} -// gdbr-check:$13 = method_on_tuple_struct::TupleStruct (200, -200.5) +// gdb-check:$13 = method_on_tuple_struct::TupleStruct (200, -200.5) // gdb-command:print arg1 // gdb-check:$14 = -9 // gdb-command:print arg2 @@ -63,62 +56,47 @@ // STACK BY REF // lldb-command:v *self -// lldbg-check:[...] { 0 = 100 1 = -100.5 } -// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 100 1 = -100.5 } +// lldb-check:[...] { 0 = 100 1 = -100.5 } // lldb-command:v arg1 -// lldbg-check:[...] -1 -// lldbr-check:(isize) arg1 = -1 +// lldb-check:[...] -1 // lldb-command:v arg2 -// lldbg-check:[...] -2 -// lldbr-check:(isize) arg2 = -2 +// lldb-check:[...] -2 // lldb-command:continue // STACK BY VAL // lldb-command:v self -// lldbg-check:[...] { 0 = 100 1 = -100.5 } -// lldbr-check:(method_on_tuple_struct::TupleStruct) self = { 0 = 100 1 = -100.5 } +// lldb-check:[...] { 0 = 100 1 = -100.5 } // lldb-command:v arg1 -// lldbg-check:[...] -3 -// lldbr-check:(isize) arg1 = -3 +// lldb-check:[...] -3 // lldb-command:v arg2 -// lldbg-check:[...] -4 -// lldbr-check:(isize) arg2 = -4 +// lldb-check:[...] -4 // lldb-command:continue // OWNED BY REF // lldb-command:v *self -// lldbg-check:[...] { 0 = 200 1 = -200.5 } -// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 200 1 = -200.5 } +// lldb-check:[...] { 0 = 200 1 = -200.5 } // lldb-command:v arg1 -// lldbg-check:[...] -5 -// lldbr-check:(isize) arg1 = -5 +// lldb-check:[...] -5 // lldb-command:v arg2 -// lldbg-check:[...] -6 -// lldbr-check:(isize) arg2 = -6 +// lldb-check:[...] -6 // lldb-command:continue // OWNED BY VAL // lldb-command:v self -// lldbg-check:[...] { 0 = 200 1 = -200.5 } -// lldbr-check:(method_on_tuple_struct::TupleStruct) self = { 0 = 200 1 = -200.5 } +// lldb-check:[...] { 0 = 200 1 = -200.5 } // lldb-command:v arg1 -// lldbg-check:[...] -7 -// lldbr-check:(isize) arg1 = -7 +// lldb-check:[...] -7 // lldb-command:v arg2 -// lldbg-check:[...] -8 -// lldbr-check:(isize) arg2 = -8 +// lldb-check:[...] -8 // lldb-command:continue // OWNED MOVED // lldb-command:v *self -// lldbg-check:[...] { 0 = 200 1 = -200.5 } -// lldbr-check:(method_on_tuple_struct::TupleStruct) *self = { 0 = 200 1 = -200.5 } +// lldb-check:[...] { 0 = 200 1 = -200.5 } // lldb-command:v arg1 -// lldbg-check:[...] -9 -// lldbr-check:(isize) arg1 = -9 +// lldb-check:[...] -9 // lldb-command:v arg2 -// lldbg-check:[...] -10 -// lldbr-check:(isize) arg2 = -10 +// lldb-check:[...] -10 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/msvc-pretty-enums.rs b/tests/debuginfo/msvc-pretty-enums.rs index a6032cc8642..d60a7b81944 100644 --- a/tests/debuginfo/msvc-pretty-enums.rs +++ b/tests/debuginfo/msvc-pretty-enums.rs @@ -6,72 +6,72 @@ // lldb-command:run // lldb-command:v a -// lldbg-check:(core::option::Option<msvc_pretty_enums::CStyleEnum>) a = { value = { 0 = Low } } +// lldb-check:(core::option::Option<msvc_pretty_enums::CStyleEnum>) a = { value = { 0 = Low } } // lldb-command:v b -// lldbg-check:(core::option::Option<msvc_pretty_enums::CStyleEnum>) b = { value = $discr$ = '\x01' } +// lldb-check:(core::option::Option<msvc_pretty_enums::CStyleEnum>) b = { value = $discr$ = '\x01' } // lldb-command:v c -// lldbg-check:(msvc_pretty_enums::NicheLayoutEnum) c = { value = $discr$ = '\x11' } +// lldb-check:(msvc_pretty_enums::NicheLayoutEnum) c = { value = $discr$ = '\x11' } // lldb-command:v d -// lldbg-check:(msvc_pretty_enums::NicheLayoutEnum) d = { value = { my_data = High } } +// lldb-check:(msvc_pretty_enums::NicheLayoutEnum) d = { value = { my_data = High } } // lldb-command:v e -// lldbg-check:(msvc_pretty_enums::NicheLayoutEnum) e = { value = $discr$ = '\x13' } +// lldb-check:(msvc_pretty_enums::NicheLayoutEnum) e = { value = $discr$ = '\x13' } // lldb-command:v h -// lldbg-check:(core::option::Option<u32>) h = { value = { 0 = 12 } $discr$ = 1 } +// lldb-check:(core::option::Option<u32>) h = { value = { 0 = 12 } $discr$ = 1 } // lldb-command:v i -// lldbg-check:(core::option::Option<u32>) i = { value = $discr$ = 0 } +// lldb-check:(core::option::Option<u32>) i = { value = $discr$ = 0 } // lldb-command:v j -// lldbg-check:(msvc_pretty_enums::CStyleEnum) j = High +// lldb-check:(msvc_pretty_enums::CStyleEnum) j = High // lldb-command:v k -// lldbg-check:(core::option::Option<alloc::string::String>) k = { value = { 0 = "IAMA optional string!" { vec = size=21 { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 'o' [6] = 'p' [7] = 't' [8] = 'i' [9] = 'o' [10] = 'n' [11] = 'a' [12] = 'l' [13] = ' ' [14] = 's' [15] = 't' [16] = 'r' [17] = 'i' [18] = 'n' [19] = 'g' [20] = '!' } } } } +// lldb-check:(core::option::Option<alloc::string::String>) k = { value = { 0 = "IAMA optional string!" { vec = size=21 { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 'o' [6] = 'p' [7] = 't' [8] = 'i' [9] = 'o' [10] = 'n' [11] = 'a' [12] = 'l' [13] = ' ' [14] = 's' [15] = 't' [16] = 'r' [17] = 'i' [18] = 'n' [19] = 'g' [20] = '!' } } } } // lldb-command:v l -// lldbg-check:(core::result::Result<u32, msvc_pretty_enums::Empty>) l = { value = { 0 = {} } } +// lldb-check:(core::result::Result<u32, msvc_pretty_enums::Empty>) l = { value = { 0 = {} } } // lldb-command:v niche128_some -// lldbg-check:(core::option::Option<core::num::nonzero::NonZero<i128>>) niche128_some = { value = $discr$ = 123456 } +// lldb-check:(core::option::Option<core::num::nonzero::NonZero<i128>>) niche128_some = { value = $discr$ = 123456 } // lldb-command:v niche128_none -// lldbg-check:(core::option::Option<core::num::nonzero::NonZero<i128>>) niche128_none = { value = $discr$ = 0 } +// lldb-check:(core::option::Option<core::num::nonzero::NonZero<i128>>) niche128_none = { value = $discr$ = 0 } // lldb-command:v wrapping_niche128_untagged -// lldbg-check:(msvc_pretty_enums::Wrapping128Niche) wrapping_niche128_untagged = { value = { 0 = { 0 = 340282366920938463463374607431768211454 } } } +// lldb-check:(msvc_pretty_enums::Wrapping128Niche) wrapping_niche128_untagged = { value = { 0 = { 0 = 340282366920938463463374607431768211454 } } } // lldb-command:v wrapping_niche128_none1 -// lldbg-check:(msvc_pretty_enums::Wrapping128Niche) wrapping_niche128_none1 = { value = { 0 = { 0 = 2 } } } +// lldb-check:(msvc_pretty_enums::Wrapping128Niche) wrapping_niche128_none1 = { value = { 0 = { 0 = 2 } } } // lldb-command:v direct_tag_128_a -// lldbg-check:(msvc_pretty_enums::DirectTag128) direct_tag_128_a = { value = { 0 = 42 } $discr$ = 0 } +// lldb-check:(msvc_pretty_enums::DirectTag128) direct_tag_128_a = { value = { 0 = 42 } $discr$ = 0 } // lldb-command:v direct_tag_128_b -// lldbg-check:(msvc_pretty_enums::DirectTag128) direct_tag_128_b = { value = { 0 = 137 } $discr$ = 1 } +// lldb-check:(msvc_pretty_enums::DirectTag128) direct_tag_128_b = { value = { 0 = 137 } $discr$ = 1 } // &u32 is incorrectly formatted and LLDB thinks it's a char* so skipping niche_w_fields_1_some // lldb-command:v niche_w_fields_1_none -// lldbg-check:(msvc_pretty_enums::NicheLayoutWithFields1) niche_w_fields_1_none = { value = { 0 = 99 } $discr$ = 1 } +// lldb-check:(msvc_pretty_enums::NicheLayoutWithFields1) niche_w_fields_1_none = { value = { 0 = 99 } $discr$ = 1 } // lldb-command:v niche_w_fields_2_some -// lldbg-check:(msvc_pretty_enums::NicheLayoutWithFields2) niche_w_fields_2_some = { value = { 0 = 800 { __0 = { 0 = 800 } } 1 = 900 } $discr$ = 0 } +// lldb-check:(msvc_pretty_enums::NicheLayoutWithFields2) niche_w_fields_2_some = { value = { 0 = 800 { __0 = { 0 = 800 } } 1 = 900 } $discr$ = 0 } // lldb-command:v niche_w_fields_3_some -// lldbg-check:(msvc_pretty_enums::NicheLayoutWithFields3) niche_w_fields_3_some = { value = { 0 = '\x89' 1 = true } } +// lldb-check:(msvc_pretty_enums::NicheLayoutWithFields3) niche_w_fields_3_some = { value = { 0 = '\x89' 1 = true } } // lldb-command:v niche_w_fields_3_niche3 -// lldbg-check:(msvc_pretty_enums::NicheLayoutWithFields3) niche_w_fields_3_niche3 = { value = { 0 = '"' } $discr$ = '\x04' } +// lldb-check:(msvc_pretty_enums::NicheLayoutWithFields3) niche_w_fields_3_niche3 = { value = { 0 = '"' } $discr$ = '\x04' } // lldb-command:v arbitrary_discr1 -// lldbg-check:(msvc_pretty_enums::ArbitraryDiscr) arbitrary_discr1 = { value = { 0 = 1234 } $discr$ = 1000 } +// lldb-check:(msvc_pretty_enums::ArbitraryDiscr) arbitrary_discr1 = { value = { 0 = 1234 } $discr$ = 1000 } // lldb-command:v arbitrary_discr2 -// lldbg-check:(msvc_pretty_enums::ArbitraryDiscr) arbitrary_discr2 = { value = { 0 = 5678 } $discr$ = 5000000 } +// lldb-check:(msvc_pretty_enums::ArbitraryDiscr) arbitrary_discr2 = { value = { 0 = 5678 } $discr$ = 5000000 } // === CDB TESTS ================================================================================== @@ -206,6 +206,30 @@ // cdb-command: dx -r2 arbitrary_discr2,d // cdb-check: arbitrary_discr2,d : Def [Type: enum2$<msvc_pretty_enums::ArbitraryDiscr>] // cdb-check: [+0x[...]] __0 : 5678 [Type: unsigned int] +// +// cdb-command: dx c_style_u128_a +// cdb-check: c_style_u128_a : A [Type: enum2$<msvc_pretty_enums::CStyleU128>] +// +// cdb-command: dx c_style_u128_b +// cdb-check: c_style_u128_b : B [Type: enum2$<msvc_pretty_enums::CStyleU128>] +// +// cdb-command: dx c_style_u128_c +// cdb-check: c_style_u128_c : C [Type: enum2$<msvc_pretty_enums::CStyleU128>] +// +// cdb-command: dx c_style_u128_d +// cdb-check: c_style_u128_d : D [Type: enum2$<msvc_pretty_enums::CStyleU128>] +// +// cdb-command: dx c_style_i128_a +// cdb-check: c_style_i128_a : A [Type: enum2$<msvc_pretty_enums::CStyleI128>] +// +// cdb-command: dx c_style_i128_b +// cdb-check: c_style_i128_b : B [Type: enum2$<msvc_pretty_enums::CStyleI128>] +// +// cdb-command: dx c_style_i128_c +// cdb-check: c_style_i128_c : C [Type: enum2$<msvc_pretty_enums::CStyleI128>] +// +// cdb-command: dx c_style_i128_d +// cdb-check: c_style_i128_d : D [Type: enum2$<msvc_pretty_enums::CStyleI128>] #![feature(rustc_attrs)] #![feature(repr128)] #![feature(arbitrary_enum_discriminant)] @@ -270,6 +294,22 @@ enum ArbitraryDiscr { Def(u32) = 5000_000, } +#[repr(u128)] +pub enum CStyleU128 { + A = 0_u128, + B = 1_u128, + C = u64::MAX as u128 + 1, + D = u128::MAX, +} + +#[repr(i128)] +pub enum CStyleI128 { + A = 0_i128, + B = -1_i128, + C = i128::MIN, + D = i128::MAX, +} + fn main() { let a = Some(CStyleEnum::Low); let b = Option::<CStyleEnum>::None; @@ -313,6 +353,16 @@ fn main() { let arbitrary_discr1 = ArbitraryDiscr::Abc(1234); let arbitrary_discr2 = ArbitraryDiscr::Def(5678); + let c_style_u128_a = CStyleU128::A; + let c_style_u128_b = CStyleU128::B; + let c_style_u128_c = CStyleU128::C; + let c_style_u128_d = CStyleU128::D; + + let c_style_i128_a = CStyleI128::A; + let c_style_i128_b = CStyleI128::B; + let c_style_i128_c = CStyleI128::C; + let c_style_i128_d = CStyleI128::D; + zzz(); // #break } diff --git a/tests/debuginfo/multi-byte-chars.rs b/tests/debuginfo/multi-byte-chars.rs index 8fb066c7185..2ab98d265b8 100644 --- a/tests/debuginfo/multi-byte-chars.rs +++ b/tests/debuginfo/multi-byte-chars.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // This test checks whether debuginfo generation can handle multi-byte UTF-8 diff --git a/tests/debuginfo/multi-cgu.rs b/tests/debuginfo/multi-cgu.rs index 32fd6895877..3bb5269adea 100644 --- a/tests/debuginfo/multi-cgu.rs +++ b/tests/debuginfo/multi-cgu.rs @@ -1,9 +1,6 @@ // This test case makes sure that we get proper break points for binaries // compiled with multiple codegen units. (see #39160) - -//@ min-lldb-version: 310 - //@ compile-flags:-g -Ccodegen-units=2 // === GDB TESTS =============================================================== @@ -24,13 +21,11 @@ // lldb-command:run // lldb-command:v xxx -// lldbg-check:[...] 12345 -// lldbr-check:(u32) xxx = 12345 +// lldb-check:[...] 12345 // lldb-command:continue // lldb-command:v yyy -// lldbg-check:[...] 67890 -// lldbr-check:(u64) yyy = 67890 +// lldb-check:[...] 67890 // lldb-command:continue diff --git a/tests/debuginfo/multiple-functions-equal-var-names.rs b/tests/debuginfo/multiple-functions-equal-var-names.rs index 2d9caf75290..6ae9225d55c 100644 --- a/tests/debuginfo/multiple-functions-equal-var-names.rs +++ b/tests/debuginfo/multiple-functions-equal-var-names.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -23,18 +21,15 @@ // lldb-command:run // lldb-command:v abc -// lldbg-check:[...] 10101 -// lldbr-check:(i32) abc = 10101 +// lldb-check:[...] 10101 // lldb-command:continue // lldb-command:v abc -// lldbg-check:[...] 20202 -// lldbr-check:(i32) abc = 20202 +// lldb-check:[...] 20202 // lldb-command:continue // lldb-command:v abc -// lldbg-check:[...] 30303 -// lldbr-check:(i32) abc = 30303 +// lldb-check:[...] 30303 #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/multiple-functions.rs b/tests/debuginfo/multiple-functions.rs index 5c01a427051..3f7a0ded91b 100644 --- a/tests/debuginfo/multiple-functions.rs +++ b/tests/debuginfo/multiple-functions.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -23,18 +21,15 @@ // lldb-command:run // lldb-command:v a -// lldbg-check:[...] 10101 -// lldbr-check:(i32) a = 10101 +// lldb-check:[...] 10101 // lldb-command:continue // lldb-command:v b -// lldbg-check:[...] 20202 -// lldbr-check:(i32) b = 20202 +// lldb-check:[...] 20202 // lldb-command:continue // lldb-command:v c -// lldbg-check:[...] 30303 -// lldbr-check:(i32) c = 30303 +// lldb-check:[...] 30303 #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/name-shadowing-and-scope-nesting.rs b/tests/debuginfo/name-shadowing-and-scope-nesting.rs index 8813793e59e..d3829b60713 100644 --- a/tests/debuginfo/name-shadowing-and-scope-nesting.rs +++ b/tests/debuginfo/name-shadowing-and-scope-nesting.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -48,51 +46,39 @@ // lldb-command:run // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:v y -// lldbg-check:[...] true -// lldbr-check:(bool) y = true +// lldb-check:[...] true // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10 -// lldbr-check:(i32) x = 10 +// lldb-check:[...] 10 // lldb-command:v y -// lldbg-check:[...] true -// lldbr-check:(bool) y = true +// lldb-check:[...] true // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10.5 -// lldbr-check:(f64) x = 10.5 +// lldb-check:[...] 10.5 // lldb-command:v y -// lldbg-check:[...] 20 -// lldbr-check:(i32) y = 20 +// lldb-check:[...] 20 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] true -// lldbr-check:(bool) x = true +// lldb-check:[...] true // lldb-command:v y -// lldbg-check:[...] 2220 -// lldbr-check:(i32) y = 2220 +// lldb-check:[...] 2220 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 203203.5 -// lldbr-check:(f64) x = 203203.5 +// lldb-check:[...] 203203.5 // lldb-command:v y -// lldbg-check:[...] 2220 -// lldbr-check:(i32) y = 2220 +// lldb-check:[...] 2220 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10.5 -// lldbr-check:(f64) x = 10.5 +// lldb-check:[...] 10.5 // lldb-command:v y -// lldbg-check:[...] 20 -// lldbr-check:(i32) y = 20 +// lldb-check:[...] 20 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/numeric-types.rs b/tests/debuginfo/numeric-types.rs index 98bc31e8855..9d232578979 100644 --- a/tests/debuginfo/numeric-types.rs +++ b/tests/debuginfo/numeric-types.rs @@ -1,7 +1,6 @@ //@ compile-flags:-g -//@ min-gdb-version: 8.1 -//@ ignore-windows-gnu // emit_debug_gdb_scripts is disabled on Windows +//@ ignore-windows-gnu: #128981 // Tests the visualizations for `NonZero<T>`, `Wrapping<T>` and // `Atomic{Bool,I8,I16,I32,I64,Isize,U8,U16,U32,U64,Usize}` located in `libcore.natvis`. diff --git a/tests/debuginfo/option-like-enum.rs b/tests/debuginfo/option-like-enum.rs index c782796f473..72a41986dce 100644 --- a/tests/debuginfo/option-like-enum.rs +++ b/tests/debuginfo/option-like-enum.rs @@ -1,6 +1,5 @@ -//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 - -//@ min-lldb-version: 310 +//@ min-lldb-version: 1800 +//@ min-gdb-version: 13.0 //@ compile-flags:-g @@ -9,36 +8,28 @@ // gdb-command:run // gdb-command:print some -// gdbg-check:$1 = {RUST$ENCODED$ENUM$0$None = {__0 = 0x12345678}} -// gdbr-check:$1 = core::option::Option<&u32>::Some(0x12345678) +// gdb-check:$1 = core::option::Option<&u32>::Some(0x[...]) // gdb-command:print none -// gdbg-check:$2 = {RUST$ENCODED$ENUM$0$None = {__0 = 0x0}} -// gdbr-check:$2 = core::option::Option<&u32>::None +// gdb-check:$2 = core::option::Option<&u32>::None // gdb-command:print full -// gdbg-check:$3 = {RUST$ENCODED$ENUM$1$Empty = {__0 = 454545, __1 = 0x87654321, __2 = 9988}} -// gdbr-check:$3 = option_like_enum::MoreFields::Full(454545, 0x87654321, 9988) +// gdb-check:$3 = option_like_enum::MoreFields::Full(454545, 0x[...], 9988) -// gdbg-command:print empty_gdb->discr -// gdbr-command:print empty_gdb.discr -// gdb-check:$4 = (isize *) 0x0 +// gdb-command:print empty +// gdb-check:$4 = option_like_enum::MoreFields::Empty // gdb-command:print droid -// gdbg-check:$5 = {RUST$ENCODED$ENUM$2$Void = {id = 675675, range = 10000001, internals = 0x43218765}} -// gdbr-check:$5 = option_like_enum::NamedFields::Droid{id: 675675, range: 10000001, internals: 0x43218765} +// gdb-check:$5 = option_like_enum::NamedFields::Droid{id: 675675, range: 10000001, internals: 0x[...]} -// gdbg-command:print void_droid_gdb->internals -// gdbr-command:print void_droid_gdb.internals -// gdb-check:$6 = (isize *) 0x0 +// gdb-command:print void_droid +// gdb-check:$6 = option_like_enum::NamedFields::Void // gdb-command:print nested_non_zero_yep -// gdbg-check:$7 = {RUST$ENCODED$ENUM$1$2$Nope = {__0 = 10.5, __1 = {a = 10, b = 20, c = [...]}}} -// gdbr-check:$7 = option_like_enum::NestedNonZero::Yep(10.5, option_like_enum::NestedNonZeroField {a: 10, b: 20, c: 0x[...] "x[...]"}) +// gdb-check:$7 = option_like_enum::NestedNonZero::Yep(10.5, option_like_enum::NestedNonZeroField {a: 10, b: 20, c: 0x[...]}) // gdb-command:print nested_non_zero_nope -// gdbg-check:$8 = {RUST$ENCODED$ENUM$1$2$Nope = {__0 = [...], __1 = {a = [...], b = [...], c = 0x0}}} -// gdbr-check:$8 = option_like_enum::NestedNonZero::Nope +// gdb-check:$8 = option_like_enum::NestedNonZero::Nope // gdb-command:continue @@ -48,19 +39,19 @@ // lldb-command:run // lldb-command:v some -// lldb-check:[...] Some(&0x12345678) +// lldb-check:[...] Some(&0x[...]) // lldb-command:v none // lldb-check:[...] None // lldb-command:v full -// lldb-check:[...] Full(454545, &0x87654321, 9988) +// lldb-check:[...] Full(454545, &0x[...], 9988) // lldb-command:v empty // lldb-check:[...] Empty // lldb-command:v droid -// lldb-check:[...] Droid { id: 675675, range: 10000001, internals: &0x43218765 } +// lldb-check:[...] Droid { id: 675675, range: 10000001, internals: &0x[...] } // lldb-command:v void_droid // lldb-check:[...] Void @@ -85,11 +76,6 @@ // contains a non-nullable pointer, then this value is used as the discriminator. // The test cases in this file make sure that something readable is generated for // this kind of types. -// If the non-empty variant contains a single non-nullable pointer than the whole -// item is represented as just a pointer and not wrapped in a struct. -// Unfortunately (for these test cases) the content of the non-discriminant fields -// in the null-case is not defined. So we just read the discriminator field in -// this case (by casting the value to a memory-equivalent struct). enum MoreFields<'a> { Full(u32, &'a isize, i16), @@ -129,32 +115,26 @@ fn main() { let some_str: Option<&'static str> = Some("abc"); let none_str: Option<&'static str> = None; - let some: Option<&u32> = Some(unsafe { std::mem::transmute(0x12345678_usize) }); + let some: Option<&u32> = Some(&1234); let none: Option<&u32> = None; - let full = MoreFields::Full(454545, unsafe { std::mem::transmute(0x87654321_usize) }, 9988); - + let full = MoreFields::Full(454545, &1234, 9988); let empty = MoreFields::Empty; - let empty_gdb: &MoreFieldsRepr = unsafe { std::mem::transmute(&MoreFields::Empty) }; let droid = NamedFields::Droid { id: 675675, range: 10000001, - internals: unsafe { std::mem::transmute(0x43218765_usize) } + internals: &1234, }; - let void_droid = NamedFields::Void; - let void_droid_gdb: &NamedFieldsRepr = unsafe { std::mem::transmute(&NamedFields::Void) }; - let x = 'x'; let nested_non_zero_yep = NestedNonZero::Yep( 10.5, NestedNonZeroField { a: 10, b: 20, - c: &x + c: &'x', }); - let nested_non_zero_nope = NestedNonZero::Nope; zzz(); // #break diff --git a/tests/debuginfo/packed-struct-with-destructor.rs b/tests/debuginfo/packed-struct-with-destructor.rs index f9bac844376..f923d36953c 100644 --- a/tests/debuginfo/packed-struct-with-destructor.rs +++ b/tests/debuginfo/packed-struct-with-destructor.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -7,37 +5,29 @@ // gdb-command:run // gdb-command:print packed -// gdbg-check:$1 = {x = 123, y = 234, z = 345} -// gdbr-check:$1 = packed_struct_with_destructor::Packed {x: 123, y: 234, z: 345} +// gdb-check:$1 = packed_struct_with_destructor::Packed {x: 123, y: 234, z: 345} // gdb-command:print packedInPacked -// gdbg-check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}} -// gdbr-check:$2 = packed_struct_with_destructor::PackedInPacked {a: 1111, b: packed_struct_with_destructor::Packed {x: 2222, y: 3333, z: 4444}, c: 5555, d: packed_struct_with_destructor::Packed {x: 6666, y: 7777, z: 8888}} +// gdb-check:$2 = packed_struct_with_destructor::PackedInPacked {a: 1111, b: packed_struct_with_destructor::Packed {x: 2222, y: 3333, z: 4444}, c: 5555, d: packed_struct_with_destructor::Packed {x: 6666, y: 7777, z: 8888}} // gdb-command:print packedInUnpacked -// gdbg-check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}} -// gdbr-check:$3 = packed_struct_with_destructor::PackedInUnpacked {a: -1111, b: packed_struct_with_destructor::Packed {x: -2222, y: -3333, z: -4444}, c: -5555, d: packed_struct_with_destructor::Packed {x: -6666, y: -7777, z: -8888}} +// gdb-check:$3 = packed_struct_with_destructor::PackedInUnpacked {a: -1111, b: packed_struct_with_destructor::Packed {x: -2222, y: -3333, z: -4444}, c: -5555, d: packed_struct_with_destructor::Packed {x: -6666, y: -7777, z: -8888}} // gdb-command:print unpackedInPacked -// gdbg-check:$4 = {a = 987, b = {x = 876, y = 765, z = 654}, c = {x = 543, y = 432, z = 321}, d = 210} -// gdbr-check:$4 = packed_struct_with_destructor::UnpackedInPacked {a: 987, b: packed_struct_with_destructor::Unpacked {x: 876, y: 765, z: 654}, c: packed_struct_with_destructor::Unpacked {x: 543, y: 432, z: 321}, d: 210} +// gdb-check:$4 = packed_struct_with_destructor::UnpackedInPacked {a: 987, b: packed_struct_with_destructor::Unpacked {x: 876, y: 765, z: 654}, c: packed_struct_with_destructor::Unpacked {x: 543, y: 432, z: 321}, d: 210} // gdb-command:print packedInPackedWithDrop -// gdbg-check:$5 = {a = 11, b = {x = 22, y = 33, z = 44}, c = 55, d = {x = 66, y = 77, z = 88}} -// gdbr-check:$5 = packed_struct_with_destructor::PackedInPackedWithDrop {a: 11, b: packed_struct_with_destructor::Packed {x: 22, y: 33, z: 44}, c: 55, d: packed_struct_with_destructor::Packed {x: 66, y: 77, z: 88}} +// gdb-check:$5 = packed_struct_with_destructor::PackedInPackedWithDrop {a: 11, b: packed_struct_with_destructor::Packed {x: 22, y: 33, z: 44}, c: 55, d: packed_struct_with_destructor::Packed {x: 66, y: 77, z: 88}} // gdb-command:print packedInUnpackedWithDrop -// gdbg-check:$6 = {a = -11, b = {x = -22, y = -33, z = -44}, c = -55, d = {x = -66, y = -77, z = -88}} -// gdbr-check:$6 = packed_struct_with_destructor::PackedInUnpackedWithDrop {a: -11, b: packed_struct_with_destructor::Packed {x: -22, y: -33, z: -44}, c: -55, d: packed_struct_with_destructor::Packed {x: -66, y: -77, z: -88}} +// gdb-check:$6 = packed_struct_with_destructor::PackedInUnpackedWithDrop {a: -11, b: packed_struct_with_destructor::Packed {x: -22, y: -33, z: -44}, c: -55, d: packed_struct_with_destructor::Packed {x: -66, y: -77, z: -88}} // gdb-command:print unpackedInPackedWithDrop -// gdbg-check:$7 = {a = 98, b = {x = 87, y = 76, z = 65}, c = {x = 54, y = 43, z = 32}, d = 21} -// gdbr-check:$7 = packed_struct_with_destructor::UnpackedInPackedWithDrop {a: 98, b: packed_struct_with_destructor::Unpacked {x: 87, y: 76, z: 65}, c: packed_struct_with_destructor::Unpacked {x: 54, y: 43, z: 32}, d: 21} +// gdb-check:$7 = packed_struct_with_destructor::UnpackedInPackedWithDrop {a: 98, b: packed_struct_with_destructor::Unpacked {x: 87, y: 76, z: 65}, c: packed_struct_with_destructor::Unpacked {x: 54, y: 43, z: 32}, d: 21} // gdb-command:print deeplyNested -// gdbg-check:$8 = {a = {a = 1, b = {x = 2, y = 3, z = 4}, c = 5, d = {x = 6, y = 7, z = 8}}, b = {a = 9, b = {x = 10, y = 11, z = 12}, c = {x = 13, y = 14, z = 15}, d = 16}, c = {a = 17, b = {x = 18, y = 19, z = 20}, c = 21, d = {x = 22, y = 23, z = 24}}, d = {a = 25, b = {x = 26, y = 27, z = 28}, c = 29, d = {x = 30, y = 31, z = 32}}, e = {a = 33, b = {x = 34, y = 35, z = 36}, c = {x = 37, y = 38, z = 39}, d = 40}, f = {a = 41, b = {x = 42, y = 43, z = 44}, c = 45, d = {x = 46, y = 47, z = 48}}} -// gdbr-check:$8 = packed_struct_with_destructor::DeeplyNested {a: packed_struct_with_destructor::PackedInPacked {a: 1, b: packed_struct_with_destructor::Packed {x: 2, y: 3, z: 4}, c: 5, d: packed_struct_with_destructor::Packed {x: 6, y: 7, z: 8}}, b: packed_struct_with_destructor::UnpackedInPackedWithDrop {a: 9, b: packed_struct_with_destructor::Unpacked {x: 10, y: 11, z: 12}, c: packed_struct_with_destructor::Unpacked {x: 13, y: 14, z: 15}, d: 16}, c: packed_struct_with_destructor::PackedInUnpacked {a: 17, b: packed_struct_with_destructor::Packed {x: 18, y: 19, z: 20}, c: 21, d: packed_struct_with_destructor::Packed {x: 22, y: 23, z: 24}}, d: packed_struct_with_destructor::PackedInUnpackedWithDrop {a: 25, b: packed_struct_with_destructor::Packed {x: 26, y: 27, z: 28}, c: 29, d: packed_struct_with_destructor::Packed {x: 30, y: 31, z: 32}}, e: packed_struct_with_destructor::UnpackedInPacked {a: 33, b: packed_struct_with_destructor::Unpacked {x: 34, y: 35, z: 36}, c: packed_struct_with_destructor::Unpacked {x: 37, y: 38, z: 39}, d: 40}, f: packed_struct_with_destructor::PackedInPackedWithDrop {a: 41, b: packed_struct_with_destructor::Packed {x: 42, y: 43, z: 44}, c: 45, d: packed_struct_with_destructor::Packed {x: 46, y: 47, z: 48}}} +// gdb-check:$8 = packed_struct_with_destructor::DeeplyNested {a: packed_struct_with_destructor::PackedInPacked {a: 1, b: packed_struct_with_destructor::Packed {x: 2, y: 3, z: 4}, c: 5, d: packed_struct_with_destructor::Packed {x: 6, y: 7, z: 8}}, b: packed_struct_with_destructor::UnpackedInPackedWithDrop {a: 9, b: packed_struct_with_destructor::Unpacked {x: 10, y: 11, z: 12}, c: packed_struct_with_destructor::Unpacked {x: 13, y: 14, z: 15}, d: 16}, c: packed_struct_with_destructor::PackedInUnpacked {a: 17, b: packed_struct_with_destructor::Packed {x: 18, y: 19, z: 20}, c: 21, d: packed_struct_with_destructor::Packed {x: 22, y: 23, z: 24}}, d: packed_struct_with_destructor::PackedInUnpackedWithDrop {a: 25, b: packed_struct_with_destructor::Packed {x: 26, y: 27, z: 28}, c: 29, d: packed_struct_with_destructor::Packed {x: 30, y: 31, z: 32}}, e: packed_struct_with_destructor::UnpackedInPacked {a: 33, b: packed_struct_with_destructor::Unpacked {x: 34, y: 35, z: 36}, c: packed_struct_with_destructor::Unpacked {x: 37, y: 38, z: 39}, d: 40}, f: packed_struct_with_destructor::PackedInPackedWithDrop {a: 41, b: packed_struct_with_destructor::Packed {x: 42, y: 43, z: 44}, c: 45, d: packed_struct_with_destructor::Packed {x: 46, y: 47, z: 48}}} // === LLDB TESTS ================================================================================== @@ -45,36 +35,28 @@ // lldb-command:run // lldb-command:v packed -// lldbg-check:[...] { x = 123 y = 234 z = 345 } -// lldbr-check:(packed_struct_with_destructor::Packed) packed = { x = 123 y = 234 z = 345 } +// lldb-check:[...] { x = 123 y = 234 z = 345 } // lldb-command:v packedInPacked -// lldbg-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } -// lldbr-check:(packed_struct_with_destructor::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } +// lldb-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldb-command:v packedInUnpacked -// lldbg-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } -// lldbr-check:(packed_struct_with_destructor::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } +// lldb-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldb-command:v unpackedInPacked -// lldbg-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } -// lldbr-check:(packed_struct_with_destructor::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } +// lldb-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 } c = { x = 543 y = 432 z = 321 } d = 210 } // lldb-command:v packedInPackedWithDrop -// lldbg-check:[...] { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } -// lldbr-check:(packed_struct_with_destructor::PackedInPackedWithDrop) packedInPackedWithDrop = { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } +// lldb-check:[...] { a = 11 b = { x = 22 y = 33 z = 44 } c = 55 d = { x = 66 y = 77 z = 88 } } // lldb-command:v packedInUnpackedWithDrop -// lldbg-check:[...] { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } -// lldbr-check:(packed_struct_with_destructor::PackedInUnpackedWithDrop) packedInUnpackedWithDrop = { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } +// lldb-check:[...] { a = -11 b = { x = -22 y = -33 z = -44 } c = -55 d = { x = -66 y = -77 z = -88 } } // lldb-command:v unpackedInPackedWithDrop -// lldbg-check:[...] { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } -// lldbr-check:(packed_struct_with_destructor::UnpackedInPackedWithDrop) unpackedInPackedWithDrop = { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } +// lldb-check:[...] { a = 98 b = { x = 87 y = 76 z = 65 } c = { x = 54 y = 43 z = 32 } d = 21 } // lldb-command:v deeplyNested -// lldbg-check:[...] { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } -// lldbr-check:(packed_struct_with_destructor::DeeplyNested) deeplyNested = { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } +// lldb-check:[...] { a = { a = 1 b = { x = 2 y = 3 z = 4 } c = 5 d = { x = 6 y = 7 z = 8 } } b = { a = 9 b = { x = 10 y = 11 z = 12 } c = { x = 13 y = 14 z = 15 } d = 16 } c = { a = 17 b = { x = 18 y = 19 z = 20 } c = 21 d = { x = 22 y = 23 z = 24 } } d = { a = 25 b = { x = 26 y = 27 z = 28 } c = 29 d = { x = 30 y = 31 z = 32 } } e = { a = 33 b = { x = 34 y = 35 z = 36 } c = { x = 37 y = 38 z = 39 } d = 40 } f = { a = 41 b = { x = 42 y = 43 z = 44 } c = 45 d = { x = 46 y = 47 z = 48 } } } #![allow(unused_variables)] diff --git a/tests/debuginfo/packed-struct.rs b/tests/debuginfo/packed-struct.rs index ea9aa22ba55..2b3652fe861 100644 --- a/tests/debuginfo/packed-struct.rs +++ b/tests/debuginfo/packed-struct.rs @@ -1,6 +1,3 @@ -//@ min-lldb-version: 310 -//@ ignore-gdb-version: 7.11.90 - 7.12.9 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -8,20 +5,16 @@ // gdb-command:run // gdb-command:print packed -// gdbg-check:$1 = {x = 123, y = 234, z = 345} -// gdbr-check:$1 = packed_struct::Packed {x: 123, y: 234, z: 345} +// gdb-check:$1 = packed_struct::Packed {x: 123, y: 234, z: 345} // gdb-command:print packedInPacked -// gdbg-check:$2 = {a = 1111, b = {x = 2222, y = 3333, z = 4444}, c = 5555, d = {x = 6666, y = 7777, z = 8888}} -// gdbr-check:$2 = packed_struct::PackedInPacked {a: 1111, b: packed_struct::Packed {x: 2222, y: 3333, z: 4444}, c: 5555, d: packed_struct::Packed {x: 6666, y: 7777, z: 8888}} +// gdb-check:$2 = packed_struct::PackedInPacked {a: 1111, b: packed_struct::Packed {x: 2222, y: 3333, z: 4444}, c: 5555, d: packed_struct::Packed {x: 6666, y: 7777, z: 8888}} // gdb-command:print packedInUnpacked -// gdbg-check:$3 = {a = -1111, b = {x = -2222, y = -3333, z = -4444}, c = -5555, d = {x = -6666, y = -7777, z = -8888}} -// gdbr-check:$3 = packed_struct::PackedInUnpacked {a: -1111, b: packed_struct::Packed {x: -2222, y: -3333, z: -4444}, c: -5555, d: packed_struct::Packed {x: -6666, y: -7777, z: -8888}} +// gdb-check:$3 = packed_struct::PackedInUnpacked {a: -1111, b: packed_struct::Packed {x: -2222, y: -3333, z: -4444}, c: -5555, d: packed_struct::Packed {x: -6666, y: -7777, z: -8888}} // gdb-command:print unpackedInPacked -// gdbg-check:$4 = {a = 987, b = {x = 876, y = 765, z = 654, w = 543}, c = {x = 432, y = 321, z = 210, w = 109}, d = -98} -// gdbr-check:$4 = packed_struct::UnpackedInPacked {a: 987, b: packed_struct::Unpacked {x: 876, y: 765, z: 654, w: 543}, c: packed_struct::Unpacked {x: 432, y: 321, z: 210, w: 109}, d: -98} +// gdb-check:$4 = packed_struct::UnpackedInPacked {a: 987, b: packed_struct::Unpacked {x: 876, y: 765, z: 654, w: 543}, c: packed_struct::Unpacked {x: 432, y: 321, z: 210, w: 109}, d: -98} // gdb-command:print sizeof(packed) // gdb-check:$5 = 14 @@ -35,28 +28,22 @@ // lldb-command:run // lldb-command:v packed -// lldbg-check:[...] { x = 123 y = 234 z = 345 } -// lldbr-check:(packed_struct::Packed) packed = { x = 123 y = 234 z = 345 } +// lldb-check:[...] { x = 123 y = 234 z = 345 } // lldb-command:v packedInPacked -// lldbg-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } -// lldbr-check:(packed_struct::PackedInPacked) packedInPacked = { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } +// lldb-check:[...] { a = 1111 b = { x = 2222 y = 3333 z = 4444 } c = 5555 d = { x = 6666 y = 7777 z = 8888 } } // lldb-command:v packedInUnpacked -// lldbg-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } -// lldbr-check:(packed_struct::PackedInUnpacked) packedInUnpacked = { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } +// lldb-check:[...] { a = -1111 b = { x = -2222 y = -3333 z = -4444 } c = -5555 d = { x = -6666 y = -7777 z = -8888 } } // lldb-command:v unpackedInPacked -// lldbg-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } -// lldbr-check:(packed_struct::UnpackedInPacked) unpackedInPacked = { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } +// lldb-check:[...] { a = 987 b = { x = 876 y = 765 z = 654 w = 543 } c = { x = 432 y = 321 z = 210 w = 109 } d = -98 } // lldb-command:expr sizeof(packed) -// lldbg-check:[...] 14 -// lldbr-check:(usize) [...] 14 +// lldb-check:[...] 14 // lldb-command:expr sizeof(packedInPacked) -// lldbg-check:[...] 40 -// lldbr-check:(usize) [...] 40 +// lldb-check:[...] 40 #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/pretty-huge-vec.rs b/tests/debuginfo/pretty-huge-vec.rs index f4b5345b66d..093fbc5b12d 100644 --- a/tests/debuginfo/pretty-huge-vec.rs +++ b/tests/debuginfo/pretty-huge-vec.rs @@ -1,9 +1,6 @@ -//@ ignore-windows failing on win32 bot -//@ ignore-freebsd: gdb package too new +//@ ignore-windows-gnu: #128981 //@ ignore-android: FIXME(#10381) //@ compile-flags:-g -//@ min-gdb-version: 8.1 -//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/pretty-slices.rs b/tests/debuginfo/pretty-slices.rs index 9defa344be0..f1aad836434 100644 --- a/tests/debuginfo/pretty-slices.rs +++ b/tests/debuginfo/pretty-slices.rs @@ -1,16 +1,14 @@ //@ ignore-android: FIXME(#10381) -//@ ignore-windows +//@ ignore-windows-gnu: #128981 //@ compile-flags:-g // gdb-command: run // gdb-command: print slice -// gdbg-check: $1 = struct &[i32](size=3) = {0, 1, 2} -// gdbr-check: $1 = &[i32](size=3) = {0, 1, 2} +// gdb-check: $1 = &[i32](size=3) = {0, 1, 2} // gdb-command: print mut_slice -// gdbg-check: $2 = struct &mut [i32](size=4) = {2, 3, 5, 7} -// gdbr-check: $2 = &mut [i32](size=4) = {2, 3, 5, 7} +// gdb-check: $2 = &mut [i32](size=4) = {2, 3, 5, 7} // gdb-command: print str_slice // gdb-check: $3 = "string slice" diff --git a/tests/debuginfo/pretty-std-collections.rs b/tests/debuginfo/pretty-std-collections.rs index e9c2c4f2a1d..5e133ee718e 100644 --- a/tests/debuginfo/pretty-std-collections.rs +++ b/tests/debuginfo/pretty-std-collections.rs @@ -1,14 +1,7 @@ -//@ ignore-windows failing on win32 bot -//@ ignore-freebsd: gdb package too new //@ ignore-android: FIXME(#10381) +//@ ignore-windows-gnu: #128981 //@ compile-flags:-g -// The pretty printers being tested here require the patch from -// https://sourceware.org/bugzilla/show_bug.cgi?id=21763 -//@ min-gdb-version: 8.1 - -//@ min-lldb-version: 310 - // === GDB TESTS =================================================================================== // gdb-command: run @@ -59,20 +52,16 @@ // lldb-command:run // lldb-command:v vec_deque -// lldbg-check:[...] size=3 { [0] = 5 [1] = 3 [2] = 7 } -// lldbr-check:(alloc::collections::vec_deque::VecDeque<i32>) vec_deque = size=3 = { [0] = 5 [1] = 3 [2] = 7 } +// lldb-check:[...] size=3 { [0] = 5 [1] = 3 [2] = 7 } // lldb-command:v vec_deque2 -// lldbg-check:[...] size=7 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 } -// lldbr-check:(alloc::collections::vec_deque::VecDeque<i32>) vec_deque2 = size=7 = { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 } +// lldb-check:[...] size=7 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 [4] = 6 [5] = 7 [6] = 8 } // lldb-command:v hash_map -// lldbg-check:[...] size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } } -// lldbr-check:(std::collections::hash::map::HashMap<u64, u64, [...]>) hash_map = size=4 size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } } +// lldb-check:[...] size=4 { [0] = { 0 = 1 1 = 10 } [1] = { 0 = 2 1 = 20 } [2] = { 0 = 3 1 = 30 } [3] = { 0 = 4 1 = 40 } } // lldb-command:v hash_set -// lldbg-check:[...] size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 } -// lldbr-check:(std::collections::hash::set::HashSet<u64, [...]>) hash_set = size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 } +// lldb-check:[...] size=4 { [0] = 1 [1] = 2 [2] = 3 [3] = 4 } #![allow(unused_variables)] use std::collections::BTreeMap; diff --git a/tests/debuginfo/pretty-std.rs b/tests/debuginfo/pretty-std.rs index 45c6dbf3439..d7c640a5bea 100644 --- a/tests/debuginfo/pretty-std.rs +++ b/tests/debuginfo/pretty-std.rs @@ -1,10 +1,8 @@ // ignore-tidy-linelength -//@ ignore-freebsd: gdb package too new -//@ only-cdb // "Temporarily" ignored on GDB/LLDB due to debuginfo tests being disabled, see PR 47155 +//@ ignore-windows-gnu: #128981 //@ ignore-android: FIXME(#10381) //@ compile-flags:-g -//@ min-gdb-version: 7.7 -//@ min-lldb-version: 310 +//@ min-lldb-version: 1800 //@ min-cdb-version: 10.0.18317.1001 // === GDB TESTS =================================================================================== @@ -12,10 +10,10 @@ // gdb-command: run // gdb-command: print slice -// gdb-check:$1 = &[i32](len: 4) = {0, 1, 2, 3} +// gdb-check:$1 = &[i32](size=4) = {0, 1, 2, 3} // gdb-command: print vec -// gdb-check:$2 = Vec<u64, alloc::alloc::Global>(len: 4, cap: [...]) = {4, 5, 6, 7} +// gdb-check:$2 = Vec(size=4) = {4, 5, 6, 7} // gdb-command: print str_slice // gdb-check:$3 = "IAMA string slice!" @@ -24,37 +22,36 @@ // gdb-check:$4 = "IAMA string!" // gdb-command: print some -// gdb-check:$5 = Some = {8} +// gdb-check:$5 = core::option::Option<i16>::Some(8) // gdb-command: print none -// gdbg-check:$6 = None -// gdbr-check:$6 = core::option::Option::None +// gdb-check:$6 = core::option::Option<i64>::None // gdb-command: print os_string // gdb-check:$7 = "IAMA OS string 😃" // gdb-command: print some_string -// gdb-check:$8 = Some = {"IAMA optional string!"} +// gdb-check:$8 = core::option::Option<alloc::string::String>::Some("IAMA optional string!") -// gdb-command: set print length 5 +// gdb-command: set print elements 5 // gdb-command: print some_string -// gdb-check:$8 = Some = {"IAMA "...} +// gdb-check:$9 = core::option::Option<alloc::string::String>::Some("IAMA "...) // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v slice -// lldb-check:[...] slice = &[0, 1, 2, 3] +// lldb-check:[...] slice = size=4 { [0] = 0 [1] = 1 [2] = 2 [3] = 3 } // lldb-command:v vec -// lldb-check:[...] vec = vec![4, 5, 6, 7] +// lldb-check:[...] vec = size=4 { [0] = 4 [1] = 5 [2] = 6 [3] = 7 } // lldb-command:v str_slice -// lldb-check:[...] str_slice = "IAMA string slice!" +// lldb-check:[...] str_slice = "IAMA string slice!" { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 's' [6] = 't' [7] = 'r' [8] = 'i' [9] = 'n' [10] = 'g' [11] = ' ' [12] = 's' [13] = 'l' [14] = 'i' [15] = 'c' [16] = 'e' [17] = '!' } // lldb-command:v string -// lldb-check:[...] string = "IAMA string!" +// lldb-check:[...] string = "IAMA string!" { vec = size=12 { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 's' [6] = 't' [7] = 'r' [8] = 'i' [9] = 'n' [10] = 'g' [11] = '!' } } // lldb-command:v some // lldb-check:[...] some = Some(8) @@ -63,7 +60,7 @@ // lldb-check:[...] none = None // lldb-command:v os_string -// lldb-check:[...] os_string = "IAMA OS string 😃"[...] +// lldb-check:[...] os_string = "IAMA OS string 😃" { inner = { inner = size=19 { [0] = 'I' [1] = 'A' [2] = 'M' [3] = 'A' [4] = ' ' [5] = 'O' [6] = 'S' [7] = ' ' [8] = 's' [9] = 't' [10] = 'r' [11] = 'i' [12] = 'n' [13] = 'g' [14] = ' ' [15] = '\xf0' [16] = '\x9f' [17] = '\x98' [18] = '\x83' } } } // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/pretty-uninitialized-vec.rs b/tests/debuginfo/pretty-uninitialized-vec.rs index 225b4a6d534..cea2f26ef58 100644 --- a/tests/debuginfo/pretty-uninitialized-vec.rs +++ b/tests/debuginfo/pretty-uninitialized-vec.rs @@ -1,9 +1,6 @@ -//@ ignore-windows failing on win32 bot -//@ ignore-freebsd: gdb package too new +//@ ignore-windows-gnu: #128981 //@ ignore-android: FIXME(#10381) //@ compile-flags:-g -//@ min-gdb-version: 8.1 -//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== diff --git a/tests/debuginfo/rc_arc.rs b/tests/debuginfo/rc_arc.rs index ca0feb1f465..f636c60702c 100644 --- a/tests/debuginfo/rc_arc.rs +++ b/tests/debuginfo/rc_arc.rs @@ -1,7 +1,6 @@ -//@ ignore-windows-gnu: pretty-printers are not loaded +//@ ignore-windows-gnu: #128981 //@ compile-flags:-g -//@ min-gdb-version: 8.1 //@ min-cdb-version: 10.0.18317.1001 // === GDB TESTS ================================================================================== diff --git a/tests/debuginfo/recursive-struct.rs b/tests/debuginfo/recursive-struct.rs index 1d039527d1a..a97eb295eb4 100644 --- a/tests/debuginfo/recursive-struct.rs +++ b/tests/debuginfo/recursive-struct.rs @@ -1,61 +1,58 @@ //@ ignore-lldb -// Require a gdb that can read DW_TAG_variant_part. -//@ min-gdb-version: 8.2 - //@ compile-flags:-g // gdb-command:run // gdb-command:print stack_unique.value // gdb-check:$1 = 0 -// gdbr-command:print stack_unique.next.val.value +// gdb-command:print stack_unique.next.val.value // gdb-check:$2 = 1 -// gdbr-command:print unique_unique.value +// gdb-command:print unique_unique.value // gdb-check:$3 = 2 -// gdbr-command:print unique_unique.next.val.value +// gdb-command:print unique_unique.next.val.value // gdb-check:$4 = 3 // gdb-command:print vec_unique[0].value // gdb-check:$5 = 6.5 -// gdbr-command:print vec_unique[0].next.val.value +// gdb-command:print vec_unique[0].next.val.value // gdb-check:$6 = 7.5 -// gdbr-command:print borrowed_unique.value +// gdb-command:print borrowed_unique.value // gdb-check:$7 = 8.5 -// gdbr-command:print borrowed_unique.next.val.value +// gdb-command:print borrowed_unique.next.val.value // gdb-check:$8 = 9.5 // LONG CYCLE // gdb-command:print long_cycle1.value // gdb-check:$9 = 20 -// gdbr-command:print long_cycle1.next.value +// gdb-command:print long_cycle1.next.value // gdb-check:$10 = 21 -// gdbr-command:print long_cycle1.next.next.value +// gdb-command:print long_cycle1.next.next.value // gdb-check:$11 = 22 -// gdbr-command:print long_cycle1.next.next.next.value +// gdb-command:print long_cycle1.next.next.next.value // gdb-check:$12 = 23 // gdb-command:print long_cycle2.value // gdb-check:$13 = 24 -// gdbr-command:print long_cycle2.next.value +// gdb-command:print long_cycle2.next.value // gdb-check:$14 = 25 -// gdbr-command:print long_cycle2.next.next.value +// gdb-command:print long_cycle2.next.next.value // gdb-check:$15 = 26 // gdb-command:print long_cycle3.value // gdb-check:$16 = 27 -// gdbr-command:print long_cycle3.next.value +// gdb-command:print long_cycle3.next.value // gdb-check:$17 = 28 // gdb-command:print long_cycle4.value // gdb-check:$18 = 29.5 -// gdbr-command:print long_cycle_w_anon_types.value +// gdb-command:print long_cycle_w_anon_types.value // gdb-check:$19 = 30 -// gdbr-command:print long_cycle_w_anon_types.next.val.value +// gdb-command:print long_cycle_w_anon_types.next.val.value // gdb-check:$20 = 31 // gdb-command:continue diff --git a/tests/debuginfo/reference-debuginfo.rs b/tests/debuginfo/reference-debuginfo.rs index e2fb964ace5..773c3ae4bc3 100644 --- a/tests/debuginfo/reference-debuginfo.rs +++ b/tests/debuginfo/reference-debuginfo.rs @@ -3,7 +3,6 @@ // and leaves codegen to create a ladder of allocations so as `*a == b`. // //@ compile-flags:-g -Zmir-enable-passes=+ReferencePropagation,-ConstDebugInfo -//@ min-lldb-version: 310 // === GDB TESTS =================================================================================== @@ -18,8 +17,7 @@ // gdb-check:$3 = 97 // gdb-command:print *i8_ref -// gdbg-check:$4 = 68 'D' -// gdbr-check:$4 = 68 +// gdb-check:$4 = 68 // gdb-command:print *i16_ref // gdb-check:$5 = -16 @@ -34,8 +32,7 @@ // gdb-check:$8 = 1 // gdb-command:print *u8_ref -// gdbg-check:$9 = 100 'd' -// gdbr-check:$9 = 100 +// gdb-check:$9 = 100 // gdb-command:print *u16_ref // gdb-check:$10 = 16 @@ -63,68 +60,50 @@ // lldb-command:run // lldb-command:v *bool_ref -// lldbg-check:[...] true -// lldbr-check:(bool) *bool_ref = true +// lldb-check:[...] true // lldb-command:v *int_ref -// lldbg-check:[...] -1 -// lldbr-check:(isize) *int_ref = -1 +// lldb-check:[...] -1 -// NOTE: only rust-enabled lldb supports 32bit chars -// lldbr-command:print *char_ref -// lldbr-check:(char) *char_ref = 'a' // lldb-command:v *i8_ref -// lldbg-check:[...] 'D' -// lldbr-check:(i8) *i8_ref = 68 +// lldb-check:[...] 'D' // lldb-command:v *i16_ref -// lldbg-check:[...] -16 -// lldbr-check:(i16) *i16_ref = -16 +// lldb-check:[...] -16 // lldb-command:v *i32_ref -// lldbg-check:[...] -32 -// lldbr-check:(i32) *i32_ref = -32 +// lldb-check:[...] -32 // lldb-command:v *i64_ref -// lldbg-check:[...] -64 -// lldbr-check:(i64) *i64_ref = -64 +// lldb-check:[...] -64 // lldb-command:v *uint_ref -// lldbg-check:[...] 1 -// lldbr-check:(usize) *uint_ref = 1 +// lldb-check:[...] 1 // lldb-command:v *u8_ref -// lldbg-check:[...] 'd' -// lldbr-check:(u8) *u8_ref = 100 +// lldb-check:[...] 'd' // lldb-command:v *u16_ref -// lldbg-check:[...] 16 -// lldbr-check:(u16) *u16_ref = 16 +// lldb-check:[...] 16 // lldb-command:v *u32_ref -// lldbg-check:[...] 32 -// lldbr-check:(u32) *u32_ref = 32 +// lldb-check:[...] 32 // lldb-command:v *u64_ref -// lldbg-check:[...] 64 -// lldbr-check:(u64) *u64_ref = 64 +// lldb-check:[...] 64 // lldb-command:v *f16_ref -// lldbg-check:[...] 1.5 -// lldbr-check:(f16) *f16_ref = 1.5 +// lldb-check:[...] 1.5 // lldb-command:v *f32_ref -// lldbg-check:[...] 2.5 -// lldbr-check:(f32) *f32_ref = 2.5 +// lldb-check:[...] 2.5 // lldb-command:v *f64_ref -// lldbg-check:[...] 3.5 -// lldbr-check:(f64) *f64_ref = 3.5 +// lldb-check:[...] 3.5 // lldb-command:v *f64_double_ref -// lldbg-check:[...] 3.5 -// lldbr-check:(f64) **f64_double_ref = 3.5 +// lldb-check:[...] 3.5 #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/regression-bad-location-list-67992.rs b/tests/debuginfo/regression-bad-location-list-67992.rs index fe410942d51..0ec474b5b5a 100644 --- a/tests/debuginfo/regression-bad-location-list-67992.rs +++ b/tests/debuginfo/regression-bad-location-list-67992.rs @@ -11,8 +11,7 @@ // lldb-command:run // lldb-command:v a -// lldbg-check:(regression_bad_location_list_67992::Foo) [...] -// lldbr-check:(regression_bad_location_list_67992::Foo) a = [...] +// lldb-check:(regression_bad_location_list_67992::Foo) [...] const ARRAY_SIZE: usize = 1024; diff --git a/tests/debuginfo/self-in-default-method.rs b/tests/debuginfo/self-in-default-method.rs index 374951475fc..02fc01d96eb 100644 --- a/tests/debuginfo/self-in-default-method.rs +++ b/tests/debuginfo/self-in-default-method.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -8,8 +6,7 @@ // STACK BY REF // gdb-command:print *self -// gdbg-check:$1 = {x = 100} -// gdbr-check:$1 = self_in_default_method::Struct {x: 100} +// gdb-check:$1 = self_in_default_method::Struct {x: 100} // gdb-command:print arg1 // gdb-check:$2 = -1 // gdb-command:print arg2 @@ -18,8 +15,7 @@ // STACK BY VAL // gdb-command:print self -// gdbg-check:$4 = {x = 100} -// gdbr-check:$4 = self_in_default_method::Struct {x: 100} +// gdb-check:$4 = self_in_default_method::Struct {x: 100} // gdb-command:print arg1 // gdb-check:$5 = -3 // gdb-command:print arg2 @@ -28,8 +24,7 @@ // OWNED BY REF // gdb-command:print *self -// gdbg-check:$7 = {x = 200} -// gdbr-check:$7 = self_in_default_method::Struct {x: 200} +// gdb-check:$7 = self_in_default_method::Struct {x: 200} // gdb-command:print arg1 // gdb-check:$8 = -5 // gdb-command:print arg2 @@ -38,8 +33,7 @@ // OWNED BY VAL // gdb-command:print self -// gdbg-check:$10 = {x = 200} -// gdbr-check:$10 = self_in_default_method::Struct {x: 200} +// gdb-check:$10 = self_in_default_method::Struct {x: 200} // gdb-command:print arg1 // gdb-check:$11 = -7 // gdb-command:print arg2 @@ -48,8 +42,7 @@ // OWNED MOVED // gdb-command:print *self -// gdbg-check:$13 = {x = 200} -// gdbr-check:$13 = self_in_default_method::Struct {x: 200} +// gdb-check:$13 = self_in_default_method::Struct {x: 200} // gdb-command:print arg1 // gdb-check:$14 = -9 // gdb-command:print arg2 @@ -63,62 +56,47 @@ // STACK BY REF // lldb-command:v *self -// lldbg-check:[...] { x = 100 } -// lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 100 } +// lldb-check:[...] { x = 100 } // lldb-command:v arg1 -// lldbg-check:[...] -1 -// lldbr-check:(isize) arg1 = -1 +// lldb-check:[...] -1 // lldb-command:v arg2 -// lldbg-check:[...] -2 -// lldbr-check:(isize) arg2 = -2 +// lldb-check:[...] -2 // lldb-command:continue // STACK BY VAL // lldb-command:v self -// lldbg-check:[...] { x = 100 } -// lldbr-check:(self_in_default_method::Struct) self = Struct { x: 100 } +// lldb-check:[...] { x = 100 } // lldb-command:v arg1 -// lldbg-check:[...] -3 -// lldbr-check:(isize) arg1 = -3 +// lldb-check:[...] -3 // lldb-command:v arg2 -// lldbg-check:[...] -4 -// lldbr-check:(isize) arg2 = -4 +// lldb-check:[...] -4 // lldb-command:continue // OWNED BY REF // lldb-command:v *self -// lldbg-check:[...] { x = 200 } -// lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 200 } +// lldb-check:[...] { x = 200 } // lldb-command:v arg1 -// lldbg-check:[...] -5 -// lldbr-check:(isize) arg1 = -5 +// lldb-check:[...] -5 // lldb-command:v arg2 -// lldbg-check:[...] -6 -// lldbr-check:(isize) arg2 = -6 +// lldb-check:[...] -6 // lldb-command:continue // OWNED BY VAL // lldb-command:v self -// lldbg-check:[...] { x = 200 } -// lldbr-check:(self_in_default_method::Struct) self = Struct { x: 200 } +// lldb-check:[...] { x = 200 } // lldb-command:v arg1 -// lldbg-check:[...] -7 -// lldbr-check:(isize) arg1 = -7 +// lldb-check:[...] -7 // lldb-command:v arg2 -// lldbg-check:[...] -8 -// lldbr-check:(isize) arg2 = -8 +// lldb-check:[...] -8 // lldb-command:continue // OWNED MOVED // lldb-command:v *self -// lldbg-check:[...] { x = 200 } -// lldbr-check:(self_in_default_method::Struct) *self = Struct { x: 200 } +// lldb-check:[...] { x = 200 } // lldb-command:v arg1 -// lldbg-check:[...] -9 -// lldbr-check:(isize) arg1 = -9 +// lldb-check:[...] -9 // lldb-command:v arg2 -// lldbg-check:[...] -10 -// lldbr-check:(isize) arg2 = -10 +// lldb-check:[...] -10 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/self-in-generic-default-method.rs b/tests/debuginfo/self-in-generic-default-method.rs index 4759ca3ecdc..65018e549ee 100644 --- a/tests/debuginfo/self-in-generic-default-method.rs +++ b/tests/debuginfo/self-in-generic-default-method.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -8,8 +6,7 @@ // STACK BY REF // gdb-command:print *self -// gdbg-check:$1 = {x = 987} -// gdbr-check:$1 = self_in_generic_default_method::Struct {x: 987} +// gdb-check:$1 = self_in_generic_default_method::Struct {x: 987} // gdb-command:print arg1 // gdb-check:$2 = -1 // gdb-command:print arg2 @@ -18,8 +15,7 @@ // STACK BY VAL // gdb-command:print self -// gdbg-check:$4 = {x = 987} -// gdbr-check:$4 = self_in_generic_default_method::Struct {x: 987} +// gdb-check:$4 = self_in_generic_default_method::Struct {x: 987} // gdb-command:print arg1 // gdb-check:$5 = -3 // gdb-command:print arg2 @@ -28,8 +24,7 @@ // OWNED BY REF // gdb-command:print *self -// gdbg-check:$7 = {x = 879} -// gdbr-check:$7 = self_in_generic_default_method::Struct {x: 879} +// gdb-check:$7 = self_in_generic_default_method::Struct {x: 879} // gdb-command:print arg1 // gdb-check:$8 = -5 // gdb-command:print arg2 @@ -38,8 +33,7 @@ // OWNED BY VAL // gdb-command:print self -// gdbg-check:$10 = {x = 879} -// gdbr-check:$10 = self_in_generic_default_method::Struct {x: 879} +// gdb-check:$10 = self_in_generic_default_method::Struct {x: 879} // gdb-command:print arg1 // gdb-check:$11 = -7 // gdb-command:print arg2 @@ -48,8 +42,7 @@ // OWNED MOVED // gdb-command:print *self -// gdbg-check:$13 = {x = 879} -// gdbr-check:$13 = self_in_generic_default_method::Struct {x: 879} +// gdb-check:$13 = self_in_generic_default_method::Struct {x: 879} // gdb-command:print arg1 // gdb-check:$14 = -9 // gdb-command:print arg2 @@ -63,62 +56,47 @@ // STACK BY REF // lldb-command:v *self -// lldbg-check:[...] { x = 987 } -// lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 987 } +// lldb-check:[...] { x = 987 } // lldb-command:v arg1 -// lldbg-check:[...] -1 -// lldbr-check:(isize) arg1 = -1 +// lldb-check:[...] -1 // lldb-command:v arg2 -// lldbg-check:[...] 2 -// lldbr-check:(u16) arg2 = 2 +// lldb-check:[...] 2 // lldb-command:continue // STACK BY VAL // lldb-command:v self -// lldbg-check:[...] { x = 987 } -// lldbr-check:(self_in_generic_default_method::Struct) self = Struct { x: 987 } +// lldb-check:[...] { x = 987 } // lldb-command:v arg1 -// lldbg-check:[...] -3 -// lldbr-check:(isize) arg1 = -3 +// lldb-check:[...] -3 // lldb-command:v arg2 -// lldbg-check:[...] -4 -// lldbr-check:(i16) arg2 = -4 +// lldb-check:[...] -4 // lldb-command:continue // OWNED BY REF // lldb-command:v *self -// lldbg-check:[...] { x = 879 } -// lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 879 } +// lldb-check:[...] { x = 879 } // lldb-command:v arg1 -// lldbg-check:[...] -5 -// lldbr-check:(isize) arg1 = -5 +// lldb-check:[...] -5 // lldb-command:v arg2 -// lldbg-check:[...] -6 -// lldbr-check:(i32) arg2 = -6 +// lldb-check:[...] -6 // lldb-command:continue // OWNED BY VAL // lldb-command:v self -// lldbg-check:[...] { x = 879 } -// lldbr-check:(self_in_generic_default_method::Struct) self = Struct { x: 879 } +// lldb-check:[...] { x = 879 } // lldb-command:v arg1 -// lldbg-check:[...] -7 -// lldbr-check:(isize) arg1 = -7 +// lldb-check:[...] -7 // lldb-command:v arg2 -// lldbg-check:[...] -8 -// lldbr-check:(i64) arg2 = -8 +// lldb-check:[...] -8 // lldb-command:continue // OWNED MOVED // lldb-command:v *self -// lldbg-check:[...] { x = 879 } -// lldbr-check:(self_in_generic_default_method::Struct) *self = Struct { x: 879 } +// lldb-check:[...] { x = 879 } // lldb-command:v arg1 -// lldbg-check:[...] -9 -// lldbr-check:(isize) arg1 = -9 +// lldb-check:[...] -9 // lldb-command:v arg2 -// lldbg-check:[...] -10.5 -// lldbr-check:(f32) arg2 = -10.5 +// lldb-check:[...] -10.5 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/shadowed-argument.rs b/tests/debuginfo/shadowed-argument.rs index e7bc731336e..3a575b4addf 100644 --- a/tests/debuginfo/shadowed-argument.rs +++ b/tests/debuginfo/shadowed-argument.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -30,27 +28,21 @@ // lldb-command:run // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:v y -// lldbg-check:[...] true -// lldbr-check:(bool) y = true +// lldb-check:[...] true // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10 -// lldbr-check:(i32) x = 10 +// lldb-check:[...] 10 // lldb-command:v y -// lldbg-check:[...] true -// lldbr-check:(bool) y = true +// lldb-check:[...] true // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10.5 -// lldbr-check:(f64) x = 10.5 +// lldb-check:[...] 10.5 // lldb-command:v y -// lldbg-check:[...] 20 -// lldbr-check:(i32) y = 20 +// lldb-check:[...] 20 // lldb-command:continue diff --git a/tests/debuginfo/shadowed-variable.rs b/tests/debuginfo/shadowed-variable.rs index 3cc5fe14cb2..752e4c233f1 100644 --- a/tests/debuginfo/shadowed-variable.rs +++ b/tests/debuginfo/shadowed-variable.rs @@ -1,4 +1,3 @@ -//@ min-lldb-version: 310 //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -40,43 +39,33 @@ // lldb-command:run // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:v y -// lldbg-check:[...] true -// lldbr-check:(bool) y = true +// lldb-check:[...] true // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10 -// lldbr-check:(i32) x = 10 +// lldb-check:[...] 10 // lldb-command:v y -// lldbg-check:[...] true -// lldbr-check:(bool) y = true +// lldb-check:[...] true // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10.5 -// lldbr-check:(f64) x = 10.5 +// lldb-check:[...] 10.5 // lldb-command:v y -// lldbg-check:[...] 20 -// lldbr-check:(i32) y = 20 +// lldb-check:[...] 20 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10.5 -// lldbr-check:(f64) x = 10.5 +// lldb-check:[...] 10.5 // lldb-command:v y -// lldbg-check:[...] 20 -// lldbr-check:(i32) y = 20 +// lldb-check:[...] 20 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 11.5 -// lldbr-check:(f64) x = 11.5 +// lldb-check:[...] 11.5 // lldb-command:v y -// lldbg-check:[...] 20 -// lldbr-check:(i32) y = 20 +// lldb-check:[...] 20 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/should-fail.rs b/tests/debuginfo/should-fail.rs index 0f153394a44..bc9b83fc242 100644 --- a/tests/debuginfo/should-fail.rs +++ b/tests/debuginfo/should-fail.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - // == Test [gdb|lldb]-[command|check] are parsed correctly === //@ should-fail //@ needs-run-enabled diff --git a/tests/debuginfo/simd.rs b/tests/debuginfo/simd.rs index a5dd2e61a8d..e4fe262235b 100644 --- a/tests/debuginfo/simd.rs +++ b/tests/debuginfo/simd.rs @@ -9,46 +9,28 @@ //@ compile-flags:-g // gdb-command:run -// gdbg-command:print/d vi8x16 -// gdbr-command:print vi8x16 -// gdbg-check:$1 = {__0 = 0, __1 = 1, __2 = 2, __3 = 3, __4 = 4, __5 = 5, __6 = 6, __7 = 7, __8 = 8, __9 = 9, __10 = 10, __11 = 11, __12 = 12, __13 = 13, __14 = 14, __15 = 15} -// gdbr-check:$1 = simd::i8x16 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) -// gdbg-command:print/d vi16x8 -// gdbr-command:print vi16x8 -// gdbg-check:$2 = {__0 = 16, __1 = 17, __2 = 18, __3 = 19, __4 = 20, __5 = 21, __6 = 22, __7 = 23} -// gdbr-check:$2 = simd::i16x8 (16, 17, 18, 19, 20, 21, 22, 23) -// gdbg-command:print/d vi32x4 -// gdbr-command:print vi32x4 -// gdbg-check:$3 = {__0 = 24, __1 = 25, __2 = 26, __3 = 27} -// gdbr-check:$3 = simd::i32x4 (24, 25, 26, 27) -// gdbg-command:print/d vi64x2 -// gdbr-command:print vi64x2 -// gdbg-check:$4 = {__0 = 28, __1 = 29} -// gdbr-check:$4 = simd::i64x2 (28, 29) +// gdb-command:print vi8x16 +// gdb-check:$1 = simd::i8x16 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) +// gdb-command:print vi16x8 +// gdb-check:$2 = simd::i16x8 (16, 17, 18, 19, 20, 21, 22, 23) +// gdb-command:print vi32x4 +// gdb-check:$3 = simd::i32x4 (24, 25, 26, 27) +// gdb-command:print vi64x2 +// gdb-check:$4 = simd::i64x2 (28, 29) -// gdbg-command:print/d vu8x16 -// gdbr-command:print vu8x16 -// gdbg-check:$5 = {__0 = 30, __1 = 31, __2 = 32, __3 = 33, __4 = 34, __5 = 35, __6 = 36, __7 = 37, __8 = 38, __9 = 39, __10 = 40, __11 = 41, __12 = 42, __13 = 43, __14 = 44, __15 = 45} -// gdbr-check:$5 = simd::u8x16 (30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45) -// gdbg-command:print/d vu16x8 -// gdbr-command:print vu16x8 -// gdbg-check:$6 = {__0 = 46, __1 = 47, __2 = 48, __3 = 49, __4 = 50, __5 = 51, __6 = 52, __7 = 53} -// gdbr-check:$6 = simd::u16x8 (46, 47, 48, 49, 50, 51, 52, 53) -// gdbg-command:print/d vu32x4 -// gdbr-command:print vu32x4 -// gdbg-check:$7 = {__0 = 54, __1 = 55, __2 = 56, __3 = 57} -// gdbr-check:$7 = simd::u32x4 (54, 55, 56, 57) -// gdbg-command:print/d vu64x2 -// gdbr-command:print vu64x2 -// gdbg-check:$8 = {__0 = 58, __1 = 59} -// gdbr-check:$8 = simd::u64x2 (58, 59) +// gdb-command:print vu8x16 +// gdb-check:$5 = simd::u8x16 (30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45) +// gdb-command:print vu16x8 +// gdb-check:$6 = simd::u16x8 (46, 47, 48, 49, 50, 51, 52, 53) +// gdb-command:print vu32x4 +// gdb-check:$7 = simd::u32x4 (54, 55, 56, 57) +// gdb-command:print vu64x2 +// gdb-check:$8 = simd::u64x2 (58, 59) // gdb-command:print vf32x4 -// gdbg-check:$9 = {__0 = 60.5, __1 = 61.5, __2 = 62.5, __3 = 63.5} -// gdbr-check:$9 = simd::f32x4 (60.5, 61.5, 62.5, 63.5) +// gdb-check:$9 = simd::f32x4 (60.5, 61.5, 62.5, 63.5) // gdb-command:print vf64x2 -// gdbg-check:$10 = {__0 = 64.5, __1 = 65.5} -// gdbr-check:$10 = simd::f64x2 (64.5, 65.5) +// gdb-check:$10 = simd::f64x2 (64.5, 65.5) // gdb-command:continue diff --git a/tests/debuginfo/simple-lexical-scope.rs b/tests/debuginfo/simple-lexical-scope.rs index 4156e68f8b1..6008489bd65 100644 --- a/tests/debuginfo/simple-lexical-scope.rs +++ b/tests/debuginfo/simple-lexical-scope.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -40,38 +38,31 @@ // lldb-command:run // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10 -// lldbr-check:(i32) x = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10 -// lldbr-check:(i32) x = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10.5 -// lldbr-check:(f64) x = 10.5 +// lldb-check:[...] 10.5 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] 10 -// lldbr-check:(i32) x = 10 +// lldb-check:[...] 10 // lldb-command:continue // lldb-command:v x -// lldbg-check:[...] false -// lldbr-check:(bool) x = false +// lldb-check:[...] false // lldb-command:continue diff --git a/tests/debuginfo/simple-struct.rs b/tests/debuginfo/simple-struct.rs index 968a5c63e89..bb6b2b79810 100644 --- a/tests/debuginfo/simple-struct.rs +++ b/tests/debuginfo/simple-struct.rs @@ -1,95 +1,62 @@ -//@ min-lldb-version: 310 -//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 - //@ compile-flags: -g -Zmir-enable-passes=-CheckAlignment // === GDB TESTS =================================================================================== -// gdbg-command:print 'simple_struct::NO_PADDING_16' -// gdbr-command:print simple_struct::NO_PADDING_16 -// gdbg-check:$1 = {x = 1000, y = -1001} -// gdbr-check:$1 = simple_struct::NoPadding16 {x: 1000, y: -1001} +// gdb-command:print simple_struct::NO_PADDING_16 +// gdb-check:$1 = simple_struct::NoPadding16 {x: 1000, y: -1001} -// gdbg-command:print 'simple_struct::NO_PADDING_32' -// gdbr-command:print simple_struct::NO_PADDING_32 -// gdbg-check:$2 = {x = 1, y = 2, z = 3} -// gdbr-check:$2 = simple_struct::NoPadding32 {x: 1, y: 2, z: 3} +// gdb-command:print simple_struct::NO_PADDING_32 +// gdb-check:$2 = simple_struct::NoPadding32 {x: 1, y: 2, z: 3} -// gdbg-command:print 'simple_struct::NO_PADDING_64' -// gdbr-command:print simple_struct::NO_PADDING_64 -// gdbg-check:$3 = {x = 4, y = 5, z = 6} -// gdbr-check:$3 = simple_struct::NoPadding64 {x: 4, y: 5, z: 6} +// gdb-command:print simple_struct::NO_PADDING_64 +// gdb-check:$3 = simple_struct::NoPadding64 {x: 4, y: 5, z: 6} -// gdbg-command:print 'simple_struct::NO_PADDING_163264' -// gdbr-command:print simple_struct::NO_PADDING_163264 -// gdbg-check:$4 = {a = 7, b = 8, c = 9, d = 10} -// gdbr-check:$4 = simple_struct::NoPadding163264 {a: 7, b: 8, c: 9, d: 10} +// gdb-command:print simple_struct::NO_PADDING_163264 +// gdb-check:$4 = simple_struct::NoPadding163264 {a: 7, b: 8, c: 9, d: 10} -// gdbg-command:print 'simple_struct::INTERNAL_PADDING' -// gdbr-command:print simple_struct::INTERNAL_PADDING -// gdbg-check:$5 = {x = 11, y = 12} -// gdbr-check:$5 = simple_struct::InternalPadding {x: 11, y: 12} +// gdb-command:print simple_struct::INTERNAL_PADDING +// gdb-check:$5 = simple_struct::InternalPadding {x: 11, y: 12} -// gdbg-command:print 'simple_struct::PADDING_AT_END' -// gdbr-command:print simple_struct::PADDING_AT_END -// gdbg-check:$6 = {x = 13, y = 14} -// gdbr-check:$6 = simple_struct::PaddingAtEnd {x: 13, y: 14} +// gdb-command:print simple_struct::PADDING_AT_END +// gdb-check:$6 = simple_struct::PaddingAtEnd {x: 13, y: 14} // gdb-command:run // gdb-command:print no_padding16 -// gdbg-check:$7 = {x = 10000, y = -10001} -// gdbr-check:$7 = simple_struct::NoPadding16 {x: 10000, y: -10001} +// gdb-check:$7 = simple_struct::NoPadding16 {x: 10000, y: -10001} // gdb-command:print no_padding32 -// gdbg-check:$8 = {x = -10002, y = -10003.5, z = 10004} -// gdbr-check:$8 = simple_struct::NoPadding32 {x: -10002, y: -10003.5, z: 10004} +// gdb-check:$8 = simple_struct::NoPadding32 {x: -10002, y: -10003.5, z: 10004} // gdb-command:print no_padding64 -// gdbg-check:$9 = {x = -10005.5, y = 10006, z = 10007} -// gdbr-check:$9 = simple_struct::NoPadding64 {x: -10005.5, y: 10006, z: 10007} +// gdb-check:$9 = simple_struct::NoPadding64 {x: -10005.5, y: 10006, z: 10007} // gdb-command:print no_padding163264 -// gdbg-check:$10 = {a = -10008, b = 10009, c = 10010, d = 10011} -// gdbr-check:$10 = simple_struct::NoPadding163264 {a: -10008, b: 10009, c: 10010, d: 10011} +// gdb-check:$10 = simple_struct::NoPadding163264 {a: -10008, b: 10009, c: 10010, d: 10011} // gdb-command:print internal_padding -// gdbg-check:$11 = {x = 10012, y = -10013} -// gdbr-check:$11 = simple_struct::InternalPadding {x: 10012, y: -10013} +// gdb-check:$11 = simple_struct::InternalPadding {x: 10012, y: -10013} // gdb-command:print padding_at_end -// gdbg-check:$12 = {x = -10014, y = 10015} -// gdbr-check:$12 = simple_struct::PaddingAtEnd {x: -10014, y: 10015} - -// gdbg-command:print 'simple_struct::NO_PADDING_16' -// gdbr-command:print simple_struct::NO_PADDING_16 -// gdbg-check:$13 = {x = 100, y = -101} -// gdbr-check:$13 = simple_struct::NoPadding16 {x: 100, y: -101} - -// gdbg-command:print 'simple_struct::NO_PADDING_32' -// gdbr-command:print simple_struct::NO_PADDING_32 -// gdbg-check:$14 = {x = -15, y = -16, z = 17} -// gdbr-check:$14 = simple_struct::NoPadding32 {x: -15, y: -16, z: 17} - -// gdbg-command:print 'simple_struct::NO_PADDING_64' -// gdbr-command:print simple_struct::NO_PADDING_64 -// gdbg-check:$15 = {x = -18, y = 19, z = 20} -// gdbr-check:$15 = simple_struct::NoPadding64 {x: -18, y: 19, z: 20} - -// gdbg-command:print 'simple_struct::NO_PADDING_163264' -// gdbr-command:print simple_struct::NO_PADDING_163264 -// gdbg-check:$16 = {a = -21, b = 22, c = 23, d = 24} -// gdbr-check:$16 = simple_struct::NoPadding163264 {a: -21, b: 22, c: 23, d: 24} - -// gdbg-command:print 'simple_struct::INTERNAL_PADDING' -// gdbr-command:print simple_struct::INTERNAL_PADDING -// gdbg-check:$17 = {x = 25, y = -26} -// gdbr-check:$17 = simple_struct::InternalPadding {x: 25, y: -26} - -// gdbg-command:print 'simple_struct::PADDING_AT_END' -// gdbr-command:print simple_struct::PADDING_AT_END -// gdbg-check:$18 = {x = -27, y = 28} -// gdbr-check:$18 = simple_struct::PaddingAtEnd {x: -27, y: 28} +// gdb-check:$12 = simple_struct::PaddingAtEnd {x: -10014, y: 10015} + +// gdb-command:print simple_struct::NO_PADDING_16 +// gdb-check:$13 = simple_struct::NoPadding16 {x: 100, y: -101} + +// gdb-command:print simple_struct::NO_PADDING_32 +// gdb-check:$14 = simple_struct::NoPadding32 {x: -15, y: -16, z: 17} + +// gdb-command:print simple_struct::NO_PADDING_64 +// gdb-check:$15 = simple_struct::NoPadding64 {x: -18, y: 19, z: 20} + +// gdb-command:print simple_struct::NO_PADDING_163264 +// gdb-check:$16 = simple_struct::NoPadding163264 {a: -21, b: 22, c: 23, d: 24} + +// gdb-command:print simple_struct::INTERNAL_PADDING +// gdb-check:$17 = simple_struct::InternalPadding {x: 25, y: -26} + +// gdb-command:print simple_struct::PADDING_AT_END +// gdb-check:$18 = simple_struct::PaddingAtEnd {x: -27, y: 28} // gdb-command:continue @@ -98,28 +65,22 @@ // lldb-command:run // lldb-command:v no_padding16 -// lldbg-check:[...] { x = 10000 y = -10001 } -// lldbr-check:(simple_struct::NoPadding16) no_padding16 = { x = 10000 y = -10001 } +// lldb-check:[...] { x = 10000 y = -10001 } // lldb-command:v no_padding32 -// lldbg-check:[...] { x = -10002 y = -10003.5 z = 10004 } -// lldbr-check:(simple_struct::NoPadding32) no_padding32 = { x = -10002 y = -10003.5 z = 10004 } +// lldb-check:[...] { x = -10002 y = -10003.5 z = 10004 } // lldb-command:v no_padding64 -// lldbg-check:[...] { x = -10005.5 y = 10006 z = 10007 } -// lldbr-check:(simple_struct::NoPadding64) no_padding64 = { x = -10005.5 y = 10006 z = 10007 } +// lldb-check:[...] { x = -10005.5 y = 10006 z = 10007 } // lldb-command:v no_padding163264 -// lldbg-check:[...] { a = -10008 b = 10009 c = 10010 d = 10011 } -// lldbr-check:(simple_struct::NoPadding163264) no_padding163264 = { a = -10008 b = 10009 c = 10010 d = 10011 } +// lldb-check:[...] { a = -10008 b = 10009 c = 10010 d = 10011 } // lldb-command:v internal_padding -// lldbg-check:[...] { x = 10012 y = -10013 } -// lldbr-check:(simple_struct::InternalPadding) internal_padding = { x = 10012 y = -10013 } +// lldb-check:[...] { x = 10012 y = -10013 } // lldb-command:v padding_at_end -// lldbg-check:[...] { x = -10014 y = 10015 } -// lldbr-check:(simple_struct::PaddingAtEnd) padding_at_end = { x = -10014 y = 10015 } +// lldb-check:[...] { x = -10014 y = 10015 } #![allow(unused_variables)] #![allow(dead_code)] diff --git a/tests/debuginfo/simple-tuple.rs b/tests/debuginfo/simple-tuple.rs index 86003105f36..82467ef3bcf 100644 --- a/tests/debuginfo/simple-tuple.rs +++ b/tests/debuginfo/simple-tuple.rs @@ -1,98 +1,59 @@ -//@ min-lldb-version: 310 -//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 - //@ compile-flags:-g // === GDB TESTS =================================================================================== -// gdbg-command:print/d 'simple_tuple::NO_PADDING_8' -// gdbr-command:print simple_tuple::NO_PADDING_8 -// gdbg-check:$1 = {__0 = -50, __1 = 50} -// gdbr-check:$1 = (-50, 50) -// gdbg-command:print 'simple_tuple::NO_PADDING_16' -// gdbr-command:print simple_tuple::NO_PADDING_16 -// gdbg-check:$2 = {__0 = -1, __1 = 2, __2 = 3} -// gdbr-check:$2 = (-1, 2, 3) -// gdbg-command:print 'simple_tuple::NO_PADDING_32' -// gdbr-command:print simple_tuple::NO_PADDING_32 -// gdbg-check:$3 = {__0 = 4, __1 = 5, __2 = 6} -// gdbr-check:$3 = (4, 5, 6) -// gdbg-command:print 'simple_tuple::NO_PADDING_64' -// gdbr-command:print simple_tuple::NO_PADDING_64 -// gdbg-check:$4 = {__0 = 7, __1 = 8, __2 = 9} -// gdbr-check:$4 = (7, 8, 9) - -// gdbg-command:print 'simple_tuple::INTERNAL_PADDING_1' -// gdbr-command:print simple_tuple::INTERNAL_PADDING_1 -// gdbg-check:$5 = {__0 = 10, __1 = 11} -// gdbr-check:$5 = (10, 11) -// gdbg-command:print 'simple_tuple::INTERNAL_PADDING_2' -// gdbr-command:print simple_tuple::INTERNAL_PADDING_2 -// gdbg-check:$6 = {__0 = 12, __1 = 13, __2 = 14, __3 = 15} -// gdbr-check:$6 = (12, 13, 14, 15) - -// gdbg-command:print 'simple_tuple::PADDING_AT_END' -// gdbr-command:print simple_tuple::PADDING_AT_END -// gdbg-check:$7 = {__0 = 16, __1 = 17} -// gdbr-check:$7 = (16, 17) +// gdb-command:print simple_tuple::NO_PADDING_8 +// gdb-check:$1 = (-50, 50) +// gdb-command:print simple_tuple::NO_PADDING_16 +// gdb-check:$2 = (-1, 2, 3) +// gdb-command:print simple_tuple::NO_PADDING_32 +// gdb-check:$3 = (4, 5, 6) +// gdb-command:print simple_tuple::NO_PADDING_64 +// gdb-check:$4 = (7, 8, 9) + +// gdb-command:print simple_tuple::INTERNAL_PADDING_1 +// gdb-check:$5 = (10, 11) +// gdb-command:print simple_tuple::INTERNAL_PADDING_2 +// gdb-check:$6 = (12, 13, 14, 15) + +// gdb-command:print simple_tuple::PADDING_AT_END +// gdb-check:$7 = (16, 17) // gdb-command:run -// gdbg-command:print/d noPadding8 -// gdbr-command:print noPadding8 -// gdbg-check:$8 = {__0 = -100, __1 = 100} -// gdbr-check:$8 = (-100, 100) +// gdb-command:print noPadding8 +// gdb-check:$8 = (-100, 100) // gdb-command:print noPadding16 -// gdbg-check:$9 = {__0 = 0, __1 = 1, __2 = 2} -// gdbr-check:$9 = (0, 1, 2) +// gdb-check:$9 = (0, 1, 2) // gdb-command:print noPadding32 -// gdbg-check:$10 = {__0 = 3, __1 = 4.5, __2 = 5} -// gdbr-check:$10 = (3, 4.5, 5) +// gdb-check:$10 = (3, 4.5, 5) // gdb-command:print noPadding64 -// gdbg-check:$11 = {__0 = 6, __1 = 7.5, __2 = 8} -// gdbr-check:$11 = (6, 7.5, 8) +// gdb-check:$11 = (6, 7.5, 8) // gdb-command:print internalPadding1 -// gdbg-check:$12 = {__0 = 9, __1 = 10} -// gdbr-check:$12 = (9, 10) +// gdb-check:$12 = (9, 10) // gdb-command:print internalPadding2 -// gdbg-check:$13 = {__0 = 11, __1 = 12, __2 = 13, __3 = 14} -// gdbr-check:$13 = (11, 12, 13, 14) +// gdb-check:$13 = (11, 12, 13, 14) // gdb-command:print paddingAtEnd -// gdbg-check:$14 = {__0 = 15, __1 = 16} -// gdbr-check:$14 = (15, 16) - -// gdbg-command:print/d 'simple_tuple::NO_PADDING_8' -// gdbr-command:print simple_tuple::NO_PADDING_8 -// gdbg-check:$15 = {__0 = -127, __1 = 127} -// gdbr-check:$15 = (-127, 127) -// gdbg-command:print 'simple_tuple::NO_PADDING_16' -// gdbr-command:print simple_tuple::NO_PADDING_16 -// gdbg-check:$16 = {__0 = -10, __1 = 10, __2 = 9} -// gdbr-check:$16 = (-10, 10, 9) -// gdbg-command:print 'simple_tuple::NO_PADDING_32' -// gdbr-command:print simple_tuple::NO_PADDING_32 -// gdbg-check:$17 = {__0 = 14, __1 = 15, __2 = 16} -// gdbr-check:$17 = (14, 15, 16) -// gdbg-command:print 'simple_tuple::NO_PADDING_64' -// gdbr-command:print simple_tuple::NO_PADDING_64 -// gdbg-check:$18 = {__0 = 17, __1 = 18, __2 = 19} -// gdbr-check:$18 = (17, 18, 19) - -// gdbg-command:print 'simple_tuple::INTERNAL_PADDING_1' -// gdbr-command:print simple_tuple::INTERNAL_PADDING_1 -// gdbg-check:$19 = {__0 = 110, __1 = 111} -// gdbr-check:$19 = (110, 111) -// gdbg-command:print 'simple_tuple::INTERNAL_PADDING_2' -// gdbr-command:print simple_tuple::INTERNAL_PADDING_2 -// gdbg-check:$20 = {__0 = 112, __1 = 113, __2 = 114, __3 = 115} -// gdbr-check:$20 = (112, 113, 114, 115) - -// gdbg-command:print 'simple_tuple::PADDING_AT_END' -// gdbr-command:print simple_tuple::PADDING_AT_END -// gdbg-check:$21 = {__0 = 116, __1 = 117} -// gdbr-check:$21 = (116, 117) +// gdb-check:$14 = (15, 16) + +// gdb-command:print simple_tuple::NO_PADDING_8 +// gdb-check:$15 = (-127, 127) +// gdb-command:print simple_tuple::NO_PADDING_16 +// gdb-check:$16 = (-10, 10, 9) +// gdb-command:print simple_tuple::NO_PADDING_32 +// gdb-check:$17 = (14, 15, 16) +// gdb-command:print simple_tuple::NO_PADDING_64 +// gdb-check:$18 = (17, 18, 19) + +// gdb-command:print simple_tuple::INTERNAL_PADDING_1 +// gdb-check:$19 = (110, 111) +// gdb-command:print simple_tuple::INTERNAL_PADDING_2 +// gdb-check:$20 = (112, 113, 114, 115) + +// gdb-command:print simple_tuple::PADDING_AT_END +// gdb-check:$21 = (116, 117) // === LLDB TESTS ================================================================================== @@ -100,28 +61,21 @@ // lldb-command:run // lldb-command:v/d noPadding8 -// lldbg-check:[...] { 0 = -100 1 = 100 } -// lldbr-check:((i8, u8)) noPadding8 = { 0 = -100 1 = 100 } +// lldb-check:[...] { 0 = -100 1 = 100 } // lldb-command:v noPadding16 -// lldbg-check:[...] { 0 = 0 1 = 1 2 = 2 } -// lldbr-check:((i16, i16, u16)) noPadding16 = { 0 = 0 1 = 1 2 = 2 } +// lldb-check:[...] { 0 = 0 1 = 1 2 = 2 } // lldb-command:v noPadding32 -// lldbg-check:[...] { 0 = 3 1 = 4.5 2 = 5 } -// lldbr-check:((i32, f32, u32)) noPadding32 = { 0 = 3 1 = 4.5 2 = 5 } +// lldb-check:[...] { 0 = 3 1 = 4.5 2 = 5 } // lldb-command:v noPadding64 -// lldbg-check:[...] { 0 = 6 1 = 7.5 2 = 8 } -// lldbr-check:((i64, f64, u64)) noPadding64 = { 0 = 6 1 = 7.5 2 = 8 } +// lldb-check:[...] { 0 = 6 1 = 7.5 2 = 8 } // lldb-command:v internalPadding1 -// lldbg-check:[...] { 0 = 9 1 = 10 } -// lldbr-check:((i16, i32)) internalPadding1 = { 0 = 9 1 = 10 } +// lldb-check:[...] { 0 = 9 1 = 10 } // lldb-command:v internalPadding2 -// lldbg-check:[...] { 0 = 11 1 = 12 2 = 13 3 = 14 } -// lldbr-check:((i16, i32, u32, u64)) internalPadding2 = { 0 = 11 1 = 12 2 = 13 3 = 14 } +// lldb-check:[...] { 0 = 11 1 = 12 2 = 13 3 = 14 } // lldb-command:v paddingAtEnd -// lldbg-check:[...] { 0 = 15 1 = 16 } -// lldbr-check:((i32, i16)) paddingAtEnd = { 0 = 15 1 = 16 } +// lldb-check:[...] { 0 = 15 1 = 16 } // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/static-method-on-struct-and-enum.rs b/tests/debuginfo/static-method-on-struct-and-enum.rs index b4ec4543572..b487512a52f 100644 --- a/tests/debuginfo/static-method-on-struct-and-enum.rs +++ b/tests/debuginfo/static-method-on-struct-and-enum.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -29,23 +27,18 @@ // STRUCT // lldb-command:v arg1 -// lldbg-check:[...] 1 -// lldbr-check:(isize) arg1 = 1 +// lldb-check:[...] 1 // lldb-command:v arg2 -// lldbg-check:[...] 2 -// lldbr-check:(isize) arg2 = 2 +// lldb-check:[...] 2 // lldb-command:continue // ENUM // lldb-command:v arg1 -// lldbg-check:[...] -3 -// lldbr-check:(isize) arg1 = -3 +// lldb-check:[...] -3 // lldb-command:v arg2 -// lldbg-check:[...] 4.5 -// lldbr-check:(f64) arg2 = 4.5 +// lldb-check:[...] 4.5 // lldb-command:v arg3 -// lldbg-check:[...] 5 -// lldbr-check:(usize) arg3 = 5 +// lldb-check:[...] 5 // lldb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/strings-and-strs.rs b/tests/debuginfo/strings-and-strs.rs index 2d29ac12bd8..b7ee3312d13 100644 --- a/tests/debuginfo/strings-and-strs.rs +++ b/tests/debuginfo/strings-and-strs.rs @@ -7,37 +7,37 @@ // gdb-command:run // gdb-command:print plain_string -// gdbr-check:$1 = alloc::string::String {vec: alloc::vec::Vec<u8, alloc::alloc::Global> {buf: alloc::raw_vec::RawVec<u8, alloc::alloc::Global> {inner: alloc::raw_vec::RawVecInner<alloc::alloc::Global> {ptr: core::ptr::unique::Unique<u8> {pointer: core::ptr::non_null::NonNull<u8> {pointer: 0x[...]}, _marker: core::marker::PhantomData<u8>}, cap: alloc::raw_vec::Cap (5), alloc: alloc::alloc::Global}, _marker: core::marker::PhantomData<u8>}, len: 5}} +// gdb-check:$1 = alloc::string::String {vec: alloc::vec::Vec<u8, alloc::alloc::Global> {buf: alloc::raw_vec::RawVec<u8, alloc::alloc::Global> {inner: alloc::raw_vec::RawVecInner<alloc::alloc::Global> {ptr: core::ptr::unique::Unique<u8> {pointer: core::ptr::non_null::NonNull<u8> {pointer: 0x[...]}, _marker: core::marker::PhantomData<u8>}, cap: alloc::raw_vec::Cap (5), alloc: alloc::alloc::Global}, _marker: core::marker::PhantomData<u8>}, len: 5}} // gdb-command:print plain_str -// gdbr-check:$2 = "Hello" +// gdb-check:$2 = "Hello" // gdb-command:print str_in_struct -// gdbr-check:$3 = strings_and_strs::Foo {inner: "Hello"} +// gdb-check:$3 = strings_and_strs::Foo {inner: "Hello"} // gdb-command:print str_in_tuple -// gdbr-check:$4 = ("Hello", "World") +// gdb-check:$4 = ("Hello", "World") // gdb-command:print str_in_rc -// gdbr-check:$5 = alloc::rc::Rc<&str, alloc::alloc::Global> {ptr: core::ptr::non_null::NonNull<alloc::rc::RcBox<&str>> {pointer: 0x[...]}, phantom: core::marker::PhantomData<alloc::rc::RcBox<&str>>, alloc: alloc::alloc::Global} +// gdb-check:$5 = alloc::rc::Rc<&str, alloc::alloc::Global> {ptr: core::ptr::non_null::NonNull<alloc::rc::RcBox<&str>> {pointer: 0x[...]}, phantom: core::marker::PhantomData<alloc::rc::RcBox<&str>>, alloc: alloc::alloc::Global} // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v plain_string -// lldbg-check:(alloc::string::String) plain_string = "Hello" { vec = size=5 { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } } +// lldb-check:(alloc::string::String) plain_string = "Hello" { vec = size=5 { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } } // lldb-command:v plain_str -// lldbg-check:(&str) plain_str = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } +// lldb-check:(&str) plain_str = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } // lldb-command:v str_in_struct -// lldbg-check:((&str, &str)) str_in_tuple = { 0 = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } 1 = "World" { [0] = 'W' [1] = 'o' [2] = 'r' [3] = 'l' [4] = 'd' } } +// lldb-check:((&str, &str)) str_in_tuple = { 0 = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } 1 = "World" { [0] = 'W' [1] = 'o' [2] = 'r' [3] = 'l' [4] = 'd' } } // lldb-command:v str_in_tuple -// lldbg-check:((&str, &str)) str_in_tuple = { 0 = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } 1 = "World" { [0] = 'W' [1] = 'o' [2] = 'r' [3] = 'l' [4] = 'd' } } +// lldb-check:((&str, &str)) str_in_tuple = { 0 = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } 1 = "World" { [0] = 'W' [1] = 'o' [2] = 'r' [3] = 'l' [4] = 'd' } } // lldb-command:v str_in_rc -// lldbg-check:(alloc::rc::Rc<&str, alloc::alloc::Global>) str_in_rc = strong=1, weak=0 { value = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } } +// lldb-check:(alloc::rc::Rc<&str, alloc::alloc::Global>) str_in_rc = strong=1, weak=0 { value = "Hello" { [0] = 'H' [1] = 'e' [2] = 'l' [3] = 'l' [4] = 'o' } } #![allow(unused_variables)] diff --git a/tests/debuginfo/struct-in-enum.rs b/tests/debuginfo/struct-in-enum.rs index 52e419e6b47..bc2c59fe4aa 100644 --- a/tests/debuginfo/struct-in-enum.rs +++ b/tests/debuginfo/struct-in-enum.rs @@ -1,6 +1,4 @@ -//@ min-lldb-version: 310 -//@ ignore-gdb-version: 7.11.90 - 7.12.9 -//@ ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 +//@ min-lldb-version: 1800 //@ compile-flags:-g @@ -10,16 +8,13 @@ // gdb-command:run // gdb-command:print case1 -// gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = {x = 2088533116, y = 2088533116, z = 31868}}, {RUST$ENUM$DISR = Case1, [...]}} -// gdbr-check:$1 = struct_in_enum::Regular::Case1(0, struct_in_enum::Struct {x: 2088533116, y: 2088533116, z: 31868}) +// gdb-check:$1 = struct_in_enum::Regular::Case1(0, struct_in_enum::Struct {x: 2088533116, y: 2088533116, z: 31868}) // gdb-command:print case2 -// gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 1229782938247303441, __2 = 4369}} -// gdbr-check:$2 = struct_in_enum::Regular::Case2(0, 1229782938247303441, 4369) +// gdb-check:$2 = struct_in_enum::Regular::Case2(0, 1229782938247303441, 4369) // gdb-command:print univariant -// gdbg-check:$3 = {{__0 = {x = 123, y = 456, z = 789}}} -// gdbr-check:$3 = struct_in_enum::Univariant::TheOnlyCase(struct_in_enum::Struct {x: 123, y: 456, z: 789}) +// gdb-check:$3 = struct_in_enum::Univariant::TheOnlyCase(struct_in_enum::Struct {x: 123, y: 456, z: 789}) // === LLDB TESTS ================================================================================== diff --git a/tests/debuginfo/struct-in-struct.rs b/tests/debuginfo/struct-in-struct.rs index 7ca0e3a5ef6..3cf48470391 100644 --- a/tests/debuginfo/struct-in-struct.rs +++ b/tests/debuginfo/struct-in-struct.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -7,16 +5,13 @@ // gdb-command:run // gdb-command:print three_simple_structs -// gdbg-check:$1 = {x = {x = 1}, y = {x = 2}, z = {x = 3}} -// gdbr-check:$1 = struct_in_struct::ThreeSimpleStructs {x: struct_in_struct::Simple {x: 1}, y: struct_in_struct::Simple {x: 2}, z: struct_in_struct::Simple {x: 3}} +// gdb-check:$1 = struct_in_struct::ThreeSimpleStructs {x: struct_in_struct::Simple {x: 1}, y: struct_in_struct::Simple {x: 2}, z: struct_in_struct::Simple {x: 3}} // gdb-command:print internal_padding_parent -// gdbg-check:$2 = {x = {x = 4, y = 5}, y = {x = 6, y = 7}, z = {x = 8, y = 9}} -// gdbr-check:$2 = struct_in_struct::InternalPaddingParent {x: struct_in_struct::InternalPadding {x: 4, y: 5}, y: struct_in_struct::InternalPadding {x: 6, y: 7}, z: struct_in_struct::InternalPadding {x: 8, y: 9}} +// gdb-check:$2 = struct_in_struct::InternalPaddingParent {x: struct_in_struct::InternalPadding {x: 4, y: 5}, y: struct_in_struct::InternalPadding {x: 6, y: 7}, z: struct_in_struct::InternalPadding {x: 8, y: 9}} // gdb-command:print padding_at_end_parent -// gdbg-check:$3 = {x = {x = 10, y = 11}, y = {x = 12, y = 13}, z = {x = 14, y = 15}} -// gdbr-check:$3 = struct_in_struct::PaddingAtEndParent {x: struct_in_struct::PaddingAtEnd {x: 10, y: 11}, y: struct_in_struct::PaddingAtEnd {x: 12, y: 13}, z: struct_in_struct::PaddingAtEnd {x: 14, y: 15}} +// gdb-check:$3 = struct_in_struct::PaddingAtEndParent {x: struct_in_struct::PaddingAtEnd {x: 10, y: 11}, y: struct_in_struct::PaddingAtEnd {x: 12, y: 13}, z: struct_in_struct::PaddingAtEnd {x: 14, y: 15}} // === LLDB TESTS ================================================================================== @@ -24,36 +19,28 @@ // lldb-command:run // lldb-command:v three_simple_structs -// lldbg-check:[...] { x = { x = 1 } y = { x = 2 } z = { x = 3 } } -// lldbr-check:(struct_in_struct::ThreeSimpleStructs) three_simple_structs = { x = { x = 1 } y = { x = 2 } z = { x = 3 } } +// lldb-check:[...] { x = { x = 1 } y = { x = 2 } z = { x = 3 } } // lldb-command:v internal_padding_parent -// lldbg-check:[...] { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } -// lldbr-check:(struct_in_struct::InternalPaddingParent) internal_padding_parent = { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } +// lldb-check:[...] { x = { x = 4 y = 5 } y = { x = 6 y = 7 } z = { x = 8 y = 9 } } // lldb-command:v padding_at_end_parent -// lldbg-check:[...] { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } -// lldbr-check:(struct_in_struct::PaddingAtEndParent) padding_at_end_parent = { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } +// lldb-check:[...] { x = { x = 10 y = 11 } y = { x = 12 y = 13 } z = { x = 14 y = 15 } } // lldb-command:v mixed -// lldbg-check:[...] { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } -// lldbr-check:(struct_in_struct::Mixed) mixed = { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } +// lldb-check:[...] { x = { x = 16 y = 17 } y = { x = 18 y = 19 } z = { x = 20 } w = 21 } // lldb-command:v bag -// lldbg-check:[...] { x = { x = 22 } } -// lldbr-check:(struct_in_struct::Bag) bag = { x = { x = 22 } } +// lldb-check:[...] { x = { x = 22 } } // lldb-command:v bag_in_bag -// lldbg-check:[...] { x = { x = { x = 23 } } } -// lldbr-check:(struct_in_struct::BagInBag) bag_in_bag = { x = { x = { x = 23 } } } +// lldb-check:[...] { x = { x = { x = 23 } } } // lldb-command:v tjo -// lldbg-check:[...] { x = { x = { x = { x = 24 } } } } -// lldbr-check:(struct_in_struct::ThatsJustOverkill) tjo = { x = { x = { x = { x = 24 } } } } +// lldb-check:[...] { x = { x = { x = { x = 24 } } } } // lldb-command:v tree -// lldbg-check:[...] { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } } -// lldbr-check:(struct_in_struct::Tree) tree = { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } } +// lldb-check:[...] { x = { x = 25 } y = { x = { x = 26 y = 27 } y = { x = 28 y = 29 } z = { x = 30 y = 31 } } z = { x = { x = { x = 32 } } } } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/struct-namespace.rs b/tests/debuginfo/struct-namespace.rs index 3cae51e83dd..95788419100 100644 --- a/tests/debuginfo/struct-namespace.rs +++ b/tests/debuginfo/struct-namespace.rs @@ -1,23 +1,18 @@ //@ ignore-gdb //@ compile-flags:-g -//@ min-lldb-version: 310 // Check that structs get placed in the correct namespace // lldb-command:run // lldb-command:v struct1 -// lldbg-check:(struct_namespace::Struct1)[...] -// lldbr-check:(struct_namespace::Struct1) struct1 = Struct1 { a: 0, b: 1 } +// lldb-check:(struct_namespace::Struct1)[...] // lldb-command:v struct2 -// lldbg-check:(struct_namespace::Struct2)[...] -// lldbr-check:(struct_namespace::Struct2) struct2 = { = 2 } +// lldb-check:(struct_namespace::Struct2)[...] // lldb-command:v mod1_struct1 -// lldbg-check:(struct_namespace::mod1::Struct1)[...] -// lldbr-check:(struct_namespace::mod1::Struct1) mod1_struct1 = Struct1 { a: 3, b: 4 } +// lldb-check:(struct_namespace::mod1::Struct1)[...] // lldb-command:v mod1_struct2 -// lldbg-check:(struct_namespace::mod1::Struct2)[...] -// lldbr-check:(struct_namespace::mod1::Struct2) mod1_struct2 = { = 5 } +// lldb-check:(struct_namespace::mod1::Struct2)[...] #![allow(unused_variables)] #![allow(dead_code)] diff --git a/tests/debuginfo/struct-style-enum.rs b/tests/debuginfo/struct-style-enum.rs index 42368017cae..cea9f3def8b 100644 --- a/tests/debuginfo/struct-style-enum.rs +++ b/tests/debuginfo/struct-style-enum.rs @@ -1,5 +1,3 @@ -// Require a gdb or lldb that can read DW_TAG_variant_part. -//@ min-gdb-version: 8.2 //@ min-lldb-version: 1800 //@ compile-flags:-g @@ -9,16 +7,16 @@ // gdb-command:run // gdb-command:print case1 -// gdbr-check:$1 = struct_style_enum::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868} +// gdb-check:$1 = struct_style_enum::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868} // gdb-command:print case2 -// gdbr-check:$2 = struct_style_enum::Regular::Case2{a: 0, b: 286331153, c: 286331153} +// gdb-check:$2 = struct_style_enum::Regular::Case2{a: 0, b: 286331153, c: 286331153} // gdb-command:print case3 -// gdbr-check:$3 = struct_style_enum::Regular::Case3{a: 0, b: 6438275382588823897} +// gdb-check:$3 = struct_style_enum::Regular::Case3{a: 0, b: 6438275382588823897} // gdb-command:print univariant -// gdbr-check:$4 = struct_style_enum::Univariant::TheOnlyCase{a: -1} +// gdb-check:$4 = struct_style_enum::Univariant::TheOnlyCase{a: -1} // === LLDB TESTS ================================================================================== @@ -26,20 +24,16 @@ // lldb-command:run // lldb-command:v case1 -// lldbg-check:(struct_style_enum::Regular) case1 = { value = { a = 0 b = 31868 c = 31868 d = 31868 e = 31868 } $discr$ = 0 } -// lldbr-check:(struct_style_enum::Regular::Case1) case1 = { a = 0 b = 31868 c = 31868 d = 31868 e = 31868 } +// lldb-check:(struct_style_enum::Regular) case1 = { value = { a = 0 b = 31868 c = 31868 d = 31868 e = 31868 } $discr$ = 0 } // lldb-command:v case2 -// lldbg-check:(struct_style_enum::Regular) case2 = { value = { a = 0 b = 286331153 c = 286331153 } $discr$ = 1 } -// lldbr-check:(struct_style_enum::Regular::Case2) case2 = Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 } +// lldb-check:(struct_style_enum::Regular) case2 = { value = { a = 0 b = 286331153 c = 286331153 } $discr$ = 1 } // lldb-command:v case3 -// lldbg-check:(struct_style_enum::Regular) case3 = { value = { a = 0 b = 6438275382588823897 } $discr$ = 2 } -// lldbr-check:(struct_style_enum::Regular::Case3) case3 = Case3 { Case1: 0, Case2: 6438275382588823897 } +// lldb-check:(struct_style_enum::Regular) case3 = { value = { a = 0 b = 6438275382588823897 } $discr$ = 2 } // lldb-command:v univariant -// lldbg-check:(struct_style_enum::Univariant) univariant = { value = { a = -1 } } -// lldbr-check:(struct_style_enum::Univariant) univariant = Univariant { TheOnlyCase: TheOnlyCase { a: -1 } } +// lldb-check:(struct_style_enum::Univariant) univariant = { value = { a = -1 } } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/struct-with-destructor.rs b/tests/debuginfo/struct-with-destructor.rs index 12e2ac4225c..c159824980a 100644 --- a/tests/debuginfo/struct-with-destructor.rs +++ b/tests/debuginfo/struct-with-destructor.rs @@ -1,45 +1,35 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== // gdb-command:run // gdb-command:print simple -// gdbg-check:$1 = {x = 10, y = 20} -// gdbr-check:$1 = struct_with_destructor::WithDestructor {x: 10, y: 20} +// gdb-check:$1 = struct_with_destructor::WithDestructor {x: 10, y: 20} // gdb-command:print noDestructor -// gdbg-check:$2 = {a = {x = 10, y = 20}, guard = -1} -// gdbr-check:$2 = struct_with_destructor::NoDestructorGuarded {a: struct_with_destructor::NoDestructor {x: 10, y: 20}, guard: -1} +// gdb-check:$2 = struct_with_destructor::NoDestructorGuarded {a: struct_with_destructor::NoDestructor {x: 10, y: 20}, guard: -1} // gdb-command:print withDestructor -// gdbg-check:$3 = {a = {x = 10, y = 20}, guard = -1} -// gdbr-check:$3 = struct_with_destructor::WithDestructorGuarded {a: struct_with_destructor::WithDestructor {x: 10, y: 20}, guard: -1} +// gdb-check:$3 = struct_with_destructor::WithDestructorGuarded {a: struct_with_destructor::WithDestructor {x: 10, y: 20}, guard: -1} // gdb-command:print nested -// gdbg-check:$4 = {a = {a = {x = 7890, y = 9870}}} -// gdbr-check:$4 = struct_with_destructor::NestedOuter {a: struct_with_destructor::NestedInner {a: struct_with_destructor::WithDestructor {x: 7890, y: 9870}}} +// gdb-check:$4 = struct_with_destructor::NestedOuter {a: struct_with_destructor::NestedInner {a: struct_with_destructor::WithDestructor {x: 7890, y: 9870}}} // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v simple -// lldbg-check:[...] { x = 10 y = 20 } -// lldbr-check:(struct_with_destructor::WithDestructor) simple = { x = 10 y = 20 } +// lldb-check:[...] { x = 10 y = 20 } // lldb-command:v noDestructor -// lldbg-check:[...] { a = { x = 10 y = 20 } guard = -1 } -// lldbr-check:(struct_with_destructor::NoDestructorGuarded) noDestructor = { a = { x = 10 y = 20 } guard = -1 } +// lldb-check:[...] { a = { x = 10 y = 20 } guard = -1 } // lldb-command:v withDestructor -// lldbg-check:[...] { a = { x = 10 y = 20 } guard = -1 } -// lldbr-check:(struct_with_destructor::WithDestructorGuarded) withDestructor = { a = { x = 10 y = 20 } guard = -1 } +// lldb-check:[...] { a = { x = 10 y = 20 } guard = -1 } // lldb-command:v nested -// lldbg-check:[...] { a = { a = { x = 7890 y = 9870 } } } -// lldbr-check:(struct_with_destructor::NestedOuter) nested = { a = { a = { x = 7890 y = 9870 } } } +// lldb-check:[...] { a = { a = { x = 7890 y = 9870 } } } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/thread-names.rs b/tests/debuginfo/thread-names.rs index 6b3b0c7f4b2..265b9271cf3 100644 --- a/tests/debuginfo/thread-names.rs +++ b/tests/debuginfo/thread-names.rs @@ -4,7 +4,7 @@ //@[macos] only-macos //@[win] only-windows //@ ignore-sgx -//@ ignore-windows-gnu +//@ ignore-windows-gnu: gdb on windows-gnu does not print thread names // === GDB TESTS ================================================================================== // diff --git a/tests/debuginfo/trait-pointers.rs b/tests/debuginfo/trait-pointers.rs index 2b4dde4d3a0..71da71b897a 100644 --- a/tests/debuginfo/trait-pointers.rs +++ b/tests/debuginfo/trait-pointers.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // gdb-command:run // lldb-command:run diff --git a/tests/debuginfo/tuple-in-struct.rs b/tests/debuginfo/tuple-in-struct.rs index e36d924e925..a74d6203f5f 100644 --- a/tests/debuginfo/tuple-in-struct.rs +++ b/tests/debuginfo/tuple-in-struct.rs @@ -1,43 +1,31 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // gdb-command:run // gdb-command:print no_padding1 -// gdbg-check:$1 = {x = {__0 = 0, __1 = 1}, y = 2, z = {__0 = 3, __1 = 4, __2 = 5}} -// gdbr-check:$1 = tuple_in_struct::NoPadding1 {x: (0, 1), y: 2, z: (3, 4, 5)} +// gdb-check:$1 = tuple_in_struct::NoPadding1 {x: (0, 1), y: 2, z: (3, 4, 5)} // gdb-command:print no_padding2 -// gdbg-check:$2 = {x = {__0 = 6, __1 = 7}, y = {__0 = {__0 = 8, __1 = 9}, __1 = 10}} -// gdbr-check:$2 = tuple_in_struct::NoPadding2 {x: (6, 7), y: ((8, 9), 10)} +// gdb-check:$2 = tuple_in_struct::NoPadding2 {x: (6, 7), y: ((8, 9), 10)} // gdb-command:print tuple_internal_padding -// gdbg-check:$3 = {x = {__0 = 11, __1 = 12}, y = {__0 = 13, __1 = 14}} -// gdbr-check:$3 = tuple_in_struct::TupleInternalPadding {x: (11, 12), y: (13, 14)} +// gdb-check:$3 = tuple_in_struct::TupleInternalPadding {x: (11, 12), y: (13, 14)} // gdb-command:print struct_internal_padding -// gdbg-check:$4 = {x = {__0 = 15, __1 = 16}, y = {__0 = 17, __1 = 18}} -// gdbr-check:$4 = tuple_in_struct::StructInternalPadding {x: (15, 16), y: (17, 18)} +// gdb-check:$4 = tuple_in_struct::StructInternalPadding {x: (15, 16), y: (17, 18)} // gdb-command:print both_internally_padded -// gdbg-check:$5 = {x = {__0 = 19, __1 = 20, __2 = 21}, y = {__0 = 22, __1 = 23}} -// gdbr-check:$5 = tuple_in_struct::BothInternallyPadded {x: (19, 20, 21), y: (22, 23)} +// gdb-check:$5 = tuple_in_struct::BothInternallyPadded {x: (19, 20, 21), y: (22, 23)} // gdb-command:print single_tuple -// gdbg-check:$6 = {x = {__0 = 24, __1 = 25, __2 = 26}} -// gdbr-check:$6 = tuple_in_struct::SingleTuple {x: (24, 25, 26)} +// gdb-check:$6 = tuple_in_struct::SingleTuple {x: (24, 25, 26)} // gdb-command:print tuple_padded_at_end -// gdbg-check:$7 = {x = {__0 = 27, __1 = 28}, y = {__0 = 29, __1 = 30}} -// gdbr-check:$7 = tuple_in_struct::TuplePaddedAtEnd {x: (27, 28), y: (29, 30)} +// gdb-check:$7 = tuple_in_struct::TuplePaddedAtEnd {x: (27, 28), y: (29, 30)} // gdb-command:print struct_padded_at_end -// gdbg-check:$8 = {x = {__0 = 31, __1 = 32}, y = {__0 = 33, __1 = 34}} -// gdbr-check:$8 = tuple_in_struct::StructPaddedAtEnd {x: (31, 32), y: (33, 34)} +// gdb-check:$8 = tuple_in_struct::StructPaddedAtEnd {x: (31, 32), y: (33, 34)} // gdb-command:print both_padded_at_end -// gdbg-check:$9 = {x = {__0 = 35, __1 = 36, __2 = 37}, y = {__0 = 38, __1 = 39}} -// gdbr-check:$9 = tuple_in_struct::BothPaddedAtEnd {x: (35, 36, 37), y: (38, 39)} +// gdb-check:$9 = tuple_in_struct::BothPaddedAtEnd {x: (35, 36, 37), y: (38, 39)} // gdb-command:print mixed_padding -// gdbg-check:$10 = {x = {__0 = {__0 = 40, __1 = 41, __2 = 42}, __1 = {__0 = 43, __1 = 44}}, y = {__0 = 45, __1 = 46, __2 = 47, __3 = 48}} -// gdbr-check:$10 = tuple_in_struct::MixedPadding {x: ((40, 41, 42), (43, 44)), y: (45, 46, 47, 48)} +// gdb-check:$10 = tuple_in_struct::MixedPadding {x: ((40, 41, 42), (43, 44)), y: (45, 46, 47, 48)} #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/tuple-in-tuple.rs b/tests/debuginfo/tuple-in-tuple.rs index 8ed0e1f9c13..d4388095ad7 100644 --- a/tests/debuginfo/tuple-in-tuple.rs +++ b/tests/debuginfo/tuple-in-tuple.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -7,28 +5,21 @@ // gdb-command:run // gdb-command:print no_padding1 -// gdbg-check:$1 = {__0 = {__0 = 0, __1 = 1}, __1 = 2, __2 = 3} -// gdbr-check:$1 = ((0, 1), 2, 3) +// gdb-check:$1 = ((0, 1), 2, 3) // gdb-command:print no_padding2 -// gdbg-check:$2 = {__0 = 4, __1 = {__0 = 5, __1 = 6}, __2 = 7} -// gdbr-check:$2 = (4, (5, 6), 7) +// gdb-check:$2 = (4, (5, 6), 7) // gdb-command:print no_padding3 -// gdbg-check:$3 = {__0 = 8, __1 = 9, __2 = {__0 = 10, __1 = 11}} -// gdbr-check:$3 = (8, 9, (10, 11)) +// gdb-check:$3 = (8, 9, (10, 11)) // gdb-command:print internal_padding1 -// gdbg-check:$4 = {__0 = 12, __1 = {__0 = 13, __1 = 14}} -// gdbr-check:$4 = (12, (13, 14)) +// gdb-check:$4 = (12, (13, 14)) // gdb-command:print internal_padding2 -// gdbg-check:$5 = {__0 = 15, __1 = {__0 = 16, __1 = 17}} -// gdbr-check:$5 = (15, (16, 17)) +// gdb-check:$5 = (15, (16, 17)) // gdb-command:print padding_at_end1 -// gdbg-check:$6 = {__0 = 18, __1 = {__0 = 19, __1 = 20}} -// gdbr-check:$6 = (18, (19, 20)) +// gdb-check:$6 = (18, (19, 20)) // gdb-command:print padding_at_end2 -// gdbg-check:$7 = {__0 = {__0 = 21, __1 = 22}, __1 = 23} -// gdbr-check:$7 = ((21, 22), 23) +// gdb-check:$7 = ((21, 22), 23) // === LLDB TESTS ================================================================================== @@ -36,28 +27,21 @@ // lldb-command:run // lldb-command:v no_padding1 -// lldbg-check:[...] { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 } -// lldbr-check:(((u32, u32), u32, u32)) no_padding1 = { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 } +// lldb-check:[...] { 0 = { 0 = 0 1 = 1 } 1 = 2 2 = 3 } // lldb-command:v no_padding2 -// lldbg-check:[...] { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 } -// lldbr-check:((u32, (u32, u32), u32)) no_padding2 = { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 } +// lldb-check:[...] { 0 = 4 1 = { 0 = 5 1 = 6 } 2 = 7 } // lldb-command:v no_padding3 -// lldbg-check:[...] { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } } -// lldbr-check:((u32, u32, (u32, u32))) no_padding3 = { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } } +// lldb-check:[...] { 0 = 8 1 = 9 2 = { 0 = 10 1 = 11 } } // lldb-command:v internal_padding1 -// lldbg-check:[...] { 0 = 12 1 = { 0 = 13 1 = 14 } } -// lldbr-check:((i16, (i32, i32))) internal_padding1 = { 0 = 12 1 = { 0 = 13 1 = 14 } } +// lldb-check:[...] { 0 = 12 1 = { 0 = 13 1 = 14 } } // lldb-command:v internal_padding2 -// lldbg-check:[...] { 0 = 15 1 = { 0 = 16 1 = 17 } } -// lldbr-check:((i16, (i16, i32))) internal_padding2 = { 0 = 15 1 = { 0 = 16 1 = 17 } } +// lldb-check:[...] { 0 = 15 1 = { 0 = 16 1 = 17 } } // lldb-command:v padding_at_end1 -// lldbg-check:[...] { 0 = 18 1 = { 0 = 19 1 = 20 } } -// lldbr-check:((i32, (i32, i16))) padding_at_end1 = { 0 = 18 1 = { 0 = 19 1 = 20 } } +// lldb-check:[...] { 0 = 18 1 = { 0 = 19 1 = 20 } } // lldb-command:v padding_at_end2 -// lldbg-check:[...] { 0 = { 0 = 21 1 = 22 } 1 = 23 } -// lldbr-check:(((i32, i16), i32)) padding_at_end2 = { 0 = { 0 = 21 1 = 22 } 1 = 23 } +// lldb-check:[...] { 0 = { 0 = 21 1 = 22 } 1 = 23 } // === CDB TESTS ================================================================================== diff --git a/tests/debuginfo/tuple-struct.rs b/tests/debuginfo/tuple-struct.rs index 88b1ae19e29..0110203a7c7 100644 --- a/tests/debuginfo/tuple-struct.rs +++ b/tests/debuginfo/tuple-struct.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -7,28 +5,22 @@ // gdb-command:run // gdb-command:print no_padding16 -// gdbg-check:$1 = {__0 = 10000, __1 = -10001} -// gdbr-check:$1 = tuple_struct::NoPadding16 (10000, -10001) +// gdb-check:$1 = tuple_struct::NoPadding16 (10000, -10001) // gdb-command:print no_padding32 -// gdbg-check:$2 = {__0 = -10002, __1 = -10003.5, __2 = 10004} -// gdbr-check:$2 = tuple_struct::NoPadding32 (-10002, -10003.5, 10004) +// gdb-check:$2 = tuple_struct::NoPadding32 (-10002, -10003.5, 10004) // gdb-command:print no_padding64 -// gdbg-check:$3 = {__0 = -10005.5, __1 = 10006, __2 = 10007} -// gdbr-check:$3 = tuple_struct::NoPadding64 (-10005.5, 10006, 10007) +// gdb-check:$3 = tuple_struct::NoPadding64 (-10005.5, 10006, 10007) // gdb-command:print no_padding163264 -// gdbg-check:$4 = {__0 = -10008, __1 = 10009, __2 = 10010, __3 = 10011} -// gdbr-check:$4 = tuple_struct::NoPadding163264 (-10008, 10009, 10010, 10011) +// gdb-check:$4 = tuple_struct::NoPadding163264 (-10008, 10009, 10010, 10011) // gdb-command:print internal_padding -// gdbg-check:$5 = {__0 = 10012, __1 = -10013} -// gdbr-check:$5 = tuple_struct::InternalPadding (10012, -10013) +// gdb-check:$5 = tuple_struct::InternalPadding (10012, -10013) // gdb-command:print padding_at_end -// gdbg-check:$6 = {__0 = -10014, __1 = 10015} -// gdbr-check:$6 = tuple_struct::PaddingAtEnd (-10014, 10015) +// gdb-check:$6 = tuple_struct::PaddingAtEnd (-10014, 10015) // === LLDB TESTS ================================================================================== @@ -36,28 +28,22 @@ // lldb-command:run // lldb-command:v no_padding16 -// lldbg-check:[...] { 0 = 10000 1 = -10001 } -// lldbr-check:(tuple_struct::NoPadding16) no_padding16 = { 0 = 10000 1 = -10001 } +// lldb-check:[...] { 0 = 10000 1 = -10001 } // lldb-command:v no_padding32 -// lldbg-check:[...] { 0 = -10002 1 = -10003.5 2 = 10004 } -// lldbr-check:(tuple_struct::NoPadding32) no_padding32 = { 0 = -10002 1 = -10003.5 2 = 10004 } +// lldb-check:[...] { 0 = -10002 1 = -10003.5 2 = 10004 } // lldb-command:v no_padding64 -// lldbg-check:[...] { 0 = -10005.5 1 = 10006 2 = 10007 } -// lldbr-check:(tuple_struct::NoPadding64) no_padding64 = { 0 = -10005.5 1 = 10006 2 = 10007 } +// lldb-check:[...] { 0 = -10005.5 1 = 10006 2 = 10007 } // lldb-command:v no_padding163264 -// lldbg-check:[...] { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } -// lldbr-check:(tuple_struct::NoPadding163264) no_padding163264 = { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } +// lldb-check:[...] { 0 = -10008 1 = 10009 2 = 10010 3 = 10011 } // lldb-command:v internal_padding -// lldbg-check:[...] { 0 = 10012 1 = -10013 } -// lldbr-check:(tuple_struct::InternalPadding) internal_padding = { 0 = 10012 1 = -10013 } +// lldb-check:[...] { 0 = 10012 1 = -10013 } // lldb-command:v padding_at_end -// lldbg-check:[...] { 0 = -10014 1 = 10015 } -// lldbr-check:(tuple_struct::PaddingAtEnd) padding_at_end = { 0 = -10014 1 = 10015 } +// lldb-check:[...] { 0 = -10014 1 = 10015 } // This test case mainly makes sure that no field names are generated for tuple structs (as opposed // to all fields having the name "<unnamed_field>"). Otherwise they are handled the same a normal diff --git a/tests/debuginfo/tuple-style-enum.rs b/tests/debuginfo/tuple-style-enum.rs index 3de4ecb1284..a759ad61c05 100644 --- a/tests/debuginfo/tuple-style-enum.rs +++ b/tests/debuginfo/tuple-style-enum.rs @@ -1,5 +1,3 @@ -// Require a gdb or lldb that can read DW_TAG_variant_part. -//@ min-gdb-version: 8.2 //@ min-lldb-version: 1800 //@ compile-flags:-g @@ -10,16 +8,16 @@ // gdb-command:run // gdb-command:print case1 -// gdbr-check:$1 = tuple_style_enum::Regular::Case1(0, 31868, 31868, 31868, 31868) +// gdb-check:$1 = tuple_style_enum::Regular::Case1(0, 31868, 31868, 31868, 31868) // gdb-command:print case2 -// gdbr-check:$2 = tuple_style_enum::Regular::Case2(0, 286331153, 286331153) +// gdb-check:$2 = tuple_style_enum::Regular::Case2(0, 286331153, 286331153) // gdb-command:print case3 -// gdbr-check:$3 = tuple_style_enum::Regular::Case3(0, 6438275382588823897) +// gdb-check:$3 = tuple_style_enum::Regular::Case3(0, 6438275382588823897) // gdb-command:print univariant -// gdbr-check:$4 = tuple_style_enum::Univariant::TheOnlyCase(-1) +// gdb-check:$4 = tuple_style_enum::Univariant::TheOnlyCase(-1) // === LLDB TESTS ================================================================================== @@ -27,20 +25,16 @@ // lldb-command:run // lldb-command:v case1 -// lldbg-check:(tuple_style_enum::Regular) case1 = { value = { 0 = 0 1 = 31868 2 = 31868 3 = 31868 4 = 31868 } $discr$ = 0 } -// lldbr-check:(tuple_style_enum::Regular::Case1) case1 = { = 0 = 31868 = 31868 = 31868 = 31868 } +// lldb-check:(tuple_style_enum::Regular) case1 = { value = { 0 = 0 1 = 31868 2 = 31868 3 = 31868 4 = 31868 } $discr$ = 0 } // lldb-command:v case2 -// lldbg-check:(tuple_style_enum::Regular) case2 = { value = { 0 = 0 1 = 286331153 2 = 286331153 } $discr$ = 1 } -// lldbr-check:(tuple_style_enum::Regular::Case2) case2 = Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 } +// lldb-check:(tuple_style_enum::Regular) case2 = { value = { 0 = 0 1 = 286331153 2 = 286331153 } $discr$ = 1 } // lldb-command:v case3 -// lldbg-check:(tuple_style_enum::Regular) case3 = { value = { 0 = 0 1 = 6438275382588823897 } $discr$ = 2 } -// lldbr-check:(tuple_style_enum::Regular::Case3) case3 = Case3 { Case1: 0, Case2: 6438275382588823897 } +// lldb-check:(tuple_style_enum::Regular) case3 = { value = { 0 = 0 1 = 6438275382588823897 } $discr$ = 2 } // lldb-command:v univariant -// lldbg-check:(tuple_style_enum::Univariant) univariant = { value = { 0 = -1 } } -// lldbr-check:(tuple_style_enum::Univariant) univariant = { TheOnlyCase = { = -1 } } +// lldb-check:(tuple_style_enum::Univariant) univariant = { value = { 0 = -1 } } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/union-smoke.rs b/tests/debuginfo/union-smoke.rs index 9b1cf6e1e95..6043240069e 100644 --- a/tests/debuginfo/union-smoke.rs +++ b/tests/debuginfo/union-smoke.rs @@ -1,31 +1,21 @@ -//@ min-lldb-version: 310 -//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 - -//@ ignore-gdb-version: 7.11.90 - 7.12.9 - //@ compile-flags:-g // === GDB TESTS =================================================================================== // gdb-command:run // gdb-command:print u -// gdbg-check:$1 = {a = {__0 = 2 '\002', __1 = 2 '\002'}, b = 514} -// gdbr-check:$1 = union_smoke::U {a: (2, 2), b: 514} +// gdb-check:$1 = union_smoke::U {a: (2, 2), b: 514} // gdb-command:print union_smoke::SU -// gdbg-check:$2 = {a = {__0 = 1 '\001', __1 = 1 '\001'}, b = 257} -// gdbr-check:$2 = union_smoke::U {a: (1, 1), b: 257} +// gdb-check:$2 = union_smoke::U {a: (1, 1), b: 257} // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v u -// lldbg-check:[...] { a = { 0 = '\x02' 1 = '\x02' } b = 514 } -// lldbr-check:(union_smoke::U) u = { a = { 0 = '\x02' 1 = '\x02' } b = 514 } +// lldb-check:[...] { a = { 0 = '\x02' 1 = '\x02' } b = 514 } -// Don't test this with rust-enabled lldb for now; see -// https://github.com/rust-lang-nursery/lldb/issues/18 -// lldbg-command:print union_smoke::SU -// lldbg-check:[...] { a = { 0 = '\x01' 1 = '\x01' } b = 257 } +// lldb-command:print union_smoke::SU +// lldb-check:[...] { a = { 0 = '\x01' 1 = '\x01' } b = 257 } #![allow(unused)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/unique-enum.rs b/tests/debuginfo/unique-enum.rs index 514c7c50812..230429278aa 100644 --- a/tests/debuginfo/unique-enum.rs +++ b/tests/debuginfo/unique-enum.rs @@ -1,5 +1,3 @@ -// Require a gdb or lldb that can read DW_TAG_variant_part. -//@ min-gdb-version: 8.2 //@ min-lldb-version: 1800 //@ compile-flags:-g @@ -9,13 +7,13 @@ // gdb-command:run // gdb-command:print *the_a -// gdbr-check:$1 = unique_enum::ABC::TheA{x: 0, y: 8970181431921507452} +// gdb-check:$1 = unique_enum::ABC::TheA{x: 0, y: 8970181431921507452} // gdb-command:print *the_b -// gdbr-check:$2 = unique_enum::ABC::TheB(0, 286331153, 286331153) +// gdb-check:$2 = unique_enum::ABC::TheB(0, 286331153, 286331153) // gdb-command:print *univariant -// gdbr-check:$3 = unique_enum::Univariant::TheOnlyCase(123234) +// gdb-check:$3 = unique_enum::Univariant::TheOnlyCase(123234) // === LLDB TESTS ================================================================================== @@ -23,16 +21,13 @@ // lldb-command:run // lldb-command:v *the_a -// lldbg-check:(unique_enum::ABC) *the_a = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } -// lldbr-check:(unique_enum::ABC::TheA) *the_a = TheA { TheA: 0, TheB: 8970181431921507452 } +// lldb-check:(unique_enum::ABC) *the_a = { value = { x = 0 y = 8970181431921507452 } $discr$ = 0 } // lldb-command:v *the_b -// lldbg-check:(unique_enum::ABC) *the_b = { value = { 0 = 0 1 = 286331153 2 = 286331153 } $discr$ = 1 } -// lldbr-check:(unique_enum::ABC::TheB) *the_b = { = 0 = 286331153 = 286331153 } +// lldb-check:(unique_enum::ABC) *the_b = { value = { 0 = 0 1 = 286331153 2 = 286331153 } $discr$ = 1 } // lldb-command:v *univariant -// lldbg-check:(unique_enum::Univariant) *univariant = { value = { 0 = 123234 } } -// lldbr-check:(unique_enum::Univariant) *univariant = { TheOnlyCase = { = 123234 } } +// lldb-check:(unique_enum::Univariant) *univariant = { value = { 0 = 123234 } } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/unit-type.rs b/tests/debuginfo/unit-type.rs index 60b105fc53d..42c0ff11f71 100644 --- a/tests/debuginfo/unit-type.rs +++ b/tests/debuginfo/unit-type.rs @@ -1,8 +1,5 @@ //@ compile-flags:-g -// We only test Rust-aware versions of GDB: -//@ min-gdb-version: 8.2 - // === GDB TESTS =================================================================================== // gdb-command: run diff --git a/tests/debuginfo/unreachable-locals.rs b/tests/debuginfo/unreachable-locals.rs index 72effc10391..d4416387e0b 100644 --- a/tests/debuginfo/unreachable-locals.rs +++ b/tests/debuginfo/unreachable-locals.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g #![allow(unused_variables)] diff --git a/tests/debuginfo/unsized.rs b/tests/debuginfo/unsized.rs index 982ab003a2a..acfe511be7c 100644 --- a/tests/debuginfo/unsized.rs +++ b/tests/debuginfo/unsized.rs @@ -7,28 +7,22 @@ // gdb-command:run // gdb-command:print a -// gdbg-check:$1 = {data_ptr = [...], length = 4} -// gdbr-check:$1 = &unsized::Foo<[u8]> {data_ptr: [...], length: 4} +// gdb-check:$1 = &unsized::Foo<[u8]> {data_ptr: [...], length: 4} // gdb-command:print b -// gdbg-check:$2 = {data_ptr = [...], length = 4} -// gdbr-check:$2 = &unsized::Foo<unsized::Foo<[u8]>> {data_ptr: [...], length: 4} +// gdb-check:$2 = &unsized::Foo<unsized::Foo<[u8]>> {data_ptr: [...], length: 4} // gdb-command:print c -// gdbg-check:$3 = {pointer = [...], vtable = [...]} -// gdbr-check:$3 = &unsized::Foo<dyn core::fmt::Debug> {pointer: [...], vtable: [...]} +// gdb-check:$3 = &unsized::Foo<dyn core::fmt::Debug> {pointer: [...], vtable: [...]} // gdb-command:print _box -// gdbg-check:$4 = {pointer = [...], vtable = [...]} -// gdbr-check:$4 = alloc::boxed::Box<unsized::Foo<dyn core::fmt::Debug>, alloc::alloc::Global> {pointer: [...], vtable: [...]} +// gdb-check:$4 = alloc::boxed::Box<unsized::Foo<dyn core::fmt::Debug>, alloc::alloc::Global> {pointer: [...], vtable: [...]} // gdb-command:print tuple_slice -// gdbg-check:$5 = {data_ptr = [...], length = 2} -// gdbr-check:$5 = &(i32, i32, [i32]) {data_ptr: [...], length: 2} +// gdb-check:$5 = &(i32, i32, [i32]) {data_ptr: [...], length: 2} // gdb-command:print tuple_dyn -// gdbg-check:$6 = {pointer = [...], vtable = [...]} -// gdbr-check:$6 = &(i32, i32, dyn core::fmt::Debug) {pointer: [...], vtable: [...]} +// gdb-check:$6 = &(i32, i32, dyn core::fmt::Debug) {pointer: [...], vtable: [...]} // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/var-captured-in-nested-closure.rs b/tests/debuginfo/var-captured-in-nested-closure.rs index 7772ec00337..4e8700015ba 100644 --- a/tests/debuginfo/var-captured-in-nested-closure.rs +++ b/tests/debuginfo/var-captured-in-nested-closure.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -11,11 +9,9 @@ // gdb-command:print constant // gdb-check:$2 = 2 // gdb-command:print a_struct -// gdbg-check:$3 = {a = -3, b = 4.5, c = 5} -// gdbr-check:$3 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5} +// gdb-check:$3 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5} // gdb-command:print *struct_ref -// gdbg-check:$4 = {a = -3, b = 4.5, c = 5} -// gdbr-check:$4 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5} +// gdb-check:$4 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5} // gdb-command:print *owned // gdb-check:$5 = 6 // gdb-command:print closure_local @@ -27,11 +23,9 @@ // gdb-command:print constant // gdb-check:$8 = 2 // gdb-command:print a_struct -// gdbg-check:$9 = {a = -3, b = 4.5, c = 5} -// gdbr-check:$9 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5} +// gdb-check:$9 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5} // gdb-command:print *struct_ref -// gdbg-check:$10 = {a = -3, b = 4.5, c = 5} -// gdbr-check:$10 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5} +// gdb-check:$10 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5} // gdb-command:print *owned // gdb-check:$11 = 6 // gdb-command:print closure_local @@ -44,43 +38,31 @@ // lldb-command:run // lldb-command:v variable -// lldbg-check:[...] 1 -// lldbr-check:(isize) variable = 1 +// lldb-check:[...] 1 // lldb-command:v constant -// lldbg-check:[...] 2 -// lldbr-check:(isize) constant = 2 +// lldb-check:[...] 2 // lldb-command:v a_struct -// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } -// lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } +// lldb-check:[...] { a = -3 b = 4.5 c = 5 } // lldb-command:v *struct_ref -// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } -// lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } +// lldb-check:[...] { a = -3 b = 4.5 c = 5 } // lldb-command:v *owned -// lldbg-check:[...] 6 -// lldbr-check:(isize) *owned = 6 +// lldb-check:[...] 6 // lldb-command:v closure_local -// lldbg-check:[...] 8 -// lldbr-check:(isize) closure_local = 8 +// lldb-check:[...] 8 // lldb-command:continue // lldb-command:v variable -// lldbg-check:[...] 1 -// lldbr-check:(isize) variable = 1 +// lldb-check:[...] 1 // lldb-command:v constant -// lldbg-check:[...] 2 -// lldbr-check:(isize) constant = 2 +// lldb-check:[...] 2 // lldb-command:v a_struct -// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } -// lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } +// lldb-check:[...] { a = -3 b = 4.5 c = 5 } // lldb-command:v *struct_ref -// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } -// lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } +// lldb-check:[...] { a = -3 b = 4.5 c = 5 } // lldb-command:v *owned -// lldbg-check:[...] 6 -// lldbr-check:(isize) *owned = 6 +// lldb-check:[...] 6 // lldb-command:v closure_local -// lldbg-check:[...] 8 -// lldbr-check:(isize) closure_local = 8 +// lldb-check:[...] 8 // lldb-command:continue diff --git a/tests/debuginfo/var-captured-in-sendable-closure.rs b/tests/debuginfo/var-captured-in-sendable-closure.rs index 782a7d11373..cbb09daeb5f 100644 --- a/tests/debuginfo/var-captured-in-sendable-closure.rs +++ b/tests/debuginfo/var-captured-in-sendable-closure.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -9,8 +7,7 @@ // gdb-command:print constant // gdb-check:$1 = 1 // gdb-command:print a_struct -// gdbg-check:$2 = {a = -2, b = 3.5, c = 4} -// gdbr-check:$2 = var_captured_in_sendable_closure::Struct {a: -2, b: 3.5, c: 4} +// gdb-check:$2 = var_captured_in_sendable_closure::Struct {a: -2, b: 3.5, c: 4} // gdb-command:print *owned // gdb-check:$3 = 5 // gdb-command:continue @@ -24,14 +21,11 @@ // lldb-command:run // lldb-command:v constant -// lldbg-check:[...] 1 -// lldbr-check:(isize) constant = 1 +// lldb-check:[...] 1 // lldb-command:v a_struct -// lldbg-check:[...] { a = -2 b = 3.5 c = 4 } -// lldbr-check:(var_captured_in_sendable_closure::Struct) a_struct = { a = -2 b = 3.5 c = 4 } +// lldb-check:[...] { a = -2 b = 3.5 c = 4 } // lldb-command:v *owned -// lldbg-check:[...] 5 -// lldbr-check:(isize) *owned = 5 +// lldb-check:[...] 5 #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/var-captured-in-stack-closure.rs b/tests/debuginfo/var-captured-in-stack-closure.rs index c9a93cd7b7f..0f84ea57b00 100644 --- a/tests/debuginfo/var-captured-in-stack-closure.rs +++ b/tests/debuginfo/var-captured-in-stack-closure.rs @@ -1,5 +1,3 @@ -//@ min-lldb-version: 310 - //@ compile-flags:-g // === GDB TESTS =================================================================================== @@ -11,11 +9,9 @@ // gdb-command:print constant // gdb-check:$2 = 2 // gdb-command:print a_struct -// gdbg-check:$3 = {a = -3, b = 4.5, c = 5} -// gdbr-check:$3 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5} +// gdb-check:$3 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5} // gdb-command:print *struct_ref -// gdbg-check:$4 = {a = -3, b = 4.5, c = 5} -// gdbr-check:$4 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5} +// gdb-check:$4 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5} // gdb-command:print *owned // gdb-check:$5 = 6 @@ -26,11 +22,9 @@ // gdb-command:print constant // gdb-check:$7 = 2 // gdb-command:print a_struct -// gdbg-check:$8 = {a = -3, b = 4.5, c = 5} -// gdbr-check:$8 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5} +// gdb-check:$8 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5} // gdb-command:print *struct_ref -// gdbg-check:$9 = {a = -3, b = 4.5, c = 5} -// gdbr-check:$9 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5} +// gdb-check:$9 = var_captured_in_stack_closure::Struct {a: -3, b: 4.5, c: 5} // gdb-command:print *owned // gdb-check:$10 = 6 @@ -40,38 +34,28 @@ // lldb-command:run // lldb-command:v variable -// lldbg-check:[...] 1 -// lldbr-check:(isize) variable = 1 +// lldb-check:[...] 1 // lldb-command:v constant -// lldbg-check:[...] 2 -// lldbr-check:(isize) constant = 2 +// lldb-check:[...] 2 // lldb-command:v a_struct -// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } -// lldbr-check:(var_captured_in_stack_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } +// lldb-check:[...] { a = -3 b = 4.5 c = 5 } // lldb-command:v *struct_ref -// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } -// lldbr-check:(var_captured_in_stack_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } +// lldb-check:[...] { a = -3 b = 4.5 c = 5 } // lldb-command:v *owned -// lldbg-check:[...] 6 -// lldbr-check:(isize) *owned = 6 +// lldb-check:[...] 6 // lldb-command:continue // lldb-command:v variable -// lldbg-check:[...] 2 -// lldbr-check:(isize) variable = 2 +// lldb-check:[...] 2 // lldb-command:v constant -// lldbg-check:[...] 2 -// lldbr-check:(isize) constant = 2 +// lldb-check:[...] 2 // lldb-command:v a_struct -// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } -// lldbr-check:(var_captured_in_stack_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 } +// lldb-check:[...] { a = -3 b = 4.5 c = 5 } // lldb-command:v *struct_ref -// lldbg-check:[...] { a = -3 b = 4.5 c = 5 } -// lldbr-check:(var_captured_in_stack_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 } +// lldb-check:[...] { a = -3 b = 4.5 c = 5 } // lldb-command:v *owned -// lldbg-check:[...] 6 -// lldbr-check:(isize) *owned = 6 +// lldb-check:[...] 6 // === CDB TESTS =================================================================================== diff --git a/tests/debuginfo/vec-slices.rs b/tests/debuginfo/vec-slices.rs index a8235dba40c..2b4d624976a 100644 --- a/tests/debuginfo/vec-slices.rs +++ b/tests/debuginfo/vec-slices.rs @@ -1,4 +1,3 @@ -//@ min-lldb-version: 310 //@ ignore-gdb-version: 15.0 - 99.0 // ^ test temporarily disabled as it fails under gdb 15 @@ -12,89 +11,64 @@ // gdb-command:print singleton.length // gdb-check:$2 = 1 -// gdbg-command:print *((i64[1]*)(singleton.data_ptr)) -// gdbr-command:print *(singleton.data_ptr as *const [i64; 1]) -// gdbg-check:$3 = {1} -// gdbr-check:$3 = [1] +// gdb-command:print *(singleton.data_ptr as *const [i64; 1]) +// gdb-check:$3 = [1] // gdb-command:print multiple.length // gdb-check:$4 = 4 -// gdbg-command:print *((i64[4]*)(multiple.data_ptr)) -// gdbr-command:print *(multiple.data_ptr as *const [i64; 4]) -// gdbg-check:$5 = {2, 3, 4, 5} -// gdbr-check:$5 = [2, 3, 4, 5] +// gdb-command:print *(multiple.data_ptr as *const [i64; 4]) +// gdb-check:$5 = [2, 3, 4, 5] // gdb-command:print slice_of_slice.length // gdb-check:$6 = 2 -// gdbg-command:print *((i64[2]*)(slice_of_slice.data_ptr)) -// gdbr-command:print *(slice_of_slice.data_ptr as *const [i64; 2]) -// gdbg-check:$7 = {3, 4} -// gdbr-check:$7 = [3, 4] +// gdb-command:print *(slice_of_slice.data_ptr as *const [i64; 2]) +// gdb-check:$7 = [3, 4] // gdb-command:print padded_tuple.length // gdb-check:$8 = 2 // gdb-command:print padded_tuple.data_ptr[0] -// gdbg-check:$9 = {__0 = 6, __1 = 7} -// gdbr-check:$9 = (6, 7) +// gdb-check:$9 = (6, 7) // gdb-command:print padded_tuple.data_ptr[1] -// gdbg-check:$10 = {__0 = 8, __1 = 9} -// gdbr-check:$10 = (8, 9) +// gdb-check:$10 = (8, 9) // gdb-command:print padded_struct.length // gdb-check:$11 = 2 // gdb-command:print padded_struct.data_ptr[0] -// gdbg-check:$12 = {x = 10, y = 11, z = 12} -// gdbr-check:$12 = vec_slices::AStruct {x: 10, y: 11, z: 12} +// gdb-check:$12 = vec_slices::AStruct {x: 10, y: 11, z: 12} // gdb-command:print padded_struct.data_ptr[1] -// gdbg-check:$13 = {x = 13, y = 14, z = 15} -// gdbr-check:$13 = vec_slices::AStruct {x: 13, y: 14, z: 15} +// gdb-check:$13 = vec_slices::AStruct {x: 13, y: 14, z: 15} // gdb-command:print mut_slice.length // gdb-check:$14 = 5 -// gdbg-command:print *((i64[5]*)(mut_slice.data_ptr)) -// gdbr-command:print *(mut_slice.data_ptr as *const [i64; 5]) -// gdbg-check:$15 = {1, 2, 3, 4, 5} -// gdbr-check:$15 = [1, 2, 3, 4, 5] - -// Some lines below are marked with [ignored] because old GDB versions seem to have trouble -// accessing globals. - -// [ignored] gdbg-command:print 'vec_slices::MUT_VECT_SLICE'.length -// gdbr-command:print MUT_VECT_SLICE.length -// [ignored] gdbg-check:$16 = 2 -// gdbr-check:$16 = 2 -// [ignored] gdbg-command:print *((i64[2]*)('vec_slices::MUT_VECT_SLICE'.data_ptr)) -// gdbr-command:print *(MUT_VECT_SLICE.data_ptr as *const [i64; 2]) -// [ignored] gdbg-check:$17 = {64, 65} -// gdbr-check:$17 = [64, 65] +// gdb-command:print *(mut_slice.data_ptr as *const [i64; 5]) +// gdb-check:$15 = [1, 2, 3, 4, 5] + +// gdb-command:print MUT_VECT_SLICE.length +// gdb-check:$16 = 2 +// gdb-command:print *(MUT_VECT_SLICE.data_ptr as *const [i64; 2]) +// gdb-check:$17 = [64, 65] // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v empty -// lldbg-check:[...] size=0 -// lldbr-check:(&[i64]) empty = size=0 +// lldb-check:[...] size=0 // lldb-command:v singleton -// lldbg-check:[...] size=1 { [0] = 1 } -// lldbr-check:(&[i64]) singleton = &[1] +// lldb-check:[...] size=1 { [0] = 1 } // lldb-command:v multiple -// lldbg-check:[...] size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 } -// lldbr-check:(&[i64]) multiple = size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 } +// lldb-check:[...] size=4 { [0] = 2 [1] = 3 [2] = 4 [3] = 5 } // lldb-command:v slice_of_slice -// lldbg-check:[...] size=2 { [0] = 3 [1] = 4 } -// lldbr-check:(&[i64]) slice_of_slice = size=2 { [0] = 3 [1] = 4 } +// lldb-check:[...] size=2 { [0] = 3 [1] = 4 } // lldb-command:v padded_tuple -// lldbg-check:[...] size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } } -// lldbr-check:(&[(i32, i16)]) padded_tuple = size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } } +// lldb-check:[...] size=2 { [0] = { 0 = 6 1 = 7 } [1] = { 0 = 8 1 = 9 } } // lldb-command:v padded_struct -// lldbg-check:[...] size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } -// lldbr-check:(&[vec_slices::AStruct]) padded_struct = size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } +// lldb-check:[...] size=2 { [0] = { x = 10 y = 11 z = 12 } [1] = { x = 13 y = 14 z = 15 } } #![allow(dead_code, unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/debuginfo/vec.rs b/tests/debuginfo/vec.rs index cf7de0b9b55..1093e38d878 100644 --- a/tests/debuginfo/vec.rs +++ b/tests/debuginfo/vec.rs @@ -1,25 +1,19 @@ -//@ min-lldb-version: 310 -//@ ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 - //@ compile-flags:-g // === GDB TESTS =================================================================================== // gdb-command:run // gdb-command:print a -// gdbg-check:$1 = {1, 2, 3} -// gdbr-check:$1 = [1, 2, 3] +// gdb-check:$1 = [1, 2, 3] // gdb-command:print vec::VECT -// gdbg-check:$2 = {4, 5, 6} -// gdbr-check:$2 = [4, 5, 6] +// gdb-check:$2 = [4, 5, 6] // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:v a -// lldbg-check:[...] { [0] = 1 [1] = 2 [2] = 3 } -// lldbr-check:([i32; 3]) a = { [0] = 1 [1] = 2 [2] = 3 } +// lldb-check:[...] { [0] = 1 [1] = 2 [2] = 3 } #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] diff --git a/tests/incremental/decl_macro.rs b/tests/incremental/decl_macro.rs new file mode 100644 index 00000000000..74810ae4227 --- /dev/null +++ b/tests/incremental/decl_macro.rs @@ -0,0 +1,34 @@ +//@ revisions: rpass1 rpass2 + +// issue#112680 + +#![feature(decl_macro)] + +pub trait T { + type Key; + fn index_from_key(key: Self::Key) -> usize; +} + +pub macro m($key_ty:ident, $val_ty:ident) { + struct $key_ty { + inner: usize, + } + + impl T for $val_ty { + type Key = $key_ty; + + fn index_from_key(key: Self::Key) -> usize { + key.inner + } + } +} + +m!(TestId, Test); + +#[cfg(rpass1)] +struct Test(u32); + +#[cfg(rpass2)] +struct Test; + +fn main() {} diff --git a/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir b/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir index cb72ad3d253..be636da4517 100644 --- a/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/address_of.address_of_reborrow.SimplifyCfg-initial.after.mir @@ -140,7 +140,7 @@ fn address_of_reborrow() -> () { StorageLive(_6); _6 = &raw const (*_1); AscribeUserType(_6, o, UserTypeProjection { base: UserType(0), projs: [] }); - _5 = _6; + _5 = copy _6; StorageDead(_6); StorageDead(_5); StorageLive(_7); @@ -153,7 +153,7 @@ fn address_of_reborrow() -> () { _9 = move _10 as *const dyn std::marker::Send (PointerCoercion(Unsize)); StorageDead(_10); AscribeUserType(_9, o, UserTypeProjection { base: UserType(1), projs: [] }); - _8 = _9; + _8 = copy _9; StorageDead(_9); StorageDead(_8); StorageLive(_11); @@ -194,7 +194,7 @@ fn address_of_reborrow() -> () { StorageLive(_22); _22 = &raw const (*_3); AscribeUserType(_22, o, UserTypeProjection { base: UserType(10), projs: [] }); - _21 = _22; + _21 = copy _22; StorageDead(_22); StorageDead(_21); StorageLive(_23); @@ -207,7 +207,7 @@ fn address_of_reborrow() -> () { _25 = move _26 as *const dyn std::marker::Send (PointerCoercion(Unsize)); StorageDead(_26); AscribeUserType(_25, o, UserTypeProjection { base: UserType(11), projs: [] }); - _24 = _25; + _24 = copy _25; StorageDead(_25); StorageDead(_24); StorageLive(_27); @@ -242,7 +242,7 @@ fn address_of_reborrow() -> () { StorageLive(_36); _36 = &raw mut (*_3); AscribeUserType(_36, o, UserTypeProjection { base: UserType(20), projs: [] }); - _35 = _36; + _35 = copy _36; StorageDead(_36); StorageDead(_35); StorageLive(_37); @@ -255,7 +255,7 @@ fn address_of_reborrow() -> () { _39 = move _40 as *mut dyn std::marker::Send (PointerCoercion(Unsize)); StorageDead(_40); AscribeUserType(_39, o, UserTypeProjection { base: UserType(21), projs: [] }); - _38 = _39; + _38 = copy _39; StorageDead(_39); StorageDead(_38); StorageLive(_41); diff --git a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir index ef51b07827f..a467987e886 100644 --- a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir +++ b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir @@ -33,17 +33,17 @@ fn main() -> () { StorageDead(_4); StorageLive(_5); StorageLive(_6); - _6 = _3; + _6 = copy _3; _5 = foo(move _6) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_6); StorageLive(_7); - _7 = _2; + _7 = copy _2; _8 = Len(_1); - _9 = Lt(_7, _8); - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind unreachable]; + _9 = Lt(copy _7, copy _8); + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, copy _7) -> [success: bb2, unwind unreachable]; } bb2: { diff --git a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir index d1aa9382a2c..bd7365543bd 100644 --- a/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir +++ b/tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir @@ -33,17 +33,17 @@ fn main() -> () { StorageDead(_4); StorageLive(_5); StorageLive(_6); - _6 = _3; + _6 = copy _3; _5 = foo(move _6) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_6); StorageLive(_7); - _7 = _2; + _7 = copy _2; _8 = Len(_1); - _9 = Lt(_7, _8); - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind continue]; + _9 = Lt(copy _7, copy _8); + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, copy _7) -> [success: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/array_index_is_temporary.rs b/tests/mir-opt/array_index_is_temporary.rs index 771fb3771b5..cda9e86b3e6 100644 --- a/tests/mir-opt/array_index_is_temporary.rs +++ b/tests/mir-opt/array_index_is_temporary.rs @@ -15,7 +15,7 @@ fn main() { // CHECK: debug x => [[x:_.*]]; // CHECK: debug y => [[y:_.*]]; // CHECK: [[y]] = const 1_usize; - // CHECK: [[tmp:_.*]] = [[y]]; + // CHECK: [[tmp:_.*]] = copy [[y]]; // CHECK: [[x]][[[tmp]]] = let mut x = [42, 43, 44]; let mut y = 1; diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.coroutine_by_move.0.panic-abort.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.coroutine_by_move.0.panic-abort.mir index 1c34955a8d9..1f5bb551b8e 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.coroutine_by_move.0.panic-abort.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.coroutine_by_move.0.panic-abort.mir @@ -22,7 +22,7 @@ yields () bb0: { StorageLive(_3); - _3 = (_1.0: i32); + _3 = copy (_1.0: i32); FakeRead(ForLet(None), _3); StorageLive(_4); _4 = &_3; diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.coroutine_by_move.0.panic-unwind.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.coroutine_by_move.0.panic-unwind.mir index 1c34955a8d9..1f5bb551b8e 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.coroutine_by_move.0.panic-unwind.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.coroutine_by_move.0.panic-unwind.mir @@ -22,7 +22,7 @@ yields () bb0: { StorageLive(_3); - _3 = (_1.0: i32); + _3 = copy (_1.0: i32); FakeRead(ForLet(None), _3); StorageLive(_4); _4 = &_3; diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.coroutine_by_move.0.panic-abort.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.coroutine_by_move.0.panic-abort.mir index 516908144a6..17fa9314806 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.coroutine_by_move.0.panic-abort.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.coroutine_by_move.0.panic-abort.mir @@ -22,7 +22,7 @@ yields () bb0: { StorageLive(_3); - _3 = (_1.0: i32); + _3 = copy (_1.0: i32); FakeRead(ForLet(None), _3); StorageLive(_4); _4 = &_3; diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.coroutine_by_move.0.panic-unwind.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.coroutine_by_move.0.panic-unwind.mir index 516908144a6..17fa9314806 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.coroutine_by_move.0.panic-unwind.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.coroutine_by_move.0.panic-unwind.mir @@ -22,7 +22,7 @@ yields () bb0: { StorageLive(_3); - _3 = (_1.0: i32); + _3 = copy (_1.0: i32); FakeRead(ForLet(None), _3); StorageLive(_4); _4 = &_3; diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.panic-abort.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.panic-abort.mir index ba20c28cd01..3fdc81791de 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.panic-abort.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.panic-abort.mir @@ -4,7 +4,7 @@ fn main::{closure#0}::{closure#1}(_1: &{async closure@$DIR/async_closure_shims.r let mut _0: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10}; bb0: { - _0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: ((*_1).0: &i32) }; + _0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: copy ((*_1).0: &i32) }; return; } } diff --git a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.panic-unwind.mir b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.panic-unwind.mir index ba20c28cd01..3fdc81791de 100644 --- a/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.panic-unwind.mir +++ b/tests/mir-opt/async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.panic-unwind.mir @@ -4,7 +4,7 @@ fn main::{closure#0}::{closure#1}(_1: &{async closure@$DIR/async_closure_shims.r let mut _0: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10}; bb0: { - _0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: ((*_1).0: &i32) }; + _0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: copy ((*_1).0: &i32) }; return; } } diff --git a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff index f187f959727..2d6adaca19e 100644 --- a/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff +++ b/tests/mir-opt/basic_assignment.main.ElaborateDrops.diff @@ -27,7 +27,7 @@ _1 = const false; StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = move _3; StorageDead(_3); StorageLive(_4); diff --git a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir index 5c0d1e9b93f..d4f0363e443 100644 --- a/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/basic_assignment.main.SimplifyCfg-initial.after.mir @@ -31,7 +31,7 @@ fn main() -> () { FakeRead(ForLet(None), _1); StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = move _3; StorageDead(_3); StorageLive(_4); diff --git a/tests/mir-opt/box_expr.rs b/tests/mir-opt/box_expr.rs index a2d3ab94db6..41cd4ca57bf 100644 --- a/tests/mir-opt/box_expr.rs +++ b/tests/mir-opt/box_expr.rs @@ -7,7 +7,7 @@ fn main() { // CHECK-LABEL: fn main( // CHECK: [[box:_.*]] = ShallowInitBox( - // CHECK: [[ptr:_.*]] = ((([[box]].0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>).0: *const S); + // CHECK: [[ptr:_.*]] = copy ((([[box]].0: std::ptr::Unique<S>).0: std::ptr::NonNull<S>).0: *const S); // CHECK: (*[[ptr]]) = S::new() -> [return: [[ret:bb.*]], unwind: [[unwind:bb.*]]]; // CHECK: [[ret]]: { // CHECK: [[box2:_.*]] = move [[box]]; diff --git a/tests/mir-opt/build_correct_coerce.main.built.after.mir b/tests/mir-opt/build_correct_coerce.main.built.after.mir new file mode 100644 index 00000000000..061174d69bb --- /dev/null +++ b/tests/mir-opt/build_correct_coerce.main.built.after.mir @@ -0,0 +1,18 @@ +// MIR for `main` after built + +fn main() -> () { + let mut _0: (); + let _1: for<'a> fn(&'a (), &'a ()); + scope 1 { + debug x => _1; + } + + bb0: { + StorageLive(_1); + _1 = foo as for<'a> fn(&'a (), &'a ()) (PointerCoercion(ReifyFnPointer)); + FakeRead(ForLet(None), _1); + _0 = const (); + StorageDead(_1); + return; + } +} diff --git a/tests/mir-opt/build_correct_coerce.rs b/tests/mir-opt/build_correct_coerce.rs new file mode 100644 index 00000000000..b6c861636dc --- /dev/null +++ b/tests/mir-opt/build_correct_coerce.rs @@ -0,0 +1,12 @@ +// skip-filecheck + +// Validate that we record the target for the `as` coercion as `for<'a> fn(&'a (), &'a ())`, +// and not `for<'a, 'b>(&'a (), &'b ())`. We previously did the latter due to a bug in +// the code that records adjustments in HIR typeck. + +fn foo<'a, 'b>(_: &'a (), _: &'b ()) {} + +// EMIT_MIR build_correct_coerce.main.built.after.mir +fn main() { + let x = foo as for<'a> fn(&'a (), &'a ()); +} diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir index c0f16ee7ec0..109a41d1ef9 100644 --- a/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir +++ b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir @@ -3,14 +3,14 @@ field_tys: { _0: CoroutineSavedTy { ty: Coroutine( - DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), + DefId(0:5 ~ async_await[ccf8]::a::{closure#0}), [ (), std::future::ResumeTy, (), (), CoroutineWitness( - DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), + DefId(0:5 ~ async_await[ccf8]::a::{closure#0}), [], ), (), @@ -24,14 +24,14 @@ }, _1: CoroutineSavedTy { ty: Coroutine( - DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), + DefId(0:5 ~ async_await[ccf8]::a::{closure#0}), [ (), std::future::ResumeTy, (), (), CoroutineWitness( - DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), + DefId(0:5 ~ async_await[ccf8]::a::{closure#0}), [], ), (), @@ -151,7 +151,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) -> StorageLive(_13); StorageLive(_14); StorageLive(_15); - _15 = _38; + _15 = copy _38; _14 = move _15; goto -> bb6; } @@ -194,8 +194,8 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) -> bb10: { StorageLive(_17); - _17 = ((_9 as Ready).0: ()); - _3 = _17; + _17 = copy ((_9 as Ready).0: ()); + _3 = copy _17; StorageDead(_17); StorageDead(_14); StorageDead(_12); @@ -253,7 +253,7 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) -> StorageLive(_29); StorageLive(_30); StorageLive(_31); - _31 = _38; + _31 = copy _38; _30 = move _31; goto -> bb18; } @@ -291,8 +291,8 @@ fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) -> bb21: { StorageLive(_33); - _33 = ((_25 as Ready).0: ()); - _37 = _33; + _33 = copy ((_25 as Ready).0: ()); + _37 = copy _33; StorageDead(_33); StorageDead(_30); StorageDead(_28); diff --git a/tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir b/tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir index c14882142f5..6d4d261b895 100644 --- a/tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir +++ b/tests/mir-opt/building/custom/aggregate_exprs.adt.built.after.mir @@ -9,8 +9,8 @@ fn adt() -> Onion { bb0: { _1 = const 1_i32; _2 = Foo { a: const 1_i32, b: const 2_i32 }; - _3 = Bar::Foo(move _2, _1); - _0 = Onion { neon: ((_3 as variant#0).1: i32) }; + _3 = Bar::Foo(move _2, copy _1); + _0 = Onion { neon: copy ((_3 as variant#0).1: i32) }; return; } } diff --git a/tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir b/tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir index fde007abab0..2c14258956a 100644 --- a/tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir +++ b/tests/mir-opt/building/custom/aggregate_exprs.array.built.after.mir @@ -8,7 +8,7 @@ fn array() -> [i32; 2] { bb0: { _1 = [const 42_i32, const 43_i32]; _2 = const 1_i32; - _1 = [_2, const 2_i32]; + _1 = [copy _2, const 2_i32]; _0 = move _1; return; } diff --git a/tests/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir b/tests/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir index 189996f1179..72a16b35885 100644 --- a/tests/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir +++ b/tests/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir @@ -6,17 +6,17 @@ fn arbitrary_let(_1: i32) -> i32 { let mut _3: i32; bb0: { - _2 = _1; + _2 = copy _1; goto -> bb2; } bb1: { - _0 = _3; + _0 = copy _3; return; } bb2: { - _3 = _2; + _3 = copy _2; goto -> bb1; } } diff --git a/tests/mir-opt/building/custom/arrays.arrays.built.after.mir b/tests/mir-opt/building/custom/arrays.arrays.built.after.mir index eaeba302f15..30d11e31e4d 100644 --- a/tests/mir-opt/building/custom/arrays.arrays.built.after.mir +++ b/tests/mir-opt/building/custom/arrays.arrays.built.after.mir @@ -8,7 +8,7 @@ fn arrays() -> usize { bb0: { _1 = [const 5_i32; C]; _2 = Len(_1); - _0 = _2; + _0 = copy _2; return; } } diff --git a/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir b/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir index e3334bc7dbe..93750719d27 100644 --- a/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir +++ b/tests/mir-opt/building/custom/as_cast.float_to_int.built.after.mir @@ -4,7 +4,7 @@ fn float_to_int(_1: f32) -> i32 { let mut _0: i32; bb0: { - _0 = _1 as i32 (FloatToInt); + _0 = copy _1 as i32 (FloatToInt); return; } } diff --git a/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir b/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir index d71cb9d78d3..9adec45d64b 100644 --- a/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir +++ b/tests/mir-opt/building/custom/as_cast.int_to_int.built.after.mir @@ -4,7 +4,7 @@ fn int_to_int(_1: u32) -> i32 { let mut _0: i32; bb0: { - _0 = _1 as i32 (IntToInt); + _0 = copy _1 as i32 (IntToInt); return; } } diff --git a/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir index faff79e8c57..aa642258095 100644 --- a/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir +++ b/tests/mir-opt/building/custom/as_cast.int_to_ptr.built.after.mir @@ -4,7 +4,7 @@ fn int_to_ptr(_1: usize) -> *const i32 { let mut _0: *const i32; bb0: { - _0 = _1 as *const i32 (PointerWithExposedProvenance); + _0 = copy _1 as *const i32 (PointerWithExposedProvenance); return; } } diff --git a/tests/mir-opt/building/custom/assume.assume_local.built.after.mir b/tests/mir-opt/building/custom/assume.assume_local.built.after.mir index 7ea1fcd30c2..36e2859ce16 100644 --- a/tests/mir-opt/building/custom/assume.assume_local.built.after.mir +++ b/tests/mir-opt/building/custom/assume.assume_local.built.after.mir @@ -4,7 +4,7 @@ fn assume_local(_1: bool) -> () { let mut _0: (); bb0: { - assume(_1); + assume(copy _1); return; } } diff --git a/tests/mir-opt/building/custom/assume.assume_place.built.after.mir b/tests/mir-opt/building/custom/assume.assume_place.built.after.mir index ce914618d3d..074af333d63 100644 --- a/tests/mir-opt/building/custom/assume.assume_place.built.after.mir +++ b/tests/mir-opt/building/custom/assume.assume_place.built.after.mir @@ -4,7 +4,7 @@ fn assume_place(_1: (bool, u8)) -> () { let mut _0: (); bb0: { - assume((_1.0: bool)); + assume(copy (_1.0: bool)); return; } } diff --git a/tests/mir-opt/building/custom/enums.switch_bool.built.after.mir b/tests/mir-opt/building/custom/enums.switch_bool.built.after.mir index f82e5f1c6fd..beefef331df 100644 --- a/tests/mir-opt/building/custom/enums.switch_bool.built.after.mir +++ b/tests/mir-opt/building/custom/enums.switch_bool.built.after.mir @@ -4,7 +4,7 @@ fn switch_bool(_1: bool) -> u32 { let mut _0: u32; bb0: { - switchInt(_1) -> [1: bb1, 0: bb2, otherwise: bb2]; + switchInt(copy _1) -> [1: bb1, 0: bb2, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/building/custom/enums.switch_option.built.after.mir b/tests/mir-opt/building/custom/enums.switch_option.built.after.mir index fa03f274be3..a854df87866 100644 --- a/tests/mir-opt/building/custom/enums.switch_option.built.after.mir +++ b/tests/mir-opt/building/custom/enums.switch_option.built.after.mir @@ -6,7 +6,7 @@ fn switch_option(_1: Option<()>) -> bool { bb0: { _2 = discriminant(_1); - switchInt(_2) -> [0: bb1, 1: bb2, otherwise: bb2]; + switchInt(copy _2) -> [0: bb1, 1: bb2, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/building/custom/enums.switch_option_repr.built.after.mir b/tests/mir-opt/building/custom/enums.switch_option_repr.built.after.mir index eec2197a8bd..4ffc08772a8 100644 --- a/tests/mir-opt/building/custom/enums.switch_option_repr.built.after.mir +++ b/tests/mir-opt/building/custom/enums.switch_option_repr.built.after.mir @@ -6,7 +6,7 @@ fn switch_option_repr(_1: Bool) -> bool { bb0: { _2 = discriminant(_1); - switchInt(_2) -> [0: bb2, otherwise: bb1]; + switchInt(copy _2) -> [0: bb2, otherwise: bb1]; } bb1: { diff --git a/tests/mir-opt/building/custom/operators.f.built.after.mir b/tests/mir-opt/building/custom/operators.f.built.after.mir index cac82f7b3ea..ed6cddd548f 100644 --- a/tests/mir-opt/building/custom/operators.f.built.after.mir +++ b/tests/mir-opt/building/custom/operators.f.built.after.mir @@ -5,26 +5,26 @@ fn f(_1: i32, _2: bool) -> i32 { let mut _3: (i32, bool); bb0: { - _1 = Neg(_1); - _2 = Not(_2); - _1 = Add(_1, _1); - _1 = Sub(_1, _1); - _1 = Mul(_1, _1); - _1 = Div(_1, _1); - _1 = Rem(_1, _1); - _1 = BitXor(_1, _1); - _1 = BitAnd(_1, _1); - _1 = Shl(_1, _1); - _1 = Shr(_1, _1); - _2 = Eq(_1, _1); - _2 = Lt(_1, _1); - _2 = Le(_1, _1); - _2 = Ge(_1, _1); - _2 = Gt(_1, _1); - _3 = AddWithOverflow(_1, _1); - _2 = (_3.1: bool); - _1 = (_3.0: i32); - _0 = _1; + _1 = Neg(copy _1); + _2 = Not(copy _2); + _1 = Add(copy _1, copy _1); + _1 = Sub(copy _1, copy _1); + _1 = Mul(copy _1, copy _1); + _1 = Div(copy _1, copy _1); + _1 = Rem(copy _1, copy _1); + _1 = BitXor(copy _1, copy _1); + _1 = BitAnd(copy _1, copy _1); + _1 = Shl(copy _1, copy _1); + _1 = Shr(copy _1, copy _1); + _2 = Eq(copy _1, copy _1); + _2 = Lt(copy _1, copy _1); + _2 = Le(copy _1, copy _1); + _2 = Ge(copy _1, copy _1); + _2 = Gt(copy _1, copy _1); + _3 = AddWithOverflow(copy _1, copy _1); + _2 = copy (_3.1: bool); + _1 = copy (_3.0: i32); + _0 = copy _1; return; } } diff --git a/tests/mir-opt/building/custom/operators.g.runtime.after.mir b/tests/mir-opt/building/custom/operators.g.runtime.after.mir index a0ad7d0f93f..7d87fd93278 100644 --- a/tests/mir-opt/building/custom/operators.g.runtime.after.mir +++ b/tests/mir-opt/building/custom/operators.g.runtime.after.mir @@ -6,8 +6,8 @@ fn g(_1: *const i32, _2: *const [i32]) -> () { let mut _4: usize; bb0: { - _3 = PtrMetadata(_1); - _4 = PtrMetadata(_2); + _3 = PtrMetadata(copy _1); + _4 = PtrMetadata(copy _2); return; } } diff --git a/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir b/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir index b1ba5f9314d..b28e96f10ea 100644 --- a/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir +++ b/tests/mir-opt/building/custom/projections.copy_for_deref.built.after.mir @@ -6,7 +6,7 @@ fn copy_for_deref(_1: (&i32, i32)) -> i32 { bb0: { _2 = deref_copy (_1.0: &i32); - _0 = (*_2); + _0 = copy (*_2); return; } } diff --git a/tests/mir-opt/building/custom/projections.simple_index.built.after.mir b/tests/mir-opt/building/custom/projections.simple_index.built.after.mir index f74c61009d3..2cd781696da 100644 --- a/tests/mir-opt/building/custom/projections.simple_index.built.after.mir +++ b/tests/mir-opt/building/custom/projections.simple_index.built.after.mir @@ -6,8 +6,8 @@ fn simple_index(_1: [i32; 10], _2: &[i32]) -> i32 { bb0: { _3 = const 3_usize; - _0 = _1[_3]; - _0 = (*_2)[_3]; + _0 = copy _1[_3]; + _0 = copy (*_2)[_3]; return; } } diff --git a/tests/mir-opt/building/custom/projections.tuples.built.after.mir b/tests/mir-opt/building/custom/projections.tuples.built.after.mir index a370de2ed84..d07269cd0d3 100644 --- a/tests/mir-opt/building/custom/projections.tuples.built.after.mir +++ b/tests/mir-opt/building/custom/projections.tuples.built.after.mir @@ -4,8 +4,8 @@ fn tuples(_1: (u32, i32)) -> (u32, i32) { let mut _0: (u32, i32); bb0: { - (_0.0: u32) = (_1.0: u32); - (_0.1: i32) = (_1.1: i32); + (_0.0: u32) = copy (_1.0: u32); + (_0.1: i32) = copy (_1.1: i32); return; } } diff --git a/tests/mir-opt/building/custom/projections.unions.built.after.mir b/tests/mir-opt/building/custom/projections.unions.built.after.mir index 4189b329e8c..fe4f7acebb5 100644 --- a/tests/mir-opt/building/custom/projections.unions.built.after.mir +++ b/tests/mir-opt/building/custom/projections.unions.built.after.mir @@ -4,7 +4,7 @@ fn unions(_1: U) -> i32 { let mut _0: i32; bb0: { - _0 = (_1.0: i32); + _0 = copy (_1.0: i32); return; } } diff --git a/tests/mir-opt/building/custom/projections.unwrap.built.after.mir b/tests/mir-opt/building/custom/projections.unwrap.built.after.mir index 0c43bdc9d24..ea706e0a97d 100644 --- a/tests/mir-opt/building/custom/projections.unwrap.built.after.mir +++ b/tests/mir-opt/building/custom/projections.unwrap.built.after.mir @@ -4,7 +4,7 @@ fn unwrap(_1: Option<i32>) -> i32 { let mut _0: i32; bb0: { - _0 = ((_1 as variant#1).0: i32); + _0 = copy ((_1 as variant#1).0: i32); return; } } diff --git a/tests/mir-opt/building/custom/projections.unwrap_deref.built.after.mir b/tests/mir-opt/building/custom/projections.unwrap_deref.built.after.mir index 39e97851343..eb83dcece3e 100644 --- a/tests/mir-opt/building/custom/projections.unwrap_deref.built.after.mir +++ b/tests/mir-opt/building/custom/projections.unwrap_deref.built.after.mir @@ -4,7 +4,7 @@ fn unwrap_deref(_1: Option<&i32>) -> i32 { let mut _0: i32; bb0: { - _0 = (*((_1 as variant#1).0: &i32)); + _0 = copy (*((_1 as variant#1).0: &i32)); return; } } diff --git a/tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir b/tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir index 8046b543eef..3893613bff9 100644 --- a/tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir +++ b/tests/mir-opt/building/custom/references.raw_pointer_offset.built.after.mir @@ -4,7 +4,7 @@ fn raw_pointer_offset(_1: *const i32) -> *const i32 { let mut _0: *const i32; bb0: { - _0 = Offset(_1, const 1_isize); + _0 = Offset(copy _1, const 1_isize); return; } } diff --git a/tests/mir-opt/building/custom/simple_assign.simple.built.after.mir b/tests/mir-opt/building/custom/simple_assign.simple.built.after.mir index 6f7aaeed979..10ad840f98c 100644 --- a/tests/mir-opt/building/custom/simple_assign.simple.built.after.mir +++ b/tests/mir-opt/building/custom/simple_assign.simple.built.after.mir @@ -7,14 +7,14 @@ fn simple(_1: i32) -> i32 { bb0: { StorageLive(_2); - _2 = _1; + _2 = copy _1; goto -> bb1; } bb1: { _3 = move _2; StorageDead(_2); - _0 = _3; + _0 = copy _3; return; } } diff --git a/tests/mir-opt/building/custom/terminators.assert_nonzero.built.after.mir b/tests/mir-opt/building/custom/terminators.assert_nonzero.built.after.mir index 9cf26dff350..44030abc797 100644 --- a/tests/mir-opt/building/custom/terminators.assert_nonzero.built.after.mir +++ b/tests/mir-opt/building/custom/terminators.assert_nonzero.built.after.mir @@ -4,7 +4,7 @@ fn assert_nonzero(_1: i32) -> () { let mut _0: (); bb0: { - switchInt(_1) -> [0: bb1, otherwise: bb2]; + switchInt(copy _1) -> [0: bb1, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir b/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir index 07044ceaef4..b29d4ec7095 100644 --- a/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir +++ b/tests/mir-opt/building/custom/terminators.direct_call.built.after.mir @@ -4,7 +4,7 @@ fn direct_call(_1: i32) -> i32 { let mut _0: i32; bb0: { - _0 = ident::<i32>(_1) -> [return: bb1, unwind continue]; + _0 = ident::<i32>(copy _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir b/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir index 3b849354dcd..b88f6603026 100644 --- a/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir +++ b/tests/mir-opt/building/custom/terminators.indirect_call.built.after.mir @@ -4,7 +4,7 @@ fn indirect_call(_1: i32, _2: fn(i32) -> i32) -> i32 { let mut _0: i32; bb0: { - _0 = _2(_1) -> [return: bb1, unwind continue]; + _0 = copy _2(copy _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/building/custom/terminators.tail_call.built.after.mir b/tests/mir-opt/building/custom/terminators.tail_call.built.after.mir index 4cf6e459aa8..ab3925dae1c 100644 --- a/tests/mir-opt/building/custom/terminators.tail_call.built.after.mir +++ b/tests/mir-opt/building/custom/terminators.tail_call.built.after.mir @@ -5,7 +5,7 @@ fn tail_call(_1: i32) -> i32 { let mut _2: i32; bb0: { - _2 = Add(_1, const 42_i32); - tailcall ident::<i32>(Spanned { node: _2, span: $DIR/terminators.rs:32:28: 32:29 (#0) }); + _2 = Add(copy _1, const 42_i32); + tailcall ident::<i32>(Spanned { node: copy _2, span: $DIR/terminators.rs:32:28: 32:29 (#0) }); } } diff --git a/tests/mir-opt/building/enum_cast.bar.built.after.mir b/tests/mir-opt/building/enum_cast.bar.built.after.mir index 512c7321619..72d0cf5d1e8 100644 --- a/tests/mir-opt/building/enum_cast.bar.built.after.mir +++ b/tests/mir-opt/building/enum_cast.bar.built.after.mir @@ -12,8 +12,8 @@ fn bar(_1: Bar) -> usize { StorageLive(_2); _2 = move _1; _3 = discriminant(_2); - _4 = _3 as u8 (IntToInt); - _5 = Le(_4, const 1_u8); + _4 = copy _3 as u8 (IntToInt); + _5 = Le(copy _4, const 1_u8); assume(move _5); _0 = move _3 as usize (IntToInt); StorageDead(_2); diff --git a/tests/mir-opt/building/enum_cast.boo.built.after.mir b/tests/mir-opt/building/enum_cast.boo.built.after.mir index ad0adf14e4a..91e06dc8862 100644 --- a/tests/mir-opt/building/enum_cast.boo.built.after.mir +++ b/tests/mir-opt/building/enum_cast.boo.built.after.mir @@ -12,8 +12,8 @@ fn boo(_1: Boo) -> usize { StorageLive(_2); _2 = move _1; _3 = discriminant(_2); - _4 = _3 as u8 (IntToInt); - _5 = Le(_4, const 1_u8); + _4 = copy _3 as u8 (IntToInt); + _5 = Le(copy _4, const 1_u8); assume(move _5); _0 = move _3 as usize (IntToInt); StorageDead(_2); diff --git a/tests/mir-opt/building/enum_cast.droppy.built.after.mir b/tests/mir-opt/building/enum_cast.droppy.built.after.mir index ea0edb610f5..f53c9199a49 100644 --- a/tests/mir-opt/building/enum_cast.droppy.built.after.mir +++ b/tests/mir-opt/building/enum_cast.droppy.built.after.mir @@ -31,8 +31,8 @@ fn droppy() -> () { StorageLive(_4); _4 = move _2; _5 = discriminant(_4); - _6 = _5 as u8 (IntToInt); - _7 = Le(_6, const 2_u8); + _6 = copy _5 as u8 (IntToInt); + _7 = Le(copy _6, const 2_u8); assume(move _7); _3 = move _5 as usize (IntToInt); drop(_4) -> [return: bb1, unwind: bb4]; diff --git a/tests/mir-opt/building/enum_cast.far.built.after.mir b/tests/mir-opt/building/enum_cast.far.built.after.mir index e75803c706d..14eaf344190 100644 --- a/tests/mir-opt/building/enum_cast.far.built.after.mir +++ b/tests/mir-opt/building/enum_cast.far.built.after.mir @@ -12,8 +12,8 @@ fn far(_1: Far) -> isize { StorageLive(_2); _2 = move _1; _3 = discriminant(_2); - _4 = _3 as u16 (IntToInt); - _5 = Le(_4, const 1_u16); + _4 = copy _3 as u16 (IntToInt); + _5 = Le(copy _4, const 1_u16); assume(move _5); _0 = move _3 as isize (IntToInt); StorageDead(_2); diff --git a/tests/mir-opt/building/enum_cast.offsetty.built.after.mir b/tests/mir-opt/building/enum_cast.offsetty.built.after.mir index 282859d7cd0..1c2acbe3023 100644 --- a/tests/mir-opt/building/enum_cast.offsetty.built.after.mir +++ b/tests/mir-opt/building/enum_cast.offsetty.built.after.mir @@ -14,9 +14,9 @@ fn offsetty(_1: NotStartingAtZero) -> u32 { StorageLive(_2); _2 = move _1; _3 = discriminant(_2); - _4 = _3 as u8 (IntToInt); - _5 = Ge(_4, const 4_u8); - _6 = Le(_4, const 8_u8); + _4 = copy _3 as u8 (IntToInt); + _5 = Ge(copy _4, const 4_u8); + _6 = Le(copy _4, const 8_u8); _7 = BitAnd(move _5, move _6); assume(move _7); _0 = move _3 as u32 (IntToInt); diff --git a/tests/mir-opt/building/enum_cast.signy.built.after.mir b/tests/mir-opt/building/enum_cast.signy.built.after.mir index a9f7d6c7800..39b6dfaf005 100644 --- a/tests/mir-opt/building/enum_cast.signy.built.after.mir +++ b/tests/mir-opt/building/enum_cast.signy.built.after.mir @@ -14,9 +14,9 @@ fn signy(_1: SignedAroundZero) -> i16 { StorageLive(_2); _2 = move _1; _3 = discriminant(_2); - _4 = _3 as u16 (IntToInt); - _5 = Ge(_4, const 65534_u16); - _6 = Le(_4, const 2_u16); + _4 = copy _3 as u16 (IntToInt); + _5 = Ge(copy _4, const 65534_u16); + _6 = Le(copy _4, const 2_u16); _7 = BitOr(move _5, move _6); assume(move _7); _0 = move _3 as i16 (IntToInt); diff --git a/tests/mir-opt/building/eq_never_type._f.built.after.mir b/tests/mir-opt/building/eq_never_type._f.built.after.mir index 39438258c2e..4711af46f1c 100644 --- a/tests/mir-opt/building/eq_never_type._f.built.after.mir +++ b/tests/mir-opt/building/eq_never_type._f.built.after.mir @@ -16,7 +16,7 @@ fn _f(_1: !, _2: !) -> () { StorageLive(_4); StorageLive(_5); StorageLive(_6); - _6 = _1; + _6 = copy _1; unreachable; } @@ -25,7 +25,7 @@ fn _f(_1: !, _2: !) -> () { StorageLive(_7); StorageLive(_8); StorageLive(_9); - _9 = _2; + _9 = copy _2; unreachable; } diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir index 5c50b3db5ca..34e5bedf4ce 100644 --- a/tests/mir-opt/building/issue_101867.main.built.after.mir +++ b/tests/mir-opt/building/issue_101867.main.built.after.mir @@ -55,7 +55,7 @@ fn main() -> () { } bb6: { - _5 = ((_1 as Some).0: u8); + _5 = copy ((_1 as Some).0: u8); _0 = const (); StorageDead(_5); StorageDead(_1); diff --git a/tests/mir-opt/building/issue_49232.main.built.after.mir b/tests/mir-opt/building/issue_49232.main.built.after.mir index d09a1748a8b..b78f6691d54 100644 --- a/tests/mir-opt/building/issue_49232.main.built.after.mir +++ b/tests/mir-opt/building/issue_49232.main.built.after.mir @@ -25,7 +25,7 @@ fn main() -> () { StorageLive(_3); _3 = const true; PlaceMention(_3); - switchInt(_3) -> [0: bb4, otherwise: bb6]; + switchInt(copy _3) -> [0: bb4, otherwise: bb6]; } bb3: { diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir index 3e16efe6980..72bd4605b26 100644 --- a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir +++ b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir @@ -54,7 +54,7 @@ fn test_complex() -> () { StorageLive(_6); StorageLive(_7); _7 = Droppy(const 0_u8); - _6 = (_7.0: u8); + _6 = copy (_7.0: u8); _5 = Gt(move _6, const 0_u8); switchInt(move _5) -> [0: bb10, otherwise: bb9]; } @@ -92,7 +92,7 @@ fn test_complex() -> () { StorageLive(_9); StorageLive(_10); _10 = Droppy(const 1_u8); - _9 = (_10.0: u8); + _9 = copy (_10.0: u8); _8 = Gt(move _9, const 1_u8); switchInt(move _8) -> [0: bb16, otherwise: bb15]; } diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir index 3e7c116016c..2fc19e7e0fd 100644 --- a/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir +++ b/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir @@ -14,7 +14,7 @@ fn test_or() -> () { StorageLive(_2); StorageLive(_3); _3 = Droppy(const 0_u8); - _2 = (_3.0: u8); + _2 = copy (_3.0: u8); _1 = Gt(move _2, const 0_u8); switchInt(move _1) -> [0: bb2, otherwise: bb1]; } @@ -44,7 +44,7 @@ fn test_or() -> () { StorageLive(_5); StorageLive(_6); _6 = Droppy(const 1_u8); - _5 = (_6.0: u8); + _5 = copy (_6.0: u8); _4 = Gt(move _5, const 1_u8); switchInt(move _4) -> [0: bb7, otherwise: bb6]; } diff --git a/tests/mir-opt/building/match/deref-patterns/string.foo.PreCodegen.after.mir b/tests/mir-opt/building/match/deref-patterns/string.foo.PreCodegen.after.mir index 1e4f7485089..9f52a8cd1e5 100644 --- a/tests/mir-opt/building/match/deref-patterns/string.foo.PreCodegen.after.mir +++ b/tests/mir-opt/building/match/deref-patterns/string.foo.PreCodegen.after.mir @@ -26,7 +26,7 @@ fn foo(_1: Option<String>) -> i32 { } bb2: { - _6 = <str as PartialEq>::eq(_5, const "a") -> [return: bb3, unwind unreachable]; + _6 = <str as PartialEq>::eq(copy _5, const "a") -> [return: bb3, unwind unreachable]; } bb3: { @@ -52,7 +52,7 @@ fn foo(_1: Option<String>) -> i32 { } bb7: { - switchInt(_2) -> [0: bb9, otherwise: bb8]; + switchInt(copy _2) -> [0: bb9, otherwise: bb8]; } bb8: { diff --git a/tests/mir-opt/building/match/exponential_or.match_tuple.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/exponential_or.match_tuple.SimplifyCfg-initial.after.mir index 596dcef85fd..d52241b459e 100644 --- a/tests/mir-opt/building/match/exponential_or.match_tuple.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/building/match/exponential_or.match_tuple.SimplifyCfg-initial.after.mir @@ -19,7 +19,7 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 { bb0: { PlaceMention(_1); - switchInt((_1.0: u32)) -> [1: bb2, 4: bb2, otherwise: bb1]; + switchInt(copy (_1.0: u32)) -> [1: bb2, 4: bb2, otherwise: bb1]; } bb1: { @@ -33,26 +33,26 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 { } bb3: { - switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1: bb4, 8: bb4, otherwise: bb1]; + switchInt(copy (((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1: bb4, 8: bb4, otherwise: bb1]; } bb4: { - _5 = Le(const 6_u32, (_1.3: u32)); + _5 = Le(const 6_u32, copy (_1.3: u32)); switchInt(move _5) -> [0: bb5, otherwise: bb7]; } bb5: { - _3 = Le(const 13_u32, (_1.3: u32)); + _3 = Le(const 13_u32, copy (_1.3: u32)); switchInt(move _3) -> [0: bb1, otherwise: bb6]; } bb6: { - _4 = Le((_1.3: u32), const 16_u32); + _4 = Le(copy (_1.3: u32), const 16_u32); switchInt(move _4) -> [0: bb1, otherwise: bb8]; } bb7: { - _6 = Le((_1.3: u32), const 9_u32); + _6 = Le(copy (_1.3: u32), const 9_u32); switchInt(move _6) -> [0: bb5, otherwise: bb8]; } @@ -62,13 +62,13 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 { bb9: { StorageLive(_7); - _7 = (_1.0: u32); + _7 = copy (_1.0: u32); StorageLive(_8); - _8 = (_1.3: u32); + _8 = copy (_1.3: u32); StorageLive(_9); - _9 = _7; + _9 = copy _7; StorageLive(_10); - _10 = _8; + _10 = copy _8; _0 = BitXor(move _9, move _10); StorageDead(_10); StorageDead(_9); diff --git a/tests/mir-opt/building/match/match_false_edges.full_tested_match.built.after.mir b/tests/mir-opt/building/match/match_false_edges.full_tested_match.built.after.mir index a93743edfac..4b0cdcfbb86 100644 --- a/tests/mir-opt/building/match/match_false_edges.full_tested_match.built.after.mir +++ b/tests/mir-opt/building/match/match_false_edges.full_tested_match.built.after.mir @@ -59,9 +59,9 @@ fn full_tested_match() -> () { bb7: { StorageLive(_9); - _9 = ((_2 as Some).0: i32); + _9 = copy ((_2 as Some).0: i32); StorageLive(_10); - _10 = _9; + _10 = copy _9; _1 = (const 2_i32, move _10); StorageDead(_10); StorageDead(_9); @@ -89,9 +89,9 @@ fn full_tested_match() -> () { FakeRead(ForMatchGuard, _3); FakeRead(ForGuardBinding, _6); StorageLive(_5); - _5 = ((_2 as Some).0: i32); + _5 = copy ((_2 as Some).0: i32); StorageLive(_8); - _8 = _5; + _8 = copy _5; _1 = (const 1_i32, move _8); StorageDead(_8); StorageDead(_5); diff --git a/tests/mir-opt/building/match/match_false_edges.full_tested_match2.built.after.mir b/tests/mir-opt/building/match/match_false_edges.full_tested_match2.built.after.mir index 0d0ea2be1b0..63ec71fdf51 100644 --- a/tests/mir-opt/building/match/match_false_edges.full_tested_match2.built.after.mir +++ b/tests/mir-opt/building/match/match_false_edges.full_tested_match2.built.after.mir @@ -42,9 +42,9 @@ fn full_tested_match2() -> () { bb3: { StorageLive(_9); - _9 = ((_2 as Some).0: i32); + _9 = copy ((_2 as Some).0: i32); StorageLive(_10); - _10 = _9; + _10 = copy _9; _1 = (const 2_i32, move _10); StorageDead(_10); StorageDead(_9); @@ -89,9 +89,9 @@ fn full_tested_match2() -> () { FakeRead(ForMatchGuard, _3); FakeRead(ForGuardBinding, _6); StorageLive(_5); - _5 = ((_2 as Some).0: i32); + _5 = copy ((_2 as Some).0: i32); StorageLive(_8); - _8 = _5; + _8 = copy _5; _1 = (const 1_i32, move _8); StorageDead(_8); StorageDead(_5); diff --git a/tests/mir-opt/building/match/match_false_edges.main.built.after.mir b/tests/mir-opt/building/match/match_false_edges.main.built.after.mir index 87b7e29848f..3b10adb499c 100644 --- a/tests/mir-opt/building/match/match_false_edges.main.built.after.mir +++ b/tests/mir-opt/building/match/match_false_edges.main.built.after.mir @@ -61,7 +61,7 @@ fn main() -> () { bb5: { StorageLive(_14); - _14 = _2; + _14 = copy _2; _1 = const 4_i32; StorageDead(_14); goto -> bb22; @@ -86,7 +86,7 @@ fn main() -> () { _3 = &fake shallow _2; StorageLive(_12); StorageLive(_13); - _13 = (*_11); + _13 = copy (*_11); _12 = guard2(move _13) -> [return: bb18, unwind: bb24]; } @@ -96,7 +96,7 @@ fn main() -> () { bb11: { StorageLive(_9); - _9 = _2; + _9 = copy _2; _1 = const 2_i32; StorageDead(_9); goto -> bb22; @@ -123,7 +123,7 @@ fn main() -> () { FakeRead(ForMatchGuard, _3); FakeRead(ForGuardBinding, _7); StorageLive(_6); - _6 = ((_2 as Some).0: i32); + _6 = copy ((_2 as Some).0: i32); _1 = const 1_i32; StorageDead(_6); StorageDead(_7); @@ -150,7 +150,7 @@ fn main() -> () { FakeRead(ForMatchGuard, _3); FakeRead(ForGuardBinding, _11); StorageLive(_10); - _10 = ((_2 as Some).0: i32); + _10 = copy ((_2 as Some).0: i32); _1 = const 3_i32; StorageDead(_10); StorageDead(_11); diff --git a/tests/mir-opt/building/match/simple_match.match_bool.built.after.mir b/tests/mir-opt/building/match/simple_match.match_bool.built.after.mir index b0ebdc37b06..0e82d9591a6 100644 --- a/tests/mir-opt/building/match/simple_match.match_bool.built.after.mir +++ b/tests/mir-opt/building/match/simple_match.match_bool.built.after.mir @@ -6,7 +6,7 @@ fn match_bool(_1: bool) -> usize { bb0: { PlaceMention(_1); - switchInt(_1) -> [0: bb1, otherwise: bb2]; + switchInt(copy _1) -> [0: bb1, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/building/match/sort_candidates.constant_eq.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/sort_candidates.constant_eq.SimplifyCfg-initial.after.mir index 2bce79a3ae7..b8f54fef0fa 100644 --- a/tests/mir-opt/building/match/sort_candidates.constant_eq.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/building/match/sort_candidates.constant_eq.SimplifyCfg-initial.after.mir @@ -16,18 +16,18 @@ fn constant_eq(_1: &str, _2: bool) -> u32 { bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; _3 = (move _4, move _5); StorageDead(_5); StorageDead(_4); PlaceMention(_3); - _9 = <str as PartialEq>::eq((_3.0: &str), const "a") -> [return: bb9, unwind: bb19]; + _9 = <str as PartialEq>::eq(copy (_3.0: &str), const "a") -> [return: bb9, unwind: bb19]; } bb1: { - switchInt((_3.1: bool)) -> [0: bb10, otherwise: bb11]; + switchInt(copy (_3.1: bool)) -> [0: bb10, otherwise: bb11]; } bb2: { @@ -35,7 +35,7 @@ fn constant_eq(_1: &str, _2: bool) -> u32 { } bb3: { - switchInt((_3.1: bool)) -> [0: bb1, otherwise: bb4]; + switchInt(copy (_3.1: bool)) -> [0: bb1, otherwise: bb4]; } bb4: { @@ -43,11 +43,11 @@ fn constant_eq(_1: &str, _2: bool) -> u32 { } bb5: { - _8 = <str as PartialEq>::eq((_3.0: &str), const "b") -> [return: bb8, unwind: bb19]; + _8 = <str as PartialEq>::eq(copy (_3.0: &str), const "b") -> [return: bb8, unwind: bb19]; } bb6: { - switchInt((_3.1: bool)) -> [0: bb1, otherwise: bb7]; + switchInt(copy (_3.1: bool)) -> [0: bb1, otherwise: bb7]; } bb7: { diff --git a/tests/mir-opt/building/match/sort_candidates.disjoint_ranges.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/sort_candidates.disjoint_ranges.SimplifyCfg-initial.after.mir index e521fb4509a..d6251680814 100644 --- a/tests/mir-opt/building/match/sort_candidates.disjoint_ranges.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/building/match/sort_candidates.disjoint_ranges.SimplifyCfg-initial.after.mir @@ -13,7 +13,7 @@ fn disjoint_ranges(_1: i32, _2: bool) -> u32 { bb0: { PlaceMention(_1); - _6 = Le(const 0_i32, _1); + _6 = Le(const 0_i32, copy _1); switchInt(move _6) -> [0: bb3, otherwise: bb8]; } @@ -27,7 +27,7 @@ fn disjoint_ranges(_1: i32, _2: bool) -> u32 { } bb3: { - _4 = Le(const 10_i32, _1); + _4 = Le(const 10_i32, copy _1); switchInt(move _4) -> [0: bb5, otherwise: bb7]; } @@ -36,7 +36,7 @@ fn disjoint_ranges(_1: i32, _2: bool) -> u32 { } bb5: { - switchInt(_1) -> [4294967295: bb6, otherwise: bb1]; + switchInt(copy _1) -> [4294967295: bb6, otherwise: bb1]; } bb6: { @@ -44,12 +44,12 @@ fn disjoint_ranges(_1: i32, _2: bool) -> u32 { } bb7: { - _5 = Le(_1, const 20_i32); + _5 = Le(copy _1, const 20_i32); switchInt(move _5) -> [0: bb5, otherwise: bb4]; } bb8: { - _7 = Lt(_1, const 10_i32); + _7 = Lt(copy _1, const 10_i32); switchInt(move _7) -> [0: bb3, otherwise: bb2]; } @@ -66,7 +66,7 @@ fn disjoint_ranges(_1: i32, _2: bool) -> u32 { bb11: { _3 = &fake shallow _1; StorageLive(_8); - _8 = _2; + _8 = copy _2; switchInt(move _8) -> [0: bb13, otherwise: bb12]; } diff --git a/tests/mir-opt/building/match/sort_candidates.rs b/tests/mir-opt/building/match/sort_candidates.rs index 593a975a7a4..d7dd82791ff 100644 --- a/tests/mir-opt/building/match/sort_candidates.rs +++ b/tests/mir-opt/building/match/sort_candidates.rs @@ -25,7 +25,7 @@ fn disjoint_ranges(x: i32, b: bool) -> u32 { // CHECK-LABEL: fn disjoint_ranges( // CHECK: debug b => _2; // CHECK: bb0: { - // CHECK: switchInt(_2) -> [0: [[jump:bb.*]], otherwise: {{bb.*}}]; + // CHECK: switchInt(copy _2) -> [0: [[jump:bb.*]], otherwise: {{bb.*}}]; // CHECK: [[jump]]: { // CHECK-NEXT: _0 = const 3_u32; // CHECK-NEXT: return; diff --git a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir index 1855bb0787d..296d71a319d 100644 --- a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir +++ b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir @@ -38,7 +38,7 @@ fn main() -> () { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; _3 = move _4 as *const Test (PointerCoercion(MutToConstPointer)); StorageDead(_4); _2 = Test::x(move _3) -> [return: bb2, unwind: bb4]; @@ -63,7 +63,7 @@ fn main() -> () { StorageLive(_10); StorageLive(_11); StorageLive(_12); - _12 = (*(*(*(*_5)))); + _12 = copy (*(*(*(*_5)))); _11 = move _12 as *const Test (PointerCoercion(MutToConstPointer)); StorageDead(_12); _10 = Test::x(move _11) -> [return: bb3, unwind: bb4]; diff --git a/tests/mir-opt/building/shifts.shift_signed.built.after.mir b/tests/mir-opt/building/shifts.shift_signed.built.after.mir index 8706ee9d446..65e2db300cd 100644 --- a/tests/mir-opt/building/shifts.shift_signed.built.after.mir +++ b/tests/mir-opt/building/shifts.shift_signed.built.after.mir @@ -44,12 +44,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128; StorageLive(_6); StorageLive(_7); StorageLive(_8); - _8 = _1; + _8 = copy _1; StorageLive(_9); - _9 = _3; - _10 = _9 as u8 (IntToInt); + _9 = copy _3; + _10 = copy _9 as u8 (IntToInt); _11 = Lt(move _10, const 8_u8); - assert(move _11, "attempt to shift right by `{}`, which would overflow", _9) -> [success: bb1, unwind: bb7]; + assert(move _11, "attempt to shift right by `{}`, which would overflow", copy _9) -> [success: bb1, unwind: bb7]; } bb1: { @@ -58,12 +58,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128; StorageDead(_8); StorageLive(_12); StorageLive(_13); - _13 = _1; + _13 = copy _1; StorageLive(_14); - _14 = _4; - _15 = _14 as u32 (IntToInt); + _14 = copy _4; + _15 = copy _14 as u32 (IntToInt); _16 = Lt(move _15, const 8_u32); - assert(move _16, "attempt to shift right by `{}`, which would overflow", _14) -> [success: bb2, unwind: bb7]; + assert(move _16, "attempt to shift right by `{}`, which would overflow", copy _14) -> [success: bb2, unwind: bb7]; } bb2: { @@ -72,12 +72,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128; StorageDead(_13); StorageLive(_17); StorageLive(_18); - _18 = _1; + _18 = copy _1; StorageLive(_19); - _19 = _5; - _20 = _19 as u128 (IntToInt); + _19 = copy _5; + _20 = copy _19 as u128 (IntToInt); _21 = Lt(move _20, const 8_u128); - assert(move _21, "attempt to shift right by `{}`, which would overflow", _19) -> [success: bb3, unwind: bb7]; + assert(move _21, "attempt to shift right by `{}`, which would overflow", copy _19) -> [success: bb3, unwind: bb7]; } bb3: { @@ -91,12 +91,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128; StorageLive(_22); StorageLive(_23); StorageLive(_24); - _24 = _2; + _24 = copy _2; StorageLive(_25); - _25 = _3; - _26 = _25 as u8 (IntToInt); + _25 = copy _3; + _26 = copy _25 as u8 (IntToInt); _27 = Lt(move _26, const 128_u8); - assert(move _27, "attempt to shift left by `{}`, which would overflow", _25) -> [success: bb4, unwind: bb7]; + assert(move _27, "attempt to shift left by `{}`, which would overflow", copy _25) -> [success: bb4, unwind: bb7]; } bb4: { @@ -105,12 +105,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128; StorageDead(_24); StorageLive(_28); StorageLive(_29); - _29 = _2; + _29 = copy _2; StorageLive(_30); - _30 = _4; - _31 = _30 as u32 (IntToInt); + _30 = copy _4; + _31 = copy _30 as u32 (IntToInt); _32 = Lt(move _31, const 128_u32); - assert(move _32, "attempt to shift left by `{}`, which would overflow", _30) -> [success: bb5, unwind: bb7]; + assert(move _32, "attempt to shift left by `{}`, which would overflow", copy _30) -> [success: bb5, unwind: bb7]; } bb5: { @@ -119,12 +119,12 @@ fn shift_signed(_1: i8, _2: u128, _3: i8, _4: i32, _5: i128) -> ([i8; 3], [u128; StorageDead(_29); StorageLive(_33); StorageLive(_34); - _34 = _2; + _34 = copy _2; StorageLive(_35); - _35 = _5; - _36 = _35 as u128 (IntToInt); + _35 = copy _5; + _36 = copy _35 as u128 (IntToInt); _37 = Lt(move _36, const 128_u128); - assert(move _37, "attempt to shift left by `{}`, which would overflow", _35) -> [success: bb6, unwind: bb7]; + assert(move _37, "attempt to shift left by `{}`, which would overflow", copy _35) -> [success: bb6, unwind: bb7]; } bb6: { diff --git a/tests/mir-opt/building/shifts.shift_unsigned.built.after.mir b/tests/mir-opt/building/shifts.shift_unsigned.built.after.mir index dfd3b5b35ad..62536833e49 100644 --- a/tests/mir-opt/building/shifts.shift_unsigned.built.after.mir +++ b/tests/mir-opt/building/shifts.shift_unsigned.built.after.mir @@ -38,11 +38,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12 StorageLive(_6); StorageLive(_7); StorageLive(_8); - _8 = _1; + _8 = copy _1; StorageLive(_9); - _9 = _3; - _10 = Lt(_9, const 8_u8); - assert(move _10, "attempt to shift right by `{}`, which would overflow", _9) -> [success: bb1, unwind: bb7]; + _9 = copy _3; + _10 = Lt(copy _9, const 8_u8); + assert(move _10, "attempt to shift right by `{}`, which would overflow", copy _9) -> [success: bb1, unwind: bb7]; } bb1: { @@ -51,11 +51,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12 StorageDead(_8); StorageLive(_11); StorageLive(_12); - _12 = _1; + _12 = copy _1; StorageLive(_13); - _13 = _4; - _14 = Lt(_13, const 8_u32); - assert(move _14, "attempt to shift right by `{}`, which would overflow", _13) -> [success: bb2, unwind: bb7]; + _13 = copy _4; + _14 = Lt(copy _13, const 8_u32); + assert(move _14, "attempt to shift right by `{}`, which would overflow", copy _13) -> [success: bb2, unwind: bb7]; } bb2: { @@ -64,11 +64,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12 StorageDead(_12); StorageLive(_15); StorageLive(_16); - _16 = _1; + _16 = copy _1; StorageLive(_17); - _17 = _5; - _18 = Lt(_17, const 8_u128); - assert(move _18, "attempt to shift right by `{}`, which would overflow", _17) -> [success: bb3, unwind: bb7]; + _17 = copy _5; + _18 = Lt(copy _17, const 8_u128); + assert(move _18, "attempt to shift right by `{}`, which would overflow", copy _17) -> [success: bb3, unwind: bb7]; } bb3: { @@ -82,11 +82,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12 StorageLive(_19); StorageLive(_20); StorageLive(_21); - _21 = _2; + _21 = copy _2; StorageLive(_22); - _22 = _3; - _23 = Lt(_22, const 128_u8); - assert(move _23, "attempt to shift left by `{}`, which would overflow", _22) -> [success: bb4, unwind: bb7]; + _22 = copy _3; + _23 = Lt(copy _22, const 128_u8); + assert(move _23, "attempt to shift left by `{}`, which would overflow", copy _22) -> [success: bb4, unwind: bb7]; } bb4: { @@ -95,11 +95,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12 StorageDead(_21); StorageLive(_24); StorageLive(_25); - _25 = _2; + _25 = copy _2; StorageLive(_26); - _26 = _4; - _27 = Lt(_26, const 128_u32); - assert(move _27, "attempt to shift left by `{}`, which would overflow", _26) -> [success: bb5, unwind: bb7]; + _26 = copy _4; + _27 = Lt(copy _26, const 128_u32); + assert(move _27, "attempt to shift left by `{}`, which would overflow", copy _26) -> [success: bb5, unwind: bb7]; } bb5: { @@ -108,11 +108,11 @@ fn shift_unsigned(_1: u8, _2: i128, _3: u8, _4: u32, _5: u128) -> ([u8; 3], [i12 StorageDead(_25); StorageLive(_28); StorageLive(_29); - _29 = _2; + _29 = copy _2; StorageLive(_30); - _30 = _5; - _31 = Lt(_30, const 128_u128); - assert(move _31, "attempt to shift left by `{}`, which would overflow", _30) -> [success: bb6, unwind: bb7]; + _30 = copy _5; + _31 = Lt(copy _30, const 128_u128); + assert(move _31, "attempt to shift left by `{}`, which would overflow", copy _30) -> [success: bb6, unwind: bb7]; } bb6: { diff --git a/tests/mir-opt/building/while_storage.rs b/tests/mir-opt/building/while_storage.rs index 83095316f00..cd226eb0c1e 100644 --- a/tests/mir-opt/building/while_storage.rs +++ b/tests/mir-opt/building/while_storage.rs @@ -15,7 +15,7 @@ fn while_loop(c: bool) { // CHECK: bb1: { // CHECK-NEXT: StorageLive(_3); // CHECK-NEXT: StorageLive(_2); - // CHECK-NEXT: _2 = _1; + // CHECK-NEXT: _2 = copy _1; // CHECK-NEXT: _3 = get_bool(move _2) -> [return: bb2, unwind // CHECK: bb2: { // CHECK-NEXT: switchInt(move _3) -> [0: bb3, otherwise: bb4]; @@ -29,7 +29,7 @@ fn while_loop(c: bool) { // CHECK-NEXT: StorageDead(_2); // CHECK-NEXT: StorageLive(_5); // CHECK-NEXT: StorageLive(_4); - // CHECK-NEXT: _4 = _1; + // CHECK-NEXT: _4 = copy _1; // CHECK-NEXT: _5 = get_bool(move _4) -> [return: bb5, unwind // CHECK: bb5: { // CHECK-NEXT: switchInt(move _5) -> [0: bb6, otherwise: bb7]; diff --git a/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir index 26c82edf2d5..44a8b7342b2 100644 --- a/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir @@ -20,7 +20,7 @@ fn while_loop(_1: bool) -> () { bb1: { StorageLive(_3); StorageLive(_2); - _2 = _1; + _2 = copy _1; _3 = get_bool(move _2) -> [return: bb2, unwind unreachable]; } @@ -40,7 +40,7 @@ fn while_loop(_1: bool) -> () { StorageDead(_2); StorageLive(_5); StorageLive(_4); - _4 = _1; + _4 = copy _1; _5 = get_bool(move _4) -> [return: bb5, unwind unreachable]; } diff --git a/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir index 1bb72074846..9a640300674 100644 --- a/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir @@ -20,7 +20,7 @@ fn while_loop(_1: bool) -> () { bb1: { StorageLive(_3); StorageLive(_2); - _2 = _1; + _2 = copy _1; _3 = get_bool(move _2) -> [return: bb2, unwind continue]; } @@ -40,7 +40,7 @@ fn while_loop(_1: bool) -> () { StorageDead(_2); StorageLive(_5); StorageLive(_4); - _4 = _1; + _4 = copy _1; _5 = get_bool(move _4) -> [return: bb5, unwind continue]; } diff --git a/tests/mir-opt/const_allocation.main.GVN.after.32bit.mir b/tests/mir-opt/const_allocation.main.GVN.after.32bit.mir index 10d99a13463..a2bd2bc0d92 100644 --- a/tests/mir-opt/const_allocation.main.GVN.after.32bit.mir +++ b/tests/mir-opt/const_allocation.main.GVN.after.32bit.mir @@ -9,7 +9,7 @@ fn main() -> () { StorageLive(_1); StorageLive(_2); _2 = const {ALLOC9: &&[(Option<i32>, &[&str])]}; - _1 = (*_2); + _1 = copy (*_2); StorageDead(_2); StorageDead(_1); _0 = const (); diff --git a/tests/mir-opt/const_allocation.main.GVN.after.64bit.mir b/tests/mir-opt/const_allocation.main.GVN.after.64bit.mir index 2f23dbe9ee4..a431104d08b 100644 --- a/tests/mir-opt/const_allocation.main.GVN.after.64bit.mir +++ b/tests/mir-opt/const_allocation.main.GVN.after.64bit.mir @@ -9,7 +9,7 @@ fn main() -> () { StorageLive(_1); StorageLive(_2); _2 = const {ALLOC9: &&[(Option<i32>, &[&str])]}; - _1 = (*_2); + _1 = copy (*_2); StorageDead(_2); StorageDead(_1); _0 = const (); diff --git a/tests/mir-opt/const_allocation2.main.GVN.after.32bit.mir b/tests/mir-opt/const_allocation2.main.GVN.after.32bit.mir index 6499e3676aa..6fae163f107 100644 --- a/tests/mir-opt/const_allocation2.main.GVN.after.32bit.mir +++ b/tests/mir-opt/const_allocation2.main.GVN.after.32bit.mir @@ -9,7 +9,7 @@ fn main() -> () { StorageLive(_1); StorageLive(_2); _2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]}; - _1 = (*_2); + _1 = copy (*_2); StorageDead(_2); StorageDead(_1); _0 = const (); diff --git a/tests/mir-opt/const_allocation2.main.GVN.after.64bit.mir b/tests/mir-opt/const_allocation2.main.GVN.after.64bit.mir index 02f5ebab847..f2bb5f46b16 100644 --- a/tests/mir-opt/const_allocation2.main.GVN.after.64bit.mir +++ b/tests/mir-opt/const_allocation2.main.GVN.after.64bit.mir @@ -9,7 +9,7 @@ fn main() -> () { StorageLive(_1); StorageLive(_2); _2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]}; - _1 = (*_2); + _1 = copy (*_2); StorageDead(_2); StorageDead(_1); _0 = const (); diff --git a/tests/mir-opt/const_allocation3.main.GVN.after.32bit.mir b/tests/mir-opt/const_allocation3.main.GVN.after.32bit.mir index c95e696946a..58776b446fa 100644 --- a/tests/mir-opt/const_allocation3.main.GVN.after.32bit.mir +++ b/tests/mir-opt/const_allocation3.main.GVN.after.32bit.mir @@ -9,7 +9,7 @@ fn main() -> () { StorageLive(_1); StorageLive(_2); _2 = const {ALLOC4: &&Packed}; - _1 = (*_2); + _1 = copy (*_2); StorageDead(_2); StorageDead(_1); _0 = const (); diff --git a/tests/mir-opt/const_allocation3.main.GVN.after.64bit.mir b/tests/mir-opt/const_allocation3.main.GVN.after.64bit.mir index 198bc8bd07e..3ccf4211971 100644 --- a/tests/mir-opt/const_allocation3.main.GVN.after.64bit.mir +++ b/tests/mir-opt/const_allocation3.main.GVN.after.64bit.mir @@ -9,7 +9,7 @@ fn main() -> () { StorageLive(_1); StorageLive(_2); _2 = const {ALLOC2: &&Packed}; - _1 = (*_2); + _1 = copy (*_2); StorageDead(_2); StorageDead(_1); _0 = const (); diff --git a/tests/mir-opt/const_goto_const_eval_fail.f.JumpThreading.diff b/tests/mir-opt/const_goto_const_eval_fail.f.JumpThreading.diff index 4fc9254b7ba..086abeba0f8 100644 --- a/tests/mir-opt/const_goto_const_eval_fail.f.JumpThreading.diff +++ b/tests/mir-opt/const_goto_const_eval_fail.f.JumpThreading.diff @@ -22,7 +22,7 @@ } bb3: { - switchInt(_1) -> [0: bb5, otherwise: bb4]; + switchInt(copy _1) -> [0: bb5, otherwise: bb4]; } bb4: { diff --git a/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff b/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff index ac372f83726..e33185f17bc 100644 --- a/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff +++ b/tests/mir-opt/const_prop/address_of_pair.fn0.GVN.diff @@ -34,10 +34,10 @@ - StorageLive(_5); + nop; StorageLive(_6); - _6 = (_2.1: bool); + _6 = copy (_2.1: bool); _5 = Not(move _6); StorageDead(_6); - _0 = _5; + _0 = copy _5; - StorageDead(_5); + nop; StorageDead(_3); diff --git a/tests/mir-opt/const_prop/address_of_pair.rs b/tests/mir-opt/const_prop/address_of_pair.rs index 9acaaa0ccaf..df1ab229d6e 100644 --- a/tests/mir-opt/const_prop/address_of_pair.rs +++ b/tests/mir-opt/const_prop/address_of_pair.rs @@ -10,13 +10,13 @@ pub fn fn0() -> bool { // CHECK: (*[[ptr]]) = const true; // CHECK-NOT: = const false; // CHECK-NOT: = const true; - // CHECK: [[tmp:_.*]] = ([[pair]].1: bool); + // CHECK: [[tmp:_.*]] = copy ([[pair]].1: bool); // CHECK-NOT: = const false; // CHECK-NOT: = const true; // CHECK: [[ret]] = Not(move [[tmp]]); // CHECK-NOT: = const false; // CHECK-NOT: = const true; - // CHECK: _0 = [[ret]]; + // CHECK: _0 = copy [[ret]]; let mut pair = (1, false); let ptr = core::ptr::addr_of_mut!(pair.1); pair = (1, false); diff --git a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff index 4f0f7fa8fa2..c6d3bad0790 100644 --- a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-abort.diff @@ -24,11 +24,11 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - _4 = (const 0_i32, move _5); -+ _4 = (const 0_i32, _1); ++ _4 = (const 0_i32, copy _1); StorageDead(_5); -- _3 = (_4.0: i32); +- _3 = copy (_4.0: i32); - _2 = Add(move _3, const 1_i32); + _3 = const 0_i32; + _2 = const 1_i32; @@ -38,11 +38,11 @@ StorageLive(_7); StorageLive(_8); StorageLive(_9); - _9 = _1; + _9 = copy _1; - _8 = (move _9, const 1_i32); -+ _8 = (_1, const 1_i32); ++ _8 = (copy _1, const 1_i32); StorageDead(_9); -- _7 = (_8.1: i32); +- _7 = copy (_8.1: i32); - _6 = Add(move _7, const 2_i32); + _7 = const 1_i32; + _6 = const 3_i32; diff --git a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff index 4f0f7fa8fa2..c6d3bad0790 100644 --- a/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/aggregate.foo.GVN.panic-unwind.diff @@ -24,11 +24,11 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - _4 = (const 0_i32, move _5); -+ _4 = (const 0_i32, _1); ++ _4 = (const 0_i32, copy _1); StorageDead(_5); -- _3 = (_4.0: i32); +- _3 = copy (_4.0: i32); - _2 = Add(move _3, const 1_i32); + _3 = const 0_i32; + _2 = const 1_i32; @@ -38,11 +38,11 @@ StorageLive(_7); StorageLive(_8); StorageLive(_9); - _9 = _1; + _9 = copy _1; - _8 = (move _9, const 1_i32); -+ _8 = (_1, const 1_i32); ++ _8 = (copy _1, const 1_i32); StorageDead(_9); -- _7 = (_8.1: i32); +- _7 = copy (_8.1: i32); - _6 = Add(move _7, const 2_i32); + _7 = const 1_i32; + _6 = const 3_i32; diff --git a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff index 854e27445af..0a59c59c2ed 100644 --- a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-abort.diff @@ -18,7 +18,7 @@ StorageLive(_2); StorageLive(_3); _3 = (const 0_i32, const 1_u8, const 2_i32); -- _2 = (_3.1: u8); +- _2 = copy (_3.1: u8); - _1 = Add(move _2, const 0_u8); + _2 = const 1_u8; + _1 = const 1_u8; @@ -26,7 +26,7 @@ StorageDead(_3); StorageLive(_4); StorageLive(_5); -- _5 = _1; +- _5 = copy _1; - _4 = foo(move _5) -> [return: bb1, unwind unreachable]; + _5 = const 1_u8; + _4 = foo(const 1_u8) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff index f6c4b2c9240..100369a2eee 100644 --- a/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/aggregate.main.GVN.panic-unwind.diff @@ -18,7 +18,7 @@ StorageLive(_2); StorageLive(_3); _3 = (const 0_i32, const 1_u8, const 2_i32); -- _2 = (_3.1: u8); +- _2 = copy (_3.1: u8); - _1 = Add(move _2, const 0_u8); + _2 = const 1_u8; + _1 = const 1_u8; @@ -26,7 +26,7 @@ StorageDead(_3); StorageLive(_4); StorageLive(_5); -- _5 = _1; +- _5 = copy _1; - _4 = foo(move _5) -> [return: bb1, unwind continue]; + _5 = const 1_u8; + _4 = foo(const 1_u8) -> [return: bb1, unwind continue]; diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff index 6d00dd5b212..e754af95ce3 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-abort.diff @@ -19,15 +19,15 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind unreachable]; + _4 = const 4_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = _2[_3]; +- _1 = copy _2[_3]; + _1 = const 2_u32; StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff index 7e2f72ab31b..e15a35c7fe9 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.32bit.panic-unwind.diff @@ -19,15 +19,15 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind continue]; + _4 = const 4_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = _2[_3]; +- _1 = copy _2[_3]; + _1 = const 2_u32; StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff index 6d00dd5b212..e754af95ce3 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-abort.diff @@ -19,15 +19,15 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind unreachable]; + _4 = const 4_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = _2[_3]; +- _1 = copy _2[_3]; + _1 = const 2_u32; StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff index 7e2f72ab31b..e15a35c7fe9 100644 --- a/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/array_index.main.GVN.64bit.panic-unwind.diff @@ -19,15 +19,15 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind continue]; + _4 = const 4_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = _2[_3]; +- _1 = copy _2[_3]; + _1 = const 2_u32; StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff index 4838efba6f9..8c535b567c3 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-abort.diff @@ -23,8 +23,8 @@ _1 = const 0_i32; StorageLive(_2); StorageLive(_3); -- _3 = _1; -- _4 = Eq(_3, const 0_i32); +- _3 = copy _1; +- _4 = Eq(copy _3, const 0_i32); - assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind unreachable]; + _3 = const 0_i32; + _4 = const true; @@ -32,10 +32,10 @@ } bb1: { -- _5 = Eq(_3, const -1_i32); +- _5 = Eq(copy _3, const -1_i32); - _6 = Eq(const 1_i32, const i32::MIN); - _7 = BitAnd(move _5, move _6); -- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; +- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, copy _3) -> [success: bb2, unwind unreachable]; + _5 = const false; + _6 = const false; + _7 = const false; diff --git a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff index 7f403d6efc1..045f4d81db6 100644 --- a/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_div_by_zero.main.GVN.panic-unwind.diff @@ -23,8 +23,8 @@ _1 = const 0_i32; StorageLive(_2); StorageLive(_3); -- _3 = _1; -- _4 = Eq(_3, const 0_i32); +- _3 = copy _1; +- _4 = Eq(copy _3, const 0_i32); - assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> [success: bb1, unwind continue]; + _3 = const 0_i32; + _4 = const true; @@ -32,10 +32,10 @@ } bb1: { -- _5 = Eq(_3, const -1_i32); +- _5 = Eq(copy _3, const -1_i32); - _6 = Eq(const 1_i32, const i32::MIN); - _7 = BitAnd(move _5, move _6); -- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue]; +- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, copy _3) -> [success: bb2, unwind continue]; + _5 = const false; + _6 = const false; + _7 = const false; diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff index 59f2eb86f50..e5a8726b855 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-abort.diff @@ -23,8 +23,8 @@ _1 = const 0_i32; StorageLive(_2); StorageLive(_3); -- _3 = _1; -- _4 = Eq(_3, const 0_i32); +- _3 = copy _1; +- _4 = Eq(copy _3, const 0_i32); - assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind unreachable]; + _3 = const 0_i32; + _4 = const true; @@ -32,10 +32,10 @@ } bb1: { -- _5 = Eq(_3, const -1_i32); +- _5 = Eq(copy _3, const -1_i32); - _6 = Eq(const 1_i32, const i32::MIN); - _7 = BitAnd(move _5, move _6); -- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable]; +- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, copy _3) -> [success: bb2, unwind unreachable]; + _5 = const false; + _6 = const false; + _7 = const false; diff --git a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff index 9b866082788..1110ff186dc 100644 --- a/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_mod_by_zero.main.GVN.panic-unwind.diff @@ -23,8 +23,8 @@ _1 = const 0_i32; StorageLive(_2); StorageLive(_3); -- _3 = _1; -- _4 = Eq(_3, const 0_i32); +- _3 = copy _1; +- _4 = Eq(copy _3, const 0_i32); - assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> [success: bb1, unwind continue]; + _3 = const 0_i32; + _4 = const true; @@ -32,10 +32,10 @@ } bb1: { -- _5 = Eq(_3, const -1_i32); +- _5 = Eq(copy _3, const -1_i32); - _6 = Eq(const 1_i32, const i32::MIN); - _7 = BitAnd(move _5, move _6); -- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue]; +- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, copy _3) -> [success: bb2, unwind continue]; + _5 = const false; + _6 = const false; + _7 = const false; diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-abort.diff index 826f4c34277..52aa4da49ef 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-abort.diff @@ -33,15 +33,15 @@ StorageLive(_6); _6 = const 3_usize; _7 = Len((*_1)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; -+ _8 = Lt(const 3_usize, _7); +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; ++ _8 = Lt(const 3_usize, copy _7); + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _5 = (*_1)[_6]; -+ _5 = (*_1)[3 of 4]; +- _5 = copy (*_1)[_6]; ++ _5 = copy (*_1)[3 of 4]; StorageDead(_6); _0 = const (); StorageDead(_5); diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-unwind.diff index 0e2ec65652f..242ff0e664f 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.32bit.panic-unwind.diff @@ -33,15 +33,15 @@ StorageLive(_6); _6 = const 3_usize; _7 = Len((*_1)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; -+ _8 = Lt(const 3_usize, _7); +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; ++ _8 = Lt(const 3_usize, copy _7); + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind continue]; } bb1: { -- _5 = (*_1)[_6]; -+ _5 = (*_1)[3 of 4]; +- _5 = copy (*_1)[_6]; ++ _5 = copy (*_1)[3 of 4]; StorageDead(_6); _0 = const (); StorageDead(_5); diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-abort.diff index 826f4c34277..52aa4da49ef 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-abort.diff @@ -33,15 +33,15 @@ StorageLive(_6); _6 = const 3_usize; _7 = Len((*_1)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; -+ _8 = Lt(const 3_usize, _7); +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; ++ _8 = Lt(const 3_usize, copy _7); + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _5 = (*_1)[_6]; -+ _5 = (*_1)[3 of 4]; +- _5 = copy (*_1)[_6]; ++ _5 = copy (*_1)[3 of 4]; StorageDead(_6); _0 = const (); StorageDead(_5); diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-unwind.diff index 0e2ec65652f..242ff0e664f 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.GVN.64bit.panic-unwind.diff @@ -33,15 +33,15 @@ StorageLive(_6); _6 = const 3_usize; _7 = Len((*_1)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; -+ _8 = Lt(const 3_usize, _7); +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; ++ _8 = Lt(const 3_usize, copy _7); + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> [success: bb1, unwind continue]; } bb1: { -- _5 = (*_1)[_6]; -+ _5 = (*_1)[3 of 4]; +- _5 = copy (*_1)[_6]; ++ _5 = copy (*_1)[3 of 4]; StorageDead(_6); _0 = const (); StorageDead(_5); diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs index 0f8d278535d..139d0fa2e0f 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs @@ -8,7 +8,7 @@ fn main() { // CHECK-LABEL: fn main( // CHECK: debug a => [[a:_.*]]; // CHECK: debug _b => [[b:_.*]]; - // CHECK: [[b]] = (*[[a]])[3 of 4]; + // CHECK: [[b]] = copy (*[[a]])[3 of 4]; let a: *const [_] = &[1, 2, 3]; unsafe { let _b = (*a)[3]; diff --git a/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff b/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff index 0bd8413289e..3fe70302b21 100644 --- a/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff +++ b/tests/mir-opt/const_prop/boolean_identities.test.GVN.diff @@ -22,22 +22,22 @@ - StorageLive(_3); + nop; StorageLive(_4); - _4 = _2; + _4 = copy _2; - _3 = BitOr(move _4, const true); + _3 = const true; StorageDead(_4); - StorageLive(_5); + nop; StorageLive(_6); - _6 = _1; + _6 = copy _1; - _5 = BitAnd(move _6, const false); + _5 = const false; StorageDead(_6); StorageLive(_7); -- _7 = _3; +- _7 = copy _3; + _7 = const true; StorageLive(_8); -- _8 = _5; +- _8 = copy _5; - _0 = BitAnd(move _7, move _8); + _8 = const false; + _0 = const false; diff --git a/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff index a408c197fd1..d5f15b750d4 100644 --- a/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/boxes.main.GVN.panic-abort.diff @@ -32,15 +32,15 @@ bb1: { StorageLive(_7); _7 = ShallowInitBox(move _6, i32); - _8 = (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); + _8 = copy (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); (*_8) = const 42_i32; _3 = move _7; StorageDead(_7); - _9 = (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); - _2 = (*_9); + _9 = copy (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); + _2 = copy (*_9); - _1 = Add(move _2, const 0_i32); - StorageDead(_2); -+ _1 = _2; ++ _1 = copy _2; + nop; drop(_3) -> [return: bb2, unwind unreachable]; } diff --git a/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff index 5706a739602..d4d4f21be6e 100644 --- a/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/boxes.main.GVN.panic-unwind.diff @@ -32,15 +32,15 @@ bb1: { StorageLive(_7); _7 = ShallowInitBox(move _6, i32); - _8 = (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); + _8 = copy (((_7.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); (*_8) = const 42_i32; _3 = move _7; StorageDead(_7); - _9 = (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); - _2 = (*_9); + _9 = copy (((_3.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); + _2 = copy (*_9); - _1 = Add(move _2, const 0_i32); - StorageDead(_2); -+ _1 = _2; ++ _1 = copy _2; + nop; drop(_3) -> [return: bb2, unwind: bb3]; } diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs index 7813352261e..f04db260e27 100644 --- a/tests/mir-opt/const_prop/boxes.rs +++ b/tests/mir-opt/const_prop/boxes.rs @@ -11,8 +11,8 @@ fn main() { // CHECK-LABEL: fn main( // CHECK: debug x => [[x:_.*]]; // CHECK: (*{{_.*}}) = const 42_i32; - // CHECK: [[tmp:_.*]] = (*{{_.*}}); - // CHECK: [[x]] = [[tmp]]; + // CHECK: [[tmp:_.*]] = copy (*{{_.*}}); + // CHECK: [[x]] = copy [[tmp]]; let x = *(#[rustc_box] Box::new(42)) + 0; diff --git a/tests/mir-opt/const_prop/discriminant.main.GVN.32bit.diff b/tests/mir-opt/const_prop/discriminant.main.GVN.32bit.diff index 70c3c3fe7e4..2543cf6257d 100644 --- a/tests/mir-opt/const_prop/discriminant.main.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/discriminant.main.GVN.32bit.diff @@ -26,7 +26,7 @@ } bb1: { -- switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; +- switchInt(copy ((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; + switchInt(const true) -> [0: bb3, otherwise: bb2]; } diff --git a/tests/mir-opt/const_prop/discriminant.main.GVN.64bit.diff b/tests/mir-opt/const_prop/discriminant.main.GVN.64bit.diff index 70c3c3fe7e4..2543cf6257d 100644 --- a/tests/mir-opt/const_prop/discriminant.main.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/discriminant.main.GVN.64bit.diff @@ -26,7 +26,7 @@ } bb1: { -- switchInt(((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; +- switchInt(copy ((_3 as Some).0: bool)) -> [0: bb3, otherwise: bb2]; + switchInt(const true) -> [0: bb3, otherwise: bb2]; } diff --git a/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff index f24b9755eae..208845942c7 100644 --- a/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/indirect.main.GVN.panic-abort.diff @@ -14,7 +14,7 @@ StorageLive(_1); StorageLive(_2); - _2 = const 2_u32 as u8 (IntToInt); -- _3 = AddWithOverflow(_2, const 1_u8); +- _3 = AddWithOverflow(copy _2, const 1_u8); - assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind unreachable]; + _2 = const 2_u8; + _3 = const (3_u8, false); diff --git a/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff index 44ff313b532..4a7c69bae3c 100644 --- a/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/indirect.main.GVN.panic-unwind.diff @@ -14,7 +14,7 @@ StorageLive(_1); StorageLive(_2); - _2 = const 2_u32 as u8 (IntToInt); -- _3 = AddWithOverflow(_2, const 1_u8); +- _3 = AddWithOverflow(copy _2, const 1_u8); - assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind continue]; + _2 = const 2_u8; + _3 = const (3_u8, false); diff --git a/tests/mir-opt/const_prop/indirect_mutation.bar.GVN.diff b/tests/mir-opt/const_prop/indirect_mutation.bar.GVN.diff index 99a6ba7d08a..849a57e2030 100644 --- a/tests/mir-opt/const_prop/indirect_mutation.bar.GVN.diff +++ b/tests/mir-opt/const_prop/indirect_mutation.bar.GVN.diff @@ -28,7 +28,7 @@ StorageDead(_2); StorageLive(_4); StorageLive(_5); - _5 = (_1.0: i32); + _5 = copy (_1.0: i32); _4 = Eq(move _5, const 5_i32); StorageDead(_5); _0 = const (); diff --git a/tests/mir-opt/const_prop/indirect_mutation.foo.GVN.diff b/tests/mir-opt/const_prop/indirect_mutation.foo.GVN.diff index c21869dece6..2435f81206b 100644 --- a/tests/mir-opt/const_prop/indirect_mutation.foo.GVN.diff +++ b/tests/mir-opt/const_prop/indirect_mutation.foo.GVN.diff @@ -24,7 +24,7 @@ StorageDead(_2); StorageLive(_3); StorageLive(_4); - _4 = (_1.0: i32); + _4 = copy (_1.0: i32); _3 = Eq(move _4, const 5_i32); StorageDead(_4); _0 = const (); diff --git a/tests/mir-opt/const_prop/indirect_mutation.rs b/tests/mir-opt/const_prop/indirect_mutation.rs index 32ff8f142b1..e82be0a8388 100644 --- a/tests/mir-opt/const_prop/indirect_mutation.rs +++ b/tests/mir-opt/const_prop/indirect_mutation.rs @@ -1,6 +1,5 @@ //@ test-mir-pass: GVN // Check that we do not propagate past an indirect mutation. -#![feature(raw_ref_op)] // EMIT_MIR indirect_mutation.foo.GVN.diff fn foo() { @@ -10,7 +9,7 @@ fn foo() { // CHECK: _1 = const (1_i32,); // CHECK: _2 = &mut (_1.0: i32); // CHECK: (*_2) = const 5_i32; - // CHECK: _4 = (_1.0: i32); + // CHECK: _4 = copy (_1.0: i32); // CHECK: _3 = Eq(move _4, const 5_i32); let mut u = (1,); @@ -25,7 +24,7 @@ fn bar() { // CHECK: debug y => _4; // CHECK: _3 = &raw mut (_1.0: i32); // CHECK: (*_3) = const 5_i32; - // CHECK: _5 = (_1.0: i32); + // CHECK: _5 = copy (_1.0: i32); // CHECK: _4 = Eq(move _5, const 5_i32); let mut v = (1,); diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff index de9cb7a47a2..ab39c5be4e3 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-abort.diff @@ -19,8 +19,8 @@ StorageLive(_3); _3 = const 1_u8; StorageLive(_4); -- _4 = AddWithOverflow(_2, _3); -- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; +- _4 = AddWithOverflow(copy _2, copy _3); +- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", copy _2, copy _3) -> [success: bb1, unwind unreachable]; + _4 = const (0_u8, true); + assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff index 1f19a13c1e8..1aea0dbb5d5 100644 --- a/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/inherit_overflow.main.GVN.panic-unwind.diff @@ -19,8 +19,8 @@ StorageLive(_3); _3 = const 1_u8; StorageLive(_4); -- _4 = AddWithOverflow(_2, _3); -- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue]; +- _4 = AddWithOverflow(copy _2, copy _3); +- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", copy _2, copy _3) -> [success: bb1, unwind continue]; + _4 = const (0_u8, true); + assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind continue]; } diff --git a/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff index f5041365604..5e843da8679 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.GVN.diff @@ -29,13 +29,13 @@ StorageLive(_1); StorageLive(_2); _2 = InvalidChar { int: const 1114113_u32 }; - _1 = (_2.1: char); + _1 = copy (_2.1: char); StorageDead(_2); StorageLive(_3); StorageLive(_4); StorageLive(_5); _5 = InvalidTag { int: const 4_u32 }; - _4 = (_5.1: E); + _4 = copy (_5.1: E); _3 = [move _4]; StorageDead(_4); StorageDead(_5); diff --git a/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff b/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff index 6e5ad8d6b81..6593b329756 100644 --- a/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff +++ b/tests/mir-opt/const_prop/invalid_constant.main.RemoveZsts.diff @@ -31,13 +31,13 @@ StorageLive(_1); StorageLive(_2); _2 = InvalidChar { int: const 1114113_u32 }; - _1 = (_2.1: char); + _1 = copy (_2.1: char); StorageDead(_2); StorageLive(_3); StorageLive(_4); StorageLive(_5); _5 = InvalidTag { int: const 4_u32 }; - _4 = (_5.1: E); + _4 = copy (_5.1: E); _3 = [move _4]; StorageDead(_4); StorageDead(_5); @@ -47,7 +47,7 @@ + nop; StorageLive(_8); _8 = NoVariants { int: const 0_u32 }; -- _7 = (_8.1: Empty); +- _7 = copy (_8.1: Empty); - _6 = [move _7]; - StorageDead(_7); + nop; diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff index bd987c01ab1..49ea51deed6 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-abort.diff @@ -19,15 +19,15 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind unreachable]; + _4 = const 5000_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = _2[_3]; +- _1 = copy _2[_3]; + _1 = const 0_u8; StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff index e9ebef84ae0..103bfbcaf64 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.32bit.panic-unwind.diff @@ -19,15 +19,15 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind continue]; + _4 = const 5000_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = _2[_3]; +- _1 = copy _2[_3]; + _1 = const 0_u8; StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff index bd987c01ab1..49ea51deed6 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-abort.diff @@ -19,15 +19,15 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind unreachable]; + _4 = const 5000_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = _2[_3]; +- _1 = copy _2[_3]; + _1 = const 0_u8; StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff index e9ebef84ae0..103bfbcaf64 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.GVN.64bit.panic-unwind.diff @@ -19,15 +19,15 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind continue]; + _4 = const 5000_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = _2[_3]; +- _1 = copy _2[_3]; + _1 = const 0_u8; StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/mult_by_zero.test.GVN.diff b/tests/mir-opt/const_prop/mult_by_zero.test.GVN.diff index 6c2aab45d48..290d9d62ce0 100644 --- a/tests/mir-opt/const_prop/mult_by_zero.test.GVN.diff +++ b/tests/mir-opt/const_prop/mult_by_zero.test.GVN.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_2); - _2 = _1; + _2 = copy _1; - _0 = Mul(move _2, const 0_i32); + _0 = const 0_i32; StorageDead(_2); diff --git a/tests/mir-opt/const_prop/mutable_variable.main.GVN.diff b/tests/mir-opt/const_prop/mutable_variable.main.GVN.diff index 11464e32400..cc25b6caf90 100644 --- a/tests/mir-opt/const_prop/mutable_variable.main.GVN.diff +++ b/tests/mir-opt/const_prop/mutable_variable.main.GVN.diff @@ -17,7 +17,7 @@ _1 = const 42_i32; _1 = const 99_i32; StorageLive(_2); - _2 = _1; + _2 = copy _1; _0 = const (); StorageDead(_2); StorageDead(_1); diff --git a/tests/mir-opt/const_prop/mutable_variable.rs b/tests/mir-opt/const_prop/mutable_variable.rs index 9698fba6a11..3aa1b1bcd21 100644 --- a/tests/mir-opt/const_prop/mutable_variable.rs +++ b/tests/mir-opt/const_prop/mutable_variable.rs @@ -7,7 +7,7 @@ fn main() { // CHECK: debug y => [[y:_.*]]; // CHECK: [[x]] = const 42_i32; // CHECK: [[x]] = const 99_i32; - // CHECK: [[y]] = [[x]]; + // CHECK: [[y]] = copy [[x]]; let mut x = 42; x = 99; let y = x; diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.GVN.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.GVN.diff index 7584353620e..3cc71eee710 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate.main.GVN.diff +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.main.GVN.diff @@ -18,7 +18,7 @@ + _1 = const (42_i32, 43_i32); (_1.1: i32) = const 99_i32; StorageLive(_2); - _2 = _1; + _2 = copy _1; _0 = const (); StorageDead(_2); StorageDead(_1); diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs index 80cd75215c1..bb8bf7f7164 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs @@ -8,7 +8,7 @@ fn main() { // CHECK: debug y => [[y:_.*]]; // CHECK: [[x]] = const (42_i32, 43_i32); // CHECK: ([[x]].1: i32) = const 99_i32; - // CHECK: [[y]] = [[x]]; + // CHECK: [[y]] = copy [[x]]; let mut x = (42, 43); x.1 = 99; let y = x; diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.GVN.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.GVN.diff index e16e2969eb8..569ad62b5cc 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.GVN.diff +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.main.GVN.diff @@ -24,7 +24,7 @@ _2 = &mut _1; ((*_2).1: i32) = const 99_i32; StorageLive(_3); - _3 = _1; + _3 = copy _1; _0 = const (); StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs index 856afd53ab4..332cac96f75 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs @@ -10,7 +10,7 @@ fn main() { // CHECK: [[x]] = const (42_i32, 43_i32); // CHECK: [[z]] = &mut [[x]]; // CHECK: ((*[[z]]).1: i32) = const 99_i32; - // CHECK: [[y]] = [[x]]; + // CHECK: [[y]] = copy [[x]]; let mut x = (42, 43); let z = &mut x; z.1 = 99; diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-abort.diff index 6480e480f8c..5b4d18a3c07 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-abort.diff @@ -21,7 +21,7 @@ (_1.1: i32) = const 99_i32; (_1.0: i32) = const 42_i32; StorageLive(_2); - _2 = (_1.1: i32); + _2 = copy (_1.1: i32); _0 = const (); StorageDead(_2); StorageDead(_1); diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-unwind.diff index fb757801082..d58febe368d 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.main.GVN.panic-unwind.diff @@ -21,7 +21,7 @@ (_1.1: i32) = const 99_i32; (_1.0: i32) = const 42_i32; StorageLive(_2); - _2 = (_1.1: i32); + _2 = copy (_1.1: i32); _0 = const (); StorageDead(_2); StorageDead(_1); diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs index 6f99e6be246..e27437a1c75 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs @@ -9,7 +9,7 @@ fn main() { // CHECK: [[x]] = foo() // CHECK: ([[x]].1: i32) = const 99_i32; // CHECK: ([[x]].0: i32) = const 42_i32; - // CHECK: [[y]] = ([[x]].1: i32); + // CHECK: [[y]] = copy ([[x]].1: i32); let mut x: (i32, i32) = foo(); x.1 = 99; x.0 = 42; diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.GVN.diff b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.GVN.diff index 31c839f6749..3f8dc12f4ae 100644 --- a/tests/mir-opt/const_prop/mutable_variable_no_prop.main.GVN.diff +++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.main.GVN.diff @@ -22,14 +22,14 @@ StorageLive(_3); StorageLive(_4); _4 = const {ALLOC0: *mut u32}; - _3 = (*_4); + _3 = copy (*_4); _1 = move _3; StorageDead(_3); StorageDead(_4); _2 = const (); StorageDead(_2); StorageLive(_5); - _5 = _1; + _5 = copy _1; _0 = const (); StorageDead(_5); StorageDead(_1); diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs index 8289832f81e..66af5bf1d5d 100644 --- a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs +++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs @@ -9,9 +9,9 @@ fn main() { // CHECK: debug x => [[x:_.*]]; // CHECK: debug y => [[y:_.*]]; // CHECK: [[x]] = const 42_u32; - // CHECK: [[tmp:_.*]] = (*{{_.*}}); + // CHECK: [[tmp:_.*]] = copy (*{{_.*}}); // CHECK: [[x]] = move [[tmp]]; - // CHECK: [[y]] = [[x]]; + // CHECK: [[y]] = copy [[x]]; let mut x = 42; unsafe { x = STATIC; diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-abort.diff index 19d79694666..7ca1b39d771 100644 --- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-abort.diff @@ -32,14 +32,14 @@ - _2 = (const 1_i32, const 2_i32); + _2 = const (1_i32, 2_i32); StorageLive(_3); - _3 = _1; + _3 = copy _1; - (_2.1: i32) = move _3; -+ (_2.1: i32) = _1; ++ (_2.1: i32) = copy _1; StorageDead(_3); StorageLive(_4); - _4 = (_2.1: i32); + _4 = copy (_2.1: i32); StorageLive(_5); - _5 = (_2.0: i32); + _5 = copy (_2.0: i32); _0 = const (); StorageDead(_5); StorageDead(_4); diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-unwind.diff index 2bb277bf27f..f6379513806 100644 --- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.main.GVN.panic-unwind.diff @@ -32,14 +32,14 @@ - _2 = (const 1_i32, const 2_i32); + _2 = const (1_i32, 2_i32); StorageLive(_3); - _3 = _1; + _3 = copy _1; - (_2.1: i32) = move _3; -+ (_2.1: i32) = _1; ++ (_2.1: i32) = copy _1; StorageDead(_3); StorageLive(_4); - _4 = (_2.1: i32); + _4 = copy (_2.1: i32); StorageLive(_5); - _5 = (_2.0: i32); + _5 = copy (_2.0: i32); _0 = const (); StorageDead(_5); StorageDead(_4); diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs index 2c6cc0db6b2..1f4421331bc 100644 --- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs @@ -11,9 +11,9 @@ fn main() { // CHECK: debug z => [[z:_.*]]; // CHECK: [[a]] = foo() // CHECK: [[x]] = const (1_i32, 2_i32); - // CHECK: ([[x]].1: i32) = [[a]]; - // CHECK: [[y]] = ([[x]].1: i32); - // CHECK: [[z]] = ([[x]].0: i32); + // CHECK: ([[x]].1: i32) = copy [[a]]; + // CHECK: [[y]] = copy ([[x]].1: i32); + // CHECK: [[z]] = copy ([[x]].0: i32); let a = foo(); let mut x: (i32, i32) = (1, 2); x.1 = a; diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs index a43558223fe..1d8890bf369 100644 --- a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs +++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs @@ -15,7 +15,7 @@ fn size_of<T>() -> usize { // CHECK-LABEL: fn size_of( // CHECK: _1 = const 0_usize; // CHECK-NEXT: _1 = const SizeOfConst::<T>::SIZE; - // CHECK-NEXT: _0 = _1; + // CHECK-NEXT: _0 = copy _1; let mut a = 0; a = SizeOfConst::<T>::SIZE; a diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.GVN.diff b/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.GVN.diff index 1eadffa4f36..da6ef0a978b 100644 --- a/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.GVN.diff +++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.GVN.diff @@ -12,7 +12,7 @@ StorageLive(_1); _1 = const 0_usize; _1 = const SizeOfConst::<T>::SIZE; - _0 = _1; + _0 = copy _1; StorageDead(_1); return; } diff --git a/tests/mir-opt/const_prop/pointer_expose_provenance.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/pointer_expose_provenance.main.GVN.panic-abort.diff index 79a95b618d1..657fa7a5fea 100644 --- a/tests/mir-opt/const_prop/pointer_expose_provenance.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/pointer_expose_provenance.main.GVN.panic-abort.diff @@ -24,9 +24,9 @@ StorageDead(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - _4 = read(move _5) -> [return: bb1, unwind unreachable]; -+ _4 = read(_1) -> [return: bb1, unwind unreachable]; ++ _4 = read(copy _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/const_prop/pointer_expose_provenance.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/pointer_expose_provenance.main.GVN.panic-unwind.diff index 9d1bcd92fef..8fef6591d41 100644 --- a/tests/mir-opt/const_prop/pointer_expose_provenance.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/pointer_expose_provenance.main.GVN.panic-unwind.diff @@ -24,9 +24,9 @@ StorageDead(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - _4 = read(move _5) -> [return: bb1, unwind continue]; -+ _4 = read(_1) -> [return: bb1, unwind continue]; ++ _4 = read(copy _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/const_prop/pointer_expose_provenance.rs b/tests/mir-opt/const_prop/pointer_expose_provenance.rs index a76fead9859..bee8a985f8f 100644 --- a/tests/mir-opt/const_prop/pointer_expose_provenance.rs +++ b/tests/mir-opt/const_prop/pointer_expose_provenance.rs @@ -10,7 +10,7 @@ fn main() { // CHECK: [[ptr:_.*]] = const main::FOO; // CHECK: [[ref:_.*]] = &raw const (*[[ptr]]); // CHECK: [[x:_.*]] = move [[ref]] as usize (PointerExposeProvenance); - // CHECK: = read([[x]]) + // CHECK: = read(copy [[x]]) const FOO: &i32 = &1; let x = FOO as *const i32 as usize; read(x); diff --git a/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff b/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff index 38f23505230..8df262b351f 100644 --- a/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff +++ b/tests/mir-opt/const_prop/read_immutable_static.main.GVN.diff @@ -19,12 +19,12 @@ + nop; + nop; _3 = const {ALLOC0: &u8}; -- _2 = (*_3); +- _2 = copy (*_3); + _2 = const 2_u8; StorageLive(_4); StorageLive(_5); _5 = const {ALLOC0: &u8}; -- _4 = (*_5); +- _4 = copy (*_5); - _1 = Add(move _2, move _4); + _4 = const 2_u8; + _1 = const 4_u8; diff --git a/tests/mir-opt/const_prop/ref_deref.main.GVN.diff b/tests/mir-opt/const_prop/ref_deref.main.GVN.diff index 509924a91c5..b9e269266b0 100644 --- a/tests/mir-opt/const_prop/ref_deref.main.GVN.diff +++ b/tests/mir-opt/const_prop/ref_deref.main.GVN.diff @@ -16,7 +16,7 @@ StorageLive(_2); _4 = const main::promoted[0]; _2 = &(*_4); -- _1 = (*_2); +- _1 = copy (*_2); + _1 = const 4_i32; StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff b/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff index 820c6cc0680..dcc13c9251c 100644 --- a/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff +++ b/tests/mir-opt/const_prop/ref_deref_project.main.GVN.diff @@ -16,7 +16,7 @@ StorageLive(_2); _4 = const main::promoted[0]; _2 = &((*_4).1: i32); -- _1 = (*_2); +- _1 = copy (*_2); + _1 = const 5_i32; StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff index 71635b8e9c3..f7c1c2da01f 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-abort.diff @@ -21,15 +21,15 @@ StorageLive(_4); _4 = const 2_usize; - _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; +- _6 = Lt(copy _4, copy _5); +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind unreachable]; + _5 = const 8_usize; + _6 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _2 = _3[_4]; +- _2 = copy _3[_4]; - _1 = Add(move _2, const 0_u32); + _2 = const 42_u32; + _1 = const 42_u32; diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff index 84205028d6d..436773c8556 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.32bit.panic-unwind.diff @@ -21,15 +21,15 @@ StorageLive(_4); _4 = const 2_usize; - _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; +- _6 = Lt(copy _4, copy _5); +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind continue]; + _5 = const 8_usize; + _6 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _2 = _3[_4]; +- _2 = copy _3[_4]; - _1 = Add(move _2, const 0_u32); + _2 = const 42_u32; + _1 = const 42_u32; diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff index 71635b8e9c3..f7c1c2da01f 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-abort.diff @@ -21,15 +21,15 @@ StorageLive(_4); _4 = const 2_usize; - _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; +- _6 = Lt(copy _4, copy _5); +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind unreachable]; + _5 = const 8_usize; + _6 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _2 = _3[_4]; +- _2 = copy _3[_4]; - _1 = Add(move _2, const 0_u32); + _2 = const 42_u32; + _1 = const 42_u32; diff --git a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff index 84205028d6d..436773c8556 100644 --- a/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/repeat.main.GVN.64bit.panic-unwind.diff @@ -21,15 +21,15 @@ StorageLive(_4); _4 = const 2_usize; - _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; +- _6 = Lt(copy _4, copy _5); +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind continue]; + _5 = const 8_usize; + _6 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _2 = _3[_4]; +- _2 = copy _3[_4]; - _1 = Add(move _2, const 0_u32); + _2 = const 42_u32; + _1 = const 42_u32; diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff index 0a20fb0e59e..3c73d34474c 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-abort.diff @@ -16,7 +16,7 @@ _1 = const 1_u32; StorageLive(_2); StorageLive(_3); -- _3 = _1; +- _3 = copy _1; - _2 = consume(move _3) -> [return: bb1, unwind unreachable]; + _3 = const 1_u32; + _2 = consume(const 1_u32) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff index 8b9519d3adc..0a7fddee39b 100644 --- a/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/scalar_literal_propagation.main.GVN.panic-unwind.diff @@ -16,7 +16,7 @@ _1 = const 1_u32; StorageLive(_2); StorageLive(_3); -- _3 = _1; +- _3 = copy _1; - _2 = consume(move _3) -> [return: bb1, unwind continue]; + _3 = const 1_u32; + _2 = consume(const 1_u32) -> [return: bb1, unwind continue]; diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff index 21d91d0320a..e834a5802c3 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-abort.diff @@ -22,24 +22,24 @@ StorageLive(_3); StorageLive(_4); _9 = const main::promoted[0]; - _4 = _9; -- _3 = _4; + _4 = copy _9; +- _3 = copy _4; - _2 = move _3 as &[u32] (PointerCoercion(Unsize)); -+ _3 = _9; -+ _2 = _9 as &[u32] (PointerCoercion(Unsize)); ++ _3 = copy _9; ++ _2 = copy _9 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; + _7 = const 3_usize; + _8 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = (*_2)[_6]; +- _1 = copy (*_2)[_6]; + _1 = const 2_u32; StorageDead(_6); StorageDead(_4); diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff index 889114c9862..55ffc501805 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.32bit.panic-unwind.diff @@ -22,24 +22,24 @@ StorageLive(_3); StorageLive(_4); _9 = const main::promoted[0]; - _4 = _9; -- _3 = _4; + _4 = copy _9; +- _3 = copy _4; - _2 = move _3 as &[u32] (PointerCoercion(Unsize)); -+ _3 = _9; -+ _2 = _9 as &[u32] (PointerCoercion(Unsize)); ++ _3 = copy _9; ++ _2 = copy _9 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; + _7 = const 3_usize; + _8 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = (*_2)[_6]; +- _1 = copy (*_2)[_6]; + _1 = const 2_u32; StorageDead(_6); StorageDead(_4); diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff index 21d91d0320a..e834a5802c3 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-abort.diff @@ -22,24 +22,24 @@ StorageLive(_3); StorageLive(_4); _9 = const main::promoted[0]; - _4 = _9; -- _3 = _4; + _4 = copy _9; +- _3 = copy _4; - _2 = move _3 as &[u32] (PointerCoercion(Unsize)); -+ _3 = _9; -+ _2 = _9 as &[u32] (PointerCoercion(Unsize)); ++ _3 = copy _9; ++ _2 = copy _9 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; + _7 = const 3_usize; + _8 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = (*_2)[_6]; +- _1 = copy (*_2)[_6]; + _1 = const 2_u32; StorageDead(_6); StorageDead(_4); diff --git a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff index 889114c9862..55ffc501805 100644 --- a/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/const_prop/slice_len.main.GVN.64bit.panic-unwind.diff @@ -22,24 +22,24 @@ StorageLive(_3); StorageLive(_4); _9 = const main::promoted[0]; - _4 = _9; -- _3 = _4; + _4 = copy _9; +- _3 = copy _4; - _2 = move _3 as &[u32] (PointerCoercion(Unsize)); -+ _3 = _9; -+ _2 = _9 as &[u32] (PointerCoercion(Unsize)); ++ _3 = copy _9; ++ _2 = copy _9 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; + _7 = const 3_usize; + _8 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = (*_2)[_6]; +- _1 = copy (*_2)[_6]; + _1 = const 2_u32; StorageDead(_6); StorageDead(_4); diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index 3d1b58965ac..46604cfe1e0 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -7,7 +7,7 @@ fn main() { // CHECK-LABEL: fn main( // CHECK: debug a => [[a:_.*]]; - // CHECK: [[slice:_.*]] = {{.*}} as &[u32] (PointerCoercion(Unsize)); + // CHECK: [[slice:_.*]] = copy {{.*}} as &[u32] (PointerCoercion(Unsize)); // CHECK: assert(const true, // CHECK: [[a]] = const 2_u32; let a = (&[1u32, 2, 3] as &[u32])[1]; diff --git a/tests/mir-opt/const_prop/switch_int.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/switch_int.main.GVN.panic-abort.diff index ee9f2d5c7f5..2339f110f5a 100644 --- a/tests/mir-opt/const_prop/switch_int.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/switch_int.main.GVN.panic-abort.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_1); _1 = const 1_i32; -- switchInt(_1) -> [1: bb2, otherwise: bb1]; +- switchInt(copy _1) -> [1: bb2, otherwise: bb1]; + switchInt(const 1_i32) -> [1: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/const_prop/switch_int.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/switch_int.main.GVN.panic-unwind.diff index 143d04ac984..49082e6ba52 100644 --- a/tests/mir-opt/const_prop/switch_int.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/switch_int.main.GVN.panic-unwind.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_1); _1 = const 1_i32; -- switchInt(_1) -> [1: bb2, otherwise: bb1]; +- switchInt(copy _1) -> [1: bb2, otherwise: bb1]; + switchInt(const 1_i32) -> [1: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff index 7a289563c50..de0b1a57f80 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.32bit.diff @@ -12,7 +12,7 @@ bb0: { StorageLive(_1); - _1 = const 1_usize as std::boxed::Box<Never> (Transmute); -- _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); +- _2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); + _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); + _2 = const {0x1 as *const Never}; unreachable; diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff index 7a289563c50..de0b1a57f80 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.GVN.64bit.diff @@ -12,7 +12,7 @@ bb0: { StorageLive(_1); - _1 = const 1_usize as std::boxed::Box<Never> (Transmute); -- _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); +- _2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); + _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); + _2 = const {0x1 as *const Never}; unreachable; diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff index bf8fece3d37..01d86ce8717 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-abort.diff @@ -17,7 +17,7 @@ + _1 = const (1_u32, 2_u32); StorageLive(_2); StorageLive(_3); -- _3 = _1; +- _3 = copy _1; - _2 = consume(move _3) -> [return: bb1, unwind unreachable]; + _3 = const (1_u32, 2_u32); + _2 = consume(const (1_u32, 2_u32)) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff index 02a75849d88..bd7d494212c 100644 --- a/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/const_prop/tuple_literal_propagation.main.GVN.panic-unwind.diff @@ -17,7 +17,7 @@ + _1 = const (1_u32, 2_u32); StorageLive(_2); StorageLive(_3); -- _3 = _1; +- _3 = copy _1; - _2 = consume(move _3) -> [return: bb1, unwind continue]; + _3 = const (1_u32, 2_u32); + _2 = consume(const (1_u32, 2_u32)) -> [return: bb1, unwind continue]; diff --git a/tests/mir-opt/const_prop/while_let_loops.change_loop_body.GVN.diff b/tests/mir-opt/const_prop/while_let_loops.change_loop_body.GVN.diff index 9548afc9d40..f830624cae7 100644 --- a/tests/mir-opt/const_prop/while_let_loops.change_loop_body.GVN.diff +++ b/tests/mir-opt/const_prop/while_let_loops.change_loop_body.GVN.diff @@ -30,7 +30,7 @@ } bb1: { -- switchInt(((_3 as Some).0: u32)) -> [0: bb2, otherwise: bb3]; +- switchInt(copy ((_3 as Some).0: u32)) -> [0: bb2, otherwise: bb3]; + switchInt(const Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: u32) -> [0: bb2, otherwise: bb3]; } diff --git a/tests/mir-opt/copy-prop/borrowed_local.borrowed.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/borrowed_local.borrowed.CopyProp.panic-abort.diff index 897592a0e2f..40e8c06f357 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.borrowed.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.borrowed.CopyProp.panic-abort.diff @@ -7,14 +7,14 @@ let mut _3: &T; bb0: { -- _2 = _1; +- _2 = copy _1; _3 = &_1; - _0 = opaque::<&T>(_3) -> [return: bb1, unwind unreachable]; + _0 = opaque::<&T>(copy _3) -> [return: bb1, unwind unreachable]; } bb1: { -- _0 = opaque::<T>(_2) -> [return: bb2, unwind unreachable]; -+ _0 = opaque::<T>(_1) -> [return: bb2, unwind unreachable]; +- _0 = opaque::<T>(copy _2) -> [return: bb2, unwind unreachable]; ++ _0 = opaque::<T>(copy _1) -> [return: bb2, unwind unreachable]; } bb2: { diff --git a/tests/mir-opt/copy-prop/borrowed_local.borrowed.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/borrowed_local.borrowed.CopyProp.panic-unwind.diff index 33c05af91a1..d09c96c0f2b 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.borrowed.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.borrowed.CopyProp.panic-unwind.diff @@ -7,14 +7,14 @@ let mut _3: &T; bb0: { -- _2 = _1; +- _2 = copy _1; _3 = &_1; - _0 = opaque::<&T>(_3) -> [return: bb1, unwind continue]; + _0 = opaque::<&T>(copy _3) -> [return: bb1, unwind continue]; } bb1: { -- _0 = opaque::<T>(_2) -> [return: bb2, unwind continue]; -+ _0 = opaque::<T>(_1) -> [return: bb2, unwind continue]; +- _0 = opaque::<T>(copy _2) -> [return: bb2, unwind continue]; ++ _0 = opaque::<T>(copy _1) -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/copy-prop/borrowed_local.compare_address.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/borrowed_local.compare_address.CopyProp.panic-abort.diff index 3d6b5dffba4..7e63911d843 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.compare_address.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.compare_address.CopyProp.panic-abort.diff @@ -11,13 +11,13 @@ bb0: { _1 = const 5_u8; _2 = &_1; - _3 = _1; + _3 = copy _1; _4 = &_3; - _0 = cmp_ref(_2, _4) -> [return: bb1, unwind unreachable]; + _0 = cmp_ref(copy _2, copy _4) -> [return: bb1, unwind unreachable]; } bb1: { - _0 = opaque::<u8>(_3) -> [return: bb2, unwind unreachable]; + _0 = opaque::<u8>(copy _3) -> [return: bb2, unwind unreachable]; } bb2: { diff --git a/tests/mir-opt/copy-prop/borrowed_local.compare_address.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/borrowed_local.compare_address.CopyProp.panic-unwind.diff index 0f29d2681de..8e5f8b21fe7 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.compare_address.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.compare_address.CopyProp.panic-unwind.diff @@ -11,13 +11,13 @@ bb0: { _1 = const 5_u8; _2 = &_1; - _3 = _1; + _3 = copy _1; _4 = &_3; - _0 = cmp_ref(_2, _4) -> [return: bb1, unwind continue]; + _0 = cmp_ref(copy _2, copy _4) -> [return: bb1, unwind continue]; } bb1: { - _0 = opaque::<u8>(_3) -> [return: bb2, unwind continue]; + _0 = opaque::<u8>(copy _3) -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/copy-prop/borrowed_local.non_freeze.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/borrowed_local.non_freeze.CopyProp.panic-abort.diff index af2aeb0dcab..99dda2a95ff 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.non_freeze.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.non_freeze.CopyProp.panic-abort.diff @@ -7,13 +7,13 @@ let mut _3: &T; bb0: { - _2 = _1; + _2 = copy _1; _3 = &_1; - _0 = opaque::<&T>(_3) -> [return: bb1, unwind unreachable]; + _0 = opaque::<&T>(copy _3) -> [return: bb1, unwind unreachable]; } bb1: { - _0 = opaque::<T>(_2) -> [return: bb2, unwind unreachable]; + _0 = opaque::<T>(copy _2) -> [return: bb2, unwind unreachable]; } bb2: { diff --git a/tests/mir-opt/copy-prop/borrowed_local.non_freeze.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/borrowed_local.non_freeze.CopyProp.panic-unwind.diff index 040ed0aec16..6eb48cd8dbc 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.non_freeze.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.non_freeze.CopyProp.panic-unwind.diff @@ -7,13 +7,13 @@ let mut _3: &T; bb0: { - _2 = _1; + _2 = copy _1; _3 = &_1; - _0 = opaque::<&T>(_3) -> [return: bb1, unwind continue]; + _0 = opaque::<&T>(copy _3) -> [return: bb1, unwind continue]; } bb1: { - _0 = opaque::<T>(_2) -> [return: bb2, unwind continue]; + _0 = opaque::<T>(copy _2) -> [return: bb2, unwind continue]; } bb2: { diff --git a/tests/mir-opt/copy-prop/borrowed_local.rs b/tests/mir-opt/copy-prop/borrowed_local.rs index dd1679513f6..8db19fbd377 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.rs +++ b/tests/mir-opt/copy-prop/borrowed_local.rs @@ -21,11 +21,11 @@ fn compare_address() -> bool { // CHECK: bb0: { // CHECK-NEXT: _1 = const 5_u8; // CHECK-NEXT: _2 = &_1; - // CHECK-NEXT: _3 = _1; + // CHECK-NEXT: _3 = copy _1; // CHECK-NEXT: _4 = &_3; - // CHECK-NEXT: _0 = cmp_ref(_2, _4) + // CHECK-NEXT: _0 = cmp_ref(copy _2, copy _4) // CHECK: bb1: { - // CHECK-NEXT: _0 = opaque::<u8>(_3) + // CHECK-NEXT: _0 = opaque::<u8>(copy _3) mir! { { let a = 5_u8; @@ -51,9 +51,9 @@ fn borrowed<T: Copy + Freeze>(x: T) -> bool { // CHECK-LABEL: fn borrowed( // CHECK: bb0: { // CHECK-NEXT: _3 = &_1; - // CHECK-NEXT: _0 = opaque::<&T>(_3) + // CHECK-NEXT: _0 = opaque::<&T>(copy _3) // CHECK: bb1: { - // CHECK-NEXT: _0 = opaque::<T>(_1) + // CHECK-NEXT: _0 = opaque::<T>(copy _1) mir! { { let a = x; @@ -74,11 +74,11 @@ fn borrowed<T: Copy + Freeze>(x: T) -> bool { fn non_freeze<T: Copy>(x: T) -> bool { // CHECK-LABEL: fn non_freeze( // CHECK: bb0: { - // CHECK-NEXT: _2 = _1; + // CHECK-NEXT: _2 = copy _1; // CHECK-NEXT: _3 = &_1; - // CHECK-NEXT: _0 = opaque::<&T>(_3) + // CHECK-NEXT: _0 = opaque::<&T>(copy _3) // CHECK: bb1: { - // CHECK-NEXT: _0 = opaque::<T>(_2) + // CHECK-NEXT: _0 = opaque::<T>(copy _2) mir! { { let a = x; diff --git a/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff index 3334cdf92e7..c8889ee716f 100644 --- a/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-abort.diff @@ -30,7 +30,7 @@ } bb3: { - _2 = _1; + _2 = copy _1; goto -> bb6; } @@ -41,13 +41,13 @@ bb5: { StorageDead(_4); - _2 = _1; + _2 = copy _1; goto -> bb6; } bb6: { StorageDead(_3); - _0 = _2; + _0 = copy _2; StorageDead(_2); StorageDead(_1); return; diff --git a/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff index 2f92d8818cf..a41c28cb8c8 100644 --- a/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/branch.foo.CopyProp.panic-unwind.diff @@ -30,7 +30,7 @@ } bb3: { - _2 = _1; + _2 = copy _1; goto -> bb6; } @@ -41,13 +41,13 @@ bb5: { StorageDead(_4); - _2 = _1; + _2 = copy _1; goto -> bb6; } bb6: { StorageDead(_3); - _0 = _2; + _0 = copy _2; StorageDead(_2); StorageDead(_1); return; diff --git a/tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff b/tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff index 4d56a8b25d3..9d0a1644ae4 100644 --- a/tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff +++ b/tests/mir-opt/copy-prop/calls.multiple_edges.CopyProp.diff @@ -6,7 +6,7 @@ let mut _2: u8; bb0: { - switchInt(_1) -> [1: bb1, otherwise: bb2]; + switchInt(copy _1) -> [1: bb1, otherwise: bb2]; } bb1: { @@ -14,7 +14,7 @@ } bb2: { - _0 = _2; + _0 = copy _2; return; } } diff --git a/tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff b/tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff index b5d56909b0d..29d9ec3f2fc 100644 --- a/tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff +++ b/tests/mir-opt/copy-prop/calls.nrvo.CopyProp.diff @@ -16,7 +16,7 @@ } bb1: { -- _0 = _1; +- _0 = copy _1; - StorageDead(_1); return; } diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-abort.diff index 70674a912ed..280908ac63a 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-abort.diff @@ -12,10 +12,10 @@ bb0: { - StorageLive(_2); -- _2 = _1; -+ _0 = _1; +- _2 = copy _1; ++ _0 = copy _1; _1 = const 123_i32; -- _0 = _2; +- _0 = copy _2; - StorageDead(_2); return; } diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff index 70674a912ed..280908ac63a 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.arg_src.CopyProp.panic-unwind.diff @@ -12,10 +12,10 @@ bb0: { - StorageLive(_2); -- _2 = _1; -+ _0 = _1; +- _2 = copy _1; ++ _0 = copy _1; _1 = const 123_i32; -- _0 = _2; +- _0 = copy _2; - StorageDead(_2); return; } diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff index 9ec014e2b25..eea07d5839d 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-abort.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = dummy(move _3) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff index ef9c343a264..b0e5219913a 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.bar.CopyProp.panic-unwind.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = dummy(move _3) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-abort.diff index 71facf91df7..5fb14902fef 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-abort.diff @@ -8,10 +8,10 @@ bb0: { StorageLive(_2); - _2 = _1; + _2 = copy _1; _1 = move _2; StorageDead(_2); - _0 = _1; + _0 = copy _1; return; } } diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff index 71facf91df7..5fb14902fef 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.baz.CopyProp.panic-unwind.diff @@ -8,10 +8,10 @@ bb0: { StorageLive(_2); - _2 = _1; + _2 = copy _1; _1 = move _2; StorageDead(_2); - _0 = _1; + _0 = copy _1; return; } } diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff index 81b73e18763..685a290492e 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-abort.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = dummy(move _3) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff index 769089e16f3..4a0601431ab 100644 --- a/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/copy_propagation_arg.foo.CopyProp.panic-unwind.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = dummy(move _3) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff index 7ba85301051..1445b899dee 100644 --- a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-abort.diff @@ -7,15 +7,15 @@ let mut _3: NotCopy; bb0: { -- _2 = _1; +- _2 = copy _1; - _0 = opaque::<NotCopy>(move _1) -> [return: bb1, unwind unreachable]; -+ _0 = opaque::<NotCopy>(_1) -> [return: bb1, unwind unreachable]; ++ _0 = opaque::<NotCopy>(copy _1) -> [return: bb1, unwind unreachable]; } bb1: { - _3 = move _2; -- _0 = opaque::<NotCopy>(_3) -> [return: bb2, unwind unreachable]; -+ _0 = opaque::<NotCopy>(_1) -> [return: bb2, unwind unreachable]; +- _0 = opaque::<NotCopy>(copy _3) -> [return: bb2, unwind unreachable]; ++ _0 = opaque::<NotCopy>(copy _1) -> [return: bb2, unwind unreachable]; } bb2: { diff --git a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff index 7ba85301051..1445b899dee 100644 --- a/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/custom_move_arg.f.CopyProp.panic-unwind.diff @@ -7,15 +7,15 @@ let mut _3: NotCopy; bb0: { -- _2 = _1; +- _2 = copy _1; - _0 = opaque::<NotCopy>(move _1) -> [return: bb1, unwind unreachable]; -+ _0 = opaque::<NotCopy>(_1) -> [return: bb1, unwind unreachable]; ++ _0 = opaque::<NotCopy>(copy _1) -> [return: bb1, unwind unreachable]; } bb1: { - _3 = move _2; -- _0 = opaque::<NotCopy>(_3) -> [return: bb2, unwind unreachable]; -+ _0 = opaque::<NotCopy>(_1) -> [return: bb2, unwind unreachable]; +- _0 = opaque::<NotCopy>(copy _3) -> [return: bb2, unwind unreachable]; ++ _0 = opaque::<NotCopy>(copy _1) -> [return: bb2, unwind unreachable]; } bb2: { diff --git a/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff index 8f97c4e439e..d133091e6a4 100644 --- a/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-abort.diff @@ -27,17 +27,17 @@ bb1: { - StorageLive(_2); - _2 = _1; + _2 = copy _1; - StorageLive(_3); -- _3 = _2; +- _3 = copy _2; - StorageLive(_4); -- _4 = _3; +- _4 = copy _3; - _1 = move _4; - StorageDead(_4); -+ _1 = _2; ++ _1 = copy _2; StorageLive(_5); StorageLive(_6); - _6 = _1; + _6 = copy _1; _5 = std::mem::drop::<i32>(move _6) -> [return: bb2, unwind unreachable]; } diff --git a/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff index e343b78924a..bd4ad737cec 100644 --- a/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/cycle.main.CopyProp.panic-unwind.diff @@ -27,17 +27,17 @@ bb1: { - StorageLive(_2); - _2 = _1; + _2 = copy _1; - StorageLive(_3); -- _3 = _2; +- _3 = copy _2; - StorageLive(_4); -- _4 = _3; +- _4 = copy _3; - _1 = move _4; - StorageDead(_4); -+ _1 = _2; ++ _1 = copy _2; StorageLive(_5); StorageLive(_6); - _6 = _1; + _6 = copy _1; _5 = std::mem::drop::<i32>(move _6) -> [return: bb2, unwind continue]; } diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir index 02b88d14003..4781fdfd902 100644 --- a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir +++ b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-abort.mir @@ -11,11 +11,11 @@ fn f(_1: usize) -> usize { } bb0: { - _2 = _1; + _2 = copy _1; _1 = const 5_usize; - _1 = _2; + _1 = copy _2; StorageLive(_4); - _4 = _1; + _4 = copy _1; _0 = id::<usize>(move _4) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir index f8c285ff384..f5fded45c13 100644 --- a/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir +++ b/tests/mir-opt/copy-prop/dead_stores_79191.f.CopyProp.after.panic-unwind.mir @@ -11,11 +11,11 @@ fn f(_1: usize) -> usize { } bb0: { - _2 = _1; + _2 = copy _1; _1 = const 5_usize; - _1 = _2; + _1 = copy _2; StorageLive(_4); - _4 = _1; + _4 = copy _1; _0 = id::<usize>(move _4) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir index 02b88d14003..4781fdfd902 100644 --- a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir +++ b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-abort.mir @@ -11,11 +11,11 @@ fn f(_1: usize) -> usize { } bb0: { - _2 = _1; + _2 = copy _1; _1 = const 5_usize; - _1 = _2; + _1 = copy _2; StorageLive(_4); - _4 = _1; + _4 = copy _1; _0 = id::<usize>(move _4) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir index f8c285ff384..f5fded45c13 100644 --- a/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir +++ b/tests/mir-opt/copy-prop/dead_stores_better.f.CopyProp.after.panic-unwind.mir @@ -11,11 +11,11 @@ fn f(_1: usize) -> usize { } bb0: { - _2 = _1; + _2 = copy _1; _1 = const 5_usize; - _1 = _2; + _1 = copy _2; StorageLive(_4); - _4 = _1; + _4 = copy _1; _0 = id::<usize>(move _4) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff index 51390e2abbe..f4411886f9a 100644 --- a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-abort.diff @@ -88,15 +88,15 @@ bb6: { - StorageLive(_16); - _16 = ((_11 as Some).0: usize); + _16 = copy ((_11 as Some).0: usize); StorageLive(_17); - StorageLive(_18); -- _18 = _16; +- _18 = copy _16; _19 = Len(_2); -- _20 = Lt(_18, _19); -- assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _18) -> [success: bb8, unwind unreachable]; -+ _20 = Lt(_16, _19); -+ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind unreachable]; +- _20 = Lt(copy _18, copy _19); +- assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, copy _18) -> [success: bb8, unwind unreachable]; ++ _20 = Lt(copy _16, copy _19); ++ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, copy _16) -> [success: bb8, unwind unreachable]; } bb7: { @@ -112,9 +112,9 @@ } bb8: { -- _17 = _2[_18]; -+ _17 = _2[_16]; - _1 = Add(_1, move _17); +- _17 = copy _2[_18]; ++ _17 = copy _2[_16]; + _1 = Add(copy _1, move _17); StorageDead(_17); - StorageDead(_18); - _10 = const (); diff --git a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff index 8a2cbb68824..833588aa4e9 100644 --- a/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/issue_107511.main.CopyProp.panic-unwind.diff @@ -88,15 +88,15 @@ bb6: { - StorageLive(_16); - _16 = ((_11 as Some).0: usize); + _16 = copy ((_11 as Some).0: usize); StorageLive(_17); - StorageLive(_18); -- _18 = _16; +- _18 = copy _16; _19 = Len(_2); -- _20 = Lt(_18, _19); -- assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _18) -> [success: bb8, unwind continue]; -+ _20 = Lt(_16, _19); -+ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, _16) -> [success: bb8, unwind continue]; +- _20 = Lt(copy _18, copy _19); +- assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, copy _18) -> [success: bb8, unwind continue]; ++ _20 = Lt(copy _16, copy _19); ++ assert(move _20, "index out of bounds: the length is {} but the index is {}", move _19, copy _16) -> [success: bb8, unwind continue]; } bb7: { @@ -112,9 +112,9 @@ } bb8: { -- _17 = _2[_18]; -+ _17 = _2[_16]; - _1 = Add(_1, move _17); +- _17 = copy _2[_18]; ++ _17 = copy _2[_16]; + _1 = Add(copy _1, move _17); StorageDead(_17); - StorageDead(_18); - _10 = const (); diff --git a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff index cf04f213efb..da9904bfa01 100644 --- a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-abort.diff @@ -15,14 +15,14 @@ bb0: { - StorageLive(_2); -- _2 = _1; +- _2 = copy _1; StorageLive(_3); - StorageLive(_4); -- _4 = _1; +- _4 = copy _1; - StorageLive(_5); -- _5 = _2; +- _5 = copy _2; - _3 = g::<T>(move _4, move _5) -> [return: bb1, unwind unreachable]; -+ _3 = g::<T>(_1, _1) -> [return: bb1, unwind unreachable]; ++ _3 = g::<T>(copy _1, copy _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff index 0c6a3c6d5c9..9b0de655bd2 100644 --- a/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/move_arg.f.CopyProp.panic-unwind.diff @@ -15,14 +15,14 @@ bb0: { - StorageLive(_2); -- _2 = _1; +- _2 = copy _1; StorageLive(_3); - StorageLive(_4); -- _4 = _1; +- _4 = copy _1; - StorageLive(_5); -- _5 = _2; +- _5 = copy _2; - _3 = g::<T>(move _4, move _5) -> [return: bb1, unwind continue]; -+ _3 = g::<T>(_1, _1) -> [return: bb1, unwind continue]; ++ _3 = g::<T>(copy _1, copy _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff index b2b89968d70..973bcd6de83 100644 --- a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-abort.diff @@ -7,11 +7,11 @@ let mut _3: u8; bb0: { -- _2 = _1; +- _2 = copy _1; - _3 = move (_2.0: u8); - _0 = opaque::<Foo>(move _1) -> [return: bb1, unwind unreachable]; -+ _3 = (_1.0: u8); -+ _0 = opaque::<Foo>(_1) -> [return: bb1, unwind unreachable]; ++ _3 = copy (_1.0: u8); ++ _0 = opaque::<Foo>(copy _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff index b2b89968d70..973bcd6de83 100644 --- a/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/move_projection.f.CopyProp.panic-unwind.diff @@ -7,11 +7,11 @@ let mut _3: u8; bb0: { -- _2 = _1; +- _2 = copy _1; - _3 = move (_2.0: u8); - _0 = opaque::<Foo>(move _1) -> [return: bb1, unwind unreachable]; -+ _3 = (_1.0: u8); -+ _0 = opaque::<Foo>(_1) -> [return: bb1, unwind unreachable]; ++ _3 = copy (_1.0: u8); ++ _0 = opaque::<Foo>(copy _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/copy-prop/mutate_through_pointer.f.CopyProp.diff b/tests/mir-opt/copy-prop/mutate_through_pointer.f.CopyProp.diff index 7f6802beeae..f96be627129 100644 --- a/tests/mir-opt/copy-prop/mutate_through_pointer.f.CopyProp.diff +++ b/tests/mir-opt/copy-prop/mutate_through_pointer.f.CopyProp.diff @@ -8,11 +8,11 @@ let mut _4: *mut bool; bb0: { - _2 = _1; + _2 = copy _1; _3 = &raw const _2; _4 = &raw mut (*_3); (*_4) = const false; - _0 = _1; + _0 = copy _1; return; } } diff --git a/tests/mir-opt/copy-prop/non_dominate.f.CopyProp.diff b/tests/mir-opt/copy-prop/non_dominate.f.CopyProp.diff index 5bf2335943c..6955d694e5a 100644 --- a/tests/mir-opt/copy-prop/non_dominate.f.CopyProp.diff +++ b/tests/mir-opt/copy-prop/non_dominate.f.CopyProp.diff @@ -11,18 +11,18 @@ } bb1: { - _3 = _1; - switchInt(_3) -> [0: bb3, otherwise: bb2]; + _3 = copy _1; + switchInt(copy _3) -> [0: bb3, otherwise: bb2]; } bb2: { - _2 = _3; + _2 = copy _3; _1 = const false; goto -> bb1; } bb3: { - _0 = _2; + _0 = copy _2; return; } } diff --git a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff index ef30ac2fc8c..676c5cee343 100644 --- a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-abort.diff @@ -30,12 +30,12 @@ _3 = &mut (*_4); StorageDead(_4); - StorageLive(_5); -- _5 = _2; +- _5 = copy _2; StorageLive(_6); - StorageLive(_7); -- _7 = _5; +- _7 = copy _5; - _6 = opaque::<*mut u8>(move _7) -> [return: bb1, unwind unreachable]; -+ _6 = opaque::<*mut u8>(_2) -> [return: bb1, unwind unreachable]; ++ _6 = opaque::<*mut u8>(copy _2) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff index a743a3e829a..ca2232ce54a 100644 --- a/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/reborrow.demiraw.CopyProp.panic-unwind.diff @@ -30,12 +30,12 @@ _3 = &mut (*_4); StorageDead(_4); - StorageLive(_5); -- _5 = _2; +- _5 = copy _2; StorageLive(_6); - StorageLive(_7); -- _7 = _5; +- _7 = copy _5; - _6 = opaque::<*mut u8>(move _7) -> [return: bb1, unwind continue]; -+ _6 = opaque::<*mut u8>(_2) -> [return: bb1, unwind continue]; ++ _6 = opaque::<*mut u8>(copy _2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff index 2de6f85ce64..1968696905f 100644 --- a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff +++ b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-abort.diff @@ -26,12 +26,12 @@ StorageLive(_3); _3 = &raw mut (*_2); - StorageLive(_4); -- _4 = _2; +- _4 = copy _2; StorageLive(_5); - StorageLive(_6); -- _6 = _4; +- _6 = copy _4; - _5 = opaque::<*mut u8>(move _6) -> [return: bb1, unwind unreachable]; -+ _5 = opaque::<*mut u8>(_2) -> [return: bb1, unwind unreachable]; ++ _5 = opaque::<*mut u8>(copy _2) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff index 2afec4898bc..9a3c9665bc8 100644 --- a/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff +++ b/tests/mir-opt/copy-prop/reborrow.miraw.CopyProp.panic-unwind.diff @@ -26,12 +26,12 @@ StorageLive(_3); _3 = &raw mut (*_2); - StorageLive(_4); -- _4 = _2; +- _4 = copy _2; StorageLive(_5); - StorageLive(_6); -- _6 = _4; +- _6 = copy _4; - _5 = opaque::<*mut u8>(move _6) -> [return: bb1, unwind continue]; -+ _5 = opaque::<*mut u8>(_2) -> [return: bb1, unwind continue]; ++ _5 = opaque::<*mut u8>(copy _2) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/copy-prop/reborrow.rs b/tests/mir-opt/copy-prop/reborrow.rs index 2f1720556cd..51a1f92cde2 100644 --- a/tests/mir-opt/copy-prop/reborrow.rs +++ b/tests/mir-opt/copy-prop/reborrow.rs @@ -3,8 +3,6 @@ // Check that CopyProp considers reborrows as not mutating the pointer. //@ test-mir-pass: CopyProp -#![feature(raw_ref_op)] - #[inline(never)] fn opaque(_: impl Sized) {} diff --git a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff index 3d791734f46..eeeac70b5b8 100644 --- a/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff +++ b/tests/mir-opt/coverage/branch_match_arms.main.InstrumentCoverage.diff @@ -71,33 +71,33 @@ bb5: { + Coverage::ExpressionUsed(2); StorageLive(_9); - _9 = ((_1 as A).0: u32); + _9 = copy ((_1 as A).0: u32); StorageLive(_10); - _10 = _9; + _10 = copy _9; _0 = consume(move _10) -> [return: bb12, unwind: bb14]; } bb6: { StorageLive(_7); - _7 = ((_1 as B).0: u32); + _7 = copy ((_1 as B).0: u32); StorageLive(_8); - _8 = _7; + _8 = copy _7; _0 = consume(move _8) -> [return: bb11, unwind: bb14]; } bb7: { StorageLive(_5); - _5 = ((_1 as C).0: u32); + _5 = copy ((_1 as C).0: u32); StorageLive(_6); - _6 = _5; + _6 = copy _5; _0 = consume(move _6) -> [return: bb10, unwind: bb14]; } bb8: { StorageLive(_3); - _3 = ((_1 as D).0: u32); + _3 = copy ((_1 as D).0: u32); StorageLive(_4); - _4 = _3; + _4 = copy _3; _0 = consume(move _4) -> [return: bb9, unwind: bb14]; } diff --git a/tests/mir-opt/dataflow-const-prop/aggregate_copy.foo.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/aggregate_copy.foo.DataflowConstProp.diff index 3b739a25cb8..8dd34d84580 100644 --- a/tests/mir-opt/dataflow-const-prop/aggregate_copy.foo.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/aggregate_copy.foo.DataflowConstProp.diff @@ -22,14 +22,14 @@ StorageLive(_1); _1 = const Foo; StorageLive(_2); -- _2 = _1; +- _2 = copy _1; + _2 = const (5_u32, 3_u32); StorageLive(_3); -- _3 = (_2.1: u32); +- _3 = copy (_2.1: u32); + _3 = const 3_u32; StorageLive(_4); StorageLive(_5); -- _5 = _3; +- _5 = copy _3; - _4 = Ge(move _5, const 2_u32); - switchInt(move _4) -> [0: bb2, otherwise: bb1]; + _5 = const 3_u32; @@ -39,7 +39,7 @@ bb1: { StorageDead(_5); -- _0 = (_2.0: u32); +- _0 = copy (_2.0: u32); + _0 = const 5_u32; goto -> bb3; } diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff index 212ddc5b154..a46daef435f 100644 --- a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-abort.diff @@ -19,16 +19,16 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind unreachable]; + _4 = const 4_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; +- _1 = copy _2[_3]; ++ _1 = copy _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff index 5c53d4f4461..1a4e15b45fa 100644 --- a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.32bit.panic-unwind.diff @@ -19,16 +19,16 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind continue]; + _4 = const 4_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; +- _1 = copy _2[_3]; ++ _1 = copy _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff index 212ddc5b154..a46daef435f 100644 --- a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-abort.diff @@ -19,16 +19,16 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind unreachable]; + _4 = const 4_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; +- _1 = copy _2[_3]; ++ _1 = copy _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff index 5c53d4f4461..1a4e15b45fa 100644 --- a/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/array_index.main.DataflowConstProp.64bit.panic-unwind.diff @@ -19,16 +19,16 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind continue]; + _4 = const 4_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; +- _1 = copy _2[_3]; ++ _1 = copy _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/array_index.rs b/tests/mir-opt/dataflow-const-prop/array_index.rs index daf9c7729c6..e442ef99f79 100644 --- a/tests/mir-opt/dataflow-const-prop/array_index.rs +++ b/tests/mir-opt/dataflow-const-prop/array_index.rs @@ -16,6 +16,6 @@ fn main() { // CHECK: {{_.*}} = const 4_usize; // CHECK: {{_.*}} = const true; // CHECK: assert(const true - // CHECK: [[x]] = [[array_lit]][2 of 3]; + // CHECK: [[x]] = copy [[array_lit]][2 of 3]; let x: u32 = [0, 1, 2, 3][2]; } diff --git a/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff index 5440c38ce4b..89175fbad5c 100644 --- a/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/boolean_identities.test.DataflowConstProp.diff @@ -13,13 +13,13 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _2; + _4 = copy _2; - _3 = BitOr(move _4, const true); + _3 = const true; StorageDead(_4); StorageLive(_5); StorageLive(_6); - _6 = _1; + _6 = copy _1; - _5 = BitAnd(move _6, const false); + _5 = const false; StorageDead(_6); diff --git a/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff index 0ca446c89f2..f2c262f9fe2 100644 --- a/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/cast.main.DataflowConstProp.diff @@ -20,7 +20,7 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); -- _4 = _1; +- _4 = copy _1; - _3 = move _4 as u8 (IntToInt); + _4 = const 257_i32; + _3 = const 1_u8; diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff index 79ea5561748..867e768790f 100644 --- a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-abort.diff @@ -36,11 +36,11 @@ _2 = const 2_i32; StorageLive(_3); StorageLive(_4); -- _4 = _1; +- _4 = copy _1; + _4 = const 1_i32; StorageLive(_5); -- _5 = _2; -- _6 = AddWithOverflow(_4, _5); +- _5 = copy _2; +- _6 = AddWithOverflow(copy _4, copy _5); - assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> [success: bb1, unwind unreachable]; + _5 = const 2_i32; + _6 = const (3_i32, false); @@ -56,8 +56,8 @@ _7 = const core::num::<impl i32>::MAX; StorageLive(_8); StorageLive(_9); -- _9 = _7; -- _10 = AddWithOverflow(_9, const 1_i32); +- _9 = copy _7; +- _10 = AddWithOverflow(copy _9, const 1_i32); - assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> [success: bb2, unwind unreachable]; + _9 = const i32::MAX; + _10 = const (i32::MIN, true); diff --git a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff index bd22c50dd8f..c22edaaec40 100644 --- a/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/checked.main.DataflowConstProp.panic-unwind.diff @@ -36,11 +36,11 @@ _2 = const 2_i32; StorageLive(_3); StorageLive(_4); -- _4 = _1; +- _4 = copy _1; + _4 = const 1_i32; StorageLive(_5); -- _5 = _2; -- _6 = AddWithOverflow(_4, _5); +- _5 = copy _2; +- _6 = AddWithOverflow(copy _4, copy _5); - assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, move _5) -> [success: bb1, unwind continue]; + _5 = const 2_i32; + _6 = const (3_i32, false); @@ -56,8 +56,8 @@ _7 = const core::num::<impl i32>::MAX; StorageLive(_8); StorageLive(_9); -- _9 = _7; -- _10 = AddWithOverflow(_9, const 1_i32); +- _9 = copy _7; +- _10 = AddWithOverflow(copy _9, const 1_i32); - assert(!move (_10.1: bool), "attempt to compute `{} + {}`, which would overflow", move _9, const 1_i32) -> [success: bb2, unwind continue]; + _9 = const i32::MAX; + _10 = const (i32::MIN, true); diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff index 9d96e895c8a..c7870a7902b 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff @@ -50,7 +50,7 @@ StorageLive(_6); StorageLive(_7); - _7 = AlignOf([bool; 0]); -- _6 = _7 as *mut [bool; 0] (Transmute); +- _6 = copy _7 as *mut [bool; 0] (Transmute); + _7 = const 1_usize; + _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); @@ -67,7 +67,7 @@ bb2: { StorageLive(_10); -- _10 = _6 as *mut () (PtrToPtr); +- _10 = copy _6 as *mut () (PtrToPtr); - _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable]; + _10 = const {0x1 as *mut ()}; + _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb3, unwind unreachable]; @@ -80,8 +80,8 @@ bb4: { StorageDead(_8); -- _11 = _6 as *const [bool; 0] (PtrToPtr); -- _5 = NonNull::<[bool; 0]> { pointer: _11 }; +- _11 = copy _6 as *const [bool; 0] (PtrToPtr); +- _5 = NonNull::<[bool; 0]> { pointer: copy _11 }; + _11 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_11); @@ -92,7 +92,7 @@ - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); + _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); -- _2 = Box::<[bool]>(_3, const std::alloc::Global); +- _2 = Box::<[bool]>(copy _3, const std::alloc::Global); + _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_9); StorageDead(_3); diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff index 0bdff584b01..f5de7a361bc 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff @@ -50,7 +50,7 @@ StorageLive(_6); StorageLive(_7); - _7 = AlignOf([bool; 0]); -- _6 = _7 as *mut [bool; 0] (Transmute); +- _6 = copy _7 as *mut [bool; 0] (Transmute); + _7 = const 1_usize; + _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); @@ -71,7 +71,7 @@ bb3: { StorageLive(_10); -- _10 = _6 as *mut () (PtrToPtr); +- _10 = copy _6 as *mut () (PtrToPtr); - _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable]; + _10 = const {0x1 as *mut ()}; + _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb4, unwind unreachable]; @@ -84,8 +84,8 @@ bb5: { StorageDead(_8); -- _11 = _6 as *const [bool; 0] (PtrToPtr); -- _5 = NonNull::<[bool; 0]> { pointer: _11 }; +- _11 = copy _6 as *const [bool; 0] (PtrToPtr); +- _5 = NonNull::<[bool; 0]> { pointer: copy _11 }; + _11 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_11); @@ -96,7 +96,7 @@ - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); + _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); -- _2 = Box::<[bool]>(_3, const std::alloc::Global); +- _2 = Box::<[bool]>(copy _3, const std::alloc::Global); + _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_9); StorageDead(_3); diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff index 99e96fe5d70..3b0bc6377da 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff @@ -50,7 +50,7 @@ StorageLive(_6); StorageLive(_7); - _7 = AlignOf([bool; 0]); -- _6 = _7 as *mut [bool; 0] (Transmute); +- _6 = copy _7 as *mut [bool; 0] (Transmute); + _7 = const 1_usize; + _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); @@ -67,7 +67,7 @@ bb2: { StorageLive(_10); -- _10 = _6 as *mut () (PtrToPtr); +- _10 = copy _6 as *mut () (PtrToPtr); - _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb3, unwind unreachable]; + _10 = const {0x1 as *mut ()}; + _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb3, unwind unreachable]; @@ -80,8 +80,8 @@ bb4: { StorageDead(_8); -- _11 = _6 as *const [bool; 0] (PtrToPtr); -- _5 = NonNull::<[bool; 0]> { pointer: _11 }; +- _11 = copy _6 as *const [bool; 0] (PtrToPtr); +- _5 = NonNull::<[bool; 0]> { pointer: copy _11 }; + _11 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_11); @@ -92,7 +92,7 @@ - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); + _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); -- _2 = Box::<[bool]>(_3, const std::alloc::Global); +- _2 = Box::<[bool]>(copy _3, const std::alloc::Global); + _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_9); StorageDead(_3); diff --git a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff index 5eefabeac38..5dd7ad9a117 100644 --- a/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff @@ -50,7 +50,7 @@ StorageLive(_6); StorageLive(_7); - _7 = AlignOf([bool; 0]); -- _6 = _7 as *mut [bool; 0] (Transmute); +- _6 = copy _7 as *mut [bool; 0] (Transmute); + _7 = const 1_usize; + _6 = const {0x1 as *mut [bool; 0]}; StorageDead(_7); @@ -71,7 +71,7 @@ bb3: { StorageLive(_10); -- _10 = _6 as *mut () (PtrToPtr); +- _10 = copy _6 as *mut () (PtrToPtr); - _9 = NonNull::<T>::new_unchecked::precondition_check(move _10) -> [return: bb4, unwind unreachable]; + _10 = const {0x1 as *mut ()}; + _9 = NonNull::<T>::new_unchecked::precondition_check(const {0x1 as *mut ()}) -> [return: bb4, unwind unreachable]; @@ -84,8 +84,8 @@ bb5: { StorageDead(_8); -- _11 = _6 as *const [bool; 0] (PtrToPtr); -- _5 = NonNull::<[bool; 0]> { pointer: _11 }; +- _11 = copy _6 as *const [bool; 0] (PtrToPtr); +- _5 = NonNull::<[bool; 0]> { pointer: copy _11 }; + _11 = const {0x1 as *const [bool; 0]}; + _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}; StorageDead(_11); @@ -96,7 +96,7 @@ - _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize)); + _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}; StorageDead(_4); -- _2 = Box::<[bool]>(_3, const std::alloc::Global); +- _2 = Box::<[bool]>(copy _3, const std::alloc::Global); + _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global); StorageDead(_9); StorageDead(_3); diff --git a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff index 9da1caf9004..ef3b24cd440 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.32bit.diff @@ -37,16 +37,16 @@ bb2: { StorageLive(_5); - _5 = ((_1 as V2).0: i32); - _2 = _5; + _5 = copy ((_1 as V2).0: i32); + _2 = copy _5; StorageDead(_5); goto -> bb4; } bb3: { StorageLive(_4); -- _4 = ((_1 as V1).0: i32); -- _2 = _4; +- _4 = copy ((_1 as V1).0: i32); +- _2 = copy _4; + _4 = const 0_i32; + _2 = const 0_i32; StorageDead(_4); diff --git a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff index 9da1caf9004..ef3b24cd440 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.constant.DataflowConstProp.64bit.diff @@ -37,16 +37,16 @@ bb2: { StorageLive(_5); - _5 = ((_1 as V2).0: i32); - _2 = _5; + _5 = copy ((_1 as V2).0: i32); + _2 = copy _5; StorageDead(_5); goto -> bb4; } bb3: { StorageLive(_4); -- _4 = ((_1 as V1).0: i32); -- _2 = _4; +- _4 = copy ((_1 as V1).0: i32); +- _2 = copy _4; + _4 = const 0_i32; + _2 = const 0_i32; StorageDead(_4); diff --git a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff index 10d33767c90..db8352bcbcf 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.32bit.diff @@ -28,13 +28,13 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; switchInt(move _4) -> [0: bb2, otherwise: bb1]; } bb1: { StorageLive(_5); - _5 = _2; + _5 = copy _2; _3 = Option::<u8>::Some(move _5); StorageDead(_5); goto -> bb3; @@ -63,15 +63,15 @@ bb6: { StorageLive(_8); - _8 = ((_3 as Some).0: u8); - _6 = _8; + _8 = copy ((_3 as Some).0: u8); + _6 = copy _8; StorageDead(_8); goto -> bb7; } bb7: { StorageLive(_9); - _9 = _6; + _9 = copy _6; _0 = const (); StorageDead(_9); StorageDead(_6); diff --git a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff index 10d33767c90..db8352bcbcf 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.multiple.DataflowConstProp.64bit.diff @@ -28,13 +28,13 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; switchInt(move _4) -> [0: bb2, otherwise: bb1]; } bb1: { StorageLive(_5); - _5 = _2; + _5 = copy _2; _3 = Option::<u8>::Some(move _5); StorageDead(_5); goto -> bb3; @@ -63,15 +63,15 @@ bb6: { StorageLive(_8); - _8 = ((_3 as Some).0: u8); - _6 = _8; + _8 = copy ((_3 as Some).0: u8); + _6 = copy _8; StorageDead(_8); goto -> bb7; } bb7: { StorageLive(_9); - _9 = _6; + _9 = copy _6; _0 = const (); StorageDead(_9); StorageDead(_6); diff --git a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff index 960e69ee916..e2cd73404be 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.32bit.diff @@ -10,7 +10,7 @@ discriminant(_1) = 1; (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize; _2 = discriminant(_1); - switchInt(_2) -> [0: bb1, otherwise: bb2]; + switchInt(copy _2) -> [0: bb1, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff index 960e69ee916..e2cd73404be 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.mutate_discriminant.DataflowConstProp.64bit.diff @@ -10,7 +10,7 @@ discriminant(_1) = 1; (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize; _2 = discriminant(_1); - switchInt(_2) -> [0: bb1, otherwise: bb2]; + switchInt(copy _2) -> [0: bb1, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs index 37304e3a270..207e29e63df 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.rs +++ b/tests/mir-opt/dataflow-const-prop/enum.rs @@ -73,7 +73,7 @@ fn statics() { static RC: &E = &E::V2(4); // CHECK: [[t:_.*]] = const {alloc5: &&E}; - // CHECK: [[e2]] = (*[[t]]); + // CHECK: [[e2]] = copy (*[[t]]); let e2 = RC; // CHECK: switchInt({{move _.*}}) -> {{.*}} @@ -108,7 +108,7 @@ fn mutate_discriminant() -> u8 { // CHECK: [[a:_.*]] = discriminant({{_.*}}); let a = Discriminant(x); - // CHECK: switchInt([[a]]) -> [0: {{bb.*}}, otherwise: {{bb.*}}]; + // CHECK: switchInt(copy [[a]]) -> [0: {{bb.*}}, otherwise: {{bb.*}}]; match a { 0 => bb1, _ => bad, @@ -143,8 +143,8 @@ fn multiple(x: bool, i: u8) { // discriminant(e) => Top // (e as Some).0 => Top // CHECK: [[x2]] = const 0_u8; - // CHECK: [[some:_.*]] = (({{_.*}} as Some).0: u8) - // CHECK: [[x2]] = [[some]]; + // CHECK: [[some:_.*]] = copy (({{_.*}} as Some).0: u8) + // CHECK: [[x2]] = copy [[some]]; let x2 = match e { Some(i) => i, None => 0, @@ -153,7 +153,7 @@ fn multiple(x: bool, i: u8) { // Therefore, `x2` should be `Top` here, and no replacement shall happen. // CHECK-NOT: [[y]] = const - // CHECK: [[y]] = [[x2]]; + // CHECK: [[y]] = copy [[x2]]; // CHECK-NOT: [[y]] = const let y = x2; } diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff index a64dda0d06c..d79c163effc 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.32bit.diff @@ -38,16 +38,16 @@ bb2: { StorageLive(_5); - _5 = ((_1 as V2).0: i32); - _2 = _5; + _5 = copy ((_1 as V2).0: i32); + _2 = copy _5; StorageDead(_5); goto -> bb4; } bb3: { StorageLive(_4); -- _4 = ((_1 as V1).0: i32); -- _2 = _4; +- _4 = copy ((_1 as V1).0: i32); +- _2 = copy _4; + _4 = const 0_i32; + _2 = const 0_i32; StorageDead(_4); diff --git a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff index a64dda0d06c..d79c163effc 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.simple.DataflowConstProp.64bit.diff @@ -38,16 +38,16 @@ bb2: { StorageLive(_5); - _5 = ((_1 as V2).0: i32); - _2 = _5; + _5 = copy ((_1 as V2).0: i32); + _2 = copy _5; StorageDead(_5); goto -> bb4; } bb3: { StorageLive(_4); -- _4 = ((_1 as V1).0: i32); -- _2 = _4; +- _4 = copy ((_1 as V1).0: i32); +- _2 = copy _4; + _4 = const 0_i32; + _2 = const 0_i32; StorageDead(_4); diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff index b4d14f25fe2..9823a48785a 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.32bit.diff @@ -44,7 +44,7 @@ StorageLive(_1); StorageLive(_2); _2 = const {ALLOC0: &E}; -- _1 = (*_2); +- _1 = copy (*_2); + _1 = const E::V1(0_i32); StorageDead(_2); StorageLive(_3); @@ -60,16 +60,16 @@ bb2: { StorageLive(_6); - _6 = ((_1 as V2).0: i32); - _3 = _6; + _6 = copy ((_1 as V2).0: i32); + _3 = copy _6; StorageDead(_6); goto -> bb4; } bb3: { StorageLive(_5); -- _5 = ((_1 as V1).0: i32); -- _3 = _5; +- _5 = copy ((_1 as V1).0: i32); +- _3 = copy _5; + _5 = const 0_i32; + _3 = const 0_i32; StorageDead(_5); @@ -80,7 +80,7 @@ StorageLive(_7); StorageLive(_8); _8 = const {ALLOC1: &&E}; - _7 = (*_8); + _7 = copy (*_8); StorageDead(_8); StorageLive(_9); _10 = discriminant((*_7)); @@ -98,7 +98,7 @@ bb6: { StorageLive(_11); _11 = &(((*_7) as V1).0: i32); - _9 = _11; + _9 = copy _11; StorageDead(_11); goto -> bb7; } diff --git a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff index 57d02b87d13..e4e68483f25 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/enum.statics.DataflowConstProp.64bit.diff @@ -44,7 +44,7 @@ StorageLive(_1); StorageLive(_2); _2 = const {ALLOC0: &E}; -- _1 = (*_2); +- _1 = copy (*_2); + _1 = const E::V1(0_i32); StorageDead(_2); StorageLive(_3); @@ -60,16 +60,16 @@ bb2: { StorageLive(_6); - _6 = ((_1 as V2).0: i32); - _3 = _6; + _6 = copy ((_1 as V2).0: i32); + _3 = copy _6; StorageDead(_6); goto -> bb4; } bb3: { StorageLive(_5); -- _5 = ((_1 as V1).0: i32); -- _3 = _5; +- _5 = copy ((_1 as V1).0: i32); +- _3 = copy _5; + _5 = const 0_i32; + _3 = const 0_i32; StorageDead(_5); @@ -80,7 +80,7 @@ StorageLive(_7); StorageLive(_8); _8 = const {ALLOC1: &&E}; - _7 = (*_8); + _7 = copy (*_8); StorageDead(_8); StorageLive(_9); _10 = discriminant((*_7)); @@ -98,7 +98,7 @@ bb6: { StorageLive(_11); _11 = &(((*_7) as V1).0: i32); - _9 = _11; + _9 = copy _11; StorageDead(_11); goto -> bb7; } diff --git a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff index 355f28b03db..5f013b1d134 100644 --- a/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/if.main.DataflowConstProp.diff @@ -37,7 +37,7 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); -- _4 = _1; +- _4 = copy _1; - _3 = Eq(move _4, const 1_i32); - switchInt(move _3) -> [0: bb2, otherwise: bb1]; + _4 = const 1_i32; @@ -61,7 +61,7 @@ StorageDead(_3); StorageLive(_5); StorageLive(_6); -- _6 = _2; +- _6 = copy _2; - _5 = Add(move _6, const 1_i32); + _6 = const 2_i32; + _5 = const 3_i32; @@ -69,7 +69,7 @@ StorageLive(_7); StorageLive(_8); StorageLive(_9); -- _9 = _1; +- _9 = copy _1; - _8 = Eq(move _9, const 1_i32); - switchInt(move _8) -> [0: bb5, otherwise: bb4]; + _9 = const 1_i32; @@ -79,7 +79,7 @@ bb4: { StorageDead(_9); -- _7 = _1; +- _7 = copy _1; + _7 = const 1_i32; goto -> bb6; } @@ -87,7 +87,7 @@ bb5: { StorageDead(_9); StorageLive(_10); - _10 = _1; + _10 = copy _1; _7 = Add(move _10, const 1_i32); StorageDead(_10); goto -> bb6; @@ -97,7 +97,7 @@ StorageDead(_8); StorageLive(_11); StorageLive(_12); -- _12 = _7; +- _12 = copy _7; - _11 = Add(move _12, const 1_i32); + _12 = const 1_i32; + _11 = const 2_i32; diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff index 8d62de0c821..1b695e4b53c 100644 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-abort.diff @@ -19,8 +19,8 @@ StorageLive(_3); _3 = const 1_u8; StorageLive(_4); -- _4 = AddWithOverflow(_2, _3); -- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable]; +- _4 = AddWithOverflow(copy _2, copy _3); +- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", copy _2, copy _3) -> [success: bb1, unwind unreachable]; + _4 = const (0_u8, true); + assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff index 25624851cb3..a0bd8e17d8c 100644 --- a/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.panic-unwind.diff @@ -19,8 +19,8 @@ StorageLive(_3); _3 = const 1_u8; StorageLive(_4); -- _4 = AddWithOverflow(_2, _3); -- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue]; +- _4 = AddWithOverflow(copy _2, copy _3); +- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", copy _2, copy _3) -> [success: bb1, unwind continue]; + _4 = const (0_u8, true); + assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind continue]; } diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff index 6c612d46725..b7ff0b671f7 100644 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-abort.diff @@ -19,16 +19,16 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind unreachable]; + _4 = const 5000_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; +- _1 = copy _2[_3]; ++ _1 = copy _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff index 87024da2628..af6e3626142 100644 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.32bit.panic-unwind.diff @@ -19,16 +19,16 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind continue]; + _4 = const 5000_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; +- _1 = copy _2[_3]; ++ _1 = copy _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff index 6c612d46725..b7ff0b671f7 100644 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-abort.diff @@ -19,16 +19,16 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind unreachable]; + _4 = const 5000_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; +- _1 = copy _2[_3]; ++ _1 = copy _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff index 87024da2628..af6e3626142 100644 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/large_array_index.main.DataflowConstProp.64bit.panic-unwind.diff @@ -19,16 +19,16 @@ StorageLive(_3); _3 = const 2_usize; - _4 = Len(_2); -- _5 = Lt(_3, _4); -- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; +- _5 = Lt(copy _3, copy _4); +- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind continue]; + _4 = const 5000_usize; + _5 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = _2[_3]; -+ _1 = _2[2 of 3]; +- _1 = copy _2[_3]; ++ _1 = copy _2[2 of 3]; StorageDead(_3); StorageDead(_2); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.rs b/tests/mir-opt/dataflow-const-prop/large_array_index.rs index e74fd88d002..e9f2fa2badf 100644 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.rs +++ b/tests/mir-opt/dataflow-const-prop/large_array_index.rs @@ -13,6 +13,6 @@ fn main() { // CHECK: {{_.*}} = const 5000_usize; // CHECK: {{_.*}} = const true; // CHECK: assert(const true - // CHECK: [[x]] = [[array_lit]][2 of 3]; + // CHECK: [[x]] = copy [[array_lit]][2 of 3]; let x: u8 = [0_u8; 5000][2]; } diff --git a/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff index 91bc10a562f..8b05386b38a 100644 --- a/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/mult_by_zero.test.DataflowConstProp.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_2); - _2 = _1; + _2 = copy _1; - _0 = Mul(move _2, const 0_i32); + _0 = const 0_i32; StorageDead(_2); diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff index fbbfd61bbed..a0e83265d31 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-abort.diff @@ -39,7 +39,7 @@ bb2: { StorageDead(_5); StorageLive(_6); - _6 = _1; + _6 = copy _1; _0 = const (); StorageDead(_6); StorageDead(_1); diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff index 4e1d26acfa3..6dead031a9f 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.main.DataflowConstProp.panic-unwind.diff @@ -39,7 +39,7 @@ bb2: { StorageDead(_5); StorageLive(_6); - _6 = _1; + _6 = copy _1; _0 = const (); StorageDead(_6); StorageDead(_1); diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs index 399de921a59..1c4eb41f35e 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs @@ -24,7 +24,7 @@ fn main() { // This should currently not be propagated. // CHECK-NOT: [[b]] = const - // CHECK: [[b]] = [[a]]; + // CHECK: [[b]] = copy [[a]]; // CHECK-NOT: [[b]] = const let b = a; } diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff index a18ef6c9db7..dfa541b1200 100644 --- a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-abort.diff @@ -21,16 +21,16 @@ StorageLive(_4); _4 = const 2_usize; - _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; +- _6 = Lt(copy _4, copy _5); +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind unreachable]; + _5 = const 8_usize; + _6 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _2 = _3[_4]; -+ _2 = _3[2 of 3]; +- _2 = copy _3[_4]; ++ _2 = copy _3[2 of 3]; _1 = Add(move _2, const 0_u32); StorageDead(_2); StorageDead(_4); diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff index 3356ef98b14..9ede3c5f7ac 100644 --- a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.32bit.panic-unwind.diff @@ -21,16 +21,16 @@ StorageLive(_4); _4 = const 2_usize; - _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; +- _6 = Lt(copy _4, copy _5); +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind continue]; + _5 = const 8_usize; + _6 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _2 = _3[_4]; -+ _2 = _3[2 of 3]; +- _2 = copy _3[_4]; ++ _2 = copy _3[2 of 3]; _1 = Add(move _2, const 0_u32); StorageDead(_2); StorageDead(_4); diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff index a18ef6c9db7..dfa541b1200 100644 --- a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-abort.diff @@ -21,16 +21,16 @@ StorageLive(_4); _4 = const 2_usize; - _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable]; +- _6 = Lt(copy _4, copy _5); +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind unreachable]; + _5 = const 8_usize; + _6 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _2 = _3[_4]; -+ _2 = _3[2 of 3]; +- _2 = copy _3[_4]; ++ _2 = copy _3[2 of 3]; _1 = Add(move _2, const 0_u32); StorageDead(_2); StorageDead(_4); diff --git a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff index 3356ef98b14..9ede3c5f7ac 100644 --- a/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/repeat.main.DataflowConstProp.64bit.panic-unwind.diff @@ -21,16 +21,16 @@ StorageLive(_4); _4 = const 2_usize; - _5 = Len(_3); -- _6 = Lt(_4, _5); -- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue]; +- _6 = Lt(copy _4, copy _5); +- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind continue]; + _5 = const 8_usize; + _6 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue]; } bb1: { -- _2 = _3[_4]; -+ _2 = _3[2 of 3]; +- _2 = copy _3[_4]; ++ _2 = copy _3[2 of 3]; _1 = Add(move _2, const 0_u32); StorageDead(_2); StorageDead(_4); diff --git a/tests/mir-opt/dataflow-const-prop/repeat.rs b/tests/mir-opt/dataflow-const-prop/repeat.rs index e32c0d0877d..2067aa3d709 100644 --- a/tests/mir-opt/dataflow-const-prop/repeat.rs +++ b/tests/mir-opt/dataflow-const-prop/repeat.rs @@ -14,8 +14,8 @@ fn main() { // CHECK: {{_.*}} = const true; // CHECK: assert(const true - // CHECK-NOT: [[t:_.*]] = [[array_lit]][_ - // CHECK: [[t:_.*]] = [[array_lit]][2 of 3]; + // CHECK-NOT: [[t:_.*]] = {{copy|move}} [[array_lit]][_ + // CHECK: [[t:_.*]] = copy [[array_lit]][2 of 3]; // CHECK: [[x]] = Add(move [[t]], const 0_u32); let x: u32 = [42; 8][2] + 0; } diff --git a/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff index 98bd40ab2c3..d0915432aaa 100644 --- a/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff @@ -22,10 +22,10 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); -- _4 = (_1.0: i32); +- _4 = copy (_1.0: i32); + _4 = const 0_i32; StorageLive(_5); -- _5 = (_1.0: i32); +- _5 = copy (_1.0: i32); - _3 = Add(move _4, move _5); + _5 = const 0_i32; + _3 = const 0_i32; diff --git a/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff index fbdbb3fa35c..e54a0d64b16 100644 --- a/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/self_assign.main.DataflowConstProp.diff @@ -20,21 +20,21 @@ StorageLive(_1); _1 = const 0_i32; StorageLive(_2); - _2 = _1; + _2 = copy _1; _1 = Add(move _2, const 1_i32); StorageDead(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _1 = move _3; StorageDead(_3); StorageLive(_4); _4 = &_1; StorageLive(_5); - _5 = _4; + _5 = copy _4; _4 = move _5; StorageDead(_5); StorageLive(_6); - _6 = (*_4); + _6 = copy (*_4); _1 = move _6; StorageDead(_6); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff b/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff index e2468a9645d..77762ed9041 100644 --- a/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff +++ b/tests/mir-opt/dataflow-const-prop/self_assign_add.main.DataflowConstProp.diff @@ -11,8 +11,8 @@ bb0: { StorageLive(_1); _1 = const 0_i32; -- _1 = Add(_1, const 1_i32); -- _1 = Add(_1, const 1_i32); +- _1 = Add(copy _1, const 1_i32); +- _1 = Add(copy _1, const 1_i32); + _1 = const 1_i32; + _1 = const 2_i32; _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff index a5e40990751..178ebad6105 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-abort.diff @@ -27,7 +27,7 @@ _3 = &raw mut (_1.0: u8); StorageLive(_4); StorageLive(_5); - _5 = _3; + _5 = copy _3; _4 = std::ptr::mut_ptr::<impl *mut u8>::add(move _5, const 1_usize) -> [return: bb1, unwind unreachable]; } @@ -39,7 +39,7 @@ StorageDead(_3); StorageDead(_2); StorageLive(_6); - _6 = (_1.1: u8); + _6 = copy (_1.1: u8); _0 = const (); StorageDead(_6); StorageDead(_1); diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff index ce2178ddbee..ce2545589f1 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.main.DataflowConstProp.panic-unwind.diff @@ -27,7 +27,7 @@ _3 = &raw mut (_1.0: u8); StorageLive(_4); StorageLive(_5); - _5 = _3; + _5 = copy _3; _4 = std::ptr::mut_ptr::<impl *mut u8>::add(move _5, const 1_usize) -> [return: bb1, unwind continue]; } @@ -39,7 +39,7 @@ StorageDead(_3); StorageDead(_2); StorageLive(_6); - _6 = (_1.1: u8); + _6 = copy (_1.1: u8); _0 = const (); StorageDead(_6); StorageDead(_1); diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs index be7f311cdc1..b123f06807d 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs @@ -20,6 +20,6 @@ fn main() { *p.add(1) = 1; } - // CHECK: [[x1]] = ({{_.*}}.1: u8); + // CHECK: [[x1]] = copy ({{_.*}}.1: u8); let x1 = x.1; // should not be propagated } diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff index efba4a4646c..40632db667a 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-abort.diff @@ -30,23 +30,23 @@ StorageLive(_3); StorageLive(_4); _14 = const main::promoted[0]; - _4 = _14; - _3 = _4; + _4 = copy _14; + _3 = copy _4; _2 = move _3 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; + _7 = const 3_usize; + _8 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = (*_2)[_6]; -+ _1 = (*_2)[1 of 2]; +- _1 = copy (*_2)[_6]; ++ _1 = copy (*_2)[1 of 2]; StorageDead(_6); StorageDead(_4); StorageDead(_2); @@ -56,16 +56,16 @@ StorageLive(_11); _11 = const 1_usize; - _12 = Len((*_10)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind unreachable]; +- _13 = Lt(copy _11, copy _12); +- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb2, unwind unreachable]; + _12 = const 3_usize; + _13 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind unreachable]; } bb2: { -- _9 = (*_10)[_11]; -+ _9 = (*_10)[1 of 2]; +- _9 = copy (*_10)[_11]; ++ _9 = copy (*_10)[1 of 2]; StorageDead(_11); StorageDead(_10); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff index bf477d7e041..596b4ac9b1e 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.32bit.panic-unwind.diff @@ -30,23 +30,23 @@ StorageLive(_3); StorageLive(_4); _14 = const main::promoted[0]; - _4 = _14; - _3 = _4; + _4 = copy _14; + _3 = copy _4; _2 = move _3 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; + _7 = const 3_usize; + _8 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = (*_2)[_6]; -+ _1 = (*_2)[1 of 2]; +- _1 = copy (*_2)[_6]; ++ _1 = copy (*_2)[1 of 2]; StorageDead(_6); StorageDead(_4); StorageDead(_2); @@ -56,16 +56,16 @@ StorageLive(_11); _11 = const 1_usize; - _12 = Len((*_10)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind continue]; +- _13 = Lt(copy _11, copy _12); +- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb2, unwind continue]; + _12 = const 3_usize; + _13 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind continue]; } bb2: { -- _9 = (*_10)[_11]; -+ _9 = (*_10)[1 of 2]; +- _9 = copy (*_10)[_11]; ++ _9 = copy (*_10)[1 of 2]; StorageDead(_11); StorageDead(_10); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff index efba4a4646c..40632db667a 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-abort.diff @@ -30,23 +30,23 @@ StorageLive(_3); StorageLive(_4); _14 = const main::promoted[0]; - _4 = _14; - _3 = _4; + _4 = copy _14; + _3 = copy _4; _2 = move _3 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable]; +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; + _7 = const 3_usize; + _8 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _1 = (*_2)[_6]; -+ _1 = (*_2)[1 of 2]; +- _1 = copy (*_2)[_6]; ++ _1 = copy (*_2)[1 of 2]; StorageDead(_6); StorageDead(_4); StorageDead(_2); @@ -56,16 +56,16 @@ StorageLive(_11); _11 = const 1_usize; - _12 = Len((*_10)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind unreachable]; +- _13 = Lt(copy _11, copy _12); +- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb2, unwind unreachable]; + _12 = const 3_usize; + _13 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind unreachable]; } bb2: { -- _9 = (*_10)[_11]; -+ _9 = (*_10)[1 of 2]; +- _9 = copy (*_10)[_11]; ++ _9 = copy (*_10)[1 of 2]; StorageDead(_11); StorageDead(_10); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff index bf477d7e041..596b4ac9b1e 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/slice_len.main.DataflowConstProp.64bit.panic-unwind.diff @@ -30,23 +30,23 @@ StorageLive(_3); StorageLive(_4); _14 = const main::promoted[0]; - _4 = _14; - _3 = _4; + _4 = copy _14; + _3 = copy _4; _2 = move _3 as &[u32] (PointerCoercion(Unsize)); StorageDead(_3); StorageLive(_6); _6 = const 1_usize; - _7 = Len((*_2)); -- _8 = Lt(_6, _7); -- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue]; +- _8 = Lt(copy _6, copy _7); +- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; + _7 = const 3_usize; + _8 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue]; } bb1: { -- _1 = (*_2)[_6]; -+ _1 = (*_2)[1 of 2]; +- _1 = copy (*_2)[_6]; ++ _1 = copy (*_2)[1 of 2]; StorageDead(_6); StorageDead(_4); StorageDead(_2); @@ -56,16 +56,16 @@ StorageLive(_11); _11 = const 1_usize; - _12 = Len((*_10)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb2, unwind continue]; +- _13 = Lt(copy _11, copy _12); +- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb2, unwind continue]; + _12 = const 3_usize; + _13 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb2, unwind continue]; } bb2: { -- _9 = (*_10)[_11]; -+ _9 = (*_10)[1 of 2]; +- _9 = copy (*_10)[_11]; ++ _9 = copy (*_10)[1 of 2]; StorageDead(_11); StorageDead(_10); _0 = const (); diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.rs b/tests/mir-opt/dataflow-const-prop/slice_len.rs index 64c043cca79..e0e68f9fde5 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.rs +++ b/tests/mir-opt/dataflow-const-prop/slice_len.rs @@ -17,7 +17,7 @@ fn main() { // CHECK: {{_.*}} = const true; // CHECK: assert(const true, - // CHECK: [[local]] = (*{{_.*}})[1 of 2]; + // CHECK: [[local]] = copy (*{{_.*}})[1 of 2]; let local = (&[1u32, 2, 3] as &[u32])[1]; // CHECK-NOT: {{_.*}} = Len( @@ -28,7 +28,7 @@ fn main() { // CHECK: {{_.*}} = const true; // CHECK: assert(const true, - // CHECK-NOT: [[constant]] = (*{{_.*}})[_ - // CHECK: [[constant]] = (*{{_.*}})[1 of 2]; + // CHECK-NOT: [[constant]] = {{copy|move}} (*{{_.*}})[_ + // CHECK: [[constant]] = copy (*{{_.*}})[1 of 2]; let constant = SLICE[1]; } diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff index 5e89382ea8f..3ea49265cee 100644 --- a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.32bit.diff @@ -83,7 +83,7 @@ + _1 = const S(1_i32); StorageLive(_2); StorageLive(_3); -- _3 = (_1.0: i32); +- _3 = copy (_1.0: i32); - _2 = Add(move _3, const 2_i32); + _3 = const 1_i32; + _2 = const 3_i32; @@ -91,10 +91,10 @@ (_1.0: i32) = const 3_i32; StorageLive(_4); StorageLive(_5); -- _5 = _2; +- _5 = copy _2; + _5 = const 3_i32; StorageLive(_6); -- _6 = (_1.0: i32); +- _6 = copy (_1.0: i32); - _4 = Add(move _5, move _6); + _6 = const 3_i32; + _4 = const 6_i32; @@ -103,35 +103,35 @@ StorageLive(_10); _10 = const main::SMALL_VAL; StorageLive(_7); -- _7 = (_10.0: f32); +- _7 = copy (_10.0: f32); + _7 = const 4f32; StorageLive(_8); - _8 = (_10.1: std::option::Option<S>); + _8 = copy (_10.1: std::option::Option<S>); StorageLive(_9); - _9 = (_10.2: &[f32]); + _9 = copy (_10.2: &[f32]); StorageDead(_10); StorageLive(_14); _14 = const {ALLOC0: &&SmallStruct}; _31 = deref_copy (*_14); StorageLive(_11); _32 = deref_copy (*_14); -- _11 = ((*_32).0: f32); +- _11 = copy ((*_32).0: f32); + _11 = const 9f32; StorageLive(_12); _33 = deref_copy (*_14); - _12 = ((*_33).1: std::option::Option<S>); + _12 = copy ((*_33).1: std::option::Option<S>); StorageLive(_13); _34 = deref_copy (*_14); - _13 = ((*_34).2: &[f32]); + _13 = copy ((*_34).2: &[f32]); StorageDead(_14); StorageLive(_15); StorageLive(_16); -- _16 = _11; +- _16 = copy _11; + _16 = const 9f32; StorageLive(_17); - _17 = _12; + _17 = copy _12; StorageLive(_18); - _18 = _13; + _18 = copy _13; - _15 = SmallStruct(move _16, move _17, move _18); + _15 = SmallStruct(const 9f32, move _17, move _18); StorageDead(_18); @@ -140,35 +140,35 @@ StorageLive(_22); _22 = const main::BIG_VAL; StorageLive(_19); -- _19 = (_22.0: f32); +- _19 = copy (_22.0: f32); + _19 = const 25f32; StorageLive(_20); - _20 = (_22.1: std::option::Option<S>); + _20 = copy (_22.1: std::option::Option<S>); StorageLive(_21); - _21 = (_22.2: &[f32]); + _21 = copy (_22.2: &[f32]); StorageDead(_22); StorageLive(_26); _26 = const {ALLOC1: &&BigStruct}; _35 = deref_copy (*_26); StorageLive(_23); _36 = deref_copy (*_26); -- _23 = ((*_36).0: f32); +- _23 = copy ((*_36).0: f32); + _23 = const 82f32; StorageLive(_24); _37 = deref_copy (*_26); - _24 = ((*_37).1: std::option::Option<S>); + _24 = copy ((*_37).1: std::option::Option<S>); StorageLive(_25); _38 = deref_copy (*_26); - _25 = ((*_38).2: &[f32]); + _25 = copy ((*_38).2: &[f32]); StorageDead(_26); StorageLive(_27); StorageLive(_28); -- _28 = _23; +- _28 = copy _23; + _28 = const 82f32; StorageLive(_29); - _29 = _24; + _29 = copy _24; StorageLive(_30); - _30 = _25; + _30 = copy _25; - _27 = BigStruct(move _28, move _29, move _30); + _27 = BigStruct(const 82f32, move _29, move _30); StorageDead(_30); diff --git a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff index a707d7e5e76..78a0944975c 100644 --- a/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/struct.main.DataflowConstProp.64bit.diff @@ -83,7 +83,7 @@ + _1 = const S(1_i32); StorageLive(_2); StorageLive(_3); -- _3 = (_1.0: i32); +- _3 = copy (_1.0: i32); - _2 = Add(move _3, const 2_i32); + _3 = const 1_i32; + _2 = const 3_i32; @@ -91,10 +91,10 @@ (_1.0: i32) = const 3_i32; StorageLive(_4); StorageLive(_5); -- _5 = _2; +- _5 = copy _2; + _5 = const 3_i32; StorageLive(_6); -- _6 = (_1.0: i32); +- _6 = copy (_1.0: i32); - _4 = Add(move _5, move _6); + _6 = const 3_i32; + _4 = const 6_i32; @@ -103,35 +103,35 @@ StorageLive(_10); _10 = const main::SMALL_VAL; StorageLive(_7); -- _7 = (_10.0: f32); +- _7 = copy (_10.0: f32); + _7 = const 4f32; StorageLive(_8); - _8 = (_10.1: std::option::Option<S>); + _8 = copy (_10.1: std::option::Option<S>); StorageLive(_9); - _9 = (_10.2: &[f32]); + _9 = copy (_10.2: &[f32]); StorageDead(_10); StorageLive(_14); _14 = const {ALLOC0: &&SmallStruct}; _31 = deref_copy (*_14); StorageLive(_11); _32 = deref_copy (*_14); -- _11 = ((*_32).0: f32); +- _11 = copy ((*_32).0: f32); + _11 = const 9f32; StorageLive(_12); _33 = deref_copy (*_14); - _12 = ((*_33).1: std::option::Option<S>); + _12 = copy ((*_33).1: std::option::Option<S>); StorageLive(_13); _34 = deref_copy (*_14); - _13 = ((*_34).2: &[f32]); + _13 = copy ((*_34).2: &[f32]); StorageDead(_14); StorageLive(_15); StorageLive(_16); -- _16 = _11; +- _16 = copy _11; + _16 = const 9f32; StorageLive(_17); - _17 = _12; + _17 = copy _12; StorageLive(_18); - _18 = _13; + _18 = copy _13; - _15 = SmallStruct(move _16, move _17, move _18); + _15 = SmallStruct(const 9f32, move _17, move _18); StorageDead(_18); @@ -140,35 +140,35 @@ StorageLive(_22); _22 = const main::BIG_VAL; StorageLive(_19); -- _19 = (_22.0: f32); +- _19 = copy (_22.0: f32); + _19 = const 25f32; StorageLive(_20); - _20 = (_22.1: std::option::Option<S>); + _20 = copy (_22.1: std::option::Option<S>); StorageLive(_21); - _21 = (_22.2: &[f32]); + _21 = copy (_22.2: &[f32]); StorageDead(_22); StorageLive(_26); _26 = const {ALLOC1: &&BigStruct}; _35 = deref_copy (*_26); StorageLive(_23); _36 = deref_copy (*_26); -- _23 = ((*_36).0: f32); +- _23 = copy ((*_36).0: f32); + _23 = const 82f32; StorageLive(_24); _37 = deref_copy (*_26); - _24 = ((*_37).1: std::option::Option<S>); + _24 = copy ((*_37).1: std::option::Option<S>); StorageLive(_25); _38 = deref_copy (*_26); - _25 = ((*_38).2: &[f32]); + _25 = copy ((*_38).2: &[f32]); StorageDead(_26); StorageLive(_27); StorageLive(_28); -- _28 = _23; +- _28 = copy _23; + _28 = const 82f32; StorageLive(_29); - _29 = _24; + _29 = copy _24; StorageLive(_30); - _30 = _25; + _30 = copy _25; - _27 = BigStruct(move _28, move _29, move _30); + _27 = BigStruct(const 82f32, move _29, move _30); StorageDead(_30); diff --git a/tests/mir-opt/dataflow-const-prop/struct.rs b/tests/mir-opt/dataflow-const-prop/struct.rs index 89ad1b87029..44591ffb6de 100644 --- a/tests/mir-opt/dataflow-const-prop/struct.rs +++ b/tests/mir-opt/dataflow-const-prop/struct.rs @@ -46,15 +46,15 @@ fn main() { const SMALL_VAL: SmallStruct = SmallStruct(4., Some(S(1)), &[]); // CHECK: [[a1]] = const 4f32; - // CHECK: [[b1]] = ({{_.*}}.1: std::option::Option<S>); - // CHECK: [[c1]] = ({{_.*}}.2: &[f32]); + // CHECK: [[b1]] = copy ({{_.*}}.1: std::option::Option<S>); + // CHECK: [[c1]] = copy ({{_.*}}.2: &[f32]); let SmallStruct(a1, b1, c1) = SMALL_VAL; static SMALL_STAT: &SmallStruct = &SmallStruct(9., None, &[13.]); // CHECK: [[a2]] = const 9f32; - // CHECK: [[b2]] = ((*{{_.*}}).1: std::option::Option<S>); - // CHECK: [[c2]] = ((*{{_.*}}).2: &[f32]); + // CHECK: [[b2]] = copy ((*{{_.*}}).1: std::option::Option<S>); + // CHECK: [[c2]] = copy ((*{{_.*}}).2: &[f32]); let SmallStruct(a2, b2, c2) = *SMALL_STAT; // CHECK: [[ss]] = SmallStruct(const 9f32, move {{_.*}}, move {{_.*}}); @@ -63,14 +63,14 @@ fn main() { const BIG_VAL: BigStruct = BigStruct(25., None, &[]); // CHECK: [[a3]] = const 25f32; - // CHECK: [[b3]] = ({{_.*}}.1: std::option::Option<S>); - // CHECK: [[c3]] = ({{_.*}}.2: &[f32]); + // CHECK: [[b3]] = copy ({{_.*}}.1: std::option::Option<S>); + // CHECK: [[c3]] = copy ({{_.*}}.2: &[f32]); let BigStruct(a3, b3, c3) = BIG_VAL; static BIG_STAT: &BigStruct = &BigStruct(82., Some(S(35)), &[45., 72.]); // CHECK: [[a4]] = const 82f32; - // CHECK: [[b4]] = ((*{{_.*}}).1: std::option::Option<S>); - // CHECK: [[c4]] = ((*{{_.*}}).2: &[f32]); + // CHECK: [[b4]] = copy ((*{{_.*}}).1: std::option::Option<S>); + // CHECK: [[c4]] = copy ((*{{_.*}}).2: &[f32]); let BigStruct(a4, b4, c4) = *BIG_STAT; // We arbitrarily limit the size of synthetized values to 4 pointers. diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff index c0f378cc21f..e13b2aa9f7e 100644 --- a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff +++ b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-abort.diff @@ -17,7 +17,7 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); -- _4 = _1; +- _4 = copy _1; - _3 = Add(move _4, const 1_i32); + _4 = const 1_i32; + _3 = const 2_i32; diff --git a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff index 395620fec52..4be25fdcc38 100644 --- a/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff +++ b/tests/mir-opt/dataflow-const-prop/terminator.main.DataflowConstProp.panic-unwind.diff @@ -17,7 +17,7 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); -- _4 = _1; +- _4 = copy _1; - _3 = Add(move _4, const 1_i32); + _4 = const 1_i32; + _3 = const 2_i32; diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff index 258e2b454eb..2d67ac92209 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.32bit.diff @@ -13,7 +13,7 @@ StorageLive(_1); - _1 = const 1_usize as std::boxed::Box<Never> (Transmute); + _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); - _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); + _2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); unreachable; } } diff --git a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff index 258e2b454eb..2d67ac92209 100644 --- a/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/transmute.unreachable_box.DataflowConstProp.64bit.diff @@ -13,7 +13,7 @@ StorageLive(_1); - _1 = const 1_usize as std::boxed::Box<Never> (Transmute); + _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); - _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); + _2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); unreachable; } } diff --git a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff index e4031b65caa..f7846823e19 100644 --- a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff +++ b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.32bit.diff @@ -37,10 +37,10 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); -- _4 = (_1.0: i32); +- _4 = copy (_1.0: i32); + _4 = const 1_i32; StorageLive(_5); -- _5 = (_1.1: i32); +- _5 = copy (_1.1: i32); - _3 = Add(move _4, move _5); + _5 = const 2_i32; + _3 = const 3_i32; @@ -54,17 +54,17 @@ StorageLive(_6); StorageLive(_7); StorageLive(_8); -- _8 = (_1.0: i32); +- _8 = copy (_1.0: i32); + _8 = const 2_i32; StorageLive(_9); -- _9 = (_1.1: i32); +- _9 = copy (_1.1: i32); - _7 = Add(move _8, move _9); + _9 = const 3_i32; + _7 = const 5_i32; StorageDead(_9); StorageDead(_8); StorageLive(_10); -- _10 = _2; +- _10 = copy _2; - _6 = Add(move _7, move _10); + _10 = const 6_i32; + _6 = const 11_i32; @@ -72,13 +72,13 @@ StorageDead(_7); StorageLive(_11); StorageLive(_12); -- _12 = _2; +- _12 = copy _2; + _12 = const 6_i32; StorageLive(_13); -- _13 = _1; +- _13 = copy _1; + _13 = const (2_i32, 3_i32); StorageLive(_14); -- _14 = _6; +- _14 = copy _6; - _11 = (move _12, move _13, move _14); + _14 = const 11_i32; + _11 = (const 6_i32, const (2_i32, 3_i32), const 11_i32); diff --git a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff index e4031b65caa..f7846823e19 100644 --- a/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff +++ b/tests/mir-opt/dataflow-const-prop/tuple.main.DataflowConstProp.64bit.diff @@ -37,10 +37,10 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); -- _4 = (_1.0: i32); +- _4 = copy (_1.0: i32); + _4 = const 1_i32; StorageLive(_5); -- _5 = (_1.1: i32); +- _5 = copy (_1.1: i32); - _3 = Add(move _4, move _5); + _5 = const 2_i32; + _3 = const 3_i32; @@ -54,17 +54,17 @@ StorageLive(_6); StorageLive(_7); StorageLive(_8); -- _8 = (_1.0: i32); +- _8 = copy (_1.0: i32); + _8 = const 2_i32; StorageLive(_9); -- _9 = (_1.1: i32); +- _9 = copy (_1.1: i32); - _7 = Add(move _8, move _9); + _9 = const 3_i32; + _7 = const 5_i32; StorageDead(_9); StorageDead(_8); StorageLive(_10); -- _10 = _2; +- _10 = copy _2; - _6 = Add(move _7, move _10); + _10 = const 6_i32; + _6 = const 11_i32; @@ -72,13 +72,13 @@ StorageDead(_7); StorageLive(_11); StorageLive(_12); -- _12 = _2; +- _12 = copy _2; + _12 = const 6_i32; StorageLive(_13); -- _13 = _1; +- _13 = copy _1; + _13 = const (2_i32, 3_i32); StorageLive(_14); -- _14 = _6; +- _14 = copy _6; - _11 = (move _12, move _13, move _14); + _14 = const 11_i32; + _11 = (const 6_i32, const (2_i32, 3_i32), const 11_i32); diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination-final.panic-abort.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination-final.panic-abort.diff index 07fb8301b9a..80b727dd1a4 100644 --- a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination-final.panic-abort.diff +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination-final.panic-abort.diff @@ -5,7 +5,7 @@ let mut _0: (); bb0: { - _0 = use_both(const 0_i32, (_1.1: i32)) -> [return: bb1, unwind unreachable]; + _0 = use_both(const 0_i32, copy (_1.1: i32)) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination-final.panic-unwind.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination-final.panic-unwind.diff index cac3badfa67..c7aff795bd8 100644 --- a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination-final.panic-unwind.diff +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_packed.DeadStoreElimination-final.panic-unwind.diff @@ -5,7 +5,7 @@ let mut _0: (); bb0: { - _0 = use_both(const 0_i32, (_1.1: i32)) -> [return: bb1, unwind continue]; + _0 = use_both(const 0_i32, copy (_1.1: i32)) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination-final.panic-abort.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination-final.panic-abort.diff index f9bc9405d6a..a09ef3e4f34 100644 --- a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination-final.panic-abort.diff +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination-final.panic-abort.diff @@ -10,8 +10,8 @@ bb0: { StorageLive(_2); -- _2 = use_both(_1, _1) -> [return: bb1, unwind unreachable]; -+ _2 = use_both(_1, move _1) -> [return: bb1, unwind unreachable]; +- _2 = use_both(copy _1, copy _1) -> [return: bb1, unwind unreachable]; ++ _2 = use_both(copy _1, move _1) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination-final.panic-unwind.diff b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination-final.panic-unwind.diff index efe165422d9..09413c99fef 100644 --- a/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination-final.panic-unwind.diff +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.move_simple.DeadStoreElimination-final.panic-unwind.diff @@ -10,8 +10,8 @@ bb0: { StorageLive(_2); -- _2 = use_both(_1, _1) -> [return: bb1, unwind continue]; -+ _2 = use_both(_1, move _1) -> [return: bb1, unwind continue]; +- _2 = use_both(copy _1, copy _1) -> [return: bb1, unwind continue]; ++ _2 = use_both(copy _1, move _1) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs index 2556848ec46..27b5ccdb936 100644 --- a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs @@ -14,7 +14,7 @@ fn use_both(_: i32, _: i32) {} // EMIT_MIR call_arg_copy.move_simple.DeadStoreElimination-final.diff fn move_simple(x: i32) { // CHECK-LABEL: fn move_simple( - // CHECK: = use_both(_1, move _1) + // CHECK: = use_both(copy _1, move _1) use_both(x, x); } @@ -28,7 +28,7 @@ struct Packed { #[custom_mir(dialect = "analysis")] fn move_packed(packed: Packed) { // CHECK-LABEL: fn move_packed( - // CHECK: = use_both(const 0_i32, (_1.1: i32)) + // CHECK: = use_both(const 0_i32, copy (_1.1: i32)) mir! { { // We have a packed struct, verify that the copy is not turned into a move. diff --git a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination-initial.diff b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination-initial.diff index 2766b6ce6a9..ff18df1efcf 100644 --- a/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination-initial.diff +++ b/tests/mir-opt/dead-store-elimination/cycle.cycle.DeadStoreElimination-initial.diff @@ -11,14 +11,14 @@ } bb1: { - switchInt(_4) -> [1: bb2, otherwise: bb3]; + switchInt(copy _4) -> [1: bb2, otherwise: bb3]; } bb2: { -- _5 = _3; -- _3 = _2; -- _2 = _1; -- _1 = _5; +- _5 = copy _3; +- _3 = copy _2; +- _2 = copy _1; +- _1 = copy _5; + nop; + nop; + nop; diff --git a/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination-initial.diff b/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination-initial.diff index 56d5c24ae1d..5d054e2ea16 100644 --- a/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination-initial.diff +++ b/tests/mir-opt/dead-store-elimination/provenance_soundness.pointer_to_int.DeadStoreElimination-initial.diff @@ -18,12 +18,12 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = move _3 as usize (PointerExposeProvenance); StorageDead(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; _4 = move _5 as isize (PointerExposeProvenance); StorageDead(_5); _0 = const (); diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff index efb28ba344b..60742ef0e9a 100644 --- a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff +++ b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff @@ -37,40 +37,40 @@ } bb3: { - switchInt((*_2)[0 of 4]) -> [47: bb4, otherwise: bb2]; + switchInt(copy (*_2)[0 of 4]) -> [47: bb4, otherwise: bb2]; } bb4: { - switchInt((*_2)[1 of 4]) -> [47: bb5, otherwise: bb2]; + switchInt(copy (*_2)[1 of 4]) -> [47: bb5, otherwise: bb2]; } bb5: { - switchInt((*_2)[2 of 4]) -> [47: bb6, otherwise: bb2]; + switchInt(copy (*_2)[2 of 4]) -> [47: bb6, otherwise: bb2]; } bb6: { -- switchInt((*_2)[3 of 4]) -> [47: bb13, otherwise: bb2]; -+ switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb2]; +- switchInt(copy (*_2)[3 of 4]) -> [47: bb13, otherwise: bb2]; ++ switchInt(copy (*_2)[3 of 4]) -> [47: bb11, otherwise: bb2]; } bb7: { - _0 = const false; - goto -> bb14; -+ switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb11]; ++ switchInt(copy (*_2)[0 of 3]) -> [47: bb8, otherwise: bb11]; } bb8: { -- switchInt((*_2)[0 of 3]) -> [47: bb9, otherwise: bb7]; -+ switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb11]; +- switchInt(copy (*_2)[0 of 3]) -> [47: bb9, otherwise: bb7]; ++ switchInt(copy (*_2)[1 of 3]) -> [47: bb9, otherwise: bb11]; } bb9: { -- switchInt((*_2)[1 of 3]) -> [47: bb10, otherwise: bb7]; -+ switchInt((*_2)[2 of 3]) -> [47: bb10, 33: bb10, otherwise: bb11]; +- switchInt(copy (*_2)[1 of 3]) -> [47: bb10, otherwise: bb7]; ++ switchInt(copy (*_2)[2 of 3]) -> [47: bb10, 33: bb10, otherwise: bb11]; } bb10: { -- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb11, otherwise: bb7]; +- switchInt(copy (*_2)[2 of 3]) -> [47: bb12, 33: bb11, otherwise: bb7]; - } - - bb11: { diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff index c6e2d3a5512..7337a32f525 100644 --- a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff +++ b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff @@ -37,40 +37,40 @@ } bb3: { - switchInt((*_2)[0 of 4]) -> [47: bb4, otherwise: bb2]; + switchInt(copy (*_2)[0 of 4]) -> [47: bb4, otherwise: bb2]; } bb4: { - switchInt((*_2)[1 of 4]) -> [47: bb5, otherwise: bb2]; + switchInt(copy (*_2)[1 of 4]) -> [47: bb5, otherwise: bb2]; } bb5: { - switchInt((*_2)[2 of 4]) -> [47: bb6, otherwise: bb2]; + switchInt(copy (*_2)[2 of 4]) -> [47: bb6, otherwise: bb2]; } bb6: { -- switchInt((*_2)[3 of 4]) -> [47: bb13, otherwise: bb2]; -+ switchInt((*_2)[3 of 4]) -> [47: bb11, otherwise: bb2]; +- switchInt(copy (*_2)[3 of 4]) -> [47: bb13, otherwise: bb2]; ++ switchInt(copy (*_2)[3 of 4]) -> [47: bb11, otherwise: bb2]; } bb7: { - _0 = const false; - goto -> bb14; -+ switchInt((*_2)[0 of 3]) -> [47: bb8, otherwise: bb11]; ++ switchInt(copy (*_2)[0 of 3]) -> [47: bb8, otherwise: bb11]; } bb8: { -- switchInt((*_2)[0 of 3]) -> [47: bb9, otherwise: bb7]; -+ switchInt((*_2)[1 of 3]) -> [47: bb9, otherwise: bb11]; +- switchInt(copy (*_2)[0 of 3]) -> [47: bb9, otherwise: bb7]; ++ switchInt(copy (*_2)[1 of 3]) -> [47: bb9, otherwise: bb11]; } bb9: { -- switchInt((*_2)[1 of 3]) -> [47: bb10, otherwise: bb7]; -+ switchInt((*_2)[2 of 3]) -> [47: bb10, 33: bb10, otherwise: bb11]; +- switchInt(copy (*_2)[1 of 3]) -> [47: bb10, otherwise: bb7]; ++ switchInt(copy (*_2)[2 of 3]) -> [47: bb10, 33: bb10, otherwise: bb11]; } bb10: { -- switchInt((*_2)[2 of 3]) -> [47: bb12, 33: bb11, otherwise: bb7]; +- switchInt(copy (*_2)[2 of 3]) -> [47: bb12, 33: bb11, otherwise: bb7]; - } - - bb11: { diff --git a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff index 4ead50e96d8..bac62c88668 100644 --- a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff +++ b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-abort.diff @@ -64,11 +64,11 @@ bb5: { StorageLive(_12); -- _12 = (*((_7 as Some).0: &i32)); +- _12 = copy (*((_7 as Some).0: &i32)); + _15 = deref_copy ((_7 as Some).0: &i32); -+ _12 = (*_15); ++ _12 = copy (*_15); StorageLive(_13); - _13 = _12; + _13 = copy _12; _6 = std::mem::drop::<i32>(move _13) -> [return: bb7, unwind: bb8]; } diff --git a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff index c7cf5f02e0e..55cd2e427ee 100644 --- a/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff +++ b/tests/mir-opt/derefer_complex_case.main.Derefer.panic-unwind.diff @@ -64,11 +64,11 @@ bb5: { StorageLive(_12); -- _12 = (*((_7 as Some).0: &i32)); +- _12 = copy (*((_7 as Some).0: &i32)); + _15 = deref_copy ((_7 as Some).0: &i32); -+ _12 = (*_15); ++ _12 = copy (*_15); StorageLive(_13); - _13 = _12; + _13 = copy _12; _6 = std::mem::drop::<i32>(move _13) -> [return: bb7, unwind continue]; } diff --git a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff index f4c034517f7..012d2eb8b72 100644 --- a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff +++ b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-abort.diff @@ -52,7 +52,7 @@ _5 = &_6; _4 = &_5; - PlaceMention((*(*(*(*_4))))); -- switchInt((*(*(*(*_4))))) -> [0: bb3, otherwise: bb4]; +- switchInt(copy (*(*(*(*_4))))) -> [0: bb3, otherwise: bb4]; + _10 = deref_copy (*_4); + _11 = deref_copy (*_10); + _12 = deref_copy (*_11); @@ -60,7 +60,7 @@ + _13 = deref_copy (*_4); + _14 = deref_copy (*_13); + _15 = deref_copy (*_14); -+ switchInt((*_15)) -> [0: bb3, otherwise: bb4]; ++ switchInt(copy (*_15)) -> [0: bb3, otherwise: bb4]; } bb3: { diff --git a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff index e3c0c6b7dd2..43cee292335 100644 --- a/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff +++ b/tests/mir-opt/derefer_terminator_test.main.Derefer.panic-unwind.diff @@ -52,7 +52,7 @@ _5 = &_6; _4 = &_5; - PlaceMention((*(*(*(*_4))))); -- switchInt((*(*(*(*_4))))) -> [0: bb3, otherwise: bb4]; +- switchInt(copy (*(*(*(*_4))))) -> [0: bb3, otherwise: bb4]; + _10 = deref_copy (*_4); + _11 = deref_copy (*_10); + _12 = deref_copy (*_11); @@ -60,7 +60,7 @@ + _13 = deref_copy (*_4); + _14 = deref_copy (*_13); + _15 = deref_copy (*_14); -+ switchInt((*_15)) -> [0: bb3, otherwise: bb4]; ++ switchInt(copy (*_15)) -> [0: bb3, otherwise: bb4]; } bb3: { diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff index 10ec3aa555e..775d51ea49f 100644 --- a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff +++ b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-abort.diff @@ -35,7 +35,7 @@ } bb3: { -- _2 = _1; +- _2 = copy _1; + nop; goto -> bb6; } @@ -47,14 +47,14 @@ bb5: { StorageDead(_4); -- _2 = _1; +- _2 = copy _1; + nop; goto -> bb6; } bb6: { StorageDead(_3); -- _0 = _2; +- _0 = copy _2; - StorageDead(_2); - StorageDead(_1); + nop; diff --git a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff index 759c1cabf45..875ef8829d0 100644 --- a/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/branch.foo.DestinationPropagation.panic-unwind.diff @@ -35,7 +35,7 @@ } bb3: { -- _2 = _1; +- _2 = copy _1; + nop; goto -> bb6; } @@ -47,14 +47,14 @@ bb5: { StorageDead(_4); -- _2 = _1; +- _2 = copy _1; + nop; goto -> bb6; } bb6: { StorageDead(_3); -- _0 = _2; +- _0 = copy _2; - StorageDead(_2); - StorageDead(_1); + nop; diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff index 1aed07f9e6a..a4908c05e2e 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-abort.diff @@ -12,11 +12,11 @@ bb0: { - StorageLive(_2); -- _2 = _1; +- _2 = copy _1; + nop; -+ _0 = _1; ++ _0 = copy _1; _1 = const 123_i32; -- _0 = _2; +- _0 = copy _2; - StorageDead(_2); + nop; + nop; diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff index 1aed07f9e6a..a4908c05e2e 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.arg_src.DestinationPropagation.panic-unwind.diff @@ -12,11 +12,11 @@ bb0: { - StorageLive(_2); -- _2 = _1; +- _2 = copy _1; + nop; -+ _0 = _1; ++ _0 = copy _1; _1 = const 123_i32; -- _0 = _2; +- _0 = copy _2; - StorageDead(_2); + nop; + nop; diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff index 641dea594e1..24f2b464e2c 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-abort.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); - StorageLive(_3); -- _3 = _1; +- _3 = copy _1; - _2 = dummy(move _3) -> [return: bb1, unwind unreachable]; + nop; + nop; diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff index 8b2835c8ced..d42ac52b631 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.bar.DestinationPropagation.panic-unwind.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); - StorageLive(_3); -- _3 = _1; +- _3 = copy _1; - _2 = dummy(move _3) -> [return: bb1, unwind continue]; + nop; + nop; diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff index 4cddaec01d2..f1f1714b472 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-abort.diff @@ -8,14 +8,14 @@ bb0: { - StorageLive(_2); -- _2 = _1; +- _2 = copy _1; - _1 = move _2; - StorageDead(_2); + nop; + nop; + nop; + nop; - _0 = _1; + _0 = copy _1; return; } } diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff index 4cddaec01d2..f1f1714b472 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.baz.DestinationPropagation.panic-unwind.diff @@ -8,14 +8,14 @@ bb0: { - StorageLive(_2); -- _2 = _1; +- _2 = copy _1; - _1 = move _2; - StorageDead(_2); + nop; + nop; + nop; + nop; - _0 = _1; + _0 = copy _1; return; } } diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff index b461869be31..0328fc6b745 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-abort.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); - StorageLive(_3); -- _3 = _1; +- _3 = copy _1; - _2 = dummy(move _3) -> [return: bb1, unwind unreachable]; + nop; + nop; diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff index d5c2e07c6c2..30e2248db82 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.foo.DestinationPropagation.panic-unwind.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); - StorageLive(_3); -- _3 = _1; +- _3 = copy _1; - _2 = dummy(move _3) -> [return: bb1, unwind continue]; + nop; + nop; diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.rs b/tests/mir-opt/dest-prop/copy_propagation_arg.rs index 084bd0544c1..ef531f4afa2 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.rs +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.rs @@ -41,9 +41,9 @@ fn arg_src(mut x: i32) -> i32 { // CHECK-LABEL: fn arg_src( // CHECK: debug x => [[x:_.*]]; // CHECK: debug y => [[y:_.*]]; - // CHECK: [[y]] = [[x]] + // CHECK: [[y]] = copy [[x]] // CHECK: [[x]] = const 123_i32; - // CHECK-NOT: {{_.*}} = [[y]]; + // CHECK-NOT: {{_.*}} = copy [[y]]; let y = x; x = 123; // Don't propagate this assignment to `y` y diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff index 98b4ee866d2..5d8aaedae37 100644 --- a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff +++ b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-abort.diff @@ -31,11 +31,11 @@ bb1: { - StorageLive(_2); -- _2 = _1; +- _2 = copy _1; - StorageLive(_3); -- _3 = _2; +- _3 = copy _2; - StorageLive(_4); -- _4 = _3; +- _4 = copy _3; - _1 = move _4; - StorageDead(_4); + nop; @@ -48,7 +48,7 @@ + nop; StorageLive(_5); - StorageLive(_6); -- _6 = _1; +- _6 = copy _1; + nop; + nop; _5 = std::mem::drop::<i32>(move _6) -> [return: bb2, unwind unreachable]; diff --git a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff index 6f6e01d37b1..05c9bcc1d73 100644 --- a/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/cycle.main.DestinationPropagation.panic-unwind.diff @@ -31,11 +31,11 @@ bb1: { - StorageLive(_2); -- _2 = _1; +- _2 = copy _1; - StorageLive(_3); -- _3 = _2; +- _3 = copy _2; - StorageLive(_4); -- _4 = _3; +- _4 = copy _3; - _1 = move _4; - StorageDead(_4); + nop; @@ -48,7 +48,7 @@ + nop; StorageLive(_5); - StorageLive(_6); -- _6 = _1; +- _6 = copy _1; + nop; + nop; _5 = std::mem::drop::<i32>(move _6) -> [return: bb2, unwind continue]; diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir index eb160fc194a..eb4209731c6 100644 --- a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir +++ b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-abort.mir @@ -12,7 +12,7 @@ fn f(_1: usize) -> usize { bb0: { nop; - _3 = _1; + _3 = copy _1; _1 = const 5_usize; nop; nop; diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir index 9147de2ec47..fe9a7376a58 100644 --- a/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir +++ b/tests/mir-opt/dest-prop/dead_stores_79191.f.DestinationPropagation.after.panic-unwind.mir @@ -12,7 +12,7 @@ fn f(_1: usize) -> usize { bb0: { nop; - _3 = _1; + _3 = copy _1; _1 = const 5_usize; nop; nop; diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.rs b/tests/mir-opt/dest-prop/dead_stores_79191.rs index 61060e4f850..d035de5ce07 100644 --- a/tests/mir-opt/dest-prop/dead_stores_79191.rs +++ b/tests/mir-opt/dest-prop/dead_stores_79191.rs @@ -10,7 +10,7 @@ fn f(mut a: usize) -> usize { // CHECK-LABEL: fn f( // CHECK: debug a => [[a:_.*]]; // CHECK: debug b => [[b:_.*]]; - // CHECK: [[b]] = [[a]]; + // CHECK: [[b]] = copy [[a]]; // CHECK: [[a]] = const 5_usize; // CHECK: [[a]] = move [[b]]; // CHECK: id::<usize>(move [[a]]) diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir index eb160fc194a..eb4209731c6 100644 --- a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir +++ b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-abort.mir @@ -12,7 +12,7 @@ fn f(_1: usize) -> usize { bb0: { nop; - _3 = _1; + _3 = copy _1; _1 = const 5_usize; nop; nop; diff --git a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir index 9147de2ec47..fe9a7376a58 100644 --- a/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir +++ b/tests/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.panic-unwind.mir @@ -12,7 +12,7 @@ fn f(_1: usize) -> usize { bb0: { nop; - _3 = _1; + _3 = copy _1; _1 = const 5_usize; nop; nop; diff --git a/tests/mir-opt/dest-prop/dead_stores_better.rs b/tests/mir-opt/dest-prop/dead_stores_better.rs index d2b9fe05712..d4c297fd97a 100644 --- a/tests/mir-opt/dest-prop/dead_stores_better.rs +++ b/tests/mir-opt/dest-prop/dead_stores_better.rs @@ -14,7 +14,7 @@ pub fn f(mut a: usize) -> usize { // CHECK-LABEL: fn f( // CHECK: debug a => [[a:_.*]]; // CHECK: debug b => [[b:_.*]]; - // CHECK: [[b]] = [[a]]; + // CHECK: [[b]] = copy [[a]]; // CHECK: [[a]] = const 5_usize; // CHECK: [[a]] = move [[b]]; // CHECK: id::<usize>(move [[a]]) diff --git a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff index 4d34f43fd5c..e9fbcf20a72 100644 --- a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff +++ b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-abort.diff @@ -18,7 +18,7 @@ _2 = [const 0_u8; 1024]; StorageLive(_3); - StorageLive(_4); -- _4 = _1; +- _4 = copy _1; + nop; + nop; StorageLive(_5); @@ -35,7 +35,7 @@ + nop; StorageDead(_6); StorageDead(_3); - _0 = _2; + _0 = copy _2; StorageDead(_2); return; } diff --git a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff index 9c3cbef38d6..95d5fe1b930 100644 --- a/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/simple.nrvo.DestinationPropagation.panic-unwind.diff @@ -18,7 +18,7 @@ _2 = [const 0_u8; 1024]; StorageLive(_3); - StorageLive(_4); -- _4 = _1; +- _4 = copy _1; + nop; + nop; StorageLive(_5); @@ -35,7 +35,7 @@ + nop; StorageDead(_6); StorageDead(_3); - _0 = _2; + _0 = copy _2; StorageDead(_2); return; } diff --git a/tests/mir-opt/dest-prop/simple.rs b/tests/mir-opt/dest-prop/simple.rs index 833d49b8c46..927a9c5b24c 100644 --- a/tests/mir-opt/dest-prop/simple.rs +++ b/tests/mir-opt/dest-prop/simple.rs @@ -7,9 +7,9 @@ fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] { // CHECK: debug init => [[init:_.*]]; // CHECK: debug buf => [[buf:_.*]]; // CHECK: [[buf]] = [const 0_u8; 1024]; - // CHECK-NOT: {{_.*}} = [[init]]; + // CHECK-NOT: {{_.*}} = copy [[init]]; // CHECK: move [[init]](move {{_.*}}) - // CHECK: {{_.*}} = [[buf]] + // CHECK: {{_.*}} = copy [[buf]] let mut buf = [0; 1024]; init(&mut buf); buf diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff index b596e25ddfd..557320f0179 100644 --- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff +++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-abort.diff @@ -22,7 +22,7 @@ _1 = Un { us: const 1_u32 }; StorageDead(_2); StorageLive(_3); - _3 = (_1.0: u32); + _3 = copy (_1.0: u32); StorageDead(_3); StorageDead(_1); return; diff --git a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff index b596e25ddfd..557320f0179 100644 --- a/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff +++ b/tests/mir-opt/dest-prop/union.main.DestinationPropagation.panic-unwind.diff @@ -22,7 +22,7 @@ _1 = Un { us: const 1_u32 }; StorageDead(_2); StorageLive(_3); - _3 = (_1.0: u32); + _3 = copy (_1.0: u32); StorageDead(_3); StorageDead(_1); return; diff --git a/tests/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff index 4af3ed3e1d1..51c41996678 100644 --- a/tests/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff @@ -20,9 +20,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; _3 = (move _4, move _5); StorageDead(_5); StorageDead(_4); @@ -42,9 +42,9 @@ bb3: { StorageLive(_8); - _8 = (((_3.0: std::option::Option<u32>) as Some).0: u32); + _8 = copy (((_3.0: std::option::Option<u32>) as Some).0: u32); StorageLive(_9); - _9 = (((_3.1: std::option::Option<u32>) as Some).0: u32); + _9 = copy (((_3.1: std::option::Option<u32>) as Some).0: u32); _0 = const 0_u32; StorageDead(_9); StorageDead(_8); diff --git a/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff index 41ae2fd3af3..f17ebee9416 100644 --- a/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch.opt2.EarlyOtherwiseBranch.diff @@ -21,9 +21,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; _3 = (move _4, move _5); StorageDead(_5); StorageDead(_4); @@ -53,9 +53,9 @@ bb5: { StorageLive(_9); - _9 = (((_3.0: std::option::Option<u32>) as Some).0: u32); + _9 = copy (((_3.0: std::option::Option<u32>) as Some).0: u32); StorageLive(_10); - _10 = (((_3.1: std::option::Option<u32>) as Some).0: u32); + _10 = copy (((_3.1: std::option::Option<u32>) as Some).0: u32); _0 = const 0_u32; StorageDead(_10); StorageDead(_9); diff --git a/tests/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff index 302fd0bfded..7b94a4c2bf7 100644 --- a/tests/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch.opt3.EarlyOtherwiseBranch.diff @@ -35,7 +35,7 @@ + StorageLive(_12); + _12 = discriminant((_3.1: Option2<bool>)); + StorageLive(_13); -+ _13 = Ne(_9, move _12); ++ _13 = Ne(copy _9, move _12); + StorageDead(_12); + switchInt(move _13) -> [0: bb7, otherwise: bb1]; } @@ -78,9 +78,9 @@ - bb7: { + bb4: { StorageLive(_10); - _10 = (((_3.0: Option2<u32>) as Some).0: u32); + _10 = copy (((_3.0: Option2<u32>) as Some).0: u32); StorageLive(_11); - _11 = (((_3.1: Option2<bool>) as Some).0: bool); + _11 = copy (((_3.1: Option2<bool>) as Some).0: bool); _0 = const 0_u32; StorageDead(_11); StorageDead(_10); @@ -101,7 +101,7 @@ + + bb7: { + StorageDead(_13); -+ switchInt(_9) -> [0: bb4, 1: bb3, 2: bb2, otherwise: bb6]; ++ switchInt(copy _9) -> [0: bb4, 1: bb3, 2: bb2, otherwise: bb6]; } } diff --git a/tests/mir-opt/early_otherwise_branch.opt4.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch.opt4.EarlyOtherwiseBranch.diff index eef4fb3278c..f52795baef8 100644 --- a/tests/mir-opt/early_otherwise_branch.opt4.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch.opt4.EarlyOtherwiseBranch.diff @@ -35,7 +35,7 @@ + StorageLive(_12); + _12 = discriminant((_3.1: Option2<u32>)); + StorageLive(_13); -+ _13 = Ne(_9, move _12); ++ _13 = Ne(copy _9, move _12); + StorageDead(_12); + switchInt(move _13) -> [0: bb7, otherwise: bb1]; } @@ -78,9 +78,9 @@ - bb7: { + bb4: { StorageLive(_10); - _10 = (((_3.0: Option2<u32>) as Some).0: u32); + _10 = copy (((_3.0: Option2<u32>) as Some).0: u32); StorageLive(_11); - _11 = (((_3.1: Option2<u32>) as Some).0: u32); + _11 = copy (((_3.1: Option2<u32>) as Some).0: u32); _0 = const 0_u32; StorageDead(_11); StorageDead(_10); @@ -101,7 +101,7 @@ + + bb7: { + StorageDead(_13); -+ switchInt(_9) -> [0: bb4, 1: bb3, 2: bb2, otherwise: bb6]; ++ switchInt(copy _9) -> [0: bb4, 1: bb3, 2: bb2, otherwise: bb6]; } } diff --git a/tests/mir-opt/early_otherwise_branch.rs b/tests/mir-opt/early_otherwise_branch.rs index b047c50df97..47bd4be295b 100644 --- a/tests/mir-opt/early_otherwise_branch.rs +++ b/tests/mir-opt/early_otherwise_branch.rs @@ -49,7 +49,7 @@ fn opt3(x: Option2<u32>, y: Option2<bool>) -> u32 { // CHECK: bb0: { // CHECK: [[LOCAL1:_.*]] = discriminant({{.*}}); // CHECK: [[LOCAL2:_.*]] = discriminant({{.*}}); - // CHECK: [[CMP_LOCAL]] = Ne([[LOCAL1]], move [[LOCAL2]]); + // CHECK: [[CMP_LOCAL]] = Ne(copy [[LOCAL1]], move [[LOCAL2]]); // CHECK: switchInt(move [[CMP_LOCAL]]) -> [ // CHECK-NEXT: } match (x, y) { @@ -67,7 +67,7 @@ fn opt4(x: Option2<u32>, y: Option2<u32>) -> u32 { // CHECK: bb0: { // CHECK: [[LOCAL1:_.*]] = discriminant({{.*}}); // CHECK: [[LOCAL2:_.*]] = discriminant({{.*}}); - // CHECK: [[CMP_LOCAL]] = Ne([[LOCAL1]], move [[LOCAL2]]); + // CHECK: [[CMP_LOCAL]] = Ne(copy [[LOCAL1]], move [[LOCAL2]]); // CHECK: switchInt(move [[CMP_LOCAL]]) -> [ // CHECK-NEXT: } match (x, y) { diff --git a/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff index cb03e2697cc..98df9934af0 100644 --- a/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff @@ -27,11 +27,11 @@ bb0: { StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; StorageLive(_6); - _6 = _2; + _6 = copy _2; StorageLive(_7); - _7 = _3; + _7 = copy _3; _4 = (move _5, move _6, move _7); StorageDead(_7); StorageDead(_6); @@ -72,11 +72,11 @@ bb7: { StorageLive(_13); - _13 = (((_4.0: std::option::Option<u32>) as Some).0: u32); + _13 = copy (((_4.0: std::option::Option<u32>) as Some).0: u32); StorageLive(_14); - _14 = (((_4.1: std::option::Option<u32>) as Some).0: u32); + _14 = copy (((_4.1: std::option::Option<u32>) as Some).0: u32); StorageLive(_15); - _15 = (((_4.2: std::option::Option<u32>) as Some).0: u32); + _15 = copy (((_4.2: std::option::Option<u32>) as Some).0: u32); _0 = const 0_u32; StorageDead(_15); StorageDead(_14); diff --git a/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt2.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt2.EarlyOtherwiseBranch.diff index 5634df253a5..831d8cbb4d6 100644 --- a/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt2.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch_3_element_tuple.opt2.EarlyOtherwiseBranch.diff @@ -45,7 +45,7 @@ + StorageLive(_18); + _18 = discriminant((_4.1: Option2<u32>)); + StorageLive(_19); -+ _19 = Ne(_14, move _18); ++ _19 = Ne(copy _14, move _18); + StorageDead(_18); + switchInt(move _19) -> [0: bb10, otherwise: bb1]; } @@ -109,11 +109,11 @@ - bb10: { + bb7: { StorageLive(_15); - _15 = (((_4.0: Option2<u32>) as Some).0: u32); + _15 = copy (((_4.0: Option2<u32>) as Some).0: u32); StorageLive(_16); - _16 = (((_4.1: Option2<u32>) as Some).0: u32); + _16 = copy (((_4.1: Option2<u32>) as Some).0: u32); StorageLive(_17); - _17 = (((_4.2: Option2<u32>) as Some).0: u32); + _17 = copy (((_4.2: Option2<u32>) as Some).0: u32); _0 = const 0_u32; StorageDead(_17); StorageDead(_16); @@ -135,7 +135,7 @@ + + bb10: { + StorageDead(_19); -+ switchInt(_14) -> [0: bb2, 1: bb3, 2: bb4, otherwise: bb9]; ++ switchInt(copy _14) -> [0: bb2, 1: bb3, 2: bb4, otherwise: bb9]; } } diff --git a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs index d2a3e1f59ff..d6b27fbce48 100644 --- a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs +++ b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs @@ -32,7 +32,7 @@ fn opt2(x: Option2<u32>, y: Option2<u32>, z: Option2<u32>) -> u32 { // CHECK: bb0: { // CHECK: [[LOCAL1:_.*]] = discriminant({{.*}}); // CHECK: [[LOCAL2:_.*]] = discriminant({{.*}}); - // CHECK: [[CMP_LOCAL]] = Ne([[LOCAL1]], move [[LOCAL2]]); + // CHECK: [[CMP_LOCAL]] = Ne(copy [[LOCAL1]], move [[LOCAL2]]); // CHECK: switchInt(move [[CMP_LOCAL]]) -> [ // CHECK-NEXT: } match (x, y, z) { diff --git a/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff index 8179d9dd115..fec318c1ab4 100644 --- a/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff @@ -70,9 +70,9 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; StorageLive(_6); - _6 = _2; + _6 = copy _2; _4 = (move _5, move _6); StorageDead(_6); StorageDead(_5); @@ -118,15 +118,15 @@ bb6: { StorageLive(_27); _39 = deref_copy (_4.0: &ViewportPercentageLength); - _27 = (((*_39) as Vmax).0: f32); + _27 = copy (((*_39) as Vmax).0: f32); StorageLive(_28); _40 = deref_copy (_4.1: &ViewportPercentageLength); - _28 = (((*_40) as Vmax).0: f32); + _28 = copy (((*_40) as Vmax).0: f32); StorageLive(_29); StorageLive(_30); - _30 = _27; + _30 = copy _27; StorageLive(_31); - _31 = _28; + _31 = copy _28; _29 = Add(move _30, move _31); StorageDead(_31); StorageDead(_30); @@ -140,15 +140,15 @@ bb7: { StorageLive(_22); _41 = deref_copy (_4.0: &ViewportPercentageLength); - _22 = (((*_41) as Vmin).0: f32); + _22 = copy (((*_41) as Vmin).0: f32); StorageLive(_23); _42 = deref_copy (_4.1: &ViewportPercentageLength); - _23 = (((*_42) as Vmin).0: f32); + _23 = copy (((*_42) as Vmin).0: f32); StorageLive(_24); StorageLive(_25); - _25 = _22; + _25 = copy _22; StorageLive(_26); - _26 = _23; + _26 = copy _23; _24 = Add(move _25, move _26); StorageDead(_26); StorageDead(_25); @@ -162,15 +162,15 @@ bb8: { StorageLive(_17); _43 = deref_copy (_4.0: &ViewportPercentageLength); - _17 = (((*_43) as Vh).0: f32); + _17 = copy (((*_43) as Vh).0: f32); StorageLive(_18); _44 = deref_copy (_4.1: &ViewportPercentageLength); - _18 = (((*_44) as Vh).0: f32); + _18 = copy (((*_44) as Vh).0: f32); StorageLive(_19); StorageLive(_20); - _20 = _17; + _20 = copy _17; StorageLive(_21); - _21 = _18; + _21 = copy _18; _19 = Add(move _20, move _21); StorageDead(_21); StorageDead(_20); @@ -184,15 +184,15 @@ bb9: { StorageLive(_12); _45 = deref_copy (_4.0: &ViewportPercentageLength); - _12 = (((*_45) as Vw).0: f32); + _12 = copy (((*_45) as Vw).0: f32); StorageLive(_13); _46 = deref_copy (_4.1: &ViewportPercentageLength); - _13 = (((*_46) as Vw).0: f32); + _13 = copy (((*_46) as Vw).0: f32); StorageLive(_14); StorageLive(_15); - _15 = _12; + _15 = copy _12; StorageLive(_16); - _16 = _13; + _16 = copy _13; _14 = Add(move _15, move _16); StorageDead(_16); StorageDead(_15); diff --git a/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff index 651b1de4ddd..8ed2274a72b 100644 --- a/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch_noopt.noopt1.EarlyOtherwiseBranch.diff @@ -29,9 +29,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; _3 = (move _4, move _5); StorageDead(_5); StorageDead(_4); @@ -60,7 +60,7 @@ bb5: { StorageLive(_12); - _12 = (((_3.1: std::option::Option<u32>) as Some).0: u32); + _12 = copy (((_3.1: std::option::Option<u32>) as Some).0: u32); _0 = const 2_u32; StorageDead(_12); goto -> bb8; @@ -68,7 +68,7 @@ bb6: { StorageLive(_11); - _11 = (((_3.0: std::option::Option<u32>) as Some).0: u32); + _11 = copy (((_3.0: std::option::Option<u32>) as Some).0: u32); _0 = const 1_u32; StorageDead(_11); goto -> bb8; @@ -76,9 +76,9 @@ bb7: { StorageLive(_9); - _9 = (((_3.0: std::option::Option<u32>) as Some).0: u32); + _9 = copy (((_3.0: std::option::Option<u32>) as Some).0: u32); StorageLive(_10); - _10 = (((_3.1: std::option::Option<u32>) as Some).0: u32); + _10 = copy (((_3.1: std::option::Option<u32>) as Some).0: u32); _0 = const 0_u32; StorageDead(_10); StorageDead(_9); diff --git a/tests/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff b/tests/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff index 8eab59823f4..eeb8b766b5d 100644 --- a/tests/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff +++ b/tests/mir-opt/early_otherwise_branch_soundness.no_deref_ptr.EarlyOtherwiseBranch.diff @@ -34,8 +34,8 @@ bb4: { StorageLive(_5); - _5 = (((*_2) as Some).0: i32); - _0 = _5; + _5 = copy (((*_2) as Some).0: i32); + _0 = copy _5; StorageDead(_5); goto -> bb5; } diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff index 085c55caaa0..727efe4b0d9 100644 --- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff +++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff @@ -38,28 +38,28 @@ + StorageLive(_4); + _4 = const [2_usize, 8197_usize]; + _5 = discriminant(_2); -+ _6 = _5 as usize (IntToInt); -+ _7 = _4[_6]; ++ _6 = copy _5 as usize (IntToInt); ++ _7 = copy _4[_6]; + _8 = &raw mut _1; -+ _9 = _8 as *mut u8 (PtrToPtr); ++ _9 = copy _8 as *mut u8 (PtrToPtr); + _10 = &raw const _2; -+ _11 = _10 as *const u8 (PtrToPtr); ++ _11 = copy _10 as *const u8 (PtrToPtr); + Deinit(_8); -+ copy_nonoverlapping(dst = _9, src = _11, count = _7); ++ copy_nonoverlapping(dst = copy _9, src = copy _11, count = copy _7); + StorageDead(_4); StorageDead(_2); - _0 = move _1; + StorageLive(_12); + _12 = const [2_usize, 8197_usize]; + _13 = discriminant(_1); -+ _14 = _13 as usize (IntToInt); -+ _15 = _12[_14]; ++ _14 = copy _13 as usize (IntToInt); ++ _15 = copy _12[_14]; + _16 = &raw mut _0; -+ _17 = _16 as *mut u8 (PtrToPtr); ++ _17 = copy _16 as *mut u8 (PtrToPtr); + _18 = &raw const _1; -+ _19 = _18 as *const u8 (PtrToPtr); ++ _19 = copy _18 as *const u8 (PtrToPtr); + Deinit(_16); -+ copy_nonoverlapping(dst = _17, src = _19, count = _15); ++ copy_nonoverlapping(dst = copy _17, src = copy _19, count = copy _15); + StorageDead(_12); StorageDead(_1); return; diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff index 798b7c10fe8..8d0cd97f786 100644 --- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff +++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff @@ -38,28 +38,28 @@ + StorageLive(_4); + _4 = const [2_usize, 8197_usize]; + _5 = discriminant(_2); -+ _6 = _5 as usize (IntToInt); -+ _7 = _4[_6]; ++ _6 = copy _5 as usize (IntToInt); ++ _7 = copy _4[_6]; + _8 = &raw mut _1; -+ _9 = _8 as *mut u8 (PtrToPtr); ++ _9 = copy _8 as *mut u8 (PtrToPtr); + _10 = &raw const _2; -+ _11 = _10 as *const u8 (PtrToPtr); ++ _11 = copy _10 as *const u8 (PtrToPtr); + Deinit(_8); -+ copy_nonoverlapping(dst = _9, src = _11, count = _7); ++ copy_nonoverlapping(dst = copy _9, src = copy _11, count = copy _7); + StorageDead(_4); StorageDead(_2); - _0 = move _1; + StorageLive(_12); + _12 = const [2_usize, 8197_usize]; + _13 = discriminant(_1); -+ _14 = _13 as usize (IntToInt); -+ _15 = _12[_14]; ++ _14 = copy _13 as usize (IntToInt); ++ _15 = copy _12[_14]; + _16 = &raw mut _0; -+ _17 = _16 as *mut u8 (PtrToPtr); ++ _17 = copy _16 as *mut u8 (PtrToPtr); + _18 = &raw const _1; -+ _19 = _18 as *const u8 (PtrToPtr); ++ _19 = copy _18 as *const u8 (PtrToPtr); + Deinit(_16); -+ copy_nonoverlapping(dst = _17, src = _19, count = _15); ++ copy_nonoverlapping(dst = copy _17, src = copy _19, count = copy _15); + StorageDead(_12); StorageDead(_1); return; diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff index a04829af4b5..6d1e2a72fdb 100644 --- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff +++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff @@ -38,28 +38,28 @@ + StorageLive(_4); + _4 = const [8197_usize, 1_usize]; + _5 = discriminant(_2); -+ _6 = _5 as usize (IntToInt); -+ _7 = _4[_6]; ++ _6 = copy _5 as usize (IntToInt); ++ _7 = copy _4[_6]; + _8 = &raw mut _1; -+ _9 = _8 as *mut u8 (PtrToPtr); ++ _9 = copy _8 as *mut u8 (PtrToPtr); + _10 = &raw const _2; -+ _11 = _10 as *const u8 (PtrToPtr); ++ _11 = copy _10 as *const u8 (PtrToPtr); + Deinit(_8); -+ copy_nonoverlapping(dst = _9, src = _11, count = _7); ++ copy_nonoverlapping(dst = copy _9, src = copy _11, count = copy _7); + StorageDead(_4); StorageDead(_2); - _0 = move _1; + StorageLive(_12); + _12 = const [8197_usize, 1_usize]; + _13 = discriminant(_1); -+ _14 = _13 as usize (IntToInt); -+ _15 = _12[_14]; ++ _14 = copy _13 as usize (IntToInt); ++ _15 = copy _12[_14]; + _16 = &raw mut _0; -+ _17 = _16 as *mut u8 (PtrToPtr); ++ _17 = copy _16 as *mut u8 (PtrToPtr); + _18 = &raw const _1; -+ _19 = _18 as *const u8 (PtrToPtr); ++ _19 = copy _18 as *const u8 (PtrToPtr); + Deinit(_16); -+ copy_nonoverlapping(dst = _17, src = _19, count = _15); ++ copy_nonoverlapping(dst = copy _17, src = copy _19, count = copy _15); + StorageDead(_12); StorageDead(_1); return; diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff index f5521a1e22a..4b1406d0d62 100644 --- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff +++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff @@ -38,28 +38,28 @@ + StorageLive(_4); + _4 = const [8197_usize, 1_usize]; + _5 = discriminant(_2); -+ _6 = _5 as usize (IntToInt); -+ _7 = _4[_6]; ++ _6 = copy _5 as usize (IntToInt); ++ _7 = copy _4[_6]; + _8 = &raw mut _1; -+ _9 = _8 as *mut u8 (PtrToPtr); ++ _9 = copy _8 as *mut u8 (PtrToPtr); + _10 = &raw const _2; -+ _11 = _10 as *const u8 (PtrToPtr); ++ _11 = copy _10 as *const u8 (PtrToPtr); + Deinit(_8); -+ copy_nonoverlapping(dst = _9, src = _11, count = _7); ++ copy_nonoverlapping(dst = copy _9, src = copy _11, count = copy _7); + StorageDead(_4); StorageDead(_2); - _0 = move _1; + StorageLive(_12); + _12 = const [8197_usize, 1_usize]; + _13 = discriminant(_1); -+ _14 = _13 as usize (IntToInt); -+ _15 = _12[_14]; ++ _14 = copy _13 as usize (IntToInt); ++ _15 = copy _12[_14]; + _16 = &raw mut _0; -+ _17 = _16 as *mut u8 (PtrToPtr); ++ _17 = copy _16 as *mut u8 (PtrToPtr); + _18 = &raw const _1; -+ _19 = _18 as *const u8 (PtrToPtr); ++ _19 = copy _18 as *const u8 (PtrToPtr); + Deinit(_16); -+ copy_nonoverlapping(dst = _17, src = _19, count = _15); ++ copy_nonoverlapping(dst = copy _17, src = copy _19, count = copy _15); + StorageDead(_12); StorageDead(_1); return; diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-abort.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-abort.diff index 8a701641ff9..ed72ca72629 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-abort.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-abort.diff @@ -42,13 +42,13 @@ StorageLive(_4); StorageLive(_20); StorageLive(_21); - _21 = ((*_1).0: u32); + _21 = copy ((*_1).0: u32); _20 = BitAnd(move _21, const 1_u32); StorageDead(_21); _4 = Ne(move _20, const 0_u32); StorageDead(_20); StorageLive(_5); - switchInt(_4) -> [0: bb2, otherwise: bb1]; + switchInt(copy _4) -> [0: bb2, otherwise: bb1]; } bb1: { @@ -65,7 +65,7 @@ bb3: { StorageLive(_6); - _6 = ((*_1).4: std::option::Option<usize>); + _6 = copy ((*_1).4: std::option::Option<usize>); _7 = discriminant(_6); switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb9]; } @@ -73,26 +73,26 @@ bb4: { - StorageLive(_8); + nop; - _8 = ((_6 as Some).0: usize); + _8 = copy ((_6 as Some).0: usize); StorageLive(_9); - _9 = _1; + _9 = copy _1; StorageLive(_10); - _10 = _2; + _10 = copy _2; StorageLive(_11); - _11 = _5; + _11 = copy _5; StorageLive(_12); StorageLive(_13); StorageLive(_14); - _14 = _8; + _14 = copy _8; - _13 = move _14 as u32 (IntToInt); -+ _13 = _8 as u32 (IntToInt); ++ _13 = copy _8 as u32 (IntToInt); StorageDead(_14); _12 = Add(move _13, const 1_u32); StorageDead(_13); StorageLive(_15); - _15 = _3; + _15 = copy _3; - _0 = float_to_exponential_common_exact::<T>(move _9, move _10, move _11, move _12, move _15) -> [return: bb5, unwind unreachable]; -+ _0 = float_to_exponential_common_exact::<T>(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind unreachable]; ++ _0 = float_to_exponential_common_exact::<T>(copy _1, copy _2, move _11, move _12, copy _3) -> [return: bb5, unwind unreachable]; } bb5: { @@ -108,15 +108,15 @@ bb6: { StorageLive(_16); - _16 = _1; + _16 = copy _1; StorageLive(_17); - _17 = _2; + _17 = copy _2; StorageLive(_18); - _18 = _5; + _18 = copy _5; StorageLive(_19); - _19 = _3; + _19 = copy _3; - _0 = float_to_exponential_common_shortest::<T>(move _16, move _17, move _18, move _19) -> [return: bb7, unwind unreachable]; -+ _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _18, _3) -> [return: bb7, unwind unreachable]; ++ _0 = float_to_exponential_common_shortest::<T>(copy _1, copy _2, move _18, copy _3) -> [return: bb7, unwind unreachable]; } bb7: { diff --git a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-unwind.diff b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-unwind.diff index 5e65700ee4a..42d99883749 100644 --- a/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-unwind.diff +++ b/tests/mir-opt/funky_arms.float_to_exponential_common.GVN.panic-unwind.diff @@ -42,13 +42,13 @@ StorageLive(_4); StorageLive(_20); StorageLive(_21); - _21 = ((*_1).0: u32); + _21 = copy ((*_1).0: u32); _20 = BitAnd(move _21, const 1_u32); StorageDead(_21); _4 = Ne(move _20, const 0_u32); StorageDead(_20); StorageLive(_5); - switchInt(_4) -> [0: bb2, otherwise: bb1]; + switchInt(copy _4) -> [0: bb2, otherwise: bb1]; } bb1: { @@ -65,7 +65,7 @@ bb3: { StorageLive(_6); - _6 = ((*_1).4: std::option::Option<usize>); + _6 = copy ((*_1).4: std::option::Option<usize>); _7 = discriminant(_6); switchInt(move _7) -> [1: bb4, 0: bb6, otherwise: bb9]; } @@ -73,26 +73,26 @@ bb4: { - StorageLive(_8); + nop; - _8 = ((_6 as Some).0: usize); + _8 = copy ((_6 as Some).0: usize); StorageLive(_9); - _9 = _1; + _9 = copy _1; StorageLive(_10); - _10 = _2; + _10 = copy _2; StorageLive(_11); - _11 = _5; + _11 = copy _5; StorageLive(_12); StorageLive(_13); StorageLive(_14); - _14 = _8; + _14 = copy _8; - _13 = move _14 as u32 (IntToInt); -+ _13 = _8 as u32 (IntToInt); ++ _13 = copy _8 as u32 (IntToInt); StorageDead(_14); _12 = Add(move _13, const 1_u32); StorageDead(_13); StorageLive(_15); - _15 = _3; + _15 = copy _3; - _0 = float_to_exponential_common_exact::<T>(move _9, move _10, move _11, move _12, move _15) -> [return: bb5, unwind continue]; -+ _0 = float_to_exponential_common_exact::<T>(_1, _2, move _11, move _12, _3) -> [return: bb5, unwind continue]; ++ _0 = float_to_exponential_common_exact::<T>(copy _1, copy _2, move _11, move _12, copy _3) -> [return: bb5, unwind continue]; } bb5: { @@ -108,15 +108,15 @@ bb6: { StorageLive(_16); - _16 = _1; + _16 = copy _1; StorageLive(_17); - _17 = _2; + _17 = copy _2; StorageLive(_18); - _18 = _5; + _18 = copy _5; StorageLive(_19); - _19 = _3; + _19 = copy _3; - _0 = float_to_exponential_common_shortest::<T>(move _16, move _17, move _18, move _19) -> [return: bb7, unwind continue]; -+ _0 = float_to_exponential_common_shortest::<T>(_1, _2, move _18, _3) -> [return: bb7, unwind continue]; ++ _0 = float_to_exponential_common_shortest::<T>(copy _1, copy _2, move _18, copy _3) -> [return: bb7, unwind continue]; } bb7: { diff --git a/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff index cb87d902015..f980645b1d0 100644 --- a/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-abort.diff @@ -82,12 +82,12 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; - _3 = Add(move _4, const 0_u64); -+ _3 = _1; ++ _3 = copy _1; StorageDead(_4); - _2 = opaque::<u64>(move _3) -> [return: bb1, unwind unreachable]; -+ _2 = opaque::<u64>(_1) -> [return: bb1, unwind unreachable]; ++ _2 = opaque::<u64>(copy _1) -> [return: bb1, unwind unreachable]; } bb1: { @@ -96,12 +96,12 @@ StorageLive(_5); StorageLive(_6); StorageLive(_7); - _7 = _1; + _7 = copy _1; - _6 = Sub(move _7, const 0_u64); -+ _6 = _1; ++ _6 = copy _1; StorageDead(_7); - _5 = opaque::<u64>(move _6) -> [return: bb2, unwind unreachable]; -+ _5 = opaque::<u64>(_1) -> [return: bb2, unwind unreachable]; ++ _5 = opaque::<u64>(copy _1) -> [return: bb2, unwind unreachable]; } bb2: { @@ -111,9 +111,9 @@ - StorageLive(_9); + nop; StorageLive(_10); - _10 = _1; + _10 = copy _1; StorageLive(_11); - _11 = _1; + _11 = copy _1; - _9 = Sub(move _10, move _11); + _9 = const 0_u64; StorageDead(_11); @@ -129,7 +129,7 @@ StorageLive(_12); StorageLive(_13); StorageLive(_14); - _14 = _1; + _14 = copy _1; - _13 = Mul(move _14, const 0_u64); + _13 = const 0_u64; StorageDead(_14); @@ -143,12 +143,12 @@ StorageLive(_15); StorageLive(_16); StorageLive(_17); - _17 = _1; + _17 = copy _1; - _16 = Mul(move _17, const 1_u64); -+ _16 = _1; ++ _16 = copy _1; StorageDead(_17); - _15 = opaque::<u64>(move _16) -> [return: bb5, unwind unreachable]; -+ _15 = opaque::<u64>(_1) -> [return: bb5, unwind unreachable]; ++ _15 = opaque::<u64>(copy _1) -> [return: bb5, unwind unreachable]; } bb5: { @@ -157,16 +157,16 @@ StorageLive(_18); StorageLive(_19); StorageLive(_20); - _20 = _1; + _20 = copy _1; - _21 = Eq(const 0_u64, const 0_u64); -- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb6, unwind unreachable]; +- assert(!move _21, "attempt to divide `{}` by zero", copy _20) -> [success: bb6, unwind unreachable]; + _21 = const true; -+ assert(!const true, "attempt to divide `{}` by zero", _1) -> [success: bb6, unwind unreachable]; ++ assert(!const true, "attempt to divide `{}` by zero", copy _1) -> [success: bb6, unwind unreachable]; } bb6: { - _19 = Div(move _20, const 0_u64); -+ _19 = Div(_1, const 0_u64); ++ _19 = Div(copy _1, const 0_u64); StorageDead(_20); _18 = opaque::<u64>(move _19) -> [return: bb7, unwind unreachable]; } @@ -177,19 +177,19 @@ StorageLive(_22); StorageLive(_23); StorageLive(_24); - _24 = _1; + _24 = copy _1; - _25 = Eq(const 1_u64, const 0_u64); -- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb8, unwind unreachable]; +- assert(!move _25, "attempt to divide `{}` by zero", copy _24) -> [success: bb8, unwind unreachable]; + _25 = const false; -+ assert(!const false, "attempt to divide `{}` by zero", _1) -> [success: bb8, unwind unreachable]; ++ assert(!const false, "attempt to divide `{}` by zero", copy _1) -> [success: bb8, unwind unreachable]; } bb8: { - _23 = Div(move _24, const 1_u64); -+ _23 = _1; ++ _23 = copy _1; StorageDead(_24); - _22 = opaque::<u64>(move _23) -> [return: bb9, unwind unreachable]; -+ _22 = opaque::<u64>(_1) -> [return: bb9, unwind unreachable]; ++ _22 = opaque::<u64>(copy _1) -> [return: bb9, unwind unreachable]; } bb9: { @@ -198,11 +198,11 @@ StorageLive(_26); StorageLive(_27); StorageLive(_28); - _28 = _1; -- _29 = Eq(_28, const 0_u64); + _28 = copy _1; +- _29 = Eq(copy _28, const 0_u64); - assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb10, unwind unreachable]; -+ _29 = Eq(_1, const 0_u64); -+ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb10, unwind unreachable]; ++ _29 = Eq(copy _1, const 0_u64); ++ assert(!copy _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb10, unwind unreachable]; } bb10: { @@ -219,16 +219,16 @@ StorageLive(_30); StorageLive(_31); StorageLive(_32); - _32 = _1; -- _33 = Eq(_32, const 0_u64); + _32 = copy _1; +- _33 = Eq(copy _32, const 0_u64); - assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb12, unwind unreachable]; -+ _33 = _29; -+ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb12, unwind unreachable]; ++ _33 = copy _29; ++ assert(!copy _29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb12, unwind unreachable]; } bb12: { - _31 = Div(const 1_u64, move _32); -+ _31 = Div(const 1_u64, _1); ++ _31 = Div(const 1_u64, copy _1); StorageDead(_32); _30 = opaque::<u64>(move _31) -> [return: bb13, unwind unreachable]; } @@ -239,16 +239,16 @@ StorageLive(_34); StorageLive(_35); StorageLive(_36); - _36 = _1; + _36 = copy _1; - _37 = Eq(const 0_u64, const 0_u64); -- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb14, unwind unreachable]; +- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _36) -> [success: bb14, unwind unreachable]; + _37 = const true; -+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb14, unwind unreachable]; ++ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _1) -> [success: bb14, unwind unreachable]; } bb14: { - _35 = Rem(move _36, const 0_u64); -+ _35 = Rem(_1, const 0_u64); ++ _35 = Rem(copy _1, const 0_u64); StorageDead(_36); _34 = opaque::<u64>(move _35) -> [return: bb15, unwind unreachable]; } @@ -259,11 +259,11 @@ StorageLive(_38); StorageLive(_39); StorageLive(_40); - _40 = _1; + _40 = copy _1; - _41 = Eq(const 1_u64, const 0_u64); -- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb16, unwind unreachable]; +- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _40) -> [success: bb16, unwind unreachable]; + _41 = const false; -+ assert(!const false, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb16, unwind unreachable]; ++ assert(!const false, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _1) -> [success: bb16, unwind unreachable]; } bb16: { @@ -280,11 +280,11 @@ StorageLive(_42); StorageLive(_43); StorageLive(_44); - _44 = _1; -- _45 = Eq(_44, const 0_u64); + _44 = copy _1; +- _45 = Eq(copy _44, const 0_u64); - assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb18, unwind unreachable]; -+ _45 = _29; -+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb18, unwind unreachable]; ++ _45 = copy _29; ++ assert(!copy _29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb18, unwind unreachable]; } bb18: { @@ -301,16 +301,16 @@ StorageLive(_46); StorageLive(_47); StorageLive(_48); - _48 = _1; -- _49 = Eq(_48, const 0_u64); + _48 = copy _1; +- _49 = Eq(copy _48, const 0_u64); - assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb20, unwind unreachable]; -+ _49 = _29; -+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb20, unwind unreachable]; ++ _49 = copy _29; ++ assert(!copy _29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb20, unwind unreachable]; } bb20: { - _47 = Rem(const 1_u64, move _48); -+ _47 = Rem(const 1_u64, _1); ++ _47 = Rem(const 1_u64, copy _1); StorageDead(_48); _46 = opaque::<u64>(move _47) -> [return: bb21, unwind unreachable]; } @@ -321,7 +321,7 @@ StorageLive(_50); StorageLive(_51); StorageLive(_52); - _52 = _1; + _52 = copy _1; - _51 = BitAnd(move _52, const 0_u64); + _51 = const 0_u64; StorageDead(_52); @@ -335,12 +335,12 @@ StorageLive(_53); StorageLive(_54); StorageLive(_55); - _55 = _1; + _55 = copy _1; - _54 = BitAnd(move _55, const core::num::<impl u64>::MAX); -+ _54 = _1; ++ _54 = copy _1; StorageDead(_55); - _53 = opaque::<u64>(move _54) -> [return: bb23, unwind unreachable]; -+ _53 = opaque::<u64>(_1) -> [return: bb23, unwind unreachable]; ++ _53 = opaque::<u64>(copy _1) -> [return: bb23, unwind unreachable]; } bb23: { @@ -349,12 +349,12 @@ StorageLive(_56); StorageLive(_57); StorageLive(_58); - _58 = _1; + _58 = copy _1; - _57 = BitOr(move _58, const 0_u64); -+ _57 = _1; ++ _57 = copy _1; StorageDead(_58); - _56 = opaque::<u64>(move _57) -> [return: bb24, unwind unreachable]; -+ _56 = opaque::<u64>(_1) -> [return: bb24, unwind unreachable]; ++ _56 = opaque::<u64>(copy _1) -> [return: bb24, unwind unreachable]; } bb24: { @@ -363,7 +363,7 @@ StorageLive(_59); StorageLive(_60); StorageLive(_61); - _61 = _1; + _61 = copy _1; - _60 = BitOr(move _61, const core::num::<impl u64>::MAX); + _60 = const u64::MAX; StorageDead(_61); @@ -377,12 +377,12 @@ StorageLive(_62); StorageLive(_63); StorageLive(_64); - _64 = _1; + _64 = copy _1; - _63 = BitXor(move _64, const 0_u64); -+ _63 = _1; ++ _63 = copy _1; StorageDead(_64); - _62 = opaque::<u64>(move _63) -> [return: bb26, unwind unreachable]; -+ _62 = opaque::<u64>(_1) -> [return: bb26, unwind unreachable]; ++ _62 = opaque::<u64>(copy _1) -> [return: bb26, unwind unreachable]; } bb26: { @@ -391,9 +391,9 @@ StorageLive(_65); StorageLive(_66); StorageLive(_67); - _67 = _1; + _67 = copy _1; StorageLive(_68); - _68 = _1; + _68 = copy _1; - _66 = BitXor(move _67, move _68); + _66 = const 0_u64; StorageDead(_68); @@ -408,12 +408,12 @@ StorageLive(_69); StorageLive(_70); StorageLive(_71); - _71 = _1; + _71 = copy _1; - _70 = Shr(move _71, const 0_i32); -+ _70 = _1; ++ _70 = copy _1; StorageDead(_71); - _69 = opaque::<u64>(move _70) -> [return: bb28, unwind unreachable]; -+ _69 = opaque::<u64>(_1) -> [return: bb28, unwind unreachable]; ++ _69 = opaque::<u64>(copy _1) -> [return: bb28, unwind unreachable]; } bb28: { @@ -422,12 +422,12 @@ StorageLive(_72); StorageLive(_73); StorageLive(_74); - _74 = _1; + _74 = copy _1; - _73 = Shl(move _74, const 0_i32); -+ _73 = _1; ++ _73 = copy _1; StorageDead(_74); - _72 = opaque::<u64>(move _73) -> [return: bb29, unwind unreachable]; -+ _72 = opaque::<u64>(_1) -> [return: bb29, unwind unreachable]; ++ _72 = opaque::<u64>(copy _1) -> [return: bb29, unwind unreachable]; } bb29: { diff --git a/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff index fa7536efc8e..b8e4967fe8b 100644 --- a/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.arithmetic.GVN.panic-unwind.diff @@ -82,12 +82,12 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; - _3 = Add(move _4, const 0_u64); -+ _3 = _1; ++ _3 = copy _1; StorageDead(_4); - _2 = opaque::<u64>(move _3) -> [return: bb1, unwind continue]; -+ _2 = opaque::<u64>(_1) -> [return: bb1, unwind continue]; ++ _2 = opaque::<u64>(copy _1) -> [return: bb1, unwind continue]; } bb1: { @@ -96,12 +96,12 @@ StorageLive(_5); StorageLive(_6); StorageLive(_7); - _7 = _1; + _7 = copy _1; - _6 = Sub(move _7, const 0_u64); -+ _6 = _1; ++ _6 = copy _1; StorageDead(_7); - _5 = opaque::<u64>(move _6) -> [return: bb2, unwind continue]; -+ _5 = opaque::<u64>(_1) -> [return: bb2, unwind continue]; ++ _5 = opaque::<u64>(copy _1) -> [return: bb2, unwind continue]; } bb2: { @@ -111,9 +111,9 @@ - StorageLive(_9); + nop; StorageLive(_10); - _10 = _1; + _10 = copy _1; StorageLive(_11); - _11 = _1; + _11 = copy _1; - _9 = Sub(move _10, move _11); + _9 = const 0_u64; StorageDead(_11); @@ -129,7 +129,7 @@ StorageLive(_12); StorageLive(_13); StorageLive(_14); - _14 = _1; + _14 = copy _1; - _13 = Mul(move _14, const 0_u64); + _13 = const 0_u64; StorageDead(_14); @@ -143,12 +143,12 @@ StorageLive(_15); StorageLive(_16); StorageLive(_17); - _17 = _1; + _17 = copy _1; - _16 = Mul(move _17, const 1_u64); -+ _16 = _1; ++ _16 = copy _1; StorageDead(_17); - _15 = opaque::<u64>(move _16) -> [return: bb5, unwind continue]; -+ _15 = opaque::<u64>(_1) -> [return: bb5, unwind continue]; ++ _15 = opaque::<u64>(copy _1) -> [return: bb5, unwind continue]; } bb5: { @@ -157,16 +157,16 @@ StorageLive(_18); StorageLive(_19); StorageLive(_20); - _20 = _1; + _20 = copy _1; - _21 = Eq(const 0_u64, const 0_u64); -- assert(!move _21, "attempt to divide `{}` by zero", _20) -> [success: bb6, unwind continue]; +- assert(!move _21, "attempt to divide `{}` by zero", copy _20) -> [success: bb6, unwind continue]; + _21 = const true; -+ assert(!const true, "attempt to divide `{}` by zero", _1) -> [success: bb6, unwind continue]; ++ assert(!const true, "attempt to divide `{}` by zero", copy _1) -> [success: bb6, unwind continue]; } bb6: { - _19 = Div(move _20, const 0_u64); -+ _19 = Div(_1, const 0_u64); ++ _19 = Div(copy _1, const 0_u64); StorageDead(_20); _18 = opaque::<u64>(move _19) -> [return: bb7, unwind continue]; } @@ -177,19 +177,19 @@ StorageLive(_22); StorageLive(_23); StorageLive(_24); - _24 = _1; + _24 = copy _1; - _25 = Eq(const 1_u64, const 0_u64); -- assert(!move _25, "attempt to divide `{}` by zero", _24) -> [success: bb8, unwind continue]; +- assert(!move _25, "attempt to divide `{}` by zero", copy _24) -> [success: bb8, unwind continue]; + _25 = const false; -+ assert(!const false, "attempt to divide `{}` by zero", _1) -> [success: bb8, unwind continue]; ++ assert(!const false, "attempt to divide `{}` by zero", copy _1) -> [success: bb8, unwind continue]; } bb8: { - _23 = Div(move _24, const 1_u64); -+ _23 = _1; ++ _23 = copy _1; StorageDead(_24); - _22 = opaque::<u64>(move _23) -> [return: bb9, unwind continue]; -+ _22 = opaque::<u64>(_1) -> [return: bb9, unwind continue]; ++ _22 = opaque::<u64>(copy _1) -> [return: bb9, unwind continue]; } bb9: { @@ -198,11 +198,11 @@ StorageLive(_26); StorageLive(_27); StorageLive(_28); - _28 = _1; -- _29 = Eq(_28, const 0_u64); + _28 = copy _1; +- _29 = Eq(copy _28, const 0_u64); - assert(!move _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb10, unwind continue]; -+ _29 = Eq(_1, const 0_u64); -+ assert(!_29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb10, unwind continue]; ++ _29 = Eq(copy _1, const 0_u64); ++ assert(!copy _29, "attempt to divide `{}` by zero", const 0_u64) -> [success: bb10, unwind continue]; } bb10: { @@ -219,16 +219,16 @@ StorageLive(_30); StorageLive(_31); StorageLive(_32); - _32 = _1; -- _33 = Eq(_32, const 0_u64); + _32 = copy _1; +- _33 = Eq(copy _32, const 0_u64); - assert(!move _33, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb12, unwind continue]; -+ _33 = _29; -+ assert(!_29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb12, unwind continue]; ++ _33 = copy _29; ++ assert(!copy _29, "attempt to divide `{}` by zero", const 1_u64) -> [success: bb12, unwind continue]; } bb12: { - _31 = Div(const 1_u64, move _32); -+ _31 = Div(const 1_u64, _1); ++ _31 = Div(const 1_u64, copy _1); StorageDead(_32); _30 = opaque::<u64>(move _31) -> [return: bb13, unwind continue]; } @@ -239,16 +239,16 @@ StorageLive(_34); StorageLive(_35); StorageLive(_36); - _36 = _1; + _36 = copy _1; - _37 = Eq(const 0_u64, const 0_u64); -- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", _36) -> [success: bb14, unwind continue]; +- assert(!move _37, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _36) -> [success: bb14, unwind continue]; + _37 = const true; -+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb14, unwind continue]; ++ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _1) -> [success: bb14, unwind continue]; } bb14: { - _35 = Rem(move _36, const 0_u64); -+ _35 = Rem(_1, const 0_u64); ++ _35 = Rem(copy _1, const 0_u64); StorageDead(_36); _34 = opaque::<u64>(move _35) -> [return: bb15, unwind continue]; } @@ -259,11 +259,11 @@ StorageLive(_38); StorageLive(_39); StorageLive(_40); - _40 = _1; + _40 = copy _1; - _41 = Eq(const 1_u64, const 0_u64); -- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", _40) -> [success: bb16, unwind continue]; +- assert(!move _41, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _40) -> [success: bb16, unwind continue]; + _41 = const false; -+ assert(!const false, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb16, unwind continue]; ++ assert(!const false, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _1) -> [success: bb16, unwind continue]; } bb16: { @@ -280,11 +280,11 @@ StorageLive(_42); StorageLive(_43); StorageLive(_44); - _44 = _1; -- _45 = Eq(_44, const 0_u64); + _44 = copy _1; +- _45 = Eq(copy _44, const 0_u64); - assert(!move _45, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb18, unwind continue]; -+ _45 = _29; -+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb18, unwind continue]; ++ _45 = copy _29; ++ assert(!copy _29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 0_u64) -> [success: bb18, unwind continue]; } bb18: { @@ -301,16 +301,16 @@ StorageLive(_46); StorageLive(_47); StorageLive(_48); - _48 = _1; -- _49 = Eq(_48, const 0_u64); + _48 = copy _1; +- _49 = Eq(copy _48, const 0_u64); - assert(!move _49, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb20, unwind continue]; -+ _49 = _29; -+ assert(!_29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb20, unwind continue]; ++ _49 = copy _29; ++ assert(!copy _29, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_u64) -> [success: bb20, unwind continue]; } bb20: { - _47 = Rem(const 1_u64, move _48); -+ _47 = Rem(const 1_u64, _1); ++ _47 = Rem(const 1_u64, copy _1); StorageDead(_48); _46 = opaque::<u64>(move _47) -> [return: bb21, unwind continue]; } @@ -321,7 +321,7 @@ StorageLive(_50); StorageLive(_51); StorageLive(_52); - _52 = _1; + _52 = copy _1; - _51 = BitAnd(move _52, const 0_u64); + _51 = const 0_u64; StorageDead(_52); @@ -335,12 +335,12 @@ StorageLive(_53); StorageLive(_54); StorageLive(_55); - _55 = _1; + _55 = copy _1; - _54 = BitAnd(move _55, const core::num::<impl u64>::MAX); -+ _54 = _1; ++ _54 = copy _1; StorageDead(_55); - _53 = opaque::<u64>(move _54) -> [return: bb23, unwind continue]; -+ _53 = opaque::<u64>(_1) -> [return: bb23, unwind continue]; ++ _53 = opaque::<u64>(copy _1) -> [return: bb23, unwind continue]; } bb23: { @@ -349,12 +349,12 @@ StorageLive(_56); StorageLive(_57); StorageLive(_58); - _58 = _1; + _58 = copy _1; - _57 = BitOr(move _58, const 0_u64); -+ _57 = _1; ++ _57 = copy _1; StorageDead(_58); - _56 = opaque::<u64>(move _57) -> [return: bb24, unwind continue]; -+ _56 = opaque::<u64>(_1) -> [return: bb24, unwind continue]; ++ _56 = opaque::<u64>(copy _1) -> [return: bb24, unwind continue]; } bb24: { @@ -363,7 +363,7 @@ StorageLive(_59); StorageLive(_60); StorageLive(_61); - _61 = _1; + _61 = copy _1; - _60 = BitOr(move _61, const core::num::<impl u64>::MAX); + _60 = const u64::MAX; StorageDead(_61); @@ -377,12 +377,12 @@ StorageLive(_62); StorageLive(_63); StorageLive(_64); - _64 = _1; + _64 = copy _1; - _63 = BitXor(move _64, const 0_u64); -+ _63 = _1; ++ _63 = copy _1; StorageDead(_64); - _62 = opaque::<u64>(move _63) -> [return: bb26, unwind continue]; -+ _62 = opaque::<u64>(_1) -> [return: bb26, unwind continue]; ++ _62 = opaque::<u64>(copy _1) -> [return: bb26, unwind continue]; } bb26: { @@ -391,9 +391,9 @@ StorageLive(_65); StorageLive(_66); StorageLive(_67); - _67 = _1; + _67 = copy _1; StorageLive(_68); - _68 = _1; + _68 = copy _1; - _66 = BitXor(move _67, move _68); + _66 = const 0_u64; StorageDead(_68); @@ -408,12 +408,12 @@ StorageLive(_69); StorageLive(_70); StorageLive(_71); - _71 = _1; + _71 = copy _1; - _70 = Shr(move _71, const 0_i32); -+ _70 = _1; ++ _70 = copy _1; StorageDead(_71); - _69 = opaque::<u64>(move _70) -> [return: bb28, unwind continue]; -+ _69 = opaque::<u64>(_1) -> [return: bb28, unwind continue]; ++ _69 = opaque::<u64>(copy _1) -> [return: bb28, unwind continue]; } bb28: { @@ -422,12 +422,12 @@ StorageLive(_72); StorageLive(_73); StorageLive(_74); - _74 = _1; + _74 = copy _1; - _73 = Shl(move _74, const 0_i32); -+ _73 = _1; ++ _73 = copy _1; StorageDead(_74); - _72 = opaque::<u64>(move _73) -> [return: bb29, unwind continue]; -+ _72 = opaque::<u64>(_1) -> [return: bb29, unwind continue]; ++ _72 = opaque::<u64>(copy _1) -> [return: bb29, unwind continue]; } bb29: { diff --git a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff index 0e3f2459fae..acf8bfc71be 100644 --- a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-abort.diff @@ -30,19 +30,19 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; -- _5 = AddWithOverflow(_4, const 0_u64); + _4 = copy _1; +- _5 = AddWithOverflow(copy _4, const 0_u64); - assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind unreachable]; -+ _5 = AddWithOverflow(_1, const 0_u64); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", _1, const 0_u64) -> [success: bb1, unwind unreachable]; ++ _5 = AddWithOverflow(copy _1, const 0_u64); ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", copy _1, const 0_u64) -> [success: bb1, unwind unreachable]; } bb1: { - _3 = move (_5.0: u64); -+ _3 = _1; ++ _3 = copy _1; StorageDead(_4); - _2 = opaque::<u64>(move _3) -> [return: bb2, unwind unreachable]; -+ _2 = opaque::<u64>(_1) -> [return: bb2, unwind unreachable]; ++ _2 = opaque::<u64>(copy _1) -> [return: bb2, unwind unreachable]; } bb2: { @@ -51,19 +51,19 @@ StorageLive(_6); StorageLive(_7); StorageLive(_8); - _8 = _1; -- _9 = SubWithOverflow(_8, const 0_u64); + _8 = copy _1; +- _9 = SubWithOverflow(copy _8, const 0_u64); - assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind unreachable]; -+ _9 = _5; -+ assert(!const false, "attempt to compute `{} - {}`, which would overflow", _1, const 0_u64) -> [success: bb3, unwind unreachable]; ++ _9 = copy _5; ++ assert(!const false, "attempt to compute `{} - {}`, which would overflow", copy _1, const 0_u64) -> [success: bb3, unwind unreachable]; } bb3: { - _7 = move (_9.0: u64); -+ _7 = _1; ++ _7 = copy _1; StorageDead(_8); - _6 = opaque::<u64>(move _7) -> [return: bb4, unwind unreachable]; -+ _6 = opaque::<u64>(_1) -> [return: bb4, unwind unreachable]; ++ _6 = opaque::<u64>(copy _1) -> [return: bb4, unwind unreachable]; } bb4: { @@ -73,13 +73,13 @@ - StorageLive(_11); + nop; StorageLive(_12); - _12 = _1; + _12 = copy _1; StorageLive(_13); - _13 = _1; -- _14 = SubWithOverflow(_12, _13); + _13 = copy _1; +- _14 = SubWithOverflow(copy _12, copy _13); - assert(!move (_14.1: bool), "attempt to compute `{} - {}`, which would overflow", move _12, move _13) -> [success: bb5, unwind unreachable]; + _14 = const (0_u64, false); -+ assert(!const false, "attempt to compute `{} - {}`, which would overflow", _1, _1) -> [success: bb5, unwind unreachable]; ++ assert(!const false, "attempt to compute `{} - {}`, which would overflow", copy _1, copy _1) -> [success: bb5, unwind unreachable]; } bb5: { @@ -98,11 +98,11 @@ StorageLive(_15); StorageLive(_16); StorageLive(_17); - _17 = _1; -- _18 = MulWithOverflow(_17, const 0_u64); + _17 = copy _1; +- _18 = MulWithOverflow(copy _17, const 0_u64); - assert(!move (_18.1: bool), "attempt to compute `{} * {}`, which would overflow", move _17, const 0_u64) -> [success: bb7, unwind unreachable]; + _18 = const (0_u64, false); -+ assert(!const false, "attempt to compute `{} * {}`, which would overflow", _1, const 0_u64) -> [success: bb7, unwind unreachable]; ++ assert(!const false, "attempt to compute `{} * {}`, which would overflow", copy _1, const 0_u64) -> [success: bb7, unwind unreachable]; } bb7: { @@ -119,19 +119,19 @@ StorageLive(_19); StorageLive(_20); StorageLive(_21); - _21 = _1; -- _22 = MulWithOverflow(_21, const 1_u64); + _21 = copy _1; +- _22 = MulWithOverflow(copy _21, const 1_u64); - assert(!move (_22.1: bool), "attempt to compute `{} * {}`, which would overflow", move _21, const 1_u64) -> [success: bb9, unwind unreachable]; -+ _22 = _5; -+ assert(!const false, "attempt to compute `{} * {}`, which would overflow", _1, const 1_u64) -> [success: bb9, unwind unreachable]; ++ _22 = copy _5; ++ assert(!const false, "attempt to compute `{} * {}`, which would overflow", copy _1, const 1_u64) -> [success: bb9, unwind unreachable]; } bb9: { - _20 = move (_22.0: u64); -+ _20 = _1; ++ _20 = copy _1; StorageDead(_21); - _19 = opaque::<u64>(move _20) -> [return: bb10, unwind unreachable]; -+ _19 = opaque::<u64>(_1) -> [return: bb10, unwind unreachable]; ++ _19 = opaque::<u64>(copy _1) -> [return: bb10, unwind unreachable]; } bb10: { diff --git a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff index 2873d7ef0ab..f3f6b381a81 100644 --- a/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.arithmetic_checked.GVN.panic-unwind.diff @@ -30,19 +30,19 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; -- _5 = AddWithOverflow(_4, const 0_u64); + _4 = copy _1; +- _5 = AddWithOverflow(copy _4, const 0_u64); - assert(!move (_5.1: bool), "attempt to compute `{} + {}`, which would overflow", move _4, const 0_u64) -> [success: bb1, unwind continue]; -+ _5 = AddWithOverflow(_1, const 0_u64); -+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", _1, const 0_u64) -> [success: bb1, unwind continue]; ++ _5 = AddWithOverflow(copy _1, const 0_u64); ++ assert(!const false, "attempt to compute `{} + {}`, which would overflow", copy _1, const 0_u64) -> [success: bb1, unwind continue]; } bb1: { - _3 = move (_5.0: u64); -+ _3 = _1; ++ _3 = copy _1; StorageDead(_4); - _2 = opaque::<u64>(move _3) -> [return: bb2, unwind continue]; -+ _2 = opaque::<u64>(_1) -> [return: bb2, unwind continue]; ++ _2 = opaque::<u64>(copy _1) -> [return: bb2, unwind continue]; } bb2: { @@ -51,19 +51,19 @@ StorageLive(_6); StorageLive(_7); StorageLive(_8); - _8 = _1; -- _9 = SubWithOverflow(_8, const 0_u64); + _8 = copy _1; +- _9 = SubWithOverflow(copy _8, const 0_u64); - assert(!move (_9.1: bool), "attempt to compute `{} - {}`, which would overflow", move _8, const 0_u64) -> [success: bb3, unwind continue]; -+ _9 = _5; -+ assert(!const false, "attempt to compute `{} - {}`, which would overflow", _1, const 0_u64) -> [success: bb3, unwind continue]; ++ _9 = copy _5; ++ assert(!const false, "attempt to compute `{} - {}`, which would overflow", copy _1, const 0_u64) -> [success: bb3, unwind continue]; } bb3: { - _7 = move (_9.0: u64); -+ _7 = _1; ++ _7 = copy _1; StorageDead(_8); - _6 = opaque::<u64>(move _7) -> [return: bb4, unwind continue]; -+ _6 = opaque::<u64>(_1) -> [return: bb4, unwind continue]; ++ _6 = opaque::<u64>(copy _1) -> [return: bb4, unwind continue]; } bb4: { @@ -73,13 +73,13 @@ - StorageLive(_11); + nop; StorageLive(_12); - _12 = _1; + _12 = copy _1; StorageLive(_13); - _13 = _1; -- _14 = SubWithOverflow(_12, _13); + _13 = copy _1; +- _14 = SubWithOverflow(copy _12, copy _13); - assert(!move (_14.1: bool), "attempt to compute `{} - {}`, which would overflow", move _12, move _13) -> [success: bb5, unwind continue]; + _14 = const (0_u64, false); -+ assert(!const false, "attempt to compute `{} - {}`, which would overflow", _1, _1) -> [success: bb5, unwind continue]; ++ assert(!const false, "attempt to compute `{} - {}`, which would overflow", copy _1, copy _1) -> [success: bb5, unwind continue]; } bb5: { @@ -98,11 +98,11 @@ StorageLive(_15); StorageLive(_16); StorageLive(_17); - _17 = _1; -- _18 = MulWithOverflow(_17, const 0_u64); + _17 = copy _1; +- _18 = MulWithOverflow(copy _17, const 0_u64); - assert(!move (_18.1: bool), "attempt to compute `{} * {}`, which would overflow", move _17, const 0_u64) -> [success: bb7, unwind continue]; + _18 = const (0_u64, false); -+ assert(!const false, "attempt to compute `{} * {}`, which would overflow", _1, const 0_u64) -> [success: bb7, unwind continue]; ++ assert(!const false, "attempt to compute `{} * {}`, which would overflow", copy _1, const 0_u64) -> [success: bb7, unwind continue]; } bb7: { @@ -119,19 +119,19 @@ StorageLive(_19); StorageLive(_20); StorageLive(_21); - _21 = _1; -- _22 = MulWithOverflow(_21, const 1_u64); + _21 = copy _1; +- _22 = MulWithOverflow(copy _21, const 1_u64); - assert(!move (_22.1: bool), "attempt to compute `{} * {}`, which would overflow", move _21, const 1_u64) -> [success: bb9, unwind continue]; -+ _22 = _5; -+ assert(!const false, "attempt to compute `{} * {}`, which would overflow", _1, const 1_u64) -> [success: bb9, unwind continue]; ++ _22 = copy _5; ++ assert(!const false, "attempt to compute `{} * {}`, which would overflow", copy _1, const 1_u64) -> [success: bb9, unwind continue]; } bb9: { - _20 = move (_22.0: u64); -+ _20 = _1; ++ _20 = copy _1; StorageDead(_21); - _19 = opaque::<u64>(move _20) -> [return: bb10, unwind continue]; -+ _19 = opaque::<u64>(_1) -> [return: bb10, unwind continue]; ++ _19 = opaque::<u64>(copy _1) -> [return: bb10, unwind continue]; } bb10: { diff --git a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff index b332100eaf0..31a85468126 100644 --- a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-abort.diff @@ -38,9 +38,9 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; - _3 = Add(move _4, const 0f64); -+ _3 = Add(_1, const 0f64); ++ _3 = Add(copy _1, const 0f64); StorageDead(_4); _2 = opaque::<f64>(move _3) -> [return: bb1, unwind unreachable]; } @@ -51,9 +51,9 @@ StorageLive(_5); StorageLive(_6); StorageLive(_7); - _7 = _1; + _7 = copy _1; - _6 = Sub(move _7, const 0f64); -+ _6 = Sub(_1, const 0f64); ++ _6 = Sub(copy _1, const 0f64); StorageDead(_7); _5 = opaque::<f64>(move _6) -> [return: bb2, unwind unreachable]; } @@ -64,9 +64,9 @@ StorageLive(_8); StorageLive(_9); StorageLive(_10); - _10 = _1; + _10 = copy _1; - _9 = Mul(move _10, const 0f64); -+ _9 = Mul(_1, const 0f64); ++ _9 = Mul(copy _1, const 0f64); StorageDead(_10); _8 = opaque::<f64>(move _9) -> [return: bb3, unwind unreachable]; } @@ -77,9 +77,9 @@ StorageLive(_11); StorageLive(_12); StorageLive(_13); - _13 = _1; + _13 = copy _1; - _12 = Div(move _13, const 0f64); -+ _12 = Div(_1, const 0f64); ++ _12 = Div(copy _1, const 0f64); StorageDead(_13); _11 = opaque::<f64>(move _12) -> [return: bb4, unwind unreachable]; } @@ -90,9 +90,9 @@ StorageLive(_14); StorageLive(_15); StorageLive(_16); - _16 = _1; + _16 = copy _1; - _15 = Div(const 0f64, move _16); -+ _15 = Div(const 0f64, _1); ++ _15 = Div(const 0f64, copy _1); StorageDead(_16); _14 = opaque::<f64>(move _15) -> [return: bb5, unwind unreachable]; } @@ -103,9 +103,9 @@ StorageLive(_17); StorageLive(_18); StorageLive(_19); - _19 = _1; + _19 = copy _1; - _18 = Rem(move _19, const 0f64); -+ _18 = Rem(_1, const 0f64); ++ _18 = Rem(copy _1, const 0f64); StorageDead(_19); _17 = opaque::<f64>(move _18) -> [return: bb6, unwind unreachable]; } @@ -116,9 +116,9 @@ StorageLive(_20); StorageLive(_21); StorageLive(_22); - _22 = _1; + _22 = copy _1; - _21 = Rem(const 0f64, move _22); -+ _21 = Rem(const 0f64, _1); ++ _21 = Rem(const 0f64, copy _1); StorageDead(_22); _20 = opaque::<f64>(move _21) -> [return: bb7, unwind unreachable]; } @@ -129,11 +129,11 @@ StorageLive(_23); StorageLive(_24); StorageLive(_25); - _25 = _1; + _25 = copy _1; StorageLive(_26); - _26 = _1; + _26 = copy _1; - _24 = Eq(move _25, move _26); -+ _24 = Eq(_1, _1); ++ _24 = Eq(copy _1, copy _1); StorageDead(_26); StorageDead(_25); _23 = opaque::<bool>(move _24) -> [return: bb8, unwind unreachable]; @@ -145,11 +145,11 @@ StorageLive(_27); StorageLive(_28); StorageLive(_29); - _29 = _1; + _29 = copy _1; StorageLive(_30); - _30 = _1; + _30 = copy _1; - _28 = Ne(move _29, move _30); -+ _28 = Ne(_1, _1); ++ _28 = Ne(copy _1, copy _1); StorageDead(_30); StorageDead(_29); _27 = opaque::<bool>(move _28) -> [return: bb9, unwind unreachable]; diff --git a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff index 28664cb0ac8..4e42b1af4fc 100644 --- a/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.arithmetic_float.GVN.panic-unwind.diff @@ -38,9 +38,9 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; - _3 = Add(move _4, const 0f64); -+ _3 = Add(_1, const 0f64); ++ _3 = Add(copy _1, const 0f64); StorageDead(_4); _2 = opaque::<f64>(move _3) -> [return: bb1, unwind continue]; } @@ -51,9 +51,9 @@ StorageLive(_5); StorageLive(_6); StorageLive(_7); - _7 = _1; + _7 = copy _1; - _6 = Sub(move _7, const 0f64); -+ _6 = Sub(_1, const 0f64); ++ _6 = Sub(copy _1, const 0f64); StorageDead(_7); _5 = opaque::<f64>(move _6) -> [return: bb2, unwind continue]; } @@ -64,9 +64,9 @@ StorageLive(_8); StorageLive(_9); StorageLive(_10); - _10 = _1; + _10 = copy _1; - _9 = Mul(move _10, const 0f64); -+ _9 = Mul(_1, const 0f64); ++ _9 = Mul(copy _1, const 0f64); StorageDead(_10); _8 = opaque::<f64>(move _9) -> [return: bb3, unwind continue]; } @@ -77,9 +77,9 @@ StorageLive(_11); StorageLive(_12); StorageLive(_13); - _13 = _1; + _13 = copy _1; - _12 = Div(move _13, const 0f64); -+ _12 = Div(_1, const 0f64); ++ _12 = Div(copy _1, const 0f64); StorageDead(_13); _11 = opaque::<f64>(move _12) -> [return: bb4, unwind continue]; } @@ -90,9 +90,9 @@ StorageLive(_14); StorageLive(_15); StorageLive(_16); - _16 = _1; + _16 = copy _1; - _15 = Div(const 0f64, move _16); -+ _15 = Div(const 0f64, _1); ++ _15 = Div(const 0f64, copy _1); StorageDead(_16); _14 = opaque::<f64>(move _15) -> [return: bb5, unwind continue]; } @@ -103,9 +103,9 @@ StorageLive(_17); StorageLive(_18); StorageLive(_19); - _19 = _1; + _19 = copy _1; - _18 = Rem(move _19, const 0f64); -+ _18 = Rem(_1, const 0f64); ++ _18 = Rem(copy _1, const 0f64); StorageDead(_19); _17 = opaque::<f64>(move _18) -> [return: bb6, unwind continue]; } @@ -116,9 +116,9 @@ StorageLive(_20); StorageLive(_21); StorageLive(_22); - _22 = _1; + _22 = copy _1; - _21 = Rem(const 0f64, move _22); -+ _21 = Rem(const 0f64, _1); ++ _21 = Rem(const 0f64, copy _1); StorageDead(_22); _20 = opaque::<f64>(move _21) -> [return: bb7, unwind continue]; } @@ -129,11 +129,11 @@ StorageLive(_23); StorageLive(_24); StorageLive(_25); - _25 = _1; + _25 = copy _1; StorageLive(_26); - _26 = _1; + _26 = copy _1; - _24 = Eq(move _25, move _26); -+ _24 = Eq(_1, _1); ++ _24 = Eq(copy _1, copy _1); StorageDead(_26); StorageDead(_25); _23 = opaque::<bool>(move _24) -> [return: bb8, unwind continue]; @@ -145,11 +145,11 @@ StorageLive(_27); StorageLive(_28); StorageLive(_29); - _29 = _1; + _29 = copy _1; StorageLive(_30); - _30 = _1; + _30 = copy _1; - _28 = Ne(move _29, move _30); -+ _28 = Ne(_1, _1); ++ _28 = Ne(copy _1, copy _1); StorageDead(_30); StorageDead(_29); _27 = opaque::<bool>(move _28) -> [return: bb9, unwind continue]; diff --git a/tests/mir-opt/gvn.borrowed.GVN.panic-abort.diff b/tests/mir-opt/gvn.borrowed.GVN.panic-abort.diff index 9520bd382ee..b0702696e18 100644 --- a/tests/mir-opt/gvn.borrowed.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.borrowed.GVN.panic-abort.diff @@ -7,19 +7,19 @@ let mut _3: &T; bb0: { - _2 = _1; + _2 = copy _1; _3 = &_1; - _0 = opaque::<&T>(_3) -> [return: bb1, unwind unreachable]; + _0 = opaque::<&T>(copy _3) -> [return: bb1, unwind unreachable]; } bb1: { -- _0 = opaque::<T>(_2) -> [return: bb2, unwind unreachable]; -+ _0 = opaque::<T>(_1) -> [return: bb2, unwind unreachable]; +- _0 = opaque::<T>(copy _2) -> [return: bb2, unwind unreachable]; ++ _0 = opaque::<T>(copy _1) -> [return: bb2, unwind unreachable]; } bb2: { -- _0 = opaque::<T>((*_3)) -> [return: bb3, unwind unreachable]; -+ _0 = opaque::<T>(_1) -> [return: bb3, unwind unreachable]; +- _0 = opaque::<T>(copy (*_3)) -> [return: bb3, unwind unreachable]; ++ _0 = opaque::<T>(copy _1) -> [return: bb3, unwind unreachable]; } bb3: { diff --git a/tests/mir-opt/gvn.borrowed.GVN.panic-unwind.diff b/tests/mir-opt/gvn.borrowed.GVN.panic-unwind.diff index 4f5d76d5644..fe05d4deeed 100644 --- a/tests/mir-opt/gvn.borrowed.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.borrowed.GVN.panic-unwind.diff @@ -7,19 +7,19 @@ let mut _3: &T; bb0: { - _2 = _1; + _2 = copy _1; _3 = &_1; - _0 = opaque::<&T>(_3) -> [return: bb1, unwind continue]; + _0 = opaque::<&T>(copy _3) -> [return: bb1, unwind continue]; } bb1: { -- _0 = opaque::<T>(_2) -> [return: bb2, unwind continue]; -+ _0 = opaque::<T>(_1) -> [return: bb2, unwind continue]; +- _0 = opaque::<T>(copy _2) -> [return: bb2, unwind continue]; ++ _0 = opaque::<T>(copy _1) -> [return: bb2, unwind continue]; } bb2: { -- _0 = opaque::<T>((*_3)) -> [return: bb3, unwind continue]; -+ _0 = opaque::<T>(_1) -> [return: bb3, unwind continue]; +- _0 = opaque::<T>(copy (*_3)) -> [return: bb3, unwind continue]; ++ _0 = opaque::<T>(copy _1) -> [return: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff index d43198c9911..1d523d22ca6 100644 --- a/tests/mir-opt/gvn.cast.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.cast.GVN.panic-abort.diff @@ -116,7 +116,7 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); -- _6 = _1; +- _6 = copy _1; - _5 = move _6 as u8 (IntToInt); + _6 = const 1_i64; + _5 = const 1_u8; @@ -131,7 +131,7 @@ StorageLive(_7); StorageLive(_8); StorageLive(_9); -- _9 = _1; +- _9 = copy _1; - _8 = move _9 as u16 (IntToInt); + _9 = const 1_i64; + _8 = const 1_u16; @@ -146,7 +146,7 @@ StorageLive(_10); StorageLive(_11); StorageLive(_12); -- _12 = _1; +- _12 = copy _1; - _11 = move _12 as u32 (IntToInt); + _12 = const 1_i64; + _11 = const 1_u32; @@ -161,7 +161,7 @@ StorageLive(_13); StorageLive(_14); StorageLive(_15); -- _15 = _1; +- _15 = copy _1; - _14 = move _15 as u64 (IntToInt); + _15 = const 1_i64; + _14 = const 1_u64; @@ -176,7 +176,7 @@ StorageLive(_16); StorageLive(_17); StorageLive(_18); -- _18 = _1; +- _18 = copy _1; - _17 = move _18 as i8 (IntToInt); + _18 = const 1_i64; + _17 = const 1_i8; @@ -191,7 +191,7 @@ StorageLive(_19); StorageLive(_20); StorageLive(_21); -- _21 = _1; +- _21 = copy _1; - _20 = move _21 as i16 (IntToInt); + _21 = const 1_i64; + _20 = const 1_i16; @@ -206,7 +206,7 @@ StorageLive(_22); StorageLive(_23); StorageLive(_24); -- _24 = _1; +- _24 = copy _1; - _23 = move _24 as i32 (IntToInt); + _24 = const 1_i64; + _23 = const 1_i32; @@ -220,7 +220,7 @@ StorageDead(_22); StorageLive(_25); StorageLive(_26); -- _26 = _1; +- _26 = copy _1; - _25 = opaque::<i64>(move _26) -> [return: bb8, unwind unreachable]; + _26 = const 1_i64; + _25 = opaque::<i64>(const 1_i64) -> [return: bb8, unwind unreachable]; @@ -232,7 +232,7 @@ StorageLive(_27); StorageLive(_28); StorageLive(_29); -- _29 = _1; +- _29 = copy _1; - _28 = move _29 as f32 (IntToFloat); + _29 = const 1_i64; + _28 = const 1f32; @@ -247,7 +247,7 @@ StorageLive(_30); StorageLive(_31); StorageLive(_32); -- _32 = _1; +- _32 = copy _1; - _31 = move _32 as f64 (IntToFloat); + _32 = const 1_i64; + _31 = const 1f64; @@ -262,7 +262,7 @@ StorageLive(_33); StorageLive(_34); StorageLive(_35); -- _35 = _2; +- _35 = copy _2; - _34 = move _35 as u8 (IntToInt); + _35 = const 1_u64; + _34 = const 1_u8; @@ -277,7 +277,7 @@ StorageLive(_36); StorageLive(_37); StorageLive(_38); -- _38 = _2; +- _38 = copy _2; - _37 = move _38 as u16 (IntToInt); + _38 = const 1_u64; + _37 = const 1_u16; @@ -292,7 +292,7 @@ StorageLive(_39); StorageLive(_40); StorageLive(_41); -- _41 = _2; +- _41 = copy _2; - _40 = move _41 as u32 (IntToInt); + _41 = const 1_u64; + _40 = const 1_u32; @@ -306,7 +306,7 @@ StorageDead(_39); StorageLive(_42); StorageLive(_43); -- _43 = _2; +- _43 = copy _2; - _42 = opaque::<u64>(move _43) -> [return: bb14, unwind unreachable]; + _43 = const 1_u64; + _42 = opaque::<u64>(const 1_u64) -> [return: bb14, unwind unreachable]; @@ -318,7 +318,7 @@ StorageLive(_44); StorageLive(_45); StorageLive(_46); -- _46 = _2; +- _46 = copy _2; - _45 = move _46 as i8 (IntToInt); + _46 = const 1_u64; + _45 = const 1_i8; @@ -333,7 +333,7 @@ StorageLive(_47); StorageLive(_48); StorageLive(_49); -- _49 = _2; +- _49 = copy _2; - _48 = move _49 as i16 (IntToInt); + _49 = const 1_u64; + _48 = const 1_i16; @@ -348,7 +348,7 @@ StorageLive(_50); StorageLive(_51); StorageLive(_52); -- _52 = _2; +- _52 = copy _2; - _51 = move _52 as i32 (IntToInt); + _52 = const 1_u64; + _51 = const 1_i32; @@ -363,7 +363,7 @@ StorageLive(_53); StorageLive(_54); StorageLive(_55); -- _55 = _2; +- _55 = copy _2; - _54 = move _55 as i64 (IntToInt); + _55 = const 1_u64; + _54 = const 1_i64; @@ -378,7 +378,7 @@ StorageLive(_56); StorageLive(_57); StorageLive(_58); -- _58 = _2; +- _58 = copy _2; - _57 = move _58 as f32 (IntToFloat); + _58 = const 1_u64; + _57 = const 1f32; @@ -393,7 +393,7 @@ StorageLive(_59); StorageLive(_60); StorageLive(_61); -- _61 = _2; +- _61 = copy _2; - _60 = move _61 as f64 (IntToFloat); + _61 = const 1_u64; + _60 = const 1f64; @@ -408,7 +408,7 @@ StorageLive(_62); StorageLive(_63); StorageLive(_64); -- _64 = _3; +- _64 = copy _3; - _63 = move _64 as u8 (FloatToInt); + _64 = const 1f64; + _63 = const 1_u8; @@ -423,7 +423,7 @@ StorageLive(_65); StorageLive(_66); StorageLive(_67); -- _67 = _3; +- _67 = copy _3; - _66 = move _67 as u16 (FloatToInt); + _67 = const 1f64; + _66 = const 1_u16; @@ -438,7 +438,7 @@ StorageLive(_68); StorageLive(_69); StorageLive(_70); -- _70 = _3; +- _70 = copy _3; - _69 = move _70 as u32 (FloatToInt); + _70 = const 1f64; + _69 = const 1_u32; @@ -453,7 +453,7 @@ StorageLive(_71); StorageLive(_72); StorageLive(_73); -- _73 = _3; +- _73 = copy _3; - _72 = move _73 as u64 (FloatToInt); + _73 = const 1f64; + _72 = const 1_u64; @@ -468,7 +468,7 @@ StorageLive(_74); StorageLive(_75); StorageLive(_76); -- _76 = _3; +- _76 = copy _3; - _75 = move _76 as i8 (FloatToInt); + _76 = const 1f64; + _75 = const 1_i8; @@ -483,7 +483,7 @@ StorageLive(_77); StorageLive(_78); StorageLive(_79); -- _79 = _3; +- _79 = copy _3; - _78 = move _79 as i16 (FloatToInt); + _79 = const 1f64; + _78 = const 1_i16; @@ -498,7 +498,7 @@ StorageLive(_80); StorageLive(_81); StorageLive(_82); -- _82 = _3; +- _82 = copy _3; - _81 = move _82 as i32 (FloatToInt); + _82 = const 1f64; + _81 = const 1_i32; @@ -513,7 +513,7 @@ StorageLive(_83); StorageLive(_84); StorageLive(_85); -- _85 = _3; +- _85 = copy _3; - _84 = move _85 as i64 (FloatToInt); + _85 = const 1f64; + _84 = const 1_i64; @@ -528,7 +528,7 @@ StorageLive(_86); StorageLive(_87); StorageLive(_88); -- _88 = _3; +- _88 = copy _3; - _87 = move _88 as f32 (FloatToFloat); + _88 = const 1f64; + _87 = const 1f32; @@ -542,7 +542,7 @@ StorageDead(_86); StorageLive(_89); StorageLive(_90); -- _90 = _3; +- _90 = copy _3; - _89 = opaque::<f64>(move _90) -> [return: bb30, unwind unreachable]; + _90 = const 1f64; + _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind unreachable]; diff --git a/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff index 08b97e13aa0..3541c10da64 100644 --- a/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.cast.GVN.panic-unwind.diff @@ -116,7 +116,7 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); -- _6 = _1; +- _6 = copy _1; - _5 = move _6 as u8 (IntToInt); + _6 = const 1_i64; + _5 = const 1_u8; @@ -131,7 +131,7 @@ StorageLive(_7); StorageLive(_8); StorageLive(_9); -- _9 = _1; +- _9 = copy _1; - _8 = move _9 as u16 (IntToInt); + _9 = const 1_i64; + _8 = const 1_u16; @@ -146,7 +146,7 @@ StorageLive(_10); StorageLive(_11); StorageLive(_12); -- _12 = _1; +- _12 = copy _1; - _11 = move _12 as u32 (IntToInt); + _12 = const 1_i64; + _11 = const 1_u32; @@ -161,7 +161,7 @@ StorageLive(_13); StorageLive(_14); StorageLive(_15); -- _15 = _1; +- _15 = copy _1; - _14 = move _15 as u64 (IntToInt); + _15 = const 1_i64; + _14 = const 1_u64; @@ -176,7 +176,7 @@ StorageLive(_16); StorageLive(_17); StorageLive(_18); -- _18 = _1; +- _18 = copy _1; - _17 = move _18 as i8 (IntToInt); + _18 = const 1_i64; + _17 = const 1_i8; @@ -191,7 +191,7 @@ StorageLive(_19); StorageLive(_20); StorageLive(_21); -- _21 = _1; +- _21 = copy _1; - _20 = move _21 as i16 (IntToInt); + _21 = const 1_i64; + _20 = const 1_i16; @@ -206,7 +206,7 @@ StorageLive(_22); StorageLive(_23); StorageLive(_24); -- _24 = _1; +- _24 = copy _1; - _23 = move _24 as i32 (IntToInt); + _24 = const 1_i64; + _23 = const 1_i32; @@ -220,7 +220,7 @@ StorageDead(_22); StorageLive(_25); StorageLive(_26); -- _26 = _1; +- _26 = copy _1; - _25 = opaque::<i64>(move _26) -> [return: bb8, unwind continue]; + _26 = const 1_i64; + _25 = opaque::<i64>(const 1_i64) -> [return: bb8, unwind continue]; @@ -232,7 +232,7 @@ StorageLive(_27); StorageLive(_28); StorageLive(_29); -- _29 = _1; +- _29 = copy _1; - _28 = move _29 as f32 (IntToFloat); + _29 = const 1_i64; + _28 = const 1f32; @@ -247,7 +247,7 @@ StorageLive(_30); StorageLive(_31); StorageLive(_32); -- _32 = _1; +- _32 = copy _1; - _31 = move _32 as f64 (IntToFloat); + _32 = const 1_i64; + _31 = const 1f64; @@ -262,7 +262,7 @@ StorageLive(_33); StorageLive(_34); StorageLive(_35); -- _35 = _2; +- _35 = copy _2; - _34 = move _35 as u8 (IntToInt); + _35 = const 1_u64; + _34 = const 1_u8; @@ -277,7 +277,7 @@ StorageLive(_36); StorageLive(_37); StorageLive(_38); -- _38 = _2; +- _38 = copy _2; - _37 = move _38 as u16 (IntToInt); + _38 = const 1_u64; + _37 = const 1_u16; @@ -292,7 +292,7 @@ StorageLive(_39); StorageLive(_40); StorageLive(_41); -- _41 = _2; +- _41 = copy _2; - _40 = move _41 as u32 (IntToInt); + _41 = const 1_u64; + _40 = const 1_u32; @@ -306,7 +306,7 @@ StorageDead(_39); StorageLive(_42); StorageLive(_43); -- _43 = _2; +- _43 = copy _2; - _42 = opaque::<u64>(move _43) -> [return: bb14, unwind continue]; + _43 = const 1_u64; + _42 = opaque::<u64>(const 1_u64) -> [return: bb14, unwind continue]; @@ -318,7 +318,7 @@ StorageLive(_44); StorageLive(_45); StorageLive(_46); -- _46 = _2; +- _46 = copy _2; - _45 = move _46 as i8 (IntToInt); + _46 = const 1_u64; + _45 = const 1_i8; @@ -333,7 +333,7 @@ StorageLive(_47); StorageLive(_48); StorageLive(_49); -- _49 = _2; +- _49 = copy _2; - _48 = move _49 as i16 (IntToInt); + _49 = const 1_u64; + _48 = const 1_i16; @@ -348,7 +348,7 @@ StorageLive(_50); StorageLive(_51); StorageLive(_52); -- _52 = _2; +- _52 = copy _2; - _51 = move _52 as i32 (IntToInt); + _52 = const 1_u64; + _51 = const 1_i32; @@ -363,7 +363,7 @@ StorageLive(_53); StorageLive(_54); StorageLive(_55); -- _55 = _2; +- _55 = copy _2; - _54 = move _55 as i64 (IntToInt); + _55 = const 1_u64; + _54 = const 1_i64; @@ -378,7 +378,7 @@ StorageLive(_56); StorageLive(_57); StorageLive(_58); -- _58 = _2; +- _58 = copy _2; - _57 = move _58 as f32 (IntToFloat); + _58 = const 1_u64; + _57 = const 1f32; @@ -393,7 +393,7 @@ StorageLive(_59); StorageLive(_60); StorageLive(_61); -- _61 = _2; +- _61 = copy _2; - _60 = move _61 as f64 (IntToFloat); + _61 = const 1_u64; + _60 = const 1f64; @@ -408,7 +408,7 @@ StorageLive(_62); StorageLive(_63); StorageLive(_64); -- _64 = _3; +- _64 = copy _3; - _63 = move _64 as u8 (FloatToInt); + _64 = const 1f64; + _63 = const 1_u8; @@ -423,7 +423,7 @@ StorageLive(_65); StorageLive(_66); StorageLive(_67); -- _67 = _3; +- _67 = copy _3; - _66 = move _67 as u16 (FloatToInt); + _67 = const 1f64; + _66 = const 1_u16; @@ -438,7 +438,7 @@ StorageLive(_68); StorageLive(_69); StorageLive(_70); -- _70 = _3; +- _70 = copy _3; - _69 = move _70 as u32 (FloatToInt); + _70 = const 1f64; + _69 = const 1_u32; @@ -453,7 +453,7 @@ StorageLive(_71); StorageLive(_72); StorageLive(_73); -- _73 = _3; +- _73 = copy _3; - _72 = move _73 as u64 (FloatToInt); + _73 = const 1f64; + _72 = const 1_u64; @@ -468,7 +468,7 @@ StorageLive(_74); StorageLive(_75); StorageLive(_76); -- _76 = _3; +- _76 = copy _3; - _75 = move _76 as i8 (FloatToInt); + _76 = const 1f64; + _75 = const 1_i8; @@ -483,7 +483,7 @@ StorageLive(_77); StorageLive(_78); StorageLive(_79); -- _79 = _3; +- _79 = copy _3; - _78 = move _79 as i16 (FloatToInt); + _79 = const 1f64; + _78 = const 1_i16; @@ -498,7 +498,7 @@ StorageLive(_80); StorageLive(_81); StorageLive(_82); -- _82 = _3; +- _82 = copy _3; - _81 = move _82 as i32 (FloatToInt); + _82 = const 1f64; + _81 = const 1_i32; @@ -513,7 +513,7 @@ StorageLive(_83); StorageLive(_84); StorageLive(_85); -- _85 = _3; +- _85 = copy _3; - _84 = move _85 as i64 (FloatToInt); + _85 = const 1f64; + _84 = const 1_i64; @@ -528,7 +528,7 @@ StorageLive(_86); StorageLive(_87); StorageLive(_88); -- _88 = _3; +- _88 = copy _3; - _87 = move _88 as f32 (FloatToFloat); + _88 = const 1f64; + _87 = const 1f32; @@ -542,7 +542,7 @@ StorageDead(_86); StorageLive(_89); StorageLive(_90); -- _90 = _3; +- _90 = copy _3; - _89 = opaque::<f64>(move _90) -> [return: bb30, unwind continue]; + _90 = const 1f64; + _89 = opaque::<f64>(const 1f64) -> [return: bb30, unwind continue]; diff --git a/tests/mir-opt/gvn.cast_pointer_eq.GVN.panic-abort.diff b/tests/mir-opt/gvn.cast_pointer_eq.GVN.panic-abort.diff index 757ab959813..f66aed0f441 100644 --- a/tests/mir-opt/gvn.cast_pointer_eq.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.cast_pointer_eq.GVN.panic-abort.diff @@ -52,70 +52,70 @@ - StorageLive(_5); + nop; StorageLive(_6); - _6 = _1; + _6 = copy _1; - _5 = move _6 as *const u32 (PtrToPtr); -+ _5 = _1 as *const u32 (PtrToPtr); ++ _5 = copy _1 as *const u32 (PtrToPtr); StorageDead(_6); StorageLive(_7); - StorageLive(_8); + nop; StorageLive(_9); - _9 = _2; + _9 = copy _2; - _8 = move _9 as *const u32 (PtrToPtr); -+ _8 = _2 as *const u32 (PtrToPtr); ++ _8 = copy _2 as *const u32 (PtrToPtr); StorageDead(_9); - _7 = move _8 as *const u32 (PtrToPtr); - StorageDead(_8); -+ _7 = _8; ++ _7 = copy _8; + nop; StorageLive(_10); - StorageLive(_11); + nop; StorageLive(_12); - _12 = _3; + _12 = copy _3; - _11 = move _12 as *const u32 (PtrToPtr); -+ _11 = _3 as *const u32 (PtrToPtr); ++ _11 = copy _3 as *const u32 (PtrToPtr); StorageDead(_12); - _10 = move _11 as *const u32 (PtrToPtr); - StorageDead(_11); - StorageLive(_13); -+ _10 = _11; ++ _10 = copy _11; + nop; + nop; StorageLive(_14); - _14 = _4; + _14 = copy _4; - _13 = move _14 as *const u32 (PtrToPtr); -+ _13 = _4 as *const u32 (PtrToPtr); ++ _13 = copy _4 as *const u32 (PtrToPtr); StorageDead(_14); StorageLive(_15); StorageLive(_16); - _16 = _5; + _16 = copy _5; StorageLive(_17); -- _17 = _7; +- _17 = copy _7; - _15 = Eq(move _16, move _17); -+ _17 = _8; -+ _15 = Eq(_5, _8); ++ _17 = copy _8; ++ _15 = Eq(copy _5, copy _8); StorageDead(_17); StorageDead(_16); StorageLive(_18); StorageLive(_19); -- _19 = _7; -+ _19 = _8; +- _19 = copy _7; ++ _19 = copy _8; StorageLive(_20); -- _20 = _10; +- _20 = copy _10; - _18 = Eq(move _19, move _20); -+ _20 = _11; -+ _18 = Eq(_2, _3); ++ _20 = copy _11; ++ _18 = Eq(copy _2, copy _3); StorageDead(_20); StorageDead(_19); StorageLive(_21); StorageLive(_22); -- _22 = _10; -+ _22 = _11; +- _22 = copy _10; ++ _22 = copy _11; StorageLive(_23); - _23 = _13; + _23 = copy _13; - _21 = Eq(move _22, move _23); -+ _21 = Eq(_11, _13); ++ _21 = Eq(copy _11, copy _13); StorageDead(_23); StorageDead(_22); _0 = const (); diff --git a/tests/mir-opt/gvn.cast_pointer_eq.GVN.panic-unwind.diff b/tests/mir-opt/gvn.cast_pointer_eq.GVN.panic-unwind.diff index 757ab959813..f66aed0f441 100644 --- a/tests/mir-opt/gvn.cast_pointer_eq.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.cast_pointer_eq.GVN.panic-unwind.diff @@ -52,70 +52,70 @@ - StorageLive(_5); + nop; StorageLive(_6); - _6 = _1; + _6 = copy _1; - _5 = move _6 as *const u32 (PtrToPtr); -+ _5 = _1 as *const u32 (PtrToPtr); ++ _5 = copy _1 as *const u32 (PtrToPtr); StorageDead(_6); StorageLive(_7); - StorageLive(_8); + nop; StorageLive(_9); - _9 = _2; + _9 = copy _2; - _8 = move _9 as *const u32 (PtrToPtr); -+ _8 = _2 as *const u32 (PtrToPtr); ++ _8 = copy _2 as *const u32 (PtrToPtr); StorageDead(_9); - _7 = move _8 as *const u32 (PtrToPtr); - StorageDead(_8); -+ _7 = _8; ++ _7 = copy _8; + nop; StorageLive(_10); - StorageLive(_11); + nop; StorageLive(_12); - _12 = _3; + _12 = copy _3; - _11 = move _12 as *const u32 (PtrToPtr); -+ _11 = _3 as *const u32 (PtrToPtr); ++ _11 = copy _3 as *const u32 (PtrToPtr); StorageDead(_12); - _10 = move _11 as *const u32 (PtrToPtr); - StorageDead(_11); - StorageLive(_13); -+ _10 = _11; ++ _10 = copy _11; + nop; + nop; StorageLive(_14); - _14 = _4; + _14 = copy _4; - _13 = move _14 as *const u32 (PtrToPtr); -+ _13 = _4 as *const u32 (PtrToPtr); ++ _13 = copy _4 as *const u32 (PtrToPtr); StorageDead(_14); StorageLive(_15); StorageLive(_16); - _16 = _5; + _16 = copy _5; StorageLive(_17); -- _17 = _7; +- _17 = copy _7; - _15 = Eq(move _16, move _17); -+ _17 = _8; -+ _15 = Eq(_5, _8); ++ _17 = copy _8; ++ _15 = Eq(copy _5, copy _8); StorageDead(_17); StorageDead(_16); StorageLive(_18); StorageLive(_19); -- _19 = _7; -+ _19 = _8; +- _19 = copy _7; ++ _19 = copy _8; StorageLive(_20); -- _20 = _10; +- _20 = copy _10; - _18 = Eq(move _19, move _20); -+ _20 = _11; -+ _18 = Eq(_2, _3); ++ _20 = copy _11; ++ _18 = Eq(copy _2, copy _3); StorageDead(_20); StorageDead(_19); StorageLive(_21); StorageLive(_22); -- _22 = _10; -+ _22 = _11; +- _22 = copy _10; ++ _22 = copy _11; StorageLive(_23); - _23 = _13; + _23 = copy _13; - _21 = Eq(move _22, move _23); -+ _21 = Eq(_11, _13); ++ _21 = Eq(copy _11, copy _13); StorageDead(_23); StorageDead(_22); _0 = const (); diff --git a/tests/mir-opt/gvn.cast_pointer_then_transmute.GVN.panic-abort.diff b/tests/mir-opt/gvn.cast_pointer_then_transmute.GVN.panic-abort.diff index 8133f6e0b00..d9f945d2c41 100644 --- a/tests/mir-opt/gvn.cast_pointer_then_transmute.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.cast_pointer_then_transmute.GVN.panic-abort.diff @@ -22,19 +22,19 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - _4 = move _5 as *const () (PtrToPtr); -+ _4 = _1 as *const () (PtrToPtr); ++ _4 = copy _1 as *const () (PtrToPtr); StorageDead(_5); - _3 = move _4 as usize (Transmute); -+ _3 = _1 as usize (Transmute); ++ _3 = copy _1 as usize (Transmute); StorageDead(_4); StorageLive(_6); StorageLive(_7); StorageLive(_8); - _8 = _2; + _8 = copy _2; - _7 = move _8 as *const () (PtrToPtr); -+ _7 = _2 as *const () (PtrToPtr); ++ _7 = copy _2 as *const () (PtrToPtr); StorageDead(_8); _6 = move _7 as usize (Transmute); StorageDead(_7); diff --git a/tests/mir-opt/gvn.cast_pointer_then_transmute.GVN.panic-unwind.diff b/tests/mir-opt/gvn.cast_pointer_then_transmute.GVN.panic-unwind.diff index 8133f6e0b00..d9f945d2c41 100644 --- a/tests/mir-opt/gvn.cast_pointer_then_transmute.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.cast_pointer_then_transmute.GVN.panic-unwind.diff @@ -22,19 +22,19 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - _4 = move _5 as *const () (PtrToPtr); -+ _4 = _1 as *const () (PtrToPtr); ++ _4 = copy _1 as *const () (PtrToPtr); StorageDead(_5); - _3 = move _4 as usize (Transmute); -+ _3 = _1 as usize (Transmute); ++ _3 = copy _1 as usize (Transmute); StorageDead(_4); StorageLive(_6); StorageLive(_7); StorageLive(_8); - _8 = _2; + _8 = copy _2; - _7 = move _8 as *const () (PtrToPtr); -+ _7 = _2 as *const () (PtrToPtr); ++ _7 = copy _2 as *const () (PtrToPtr); StorageDead(_8); _6 = move _7 as usize (Transmute); StorageDead(_7); diff --git a/tests/mir-opt/gvn.casts_before_aggregate_raw_ptr.GVN.panic-abort.diff b/tests/mir-opt/gvn.casts_before_aggregate_raw_ptr.GVN.panic-abort.diff index 6e5bdb16595..fd09310fabd 100644 --- a/tests/mir-opt/gvn.casts_before_aggregate_raw_ptr.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.casts_before_aggregate_raw_ptr.GVN.panic-abort.diff @@ -25,28 +25,28 @@ - StorageLive(_2); + nop; StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = move _3 as *const [u8; 4] (PtrToPtr); -+ _2 = _1 as *const [u8; 4] (PtrToPtr); ++ _2 = copy _1 as *const [u8; 4] (PtrToPtr); StorageDead(_3); - StorageLive(_4); + nop; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _4 = move _5 as *const u8 (PtrToPtr); -+ _4 = _1 as *const u8 (PtrToPtr); ++ _4 = copy _1 as *const u8 (PtrToPtr); StorageDead(_5); - StorageLive(_6); + nop; StorageLive(_7); - _7 = _4; + _7 = copy _4; - _6 = move _7 as *const () (PtrToPtr); -+ _6 = _1 as *const () (PtrToPtr); ++ _6 = copy _1 as *const () (PtrToPtr); StorageDead(_7); StorageLive(_8); - _8 = _6; + _8 = copy _6; - _0 = *const [u8] from (move _8, const 4_usize); -+ _0 = *const [u8] from (_1, const 4_usize); ++ _0 = *const [u8] from (copy _1, const 4_usize); StorageDead(_8); - StorageDead(_6); - StorageDead(_4); diff --git a/tests/mir-opt/gvn.casts_before_aggregate_raw_ptr.GVN.panic-unwind.diff b/tests/mir-opt/gvn.casts_before_aggregate_raw_ptr.GVN.panic-unwind.diff index 6e5bdb16595..fd09310fabd 100644 --- a/tests/mir-opt/gvn.casts_before_aggregate_raw_ptr.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.casts_before_aggregate_raw_ptr.GVN.panic-unwind.diff @@ -25,28 +25,28 @@ - StorageLive(_2); + nop; StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = move _3 as *const [u8; 4] (PtrToPtr); -+ _2 = _1 as *const [u8; 4] (PtrToPtr); ++ _2 = copy _1 as *const [u8; 4] (PtrToPtr); StorageDead(_3); - StorageLive(_4); + nop; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _4 = move _5 as *const u8 (PtrToPtr); -+ _4 = _1 as *const u8 (PtrToPtr); ++ _4 = copy _1 as *const u8 (PtrToPtr); StorageDead(_5); - StorageLive(_6); + nop; StorageLive(_7); - _7 = _4; + _7 = copy _4; - _6 = move _7 as *const () (PtrToPtr); -+ _6 = _1 as *const () (PtrToPtr); ++ _6 = copy _1 as *const () (PtrToPtr); StorageDead(_7); StorageLive(_8); - _8 = _6; + _8 = copy _6; - _0 = *const [u8] from (move _8, const 4_usize); -+ _0 = *const [u8] from (_1, const 4_usize); ++ _0 = *const [u8] from (copy _1, const 4_usize); StorageDead(_8); - StorageDead(_6); - StorageDead(_4); diff --git a/tests/mir-opt/gvn.comparison.GVN.panic-abort.diff b/tests/mir-opt/gvn.comparison.GVN.panic-abort.diff index fefdf14bddc..7b25dedbb88 100644 --- a/tests/mir-opt/gvn.comparison.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.comparison.GVN.panic-abort.diff @@ -26,9 +26,9 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; StorageLive(_6); - _6 = _1; + _6 = copy _1; - _4 = Eq(move _5, move _6); + _4 = const true; StorageDead(_6); @@ -43,9 +43,9 @@ StorageLive(_7); StorageLive(_8); StorageLive(_9); - _9 = _1; + _9 = copy _1; StorageLive(_10); - _10 = _1; + _10 = copy _1; - _8 = Ne(move _9, move _10); + _8 = const false; StorageDead(_10); @@ -60,11 +60,11 @@ StorageLive(_11); StorageLive(_12); StorageLive(_13); - _13 = _1; + _13 = copy _1; StorageLive(_14); - _14 = _2; + _14 = copy _2; - _12 = Eq(move _13, move _14); -+ _12 = Eq(_1, _2); ++ _12 = Eq(copy _1, copy _2); StorageDead(_14); StorageDead(_13); _11 = opaque::<bool>(move _12) -> [return: bb3, unwind unreachable]; @@ -76,11 +76,11 @@ StorageLive(_15); StorageLive(_16); StorageLive(_17); - _17 = _1; + _17 = copy _1; StorageLive(_18); - _18 = _2; + _18 = copy _2; - _16 = Ne(move _17, move _18); -+ _16 = Ne(_1, _2); ++ _16 = Ne(copy _1, copy _2); StorageDead(_18); StorageDead(_17); _15 = opaque::<bool>(move _16) -> [return: bb4, unwind unreachable]; diff --git a/tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff b/tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff index 9f19b2b59fa..416ae1ee559 100644 --- a/tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.comparison.GVN.panic-unwind.diff @@ -26,9 +26,9 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; StorageLive(_6); - _6 = _1; + _6 = copy _1; - _4 = Eq(move _5, move _6); + _4 = const true; StorageDead(_6); @@ -43,9 +43,9 @@ StorageLive(_7); StorageLive(_8); StorageLive(_9); - _9 = _1; + _9 = copy _1; StorageLive(_10); - _10 = _1; + _10 = copy _1; - _8 = Ne(move _9, move _10); + _8 = const false; StorageDead(_10); @@ -60,11 +60,11 @@ StorageLive(_11); StorageLive(_12); StorageLive(_13); - _13 = _1; + _13 = copy _1; StorageLive(_14); - _14 = _2; + _14 = copy _2; - _12 = Eq(move _13, move _14); -+ _12 = Eq(_1, _2); ++ _12 = Eq(copy _1, copy _2); StorageDead(_14); StorageDead(_13); _11 = opaque::<bool>(move _12) -> [return: bb3, unwind continue]; @@ -76,11 +76,11 @@ StorageLive(_15); StorageLive(_16); StorageLive(_17); - _17 = _1; + _17 = copy _1; StorageLive(_18); - _18 = _2; + _18 = copy _2; - _16 = Ne(move _17, move _18); -+ _16 = Ne(_1, _2); ++ _16 = Ne(copy _1, copy _2); StorageDead(_18); StorageDead(_17); _15 = opaque::<bool>(move _16) -> [return: bb4, unwind continue]; diff --git a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff index c417c51f9b7..3f052ee19fd 100644 --- a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-abort.diff @@ -32,7 +32,7 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); -- _5 = _2; +- _5 = copy _2; + _5 = const usize::MAX; StorageLive(_6); StorageLive(_7); @@ -51,18 +51,18 @@ StorageDead(_6); StorageDead(_5); StorageLive(_8); -- _8 = _2; +- _8 = copy _2; + _8 = const usize::MAX; _9 = Len((*_1)); -- _10 = Lt(_8, _9); -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind unreachable]; -+ _10 = Lt(const usize::MAX, _9); +- _10 = Lt(copy _8, copy _9); +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, copy _8) -> [success: bb3, unwind unreachable]; ++ _10 = Lt(const usize::MAX, copy _9); + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, const usize::MAX) -> [success: bb3, unwind unreachable]; } bb3: { -- _3 = (*_1)[_8]; -+ _3 = (*_1)[_2]; +- _3 = copy (*_1)[_8]; ++ _3 = copy (*_1)[_2]; StorageDead(_8); goto -> bb6; } @@ -73,15 +73,15 @@ StorageLive(_11); _11 = const 0_usize; _12 = Len((*_1)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind unreachable]; -+ _13 = Lt(const 0_usize, _12); +- _13 = Lt(copy _11, copy _12); +- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb5, unwind unreachable]; ++ _13 = Lt(const 0_usize, copy _12); + assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, const 0_usize) -> [success: bb5, unwind unreachable]; } bb5: { -- _3 = (*_1)[_11]; -+ _3 = (*_1)[0 of 1]; +- _3 = copy (*_1)[_11]; ++ _3 = copy (*_1)[0 of 1]; StorageDead(_11); goto -> bb6; } @@ -89,7 +89,7 @@ bb6: { StorageDead(_4); StorageLive(_14); - _14 = _3; + _14 = copy _3; _0 = opaque::<T>(move _14) -> [return: bb7, unwind unreachable]; } diff --git a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff index 7a23fbe7cc0..84b738c7804 100644 --- a/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.constant_index_overflow.GVN.panic-unwind.diff @@ -32,7 +32,7 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); -- _5 = _2; +- _5 = copy _2; + _5 = const usize::MAX; StorageLive(_6); StorageLive(_7); @@ -51,18 +51,18 @@ StorageDead(_6); StorageDead(_5); StorageLive(_8); -- _8 = _2; +- _8 = copy _2; + _8 = const usize::MAX; _9 = Len((*_1)); -- _10 = Lt(_8, _9); -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind continue]; -+ _10 = Lt(const usize::MAX, _9); +- _10 = Lt(copy _8, copy _9); +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, copy _8) -> [success: bb3, unwind continue]; ++ _10 = Lt(const usize::MAX, copy _9); + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, const usize::MAX) -> [success: bb3, unwind continue]; } bb3: { -- _3 = (*_1)[_8]; -+ _3 = (*_1)[_2]; +- _3 = copy (*_1)[_8]; ++ _3 = copy (*_1)[_2]; StorageDead(_8); goto -> bb6; } @@ -73,15 +73,15 @@ StorageLive(_11); _11 = const 0_usize; _12 = Len((*_1)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind continue]; -+ _13 = Lt(const 0_usize, _12); +- _13 = Lt(copy _11, copy _12); +- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb5, unwind continue]; ++ _13 = Lt(const 0_usize, copy _12); + assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, const 0_usize) -> [success: bb5, unwind continue]; } bb5: { -- _3 = (*_1)[_11]; -+ _3 = (*_1)[0 of 1]; +- _3 = copy (*_1)[_11]; ++ _3 = copy (*_1)[0 of 1]; StorageDead(_11); goto -> bb6; } @@ -89,7 +89,7 @@ bb6: { StorageDead(_4); StorageLive(_14); - _14 = _3; + _14 = copy _3; _0 = opaque::<T>(move _14) -> [return: bb7, unwind continue]; } diff --git a/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff index 906835530d8..a763614dc64 100644 --- a/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.dereferences.GVN.panic-abort.diff @@ -48,7 +48,7 @@ bb0: { StorageLive(_4); StorageLive(_5); - _5 = (*_1); + _5 = copy (*_1); _4 = opaque::<u32>(move _5) -> [return: bb1, unwind unreachable]; } @@ -57,7 +57,7 @@ StorageDead(_4); StorageLive(_6); StorageLive(_7); - _7 = (*_1); + _7 = copy (*_1); _6 = opaque::<u32>(move _7) -> [return: bb2, unwind unreachable]; } @@ -68,7 +68,7 @@ _8 = &raw const (*_1); StorageLive(_9); StorageLive(_10); - _10 = (*_8); + _10 = copy (*_8); _9 = opaque::<u32>(move _10) -> [return: bb3, unwind unreachable]; } @@ -77,7 +77,7 @@ StorageDead(_9); StorageLive(_11); StorageLive(_12); - _12 = (*_8); + _12 = copy (*_8); _11 = opaque::<u32>(move _12) -> [return: bb4, unwind unreachable]; } @@ -88,7 +88,7 @@ _13 = &raw mut (*_1); StorageLive(_14); StorageLive(_15); - _15 = (*_13); + _15 = copy (*_13); _14 = opaque::<u32>(move _15) -> [return: bb5, unwind unreachable]; } @@ -97,7 +97,7 @@ StorageDead(_14); StorageLive(_16); StorageLive(_17); - _17 = (*_13); + _17 = copy (*_13); _16 = opaque::<u32>(move _17) -> [return: bb6, unwind unreachable]; } @@ -109,9 +109,9 @@ StorageLive(_19); - StorageLive(_20); + nop; - _20 = (*_18); + _20 = copy (*_18); - _19 = opaque::<u32>(move _20) -> [return: bb7, unwind unreachable]; -+ _19 = opaque::<u32>(_20) -> [return: bb7, unwind unreachable]; ++ _19 = opaque::<u32>(copy _20) -> [return: bb7, unwind unreachable]; } bb7: { @@ -120,10 +120,10 @@ StorageDead(_19); StorageLive(_21); StorageLive(_22); -- _22 = (*_18); +- _22 = copy (*_18); - _21 = opaque::<u32>(move _22) -> [return: bb8, unwind unreachable]; -+ _22 = _20; -+ _21 = opaque::<u32>(_20) -> [return: bb8, unwind unreachable]; ++ _22 = copy _20; ++ _21 = opaque::<u32>(copy _20) -> [return: bb8, unwind unreachable]; } bb8: { @@ -140,7 +140,7 @@ StorageDead(_23); StorageLive(_25); StorageLive(_26); - _26 = (*_2); + _26 = copy (*_2); _25 = opaque::<impl Copy>(move _26) -> [return: bb10, unwind unreachable]; } @@ -149,7 +149,7 @@ StorageDead(_25); StorageLive(_27); StorageLive(_28); - _28 = (*_2); + _28 = copy (*_2); _27 = opaque::<impl Copy>(move _28) -> [return: bb11, unwind unreachable]; } @@ -159,9 +159,9 @@ StorageLive(_29); - StorageLive(_30); + nop; - _30 = ((*_3).0: u32); + _30 = copy ((*_3).0: u32); - _29 = opaque::<u32>(move _30) -> [return: bb12, unwind unreachable]; -+ _29 = opaque::<u32>(_30) -> [return: bb12, unwind unreachable]; ++ _29 = opaque::<u32>(copy _30) -> [return: bb12, unwind unreachable]; } bb12: { @@ -170,10 +170,10 @@ StorageDead(_29); StorageLive(_31); StorageLive(_32); -- _32 = ((*_3).0: u32); +- _32 = copy ((*_3).0: u32); - _31 = opaque::<u32>(move _32) -> [return: bb13, unwind unreachable]; -+ _32 = _30; -+ _31 = opaque::<u32>(_30) -> [return: bb13, unwind unreachable]; ++ _32 = copy _30; ++ _31 = opaque::<u32>(copy _30) -> [return: bb13, unwind unreachable]; } bb13: { diff --git a/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff index 006b5da646c..ca6fda48364 100644 --- a/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.dereferences.GVN.panic-unwind.diff @@ -48,7 +48,7 @@ bb0: { StorageLive(_4); StorageLive(_5); - _5 = (*_1); + _5 = copy (*_1); _4 = opaque::<u32>(move _5) -> [return: bb1, unwind continue]; } @@ -57,7 +57,7 @@ StorageDead(_4); StorageLive(_6); StorageLive(_7); - _7 = (*_1); + _7 = copy (*_1); _6 = opaque::<u32>(move _7) -> [return: bb2, unwind continue]; } @@ -68,7 +68,7 @@ _8 = &raw const (*_1); StorageLive(_9); StorageLive(_10); - _10 = (*_8); + _10 = copy (*_8); _9 = opaque::<u32>(move _10) -> [return: bb3, unwind continue]; } @@ -77,7 +77,7 @@ StorageDead(_9); StorageLive(_11); StorageLive(_12); - _12 = (*_8); + _12 = copy (*_8); _11 = opaque::<u32>(move _12) -> [return: bb4, unwind continue]; } @@ -88,7 +88,7 @@ _13 = &raw mut (*_1); StorageLive(_14); StorageLive(_15); - _15 = (*_13); + _15 = copy (*_13); _14 = opaque::<u32>(move _15) -> [return: bb5, unwind continue]; } @@ -97,7 +97,7 @@ StorageDead(_14); StorageLive(_16); StorageLive(_17); - _17 = (*_13); + _17 = copy (*_13); _16 = opaque::<u32>(move _17) -> [return: bb6, unwind continue]; } @@ -109,9 +109,9 @@ StorageLive(_19); - StorageLive(_20); + nop; - _20 = (*_18); + _20 = copy (*_18); - _19 = opaque::<u32>(move _20) -> [return: bb7, unwind continue]; -+ _19 = opaque::<u32>(_20) -> [return: bb7, unwind continue]; ++ _19 = opaque::<u32>(copy _20) -> [return: bb7, unwind continue]; } bb7: { @@ -120,10 +120,10 @@ StorageDead(_19); StorageLive(_21); StorageLive(_22); -- _22 = (*_18); +- _22 = copy (*_18); - _21 = opaque::<u32>(move _22) -> [return: bb8, unwind continue]; -+ _22 = _20; -+ _21 = opaque::<u32>(_20) -> [return: bb8, unwind continue]; ++ _22 = copy _20; ++ _21 = opaque::<u32>(copy _20) -> [return: bb8, unwind continue]; } bb8: { @@ -140,7 +140,7 @@ StorageDead(_23); StorageLive(_25); StorageLive(_26); - _26 = (*_2); + _26 = copy (*_2); _25 = opaque::<impl Copy>(move _26) -> [return: bb10, unwind continue]; } @@ -149,7 +149,7 @@ StorageDead(_25); StorageLive(_27); StorageLive(_28); - _28 = (*_2); + _28 = copy (*_2); _27 = opaque::<impl Copy>(move _28) -> [return: bb11, unwind continue]; } @@ -159,9 +159,9 @@ StorageLive(_29); - StorageLive(_30); + nop; - _30 = ((*_3).0: u32); + _30 = copy ((*_3).0: u32); - _29 = opaque::<u32>(move _30) -> [return: bb12, unwind continue]; -+ _29 = opaque::<u32>(_30) -> [return: bb12, unwind continue]; ++ _29 = opaque::<u32>(copy _30) -> [return: bb12, unwind continue]; } bb12: { @@ -170,10 +170,10 @@ StorageDead(_29); StorageLive(_31); StorageLive(_32); -- _32 = ((*_3).0: u32); +- _32 = copy ((*_3).0: u32); - _31 = opaque::<u32>(move _32) -> [return: bb13, unwind continue]; -+ _32 = _30; -+ _31 = opaque::<u32>(_30) -> [return: bb13, unwind continue]; ++ _32 = copy _30; ++ _31 = opaque::<u32>(copy _30) -> [return: bb13, unwind continue]; } bb13: { diff --git a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff index 7ae1fae68e8..18c2897d528 100644 --- a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-abort.diff @@ -16,22 +16,22 @@ bb0: { _7 = (const "a",); - _1 = (_7.0: &str) as u128 (Transmute); - _5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind unreachable]; + _1 = copy (_7.0: &str) as u128 (Transmute); + _5 = identity::<&str>(copy (_7.0: &str)) -> [return: bb1, unwind unreachable]; } bb1: { - _3 = _5 as u128 (Transmute); + _3 = copy _5 as u128 (Transmute); _8 = const "a"; - _2 = _8 as u128 (Transmute); - _6 = identity::<&str>(_8) -> [return: bb2, unwind unreachable]; + _2 = copy _8 as u128 (Transmute); + _6 = identity::<&str>(copy _8) -> [return: bb2, unwind unreachable]; } bb2: { - _4 = _6 as u128 (Transmute); - _9 = Eq(_1, _2); - _10 = Eq(_3, _4); - _0 = (_9, _10); + _4 = copy _6 as u128 (Transmute); + _9 = Eq(copy _1, copy _2); + _10 = Eq(copy _3, copy _4); + _0 = (copy _9, copy _10); return; } } diff --git a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff index 8c96edaa280..55f382e926e 100644 --- a/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.duplicate_slice.GVN.panic-unwind.diff @@ -16,22 +16,22 @@ bb0: { _7 = (const "a",); - _1 = (_7.0: &str) as u128 (Transmute); - _5 = identity::<&str>((_7.0: &str)) -> [return: bb1, unwind continue]; + _1 = copy (_7.0: &str) as u128 (Transmute); + _5 = identity::<&str>(copy (_7.0: &str)) -> [return: bb1, unwind continue]; } bb1: { - _3 = _5 as u128 (Transmute); + _3 = copy _5 as u128 (Transmute); _8 = const "a"; - _2 = _8 as u128 (Transmute); - _6 = identity::<&str>(_8) -> [return: bb2, unwind continue]; + _2 = copy _8 as u128 (Transmute); + _6 = identity::<&str>(copy _8) -> [return: bb2, unwind continue]; } bb2: { - _4 = _6 as u128 (Transmute); - _9 = Eq(_1, _2); - _10 = Eq(_3, _4); - _0 = (_9, _10); + _4 = copy _6 as u128 (Transmute); + _9 = Eq(copy _1, copy _2); + _10 = Eq(copy _3, copy _4); + _0 = (copy _9, copy _10); return; } } diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff index b5c0cee7846..292b812b50c 100644 --- a/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-abort.diff @@ -8,10 +8,10 @@ let mut _3: fn(u8) -> u8; let _5: (); let mut _6: fn(u8) -> u8; - let mut _9: {closure@$DIR/gvn.rs:615:19: 615:21}; + let mut _9: {closure@$DIR/gvn.rs:614:19: 614:21}; let _10: (); let mut _11: fn(); - let mut _13: {closure@$DIR/gvn.rs:615:19: 615:21}; + let mut _13: {closure@$DIR/gvn.rs:614:19: 614:21}; let _14: (); let mut _15: fn(); scope 1 { @@ -19,7 +19,7 @@ let _4: fn(u8) -> u8; scope 2 { debug g => _4; - let _7: {closure@$DIR/gvn.rs:615:19: 615:21}; + let _7: {closure@$DIR/gvn.rs:614:19: 614:21}; scope 3 { debug closure => _7; let _8: fn(); @@ -40,9 +40,9 @@ _1 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer)); StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = opaque::<fn(u8) -> u8>(move _3) -> [return: bb1, unwind unreachable]; -+ _2 = opaque::<fn(u8) -> u8>(_1) -> [return: bb1, unwind unreachable]; ++ _2 = opaque::<fn(u8) -> u8>(copy _1) -> [return: bb1, unwind unreachable]; } bb1: { @@ -53,31 +53,31 @@ _4 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer)); StorageLive(_5); StorageLive(_6); - _6 = _4; + _6 = copy _4; - _5 = opaque::<fn(u8) -> u8>(move _6) -> [return: bb2, unwind unreachable]; -+ _5 = opaque::<fn(u8) -> u8>(_4) -> [return: bb2, unwind unreachable]; ++ _5 = opaque::<fn(u8) -> u8>(copy _4) -> [return: bb2, unwind unreachable]; } bb2: { StorageDead(_6); StorageDead(_5); - StorageLive(_7); -- _7 = {closure@$DIR/gvn.rs:615:19: 615:21}; +- _7 = {closure@$DIR/gvn.rs:614:19: 614:21}; - StorageLive(_8); + nop; -+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21}; ++ _7 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; + nop; StorageLive(_9); -- _9 = _7; +- _9 = copy _7; - _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe))); -+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21}; -+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe))); ++ _9 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; ++ _8 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe))); StorageDead(_9); StorageLive(_10); StorageLive(_11); - _11 = _8; + _11 = copy _8; - _10 = opaque::<fn()>(move _11) -> [return: bb3, unwind unreachable]; -+ _10 = opaque::<fn()>(_8) -> [return: bb3, unwind unreachable]; ++ _10 = opaque::<fn()>(copy _8) -> [return: bb3, unwind unreachable]; } bb3: { @@ -86,16 +86,16 @@ - StorageLive(_12); + nop; StorageLive(_13); -- _13 = _7; +- _13 = copy _7; - _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe))); -+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21}; -+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe))); ++ _13 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; ++ _12 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe))); StorageDead(_13); StorageLive(_14); StorageLive(_15); - _15 = _12; + _15 = copy _12; - _14 = opaque::<fn()>(move _15) -> [return: bb4, unwind unreachable]; -+ _14 = opaque::<fn()>(_12) -> [return: bb4, unwind unreachable]; ++ _14 = opaque::<fn()>(copy _12) -> [return: bb4, unwind unreachable]; } bb4: { diff --git a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff index 7bc6573c13d..a60d986132e 100644 --- a/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.fn_pointers.GVN.panic-unwind.diff @@ -8,10 +8,10 @@ let mut _3: fn(u8) -> u8; let _5: (); let mut _6: fn(u8) -> u8; - let mut _9: {closure@$DIR/gvn.rs:615:19: 615:21}; + let mut _9: {closure@$DIR/gvn.rs:614:19: 614:21}; let _10: (); let mut _11: fn(); - let mut _13: {closure@$DIR/gvn.rs:615:19: 615:21}; + let mut _13: {closure@$DIR/gvn.rs:614:19: 614:21}; let _14: (); let mut _15: fn(); scope 1 { @@ -19,7 +19,7 @@ let _4: fn(u8) -> u8; scope 2 { debug g => _4; - let _7: {closure@$DIR/gvn.rs:615:19: 615:21}; + let _7: {closure@$DIR/gvn.rs:614:19: 614:21}; scope 3 { debug closure => _7; let _8: fn(); @@ -40,9 +40,9 @@ _1 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer)); StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = opaque::<fn(u8) -> u8>(move _3) -> [return: bb1, unwind continue]; -+ _2 = opaque::<fn(u8) -> u8>(_1) -> [return: bb1, unwind continue]; ++ _2 = opaque::<fn(u8) -> u8>(copy _1) -> [return: bb1, unwind continue]; } bb1: { @@ -53,31 +53,31 @@ _4 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer)); StorageLive(_5); StorageLive(_6); - _6 = _4; + _6 = copy _4; - _5 = opaque::<fn(u8) -> u8>(move _6) -> [return: bb2, unwind continue]; -+ _5 = opaque::<fn(u8) -> u8>(_4) -> [return: bb2, unwind continue]; ++ _5 = opaque::<fn(u8) -> u8>(copy _4) -> [return: bb2, unwind continue]; } bb2: { StorageDead(_6); StorageDead(_5); - StorageLive(_7); -- _7 = {closure@$DIR/gvn.rs:615:19: 615:21}; +- _7 = {closure@$DIR/gvn.rs:614:19: 614:21}; - StorageLive(_8); + nop; -+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21}; ++ _7 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; + nop; StorageLive(_9); -- _9 = _7; +- _9 = copy _7; - _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe))); -+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21}; -+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe))); ++ _9 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; ++ _8 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe))); StorageDead(_9); StorageLive(_10); StorageLive(_11); - _11 = _8; + _11 = copy _8; - _10 = opaque::<fn()>(move _11) -> [return: bb3, unwind continue]; -+ _10 = opaque::<fn()>(_8) -> [return: bb3, unwind continue]; ++ _10 = opaque::<fn()>(copy _8) -> [return: bb3, unwind continue]; } bb3: { @@ -86,16 +86,16 @@ - StorageLive(_12); + nop; StorageLive(_13); -- _13 = _7; +- _13 = copy _7; - _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe))); -+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21}; -+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:615:19: 615:21} as fn() (PointerCoercion(ClosureFnPointer(Safe))); ++ _13 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; ++ _12 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe))); StorageDead(_13); StorageLive(_14); StorageLive(_15); - _15 = _12; + _15 = copy _12; - _14 = opaque::<fn()>(move _15) -> [return: bb4, unwind continue]; -+ _14 = opaque::<fn()>(_12) -> [return: bb4, unwind continue]; ++ _14 = opaque::<fn()>(copy _12) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/gvn.generic_cast_metadata.GVN.panic-abort.diff b/tests/mir-opt/gvn.generic_cast_metadata.GVN.panic-abort.diff index 1d462a8a23c..770c6730775 100644 --- a/tests/mir-opt/gvn.generic_cast_metadata.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.generic_cast_metadata.GVN.panic-abort.diff @@ -17,21 +17,21 @@ let mut _15: <B as std::ptr::Pointee>::Metadata; bb0: { - _4 = _1 as *const T (PtrToPtr); - _5 = PtrMetadata(_4); - _6 = _1 as *const (&A, [T]) (PtrToPtr); -- _7 = PtrMetadata(_6); -+ _7 = PtrMetadata(_1); - _8 = _2 as *const (T, B) (PtrToPtr); - _9 = PtrMetadata(_8); - _10 = _2 as *const (T, A) (PtrToPtr); -- _11 = PtrMetadata(_10); -+ _11 = PtrMetadata(_2); - _12 = _3 as *mut A (PtrToPtr); - _13 = PtrMetadata(_12); - _14 = _3 as *mut B (PtrToPtr); -- _15 = PtrMetadata(_14); -+ _15 = PtrMetadata(_3); + _4 = copy _1 as *const T (PtrToPtr); + _5 = PtrMetadata(copy _4); + _6 = copy _1 as *const (&A, [T]) (PtrToPtr); +- _7 = PtrMetadata(copy _6); ++ _7 = PtrMetadata(copy _1); + _8 = copy _2 as *const (T, B) (PtrToPtr); + _9 = PtrMetadata(copy _8); + _10 = copy _2 as *const (T, A) (PtrToPtr); +- _11 = PtrMetadata(copy _10); ++ _11 = PtrMetadata(copy _2); + _12 = copy _3 as *mut A (PtrToPtr); + _13 = PtrMetadata(copy _12); + _14 = copy _3 as *mut B (PtrToPtr); +- _15 = PtrMetadata(copy _14); ++ _15 = PtrMetadata(copy _3); return; } } diff --git a/tests/mir-opt/gvn.generic_cast_metadata.GVN.panic-unwind.diff b/tests/mir-opt/gvn.generic_cast_metadata.GVN.panic-unwind.diff index 1d462a8a23c..770c6730775 100644 --- a/tests/mir-opt/gvn.generic_cast_metadata.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.generic_cast_metadata.GVN.panic-unwind.diff @@ -17,21 +17,21 @@ let mut _15: <B as std::ptr::Pointee>::Metadata; bb0: { - _4 = _1 as *const T (PtrToPtr); - _5 = PtrMetadata(_4); - _6 = _1 as *const (&A, [T]) (PtrToPtr); -- _7 = PtrMetadata(_6); -+ _7 = PtrMetadata(_1); - _8 = _2 as *const (T, B) (PtrToPtr); - _9 = PtrMetadata(_8); - _10 = _2 as *const (T, A) (PtrToPtr); -- _11 = PtrMetadata(_10); -+ _11 = PtrMetadata(_2); - _12 = _3 as *mut A (PtrToPtr); - _13 = PtrMetadata(_12); - _14 = _3 as *mut B (PtrToPtr); -- _15 = PtrMetadata(_14); -+ _15 = PtrMetadata(_3); + _4 = copy _1 as *const T (PtrToPtr); + _5 = PtrMetadata(copy _4); + _6 = copy _1 as *const (&A, [T]) (PtrToPtr); +- _7 = PtrMetadata(copy _6); ++ _7 = PtrMetadata(copy _1); + _8 = copy _2 as *const (T, B) (PtrToPtr); + _9 = PtrMetadata(copy _8); + _10 = copy _2 as *const (T, A) (PtrToPtr); +- _11 = PtrMetadata(copy _10); ++ _11 = PtrMetadata(copy _2); + _12 = copy _3 as *mut A (PtrToPtr); + _13 = PtrMetadata(copy _12); + _14 = copy _3 as *mut B (PtrToPtr); +- _15 = PtrMetadata(copy _14); ++ _15 = PtrMetadata(copy _3); return; } } diff --git a/tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff b/tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff index e84f91e495d..97f41f89fb2 100644 --- a/tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.indirect_static.GVN.panic-abort.diff @@ -8,7 +8,7 @@ bb0: { _1 = const {ALLOC0: &Option<u8>}; - _2 = (((*_1) as variant#1).0: u8); + _2 = copy (((*_1) as variant#1).0: u8); return; } } diff --git a/tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff b/tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff index e84f91e495d..97f41f89fb2 100644 --- a/tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.indirect_static.GVN.panic-unwind.diff @@ -8,7 +8,7 @@ bb0: { _1 = const {ALLOC0: &Option<u8>}; - _2 = (((*_1) as variant#1).0: u8); + _2 = copy (((*_1) as variant#1).0: u8); return; } } diff --git a/tests/mir-opt/gvn.manual_slice_mut_len.GVN.panic-abort.diff b/tests/mir-opt/gvn.manual_slice_mut_len.GVN.panic-abort.diff index c877d8a3c0e..936fa3db82a 100644 --- a/tests/mir-opt/gvn.manual_slice_mut_len.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.manual_slice_mut_len.GVN.panic-abort.diff @@ -22,14 +22,14 @@ - StorageLive(_3); + nop; StorageLive(_4); - _4 = _2; + _4 = copy _2; - _3 = move _4 as *const [i32] (PtrToPtr); -+ _3 = _2 as *const [i32] (PtrToPtr); ++ _3 = copy _2 as *const [i32] (PtrToPtr); StorageDead(_4); StorageLive(_5); - _5 = _3; + _5 = copy _3; - _0 = PtrMetadata(move _5); -+ _0 = PtrMetadata(_1); ++ _0 = PtrMetadata(copy _1); StorageDead(_5); - StorageDead(_3); - StorageDead(_2); diff --git a/tests/mir-opt/gvn.manual_slice_mut_len.GVN.panic-unwind.diff b/tests/mir-opt/gvn.manual_slice_mut_len.GVN.panic-unwind.diff index c877d8a3c0e..936fa3db82a 100644 --- a/tests/mir-opt/gvn.manual_slice_mut_len.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.manual_slice_mut_len.GVN.panic-unwind.diff @@ -22,14 +22,14 @@ - StorageLive(_3); + nop; StorageLive(_4); - _4 = _2; + _4 = copy _2; - _3 = move _4 as *const [i32] (PtrToPtr); -+ _3 = _2 as *const [i32] (PtrToPtr); ++ _3 = copy _2 as *const [i32] (PtrToPtr); StorageDead(_4); StorageLive(_5); - _5 = _3; + _5 = copy _3; - _0 = PtrMetadata(move _5); -+ _0 = PtrMetadata(_1); ++ _0 = PtrMetadata(copy _1); StorageDead(_5); - StorageDead(_3); - StorageDead(_2); diff --git a/tests/mir-opt/gvn.meta_of_ref_to_slice.GVN.panic-abort.diff b/tests/mir-opt/gvn.meta_of_ref_to_slice.GVN.panic-abort.diff index 73dbabb56b3..3ed6c2b5308 100644 --- a/tests/mir-opt/gvn.meta_of_ref_to_slice.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.meta_of_ref_to_slice.GVN.panic-abort.diff @@ -15,12 +15,12 @@ - StorageLive(_2); + nop; StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = *const [i32] from (move _3, const 1_usize); -+ _2 = *const [i32] from (_1, const 1_usize); ++ _2 = *const [i32] from (copy _1, const 1_usize); StorageDead(_3); StorageLive(_4); - _4 = _2; + _4 = copy _2; - _0 = PtrMetadata(move _4); + _0 = const 1_usize; StorageDead(_4); diff --git a/tests/mir-opt/gvn.meta_of_ref_to_slice.GVN.panic-unwind.diff b/tests/mir-opt/gvn.meta_of_ref_to_slice.GVN.panic-unwind.diff index 73dbabb56b3..3ed6c2b5308 100644 --- a/tests/mir-opt/gvn.meta_of_ref_to_slice.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.meta_of_ref_to_slice.GVN.panic-unwind.diff @@ -15,12 +15,12 @@ - StorageLive(_2); + nop; StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = *const [i32] from (move _3, const 1_usize); -+ _2 = *const [i32] from (_1, const 1_usize); ++ _2 = *const [i32] from (copy _1, const 1_usize); StorageDead(_3); StorageLive(_4); - _4 = _2; + _4 = copy _2; - _0 = PtrMetadata(move _4); + _0 = const 1_usize; StorageDead(_4); diff --git a/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff b/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff index 29ca1ba5902..f300ce7e884 100644 --- a/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-abort.diff @@ -41,9 +41,9 @@ bb0: { StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - switchInt(move _5) -> [0: bb4, otherwise: bb1]; -+ switchInt(_1) -> [0: bb4, otherwise: bb1]; ++ switchInt(copy _1) -> [0: bb4, otherwise: bb1]; } bb1: { @@ -51,15 +51,15 @@ - StorageLive(_7); + nop; StorageLive(_8); - _8 = _2; + _8 = copy _2; StorageLive(_9); - _9 = _3; + _9 = copy _3; - _7 = Add(move _8, move _9); -+ _7 = Add(_2, _3); ++ _7 = Add(copy _2, copy _3); StorageDead(_9); StorageDead(_8); - _6 = opaque::<u8>(move _7) -> [return: bb2, unwind unreachable]; -+ _6 = opaque::<u8>(_7) -> [return: bb2, unwind unreachable]; ++ _6 = opaque::<u8>(copy _7) -> [return: bb2, unwind unreachable]; } bb2: { @@ -69,15 +69,15 @@ StorageLive(_10); StorageLive(_11); StorageLive(_12); - _12 = _2; + _12 = copy _2; StorageLive(_13); - _13 = _3; + _13 = copy _3; - _11 = Add(move _12, move _13); -+ _11 = _7; ++ _11 = copy _7; StorageDead(_13); StorageDead(_12); - _10 = opaque::<u8>(move _11) -> [return: bb3, unwind unreachable]; -+ _10 = opaque::<u8>(_7) -> [return: bb3, unwind unreachable]; ++ _10 = opaque::<u8>(copy _7) -> [return: bb3, unwind unreachable]; } bb3: { @@ -92,15 +92,15 @@ - StorageLive(_15); + nop; StorageLive(_16); - _16 = _2; + _16 = copy _2; StorageLive(_17); - _17 = _3; + _17 = copy _3; - _15 = Add(move _16, move _17); -+ _15 = Add(_2, _3); ++ _15 = Add(copy _2, copy _3); StorageDead(_17); StorageDead(_16); - _14 = opaque::<u8>(move _15) -> [return: bb5, unwind unreachable]; -+ _14 = opaque::<u8>(_15) -> [return: bb5, unwind unreachable]; ++ _14 = opaque::<u8>(copy _15) -> [return: bb5, unwind unreachable]; } bb5: { @@ -110,15 +110,15 @@ StorageLive(_18); StorageLive(_19); StorageLive(_20); - _20 = _2; + _20 = copy _2; StorageLive(_21); - _21 = _3; + _21 = copy _3; - _19 = Add(move _20, move _21); -+ _19 = _15; ++ _19 = copy _15; StorageDead(_21); StorageDead(_20); - _18 = opaque::<u8>(move _19) -> [return: bb6, unwind unreachable]; -+ _18 = opaque::<u8>(_15) -> [return: bb6, unwind unreachable]; ++ _18 = opaque::<u8>(copy _15) -> [return: bb6, unwind unreachable]; } bb6: { @@ -135,15 +135,15 @@ - StorageLive(_23); + nop; StorageLive(_24); - _24 = _2; + _24 = copy _2; StorageLive(_25); - _25 = _3; + _25 = copy _3; - _23 = Add(move _24, move _25); -+ _23 = Add(_2, _3); ++ _23 = Add(copy _2, copy _3); StorageDead(_25); StorageDead(_24); - _22 = opaque::<u8>(move _23) -> [return: bb8, unwind unreachable]; -+ _22 = opaque::<u8>(_23) -> [return: bb8, unwind unreachable]; ++ _22 = opaque::<u8>(copy _23) -> [return: bb8, unwind unreachable]; } bb8: { @@ -151,24 +151,24 @@ + nop; StorageDead(_22); StorageLive(_26); - _26 = _1; + _26 = copy _1; - switchInt(move _26) -> [0: bb11, otherwise: bb9]; -+ switchInt(_1) -> [0: bb11, otherwise: bb9]; ++ switchInt(copy _1) -> [0: bb11, otherwise: bb9]; } bb9: { StorageLive(_27); StorageLive(_28); StorageLive(_29); - _29 = _2; + _29 = copy _2; StorageLive(_30); - _30 = _3; + _30 = copy _3; - _28 = Add(move _29, move _30); -+ _28 = _23; ++ _28 = copy _23; StorageDead(_30); StorageDead(_29); - _27 = opaque::<u8>(move _28) -> [return: bb10, unwind unreachable]; -+ _27 = opaque::<u8>(_23) -> [return: bb10, unwind unreachable]; ++ _27 = opaque::<u8>(copy _23) -> [return: bb10, unwind unreachable]; } bb10: { @@ -182,15 +182,15 @@ StorageLive(_31); StorageLive(_32); StorageLive(_33); - _33 = _2; + _33 = copy _2; StorageLive(_34); - _34 = _3; + _34 = copy _3; - _32 = Add(move _33, move _34); -+ _32 = _23; ++ _32 = copy _23; StorageDead(_34); StorageDead(_33); - _31 = opaque::<u8>(move _32) -> [return: bb12, unwind unreachable]; -+ _31 = opaque::<u8>(_23) -> [return: bb12, unwind unreachable]; ++ _31 = opaque::<u8>(copy _23) -> [return: bb12, unwind unreachable]; } bb12: { diff --git a/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff b/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff index 5394dc8be8a..f34765534cc 100644 --- a/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.multiple_branches.GVN.panic-unwind.diff @@ -41,9 +41,9 @@ bb0: { StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - switchInt(move _5) -> [0: bb4, otherwise: bb1]; -+ switchInt(_1) -> [0: bb4, otherwise: bb1]; ++ switchInt(copy _1) -> [0: bb4, otherwise: bb1]; } bb1: { @@ -51,15 +51,15 @@ - StorageLive(_7); + nop; StorageLive(_8); - _8 = _2; + _8 = copy _2; StorageLive(_9); - _9 = _3; + _9 = copy _3; - _7 = Add(move _8, move _9); -+ _7 = Add(_2, _3); ++ _7 = Add(copy _2, copy _3); StorageDead(_9); StorageDead(_8); - _6 = opaque::<u8>(move _7) -> [return: bb2, unwind continue]; -+ _6 = opaque::<u8>(_7) -> [return: bb2, unwind continue]; ++ _6 = opaque::<u8>(copy _7) -> [return: bb2, unwind continue]; } bb2: { @@ -69,15 +69,15 @@ StorageLive(_10); StorageLive(_11); StorageLive(_12); - _12 = _2; + _12 = copy _2; StorageLive(_13); - _13 = _3; + _13 = copy _3; - _11 = Add(move _12, move _13); -+ _11 = _7; ++ _11 = copy _7; StorageDead(_13); StorageDead(_12); - _10 = opaque::<u8>(move _11) -> [return: bb3, unwind continue]; -+ _10 = opaque::<u8>(_7) -> [return: bb3, unwind continue]; ++ _10 = opaque::<u8>(copy _7) -> [return: bb3, unwind continue]; } bb3: { @@ -92,15 +92,15 @@ - StorageLive(_15); + nop; StorageLive(_16); - _16 = _2; + _16 = copy _2; StorageLive(_17); - _17 = _3; + _17 = copy _3; - _15 = Add(move _16, move _17); -+ _15 = Add(_2, _3); ++ _15 = Add(copy _2, copy _3); StorageDead(_17); StorageDead(_16); - _14 = opaque::<u8>(move _15) -> [return: bb5, unwind continue]; -+ _14 = opaque::<u8>(_15) -> [return: bb5, unwind continue]; ++ _14 = opaque::<u8>(copy _15) -> [return: bb5, unwind continue]; } bb5: { @@ -110,15 +110,15 @@ StorageLive(_18); StorageLive(_19); StorageLive(_20); - _20 = _2; + _20 = copy _2; StorageLive(_21); - _21 = _3; + _21 = copy _3; - _19 = Add(move _20, move _21); -+ _19 = _15; ++ _19 = copy _15; StorageDead(_21); StorageDead(_20); - _18 = opaque::<u8>(move _19) -> [return: bb6, unwind continue]; -+ _18 = opaque::<u8>(_15) -> [return: bb6, unwind continue]; ++ _18 = opaque::<u8>(copy _15) -> [return: bb6, unwind continue]; } bb6: { @@ -135,15 +135,15 @@ - StorageLive(_23); + nop; StorageLive(_24); - _24 = _2; + _24 = copy _2; StorageLive(_25); - _25 = _3; + _25 = copy _3; - _23 = Add(move _24, move _25); -+ _23 = Add(_2, _3); ++ _23 = Add(copy _2, copy _3); StorageDead(_25); StorageDead(_24); - _22 = opaque::<u8>(move _23) -> [return: bb8, unwind continue]; -+ _22 = opaque::<u8>(_23) -> [return: bb8, unwind continue]; ++ _22 = opaque::<u8>(copy _23) -> [return: bb8, unwind continue]; } bb8: { @@ -151,24 +151,24 @@ + nop; StorageDead(_22); StorageLive(_26); - _26 = _1; + _26 = copy _1; - switchInt(move _26) -> [0: bb11, otherwise: bb9]; -+ switchInt(_1) -> [0: bb11, otherwise: bb9]; ++ switchInt(copy _1) -> [0: bb11, otherwise: bb9]; } bb9: { StorageLive(_27); StorageLive(_28); StorageLive(_29); - _29 = _2; + _29 = copy _2; StorageLive(_30); - _30 = _3; + _30 = copy _3; - _28 = Add(move _29, move _30); -+ _28 = _23; ++ _28 = copy _23; StorageDead(_30); StorageDead(_29); - _27 = opaque::<u8>(move _28) -> [return: bb10, unwind continue]; -+ _27 = opaque::<u8>(_23) -> [return: bb10, unwind continue]; ++ _27 = opaque::<u8>(copy _23) -> [return: bb10, unwind continue]; } bb10: { @@ -182,15 +182,15 @@ StorageLive(_31); StorageLive(_32); StorageLive(_33); - _33 = _2; + _33 = copy _2; StorageLive(_34); - _34 = _3; + _34 = copy _3; - _32 = Add(move _33, move _34); -+ _32 = _23; ++ _32 = copy _23; StorageDead(_34); StorageDead(_33); - _31 = opaque::<u8>(move _32) -> [return: bb12, unwind continue]; -+ _31 = opaque::<u8>(_23) -> [return: bb12, unwind continue]; ++ _31 = opaque::<u8>(copy _23) -> [return: bb12, unwind continue]; } bb12: { diff --git a/tests/mir-opt/gvn.non_freeze.GVN.panic-abort.diff b/tests/mir-opt/gvn.non_freeze.GVN.panic-abort.diff index 7b6ed096118..377b4d7670c 100644 --- a/tests/mir-opt/gvn.non_freeze.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.non_freeze.GVN.panic-abort.diff @@ -7,17 +7,17 @@ let mut _3: &T; bb0: { - _2 = _1; + _2 = copy _1; _3 = &_1; - _0 = opaque::<&T>(_3) -> [return: bb1, unwind unreachable]; + _0 = opaque::<&T>(copy _3) -> [return: bb1, unwind unreachable]; } bb1: { - _0 = opaque::<T>(_2) -> [return: bb2, unwind unreachable]; + _0 = opaque::<T>(copy _2) -> [return: bb2, unwind unreachable]; } bb2: { - _0 = opaque::<T>((*_3)) -> [return: bb3, unwind unreachable]; + _0 = opaque::<T>(copy (*_3)) -> [return: bb3, unwind unreachable]; } bb3: { diff --git a/tests/mir-opt/gvn.non_freeze.GVN.panic-unwind.diff b/tests/mir-opt/gvn.non_freeze.GVN.panic-unwind.diff index 641a2f4609a..988eee07cc9 100644 --- a/tests/mir-opt/gvn.non_freeze.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.non_freeze.GVN.panic-unwind.diff @@ -7,17 +7,17 @@ let mut _3: &T; bb0: { - _2 = _1; + _2 = copy _1; _3 = &_1; - _0 = opaque::<&T>(_3) -> [return: bb1, unwind continue]; + _0 = opaque::<&T>(copy _3) -> [return: bb1, unwind continue]; } bb1: { - _0 = opaque::<T>(_2) -> [return: bb2, unwind continue]; + _0 = opaque::<T>(copy _2) -> [return: bb2, unwind continue]; } bb2: { - _0 = opaque::<T>((*_3)) -> [return: bb3, unwind continue]; + _0 = opaque::<T>(copy (*_3)) -> [return: bb3, unwind continue]; } bb3: { diff --git a/tests/mir-opt/gvn.references.GVN.panic-abort.diff b/tests/mir-opt/gvn.references.GVN.panic-abort.diff index 7799c611445..62a487dee82 100644 --- a/tests/mir-opt/gvn.references.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.references.GVN.panic-abort.diff @@ -120,11 +120,11 @@ StorageLive(_21); - _21 = move _18; - _20 = S::<&mut impl Sized>(move _21); -+ _21 = _18; -+ _20 = S::<&mut impl Sized>(_18); ++ _21 = copy _18; ++ _20 = S::<&mut impl Sized>(copy _18); StorageDead(_21); - _19 = move (_20.0: &mut impl Sized); -+ _19 = _18; ++ _19 = copy _18; StorageDead(_20); StorageLive(_22); StorageLive(_23); diff --git a/tests/mir-opt/gvn.references.GVN.panic-unwind.diff b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff index 880e7913fa9..6dd986907fc 100644 --- a/tests/mir-opt/gvn.references.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.references.GVN.panic-unwind.diff @@ -120,11 +120,11 @@ StorageLive(_21); - _21 = move _18; - _20 = S::<&mut impl Sized>(move _21); -+ _21 = _18; -+ _20 = S::<&mut impl Sized>(_18); ++ _21 = copy _18; ++ _20 = S::<&mut impl Sized>(copy _18); StorageDead(_21); - _19 = move (_20.0: &mut impl Sized); -+ _19 = _18; ++ _19 = copy _18; StorageDead(_20); StorageLive(_22); StorageLive(_23); diff --git a/tests/mir-opt/gvn.remove_casts_must_change_both_sides.GVN.panic-abort.diff b/tests/mir-opt/gvn.remove_casts_must_change_both_sides.GVN.panic-abort.diff index 8b4bfb70401..98cb34810bc 100644 --- a/tests/mir-opt/gvn.remove_casts_must_change_both_sides.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.remove_casts_must_change_both_sides.GVN.panic-abort.diff @@ -7,9 +7,9 @@ let mut _4: *const u8; bb0: { - _3 = (*_1) as *const u8 (PtrToPtr); - _4 = _2 as *const u8 (PtrToPtr); - _0 = Eq(_3, _4); + _3 = copy (*_1) as *const u8 (PtrToPtr); + _4 = copy _2 as *const u8 (PtrToPtr); + _0 = Eq(copy _3, copy _4); return; } } diff --git a/tests/mir-opt/gvn.remove_casts_must_change_both_sides.GVN.panic-unwind.diff b/tests/mir-opt/gvn.remove_casts_must_change_both_sides.GVN.panic-unwind.diff index 8b4bfb70401..98cb34810bc 100644 --- a/tests/mir-opt/gvn.remove_casts_must_change_both_sides.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.remove_casts_must_change_both_sides.GVN.panic-unwind.diff @@ -7,9 +7,9 @@ let mut _4: *const u8; bb0: { - _3 = (*_1) as *const u8 (PtrToPtr); - _4 = _2 as *const u8 (PtrToPtr); - _0 = Eq(_3, _4); + _3 = copy (*_1) as *const u8 (PtrToPtr); + _4 = copy _2 as *const u8 (PtrToPtr); + _0 = Eq(copy _3, copy _4); return; } } diff --git a/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff b/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff index 37915f8578d..ef2eb1a6677 100644 --- a/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.repeat.GVN.panic-abort.diff @@ -28,34 +28,34 @@ _1 = const 5_i32; StorageLive(_2); StorageLive(_3); -- _3 = _1; +- _3 = copy _1; + _3 = const 5_i32; StorageLive(_4); -- _4 = _1; +- _4 = copy _1; + _4 = const 5_i32; StorageLive(_5); -- _5 = _1; +- _5 = copy _1; + _5 = const 5_i32; StorageLive(_6); -- _6 = _1; +- _6 = copy _1; + _6 = const 5_i32; StorageLive(_7); -- _7 = _1; +- _7 = copy _1; + _7 = const 5_i32; StorageLive(_8); -- _8 = _1; +- _8 = copy _1; + _8 = const 5_i32; StorageLive(_9); -- _9 = _1; +- _9 = copy _1; + _9 = const 5_i32; StorageLive(_10); -- _10 = _1; +- _10 = copy _1; + _10 = const 5_i32; StorageLive(_11); -- _11 = _1; +- _11 = copy _1; + _11 = const 5_i32; StorageLive(_12); -- _12 = _1; +- _12 = copy _1; - _2 = [move _3, move _4, move _5, move _6, move _7, move _8, move _9, move _10, move _11, move _12]; + _12 = const 5_i32; + _2 = [const 5_i32; 10]; diff --git a/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff b/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff index 37915f8578d..ef2eb1a6677 100644 --- a/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.repeat.GVN.panic-unwind.diff @@ -28,34 +28,34 @@ _1 = const 5_i32; StorageLive(_2); StorageLive(_3); -- _3 = _1; +- _3 = copy _1; + _3 = const 5_i32; StorageLive(_4); -- _4 = _1; +- _4 = copy _1; + _4 = const 5_i32; StorageLive(_5); -- _5 = _1; +- _5 = copy _1; + _5 = const 5_i32; StorageLive(_6); -- _6 = _1; +- _6 = copy _1; + _6 = const 5_i32; StorageLive(_7); -- _7 = _1; +- _7 = copy _1; + _7 = const 5_i32; StorageLive(_8); -- _8 = _1; +- _8 = copy _1; + _8 = const 5_i32; StorageLive(_9); -- _9 = _1; +- _9 = copy _1; + _9 = const 5_i32; StorageLive(_10); -- _10 = _1; +- _10 = copy _1; + _10 = const 5_i32; StorageLive(_11); -- _11 = _1; +- _11 = copy _1; + _11 = const 5_i32; StorageLive(_12); -- _12 = _1; +- _12 = copy _1; - _2 = [move _3, move _4, move _5, move _6, move _7, move _8, move _9, move _10, move _11, move _12]; + _12 = const 5_i32; + _2 = [const 5_i32; 10]; diff --git a/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff b/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff index 8ce05c9b340..d4b22d05f6c 100644 --- a/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-abort.diff @@ -24,27 +24,27 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; - _3 = [move _4; N]; -+ _3 = [_1; N]; ++ _3 = [copy _1; N]; StorageDead(_4); StorageLive(_5); StorageLive(_6); StorageLive(_7); _7 = const 0_usize; - _8 = Len(_3); -- _9 = Lt(_7, _8); -- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb1, unwind unreachable]; +- _9 = Lt(copy _7, copy _8); +- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, copy _7) -> [success: bb1, unwind unreachable]; + _8 = const N; + _9 = Lt(const 0_usize, const N); + assert(move _9, "index out of bounds: the length is {} but the index is {}", const N, const 0_usize) -> [success: bb1, unwind unreachable]; } bb1: { -- _6 = _3[_7]; +- _6 = copy _3[_7]; - _5 = opaque::<T>(move _6) -> [return: bb2, unwind unreachable]; -+ _6 = _1; -+ _5 = opaque::<T>(_1) -> [return: bb2, unwind unreachable]; ++ _6 = copy _1; ++ _5 = opaque::<T>(copy _1) -> [return: bb2, unwind unreachable]; } bb2: { @@ -54,20 +54,20 @@ StorageLive(_10); StorageLive(_11); StorageLive(_12); - _12 = _2; + _12 = copy _2; - _13 = Len(_3); -- _14 = Lt(_12, _13); -- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind unreachable]; +- _14 = Lt(copy _12, copy _13); +- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, copy _12) -> [success: bb3, unwind unreachable]; + _13 = const N; -+ _14 = Lt(_2, const N); -+ assert(move _14, "index out of bounds: the length is {} but the index is {}", const N, _2) -> [success: bb3, unwind unreachable]; ++ _14 = Lt(copy _2, const N); ++ assert(move _14, "index out of bounds: the length is {} but the index is {}", const N, copy _2) -> [success: bb3, unwind unreachable]; } bb3: { -- _11 = _3[_12]; +- _11 = copy _3[_12]; - _10 = opaque::<T>(move _11) -> [return: bb4, unwind unreachable]; -+ _11 = _1; -+ _10 = opaque::<T>(_1) -> [return: bb4, unwind unreachable]; ++ _11 = copy _1; ++ _10 = opaque::<T>(copy _1) -> [return: bb4, unwind unreachable]; } bb4: { diff --git a/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff b/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff index 7ed547eeb4a..708c0f92e54 100644 --- a/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.repeated_index.GVN.panic-unwind.diff @@ -24,27 +24,27 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; - _3 = [move _4; N]; -+ _3 = [_1; N]; ++ _3 = [copy _1; N]; StorageDead(_4); StorageLive(_5); StorageLive(_6); StorageLive(_7); _7 = const 0_usize; - _8 = Len(_3); -- _9 = Lt(_7, _8); -- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb1, unwind continue]; +- _9 = Lt(copy _7, copy _8); +- assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, copy _7) -> [success: bb1, unwind continue]; + _8 = const N; + _9 = Lt(const 0_usize, const N); + assert(move _9, "index out of bounds: the length is {} but the index is {}", const N, const 0_usize) -> [success: bb1, unwind continue]; } bb1: { -- _6 = _3[_7]; +- _6 = copy _3[_7]; - _5 = opaque::<T>(move _6) -> [return: bb2, unwind continue]; -+ _6 = _1; -+ _5 = opaque::<T>(_1) -> [return: bb2, unwind continue]; ++ _6 = copy _1; ++ _5 = opaque::<T>(copy _1) -> [return: bb2, unwind continue]; } bb2: { @@ -54,20 +54,20 @@ StorageLive(_10); StorageLive(_11); StorageLive(_12); - _12 = _2; + _12 = copy _2; - _13 = Len(_3); -- _14 = Lt(_12, _13); -- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, _12) -> [success: bb3, unwind continue]; +- _14 = Lt(copy _12, copy _13); +- assert(move _14, "index out of bounds: the length is {} but the index is {}", move _13, copy _12) -> [success: bb3, unwind continue]; + _13 = const N; -+ _14 = Lt(_2, const N); -+ assert(move _14, "index out of bounds: the length is {} but the index is {}", const N, _2) -> [success: bb3, unwind continue]; ++ _14 = Lt(copy _2, const N); ++ assert(move _14, "index out of bounds: the length is {} but the index is {}", const N, copy _2) -> [success: bb3, unwind continue]; } bb3: { -- _11 = _3[_12]; +- _11 = copy _3[_12]; - _10 = opaque::<T>(move _11) -> [return: bb4, unwind continue]; -+ _11 = _1; -+ _10 = opaque::<T>(_1) -> [return: bb4, unwind continue]; ++ _11 = copy _1; ++ _10 = opaque::<T>(copy _1) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs index 430f979fec7..faa6faa7017 100644 --- a/tests/mir-opt/gvn.rs +++ b/tests/mir-opt/gvn.rs @@ -3,7 +3,6 @@ // EMIT_MIR_FOR_EACH_PANIC_STRATEGY //@ only-64bit -#![feature(raw_ref_op)] #![feature(rustc_attrs)] #![feature(custom_mir)] #![feature(core_intrinsics)] @@ -21,91 +20,91 @@ struct S<T>(T); fn subexpression_elimination(x: u64, y: u64, mut z: u64) { // CHECK-LABEL: fn subexpression_elimination( - // CHECK: [[add:_.*]] = Add(_1, _2); - // CHECK: opaque::<u64>([[add]]) + // CHECK: [[add:_.*]] = Add(copy _1, copy _2); + // CHECK: opaque::<u64>(copy [[add]]) opaque(x + y); - // CHECK: [[mul:_.*]] = Mul(_1, _2); - // CHECK: opaque::<u64>([[mul]]) + // CHECK: [[mul:_.*]] = Mul(copy _1, copy _2); + // CHECK: opaque::<u64>(copy [[mul]]) opaque(x * y); - // CHECK: [[sub:_.*]] = Sub(_1, _2); - // CHECK: opaque::<u64>([[sub]]) + // CHECK: [[sub:_.*]] = Sub(copy _1, copy _2); + // CHECK: opaque::<u64>(copy [[sub]]) opaque(x - y); - // CHECK: [[div:_.*]] = Div(_1, _2); - // CHECK: opaque::<u64>([[div]]) + // CHECK: [[div:_.*]] = Div(copy _1, copy _2); + // CHECK: opaque::<u64>(copy [[div]]) opaque(x / y); - // CHECK: [[rem:_.*]] = Rem(_1, _2); - // CHECK: opaque::<u64>([[rem]]) + // CHECK: [[rem:_.*]] = Rem(copy _1, copy _2); + // CHECK: opaque::<u64>(copy [[rem]]) opaque(x % y); - // CHECK: [[and:_.*]] = BitAnd(_1, _2); - // CHECK: opaque::<u64>([[and]]) + // CHECK: [[and:_.*]] = BitAnd(copy _1, copy _2); + // CHECK: opaque::<u64>(copy [[and]]) opaque(x & y); - // CHECK: [[or:_.*]] = BitOr(_1, _2); - // CHECK: opaque::<u64>([[or]]) + // CHECK: [[or:_.*]] = BitOr(copy _1, copy _2); + // CHECK: opaque::<u64>(copy [[or]]) opaque(x | y); - // CHECK: [[xor:_.*]] = BitXor(_1, _2); - // CHECK: opaque::<u64>([[xor]]) + // CHECK: [[xor:_.*]] = BitXor(copy _1, copy _2); + // CHECK: opaque::<u64>(copy [[xor]]) opaque(x ^ y); - // CHECK: [[shl:_.*]] = Shl(_1, _2); - // CHECK: opaque::<u64>([[shl]]) + // CHECK: [[shl:_.*]] = Shl(copy _1, copy _2); + // CHECK: opaque::<u64>(copy [[shl]]) opaque(x << y); - // CHECK: [[shr:_.*]] = Shr(_1, _2); - // CHECK: opaque::<u64>([[shr]]) + // CHECK: [[shr:_.*]] = Shr(copy _1, copy _2); + // CHECK: opaque::<u64>(copy [[shr]]) opaque(x >> y); - // CHECK: [[int:_.*]] = _1 as u32 (IntToInt); - // CHECK: opaque::<u32>([[int]]) + // CHECK: [[int:_.*]] = copy _1 as u32 (IntToInt); + // CHECK: opaque::<u32>(copy [[int]]) opaque(x as u32); - // CHECK: [[float:_.*]] = _1 as f32 (IntToFloat); - // CHECK: opaque::<f32>([[float]]) + // CHECK: [[float:_.*]] = copy _1 as f32 (IntToFloat); + // CHECK: opaque::<f32>(copy [[float]]) opaque(x as f32); - // CHECK: [[wrap:_.*]] = S::<u64>(_1); - // CHECK: opaque::<S<u64>>([[wrap]]) + // CHECK: [[wrap:_.*]] = S::<u64>(copy _1); + // CHECK: opaque::<S<u64>>(copy [[wrap]]) opaque(S(x)); - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(S(x).0); // Those are duplicates to substitute somehow. - // CHECK: opaque::<u64>([[add]]) + // CHECK: opaque::<u64>(copy [[add]]) opaque(x + y); - // CHECK: opaque::<u64>([[mul]]) + // CHECK: opaque::<u64>(copy [[mul]]) opaque(x * y); - // CHECK: opaque::<u64>([[sub]]) + // CHECK: opaque::<u64>(copy [[sub]]) opaque(x - y); - // CHECK: opaque::<u64>([[div]]) + // CHECK: opaque::<u64>(copy [[div]]) opaque(x / y); - // CHECK: opaque::<u64>([[rem]]) + // CHECK: opaque::<u64>(copy [[rem]]) opaque(x % y); - // CHECK: opaque::<u64>([[and]]) + // CHECK: opaque::<u64>(copy [[and]]) opaque(x & y); - // CHECK: opaque::<u64>([[or]]) + // CHECK: opaque::<u64>(copy [[or]]) opaque(x | y); - // CHECK: opaque::<u64>([[xor]]) + // CHECK: opaque::<u64>(copy [[xor]]) opaque(x ^ y); - // CHECK: opaque::<u64>([[shl]]) + // CHECK: opaque::<u64>(copy [[shl]]) opaque(x << y); - // CHECK: opaque::<u64>([[shr]]) + // CHECK: opaque::<u64>(copy [[shr]]) opaque(x >> y); - // CHECK: opaque::<u32>([[int]]) + // CHECK: opaque::<u32>(copy [[int]]) opaque(x as u32); - // CHECK: opaque::<f32>([[float]]) + // CHECK: opaque::<f32>(copy [[float]]) opaque(x as f32); - // CHECK: opaque::<S<u64>>([[wrap]]) + // CHECK: opaque::<S<u64>>(copy [[wrap]]) opaque(S(x)); - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(S(x).0); // We can substitute through a complex expression. - // CHECK: [[compound:_.*]] = Sub([[mul]], _2); - // CHECK: opaque::<u64>([[compound]]) - // CHECK: opaque::<u64>([[compound]]) + // CHECK: [[compound:_.*]] = Sub(copy [[mul]], copy _2); + // CHECK: opaque::<u64>(copy [[compound]]) + // CHECK: opaque::<u64>(copy [[compound]]) opaque((x * y) - y); opaque((x * y) - y); // We can substitute through an immutable reference too. // CHECK: [[ref:_.*]] = &_3; - // CHECK: [[deref:_.*]] = (*[[ref]]); - // CHECK: [[addref:_.*]] = Add([[deref]], _1); - // CHECK: opaque::<u64>([[addref]]) - // CHECK: opaque::<u64>([[addref]]) + // CHECK: [[deref:_.*]] = copy (*[[ref]]); + // CHECK: [[addref:_.*]] = Add(copy [[deref]], copy _1); + // CHECK: opaque::<u64>(copy [[addref]]) + // CHECK: opaque::<u64>(copy [[addref]]) let a = &z; opaque(*a + x); opaque(*a + x); @@ -141,10 +140,10 @@ fn subexpression_elimination(x: u64, y: u64, mut z: u64) { // We can substitute again, but not with the earlier computations. // Important: `e` is not `a`! // CHECK: [[ref2:_.*]] = &_3; - // CHECK: [[deref2:_.*]] = (*[[ref2]]); - // CHECK: [[addref2:_.*]] = Add([[deref2]], _1); - // CHECK: opaque::<u64>([[addref2]]) - // CHECK: opaque::<u64>([[addref2]]) + // CHECK: [[deref2:_.*]] = copy (*[[ref2]]); + // CHECK: [[addref2:_.*]] = Add(copy [[deref2]], copy _1); + // CHECK: opaque::<u64>(copy [[addref2]]) + // CHECK: opaque::<u64>(copy [[addref2]]) let e = &z; opaque(*e + x); opaque(*e + x); @@ -152,9 +151,9 @@ fn subexpression_elimination(x: u64, y: u64, mut z: u64) { fn wrap_unwrap<T: Copy>(x: T) -> T { // CHECK-LABEL: fn wrap_unwrap( - // CHECK: [[some:_.*]] = Option::<T>::Some(_1); + // CHECK: [[some:_.*]] = Option::<T>::Some(copy _1); // CHECK: switchInt(const 1_isize) - // CHECK: _0 = _1; + // CHECK: _0 = copy _1; match Some(x) { Some(y) => y, None => panic!(), @@ -163,35 +162,35 @@ fn wrap_unwrap<T: Copy>(x: T) -> T { fn repeated_index<T: Copy, const N: usize>(x: T, idx: usize) { // CHECK-LABEL: fn repeated_index( - // CHECK: [[a:_.*]] = [_1; N]; + // CHECK: [[a:_.*]] = [copy _1; N]; let a = [x; N]; - // CHECK: opaque::<T>(_1) + // CHECK: opaque::<T>(copy _1) opaque(a[0]); - // CHECK: opaque::<T>(_1) + // CHECK: opaque::<T>(copy _1) opaque(a[idx]); } fn unary(x: i64) { // CHECK-LABEL: fn unary( - // CHECK: opaque::<i64>(_1) + // CHECK: opaque::<i64>(copy _1) opaque(--x); // This is `x`. - // CHECK: [[b:_.*]] = Lt(_1, const 13_i64); - // CHECK: opaque::<bool>([[b]]) + // CHECK: [[b:_.*]] = Lt(copy _1, const 13_i64); + // CHECK: opaque::<bool>(copy [[b]]) let b = x < 13; opaque(!!b); // This is `b`. // Both lines should test the same thing. - // CHECK: [[c:_.*]] = Ne(_1, const 15_i64); - // CHECK: opaque::<bool>([[c]]) - // CHECK: opaque::<bool>([[c]]) + // CHECK: [[c:_.*]] = Ne(copy _1, const 15_i64); + // CHECK: opaque::<bool>(copy [[c]]) + // CHECK: opaque::<bool>(copy [[c]]) opaque(x != 15); opaque(!(x == 15)); // Both lines should test the same thing. - // CHECK: [[d:_.*]] = Eq(_1, const 35_i64); - // CHECK: opaque::<bool>([[d]]) - // CHECK: opaque::<bool>([[d]]) + // CHECK: [[d:_.*]] = Eq(copy _1, const 35_i64); + // CHECK: opaque::<bool>(copy [[d]]) + // CHECK: opaque::<bool>(copy [[d]]) opaque(x == 35); opaque(!(x != 35)); } @@ -199,53 +198,53 @@ fn unary(x: i64) { /// Verify symbolic integer arithmetic simplifications. fn arithmetic(x: u64) { // CHECK-LABEL: fn arithmetic( - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x + 0); - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x - 0); // CHECK: opaque::<u64>(const 0_u64) opaque(x - x); // CHECK: opaque::<u64>(const 0_u64) opaque(x * 0); - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x * 1); // CHECK: assert(!const true, "attempt to divide `{}` by zero", - // CHECK: [[div0:_.*]] = Div(_1, const 0_u64); + // CHECK: [[div0:_.*]] = Div(copy _1, const 0_u64); // CHECK: opaque::<u64>(move [[div0]]) opaque(x / 0); - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x / 1); // CHECK: opaque::<u64>(const 0_u64) opaque(0 / x); - // CHECK: [[odiv:_.*]] = Div(const 1_u64, _1); + // CHECK: [[odiv:_.*]] = Div(const 1_u64, copy _1); // CHECK: opaque::<u64>(move [[odiv]]) opaque(1 / x); // CHECK: assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero" - // CHECK: [[rem0:_.*]] = Rem(_1, const 0_u64); + // CHECK: [[rem0:_.*]] = Rem(copy _1, const 0_u64); // CHECK: opaque::<u64>(move [[rem0]]) opaque(x % 0); // CHECK: opaque::<u64>(const 0_u64) opaque(x % 1); // CHECK: opaque::<u64>(const 0_u64) opaque(0 % x); - // CHECK: [[orem:_.*]] = Rem(const 1_u64, _1); + // CHECK: [[orem:_.*]] = Rem(const 1_u64, copy _1); // CHECK: opaque::<u64>(move [[orem]]) opaque(1 % x); // CHECK: opaque::<u64>(const 0_u64) opaque(x & 0); - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x & u64::MAX); - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x | 0); // CHECK: opaque::<u64>(const u64::MAX) opaque(x | u64::MAX); - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x ^ 0); // CHECK: opaque::<u64>(const 0_u64) opaque(x ^ x); - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x >> 0); - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x << 0); } @@ -255,10 +254,10 @@ fn comparison(x: u64, y: u64) { opaque(x == x); // CHECK: opaque::<bool>(const false) opaque(x != x); - // CHECK: [[eqxy:_.*]] = Eq(_1, _2); + // CHECK: [[eqxy:_.*]] = Eq(copy _1, copy _2); // CHECK: opaque::<bool>(move [[eqxy]]) opaque(x == y); - // CHECK: [[nexy:_.*]] = Ne(_1, _2); + // CHECK: [[nexy:_.*]] = Ne(copy _1, copy _2); // CHECK: opaque::<bool>(move [[nexy]]) opaque(x != y); } @@ -268,10 +267,10 @@ fn comparison(x: u64, y: u64) { fn arithmetic_checked(x: u64) { // CHECK-LABEL: fn arithmetic_checked( // CHECK: assert(!const false, - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x + 0); // CHECK: assert(!const false, - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x - 0); // CHECK: assert(!const false, // CHECK: opaque::<u64>(const 0_u64) @@ -280,39 +279,39 @@ fn arithmetic_checked(x: u64) { // CHECK: opaque::<u64>(const 0_u64) opaque(x * 0); // CHECK: assert(!const false, - // CHECK: opaque::<u64>(_1) + // CHECK: opaque::<u64>(copy _1) opaque(x * 1); } /// Verify that we do not apply arithmetic simplifications on floats. fn arithmetic_float(x: f64) { // CHECK-LABEL: fn arithmetic_float( - // CHECK: [[add:_.*]] = Add(_1, const 0f64); + // CHECK: [[add:_.*]] = Add(copy _1, const 0f64); // CHECK: opaque::<f64>(move [[add]]) opaque(x + 0.); - // CHECK: [[sub:_.*]] = Sub(_1, const 0f64); + // CHECK: [[sub:_.*]] = Sub(copy _1, const 0f64); // CHECK: opaque::<f64>(move [[sub]]) opaque(x - 0.); - // CHECK: [[mul:_.*]] = Mul(_1, const 0f64); + // CHECK: [[mul:_.*]] = Mul(copy _1, const 0f64); // CHECK: opaque::<f64>(move [[mul]]) opaque(x * 0.); - // CHECK: [[div0:_.*]] = Div(_1, const 0f64); + // CHECK: [[div0:_.*]] = Div(copy _1, const 0f64); // CHECK: opaque::<f64>(move [[div0]]) opaque(x / 0.); - // CHECK: [[zdiv:_.*]] = Div(const 0f64, _1); + // CHECK: [[zdiv:_.*]] = Div(const 0f64, copy _1); // CHECK: opaque::<f64>(move [[zdiv]]) opaque(0. / x); - // CHECK: [[rem0:_.*]] = Rem(_1, const 0f64); + // CHECK: [[rem0:_.*]] = Rem(copy _1, const 0f64); // CHECK: opaque::<f64>(move [[rem0]]) opaque(x % 0.); - // CHECK: [[zrem:_.*]] = Rem(const 0f64, _1); + // CHECK: [[zrem:_.*]] = Rem(const 0f64, copy _1); // CHECK: opaque::<f64>(move [[zrem]]) opaque(0. % x); // Those are not simplifiable to `true`/`false`, thanks to NaNs. - // CHECK: [[eq:_.*]] = Eq(_1, _1); + // CHECK: [[eq:_.*]] = Eq(copy _1, copy _1); // CHECK: opaque::<bool>(move [[eq]]) opaque(x == x); - // CHECK: [[ne:_.*]] = Ne(_1, _1); + // CHECK: [[ne:_.*]] = Ne(copy _1, copy _1); // CHECK: opaque::<bool>(move [[ne]]) opaque(x != x); } @@ -386,36 +385,36 @@ fn cast() { fn multiple_branches(t: bool, x: u8, y: u8) { // CHECK-LABEL: fn multiple_branches( - // CHECK: switchInt(_1) -> [0: [[bbf:bb.*]], otherwise: [[bbt:bb.*]]]; + // CHECK: switchInt(copy _1) -> [0: [[bbf:bb.*]], otherwise: [[bbt:bb.*]]]; if t { // CHECK: [[bbt]]: { - // CHECK: [[a:_.*]] = Add(_2, _3); - // CHECK: opaque::<u8>([[a]]) - // CHECK: opaque::<u8>([[a]]) + // CHECK: [[a:_.*]] = Add(copy _2, copy _3); + // CHECK: opaque::<u8>(copy [[a]]) + // CHECK: opaque::<u8>(copy [[a]]) // CHECK: goto -> [[bbc:bb.*]]; opaque(x + y); opaque(x + y); } else { // CHECK: [[bbf]]: { - // CHECK: [[b:_.*]] = Add(_2, _3); - // CHECK: opaque::<u8>([[b]]) - // CHECK: opaque::<u8>([[b]]) + // CHECK: [[b:_.*]] = Add(copy _2, copy _3); + // CHECK: opaque::<u8>(copy [[b]]) + // CHECK: opaque::<u8>(copy [[b]]) // CHECK: goto -> [[bbc:bb.*]]; opaque(x + y); opaque(x + y); } // Neither `a` nor `b` dominate `c`, so we cannot reuse any of them. // CHECK: [[bbc]]: { - // CHECK: [[c:_.*]] = Add(_2, _3); - // CHECK: opaque::<u8>([[c]]) + // CHECK: [[c:_.*]] = Add(copy _2, copy _3); + // CHECK: opaque::<u8>(copy [[c]]) opaque(x + y); // `c` dominates both calls, so we can reuse it. if t { - // CHECK: opaque::<u8>([[c]]) + // CHECK: opaque::<u8>(copy [[c]]) opaque(x + y); } else { - // CHECK: opaque::<u8>([[c]]) + // CHECK: opaque::<u8>(copy [[c]]) opaque(x + y); } } @@ -469,18 +468,18 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S<u32>) { // CHECK-LABEL: fn dereferences( // Do not reuse dereferences of `&mut`. - // CHECK: [[st1:_.*]] = (*_1); + // CHECK: [[st1:_.*]] = copy (*_1); // CHECK: opaque::<u32>(move [[st1]]) - // CHECK: [[st2:_.*]] = (*_1); + // CHECK: [[st2:_.*]] = copy (*_1); // CHECK: opaque::<u32>(move [[st2]]) opaque(*t); opaque(*t); // Do not reuse dereferences of `*const`. // CHECK: [[raw:_.*]] = &raw const (*_1); - // CHECK: [[st3:_.*]] = (*[[raw]]); + // CHECK: [[st3:_.*]] = copy (*[[raw]]); // CHECK: opaque::<u32>(move [[st3]]) - // CHECK: [[st4:_.*]] = (*[[raw]]); + // CHECK: [[st4:_.*]] = copy (*[[raw]]); // CHECK: opaque::<u32>(move [[st4]]) let z = &raw const *t; unsafe { opaque(*z) }; @@ -488,9 +487,9 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S<u32>) { // Do not reuse dereferences of `*mut`. // CHECK: [[ptr:_.*]] = &raw mut (*_1); - // CHECK: [[st5:_.*]] = (*[[ptr]]); + // CHECK: [[st5:_.*]] = copy (*[[ptr]]); // CHECK: opaque::<u32>(move [[st5]]) - // CHECK: [[st6:_.*]] = (*[[ptr]]); + // CHECK: [[st6:_.*]] = copy (*[[ptr]]); // CHECK: opaque::<u32>(move [[st6]]) let z = &raw mut *t; unsafe { opaque(*z) }; @@ -498,9 +497,9 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S<u32>) { // We can reuse dereferences of `&Freeze`. // CHECK: [[ref:_.*]] = &(*_1); - // CHECK: [[st7:_.*]] = (*[[ref]]); - // CHECK: opaque::<u32>([[st7]]) - // CHECK: opaque::<u32>([[st7]]) + // CHECK: [[st7:_.*]] = copy (*[[ref]]); + // CHECK: opaque::<u32>(copy [[st7]]) + // CHECK: opaque::<u32>(copy [[st7]]) let z = &*t; opaque(*z); opaque(*z); @@ -510,17 +509,17 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S<u32>) { opaque(&*z); // `*u` is not Freeze, so we cannot reuse. - // CHECK: [[st8:_.*]] = (*_2); + // CHECK: [[st8:_.*]] = copy (*_2); // CHECK: opaque::<impl Copy>(move [[st8]]) - // CHECK: [[st9:_.*]] = (*_2); + // CHECK: [[st9:_.*]] = copy (*_2); // CHECK: opaque::<impl Copy>(move [[st9]]) opaque(*u); opaque(*u); - // `*s` is not Copy, by `(*s).0` is, so we can reuse. - // CHECK: [[st10:_.*]] = ((*_3).0: u32); - // CHECK: opaque::<u32>([[st10]]) - // CHECK: opaque::<u32>([[st10]]) + // `*s` is not Copy, but `(*s).0` is, so we can reuse. + // CHECK: [[st10:_.*]] = copy ((*_3).0: u32); + // CHECK: opaque::<u32>(copy [[st10]]) + // CHECK: opaque::<u32>(copy [[st10]]) opaque(s.0); opaque(s.0); } @@ -551,38 +550,38 @@ fn duplicate_slice() -> (bool, bool) { let d: &str; { // CHECK: [[a:_.*]] = (const "a",); - // CHECK: [[au:_.*]] = ([[a]].0: &str) as u128 (Transmute); + // CHECK: [[au:_.*]] = copy ([[a]].0: &str) as u128 (Transmute); let a = ("a",); Call(au = transmute::<_, u128>(a.0), ReturnTo(bb1), UnwindContinue()) } bb1 = { - // CHECK: [[c:_.*]] = identity::<&str>(([[a]].0: &str)) + // CHECK: [[c:_.*]] = identity::<&str>(copy ([[a]].0: &str)) Call(c = identity(a.0), ReturnTo(bb2), UnwindContinue()) } bb2 = { - // CHECK: [[cu:_.*]] = [[c]] as u128 (Transmute); + // CHECK: [[cu:_.*]] = copy [[c]] as u128 (Transmute); Call(cu = transmute::<_, u128>(c), ReturnTo(bb3), UnwindContinue()) } bb3 = { // This slice is different from `a.0`. Hence `bu` is not `au`. // CHECK: [[b:_.*]] = const "a"; - // CHECK: [[bu:_.*]] = [[b]] as u128 (Transmute); + // CHECK: [[bu:_.*]] = copy [[b]] as u128 (Transmute); let b = "a"; Call(bu = transmute::<_, u128>(b), ReturnTo(bb4), UnwindContinue()) } bb4 = { // This returns a copy of `b`, which is not `a`. - // CHECK: [[d:_.*]] = identity::<&str>([[b]]) + // CHECK: [[d:_.*]] = identity::<&str>(copy [[b]]) Call(d = identity(b), ReturnTo(bb5), UnwindContinue()) } bb5 = { - // CHECK: [[du:_.*]] = [[d]] as u128 (Transmute); + // CHECK: [[du:_.*]] = copy [[d]] as u128 (Transmute); Call(du = transmute::<_, u128>(d), ReturnTo(bb6), UnwindContinue()) } bb6 = { // `direct` must not fold to `true`, as `indirect` will not. - // CHECK: = Eq([[au]], [[bu]]); - // CHECK: = Eq([[cu]], [[du]]); + // CHECK: = Eq(copy [[au]], copy [[bu]]); + // CHECK: = Eq(copy [[cu]], copy [[du]]); let direct = au == bu; let indirect = cu == du; RET = (direct, indirect); @@ -602,21 +601,21 @@ fn repeat() { fn fn_pointers() { // CHECK-LABEL: fn fn_pointers( // CHECK: [[f:_.*]] = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer - // CHECK: opaque::<fn(u8) -> u8>([[f]]) + // CHECK: opaque::<fn(u8) -> u8>(copy [[f]]) let f = identity as fn(u8) -> u8; opaque(f); // CHECK: [[g:_.*]] = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer - // CHECK: opaque::<fn(u8) -> u8>([[g]]) + // CHECK: opaque::<fn(u8) -> u8>(copy [[g]]) let g = identity as fn(u8) -> u8; opaque(g); // CHECK: [[cf:_.*]] = const {{.*}} as fn() (PointerCoercion(ClosureFnPointer - // CHECK: opaque::<fn()>([[cf]]) + // CHECK: opaque::<fn()>(copy [[cf]]) let closure = || {}; let cf = closure as fn(); opaque(cf); // CHECK: [[cg:_.*]] = const {{.*}} as fn() (PointerCoercion(ClosureFnPointer - // CHECK: opaque::<fn()>([[cg]]) + // CHECK: opaque::<fn()>(copy [[cg]]) let cg = closure as fn(); opaque(cg); } @@ -642,9 +641,9 @@ fn constant_index_overflow<T: Copy>(x: &[T]) { // CHECK: debug b => [[b:_.*]]; // CHECK: [[a]] = const usize::MAX; // CHECK-NOT: = (*_1)[{{.*}} of 0]; - // CHECK: [[b]] = (*_1)[[[a]]]; + // CHECK: [[b]] = copy (*_1)[[[a]]]; // CHECK-NOT: = (*_1)[{{.*}} of 0]; - // CHECK: [[b]] = (*_1)[0 of 1]; + // CHECK: [[b]] = copy (*_1)[0 of 1]; // CHECK-NOT: = (*_1)[{{.*}} of 0]; let a = u64::MAX as usize; let b = if a < x.len() { x[a] } else { x[0] }; @@ -657,22 +656,22 @@ fn wide_ptr_provenance() { let a: *const dyn Send = &1 as &dyn Send; let b: *const dyn Send = &1 as &dyn Send; - // CHECK: [[eqp:_.*]] = Eq([[a:_.*]], [[b:_.*]]); + // CHECK: [[eqp:_.*]] = Eq(copy [[a:_.*]], copy [[b:_.*]]); // CHECK: opaque::<bool>(move [[eqp]]) opaque(a == b); - // CHECK: [[nep:_.*]] = Ne([[a]], [[b]]); + // CHECK: [[nep:_.*]] = Ne(copy [[a]], copy [[b]]); // CHECK: opaque::<bool>(move [[nep]]) opaque(a != b); - // CHECK: [[ltp:_.*]] = Lt([[a]], [[b]]); + // CHECK: [[ltp:_.*]] = Lt(copy [[a]], copy [[b]]); // CHECK: opaque::<bool>(move [[ltp]]) opaque(a < b); - // CHECK: [[lep:_.*]] = Le([[a]], [[b]]); + // CHECK: [[lep:_.*]] = Le(copy [[a]], copy [[b]]); // CHECK: opaque::<bool>(move [[lep]]) opaque(a <= b); - // CHECK: [[gtp:_.*]] = Gt([[a]], [[b]]); + // CHECK: [[gtp:_.*]] = Gt(copy [[a]], copy [[b]]); // CHECK: opaque::<bool>(move [[gtp]]) opaque(a > b); - // CHECK: [[gep:_.*]] = Ge([[a]], [[b]]); + // CHECK: [[gep:_.*]] = Ge(copy [[a]], copy [[b]]); // CHECK: opaque::<bool>(move [[gep]]) opaque(a >= b); } @@ -684,22 +683,22 @@ fn wide_ptr_same_provenance() { let a: *const dyn Send = &slice[0] as &dyn Send; let b: *const dyn Send = &slice[1] as &dyn Send; - // CHECK: [[eqp:_.*]] = Eq([[a:_.*]], [[b:_.*]]); + // CHECK: [[eqp:_.*]] = Eq(copy [[a:_.*]], copy [[b:_.*]]); // CHECK: opaque::<bool>(move [[eqp]]) opaque(a == b); - // CHECK: [[nep:_.*]] = Ne([[a]], [[b]]); + // CHECK: [[nep:_.*]] = Ne(copy [[a]], copy [[b]]); // CHECK: opaque::<bool>(move [[nep]]) opaque(a != b); - // CHECK: [[ltp:_.*]] = Lt([[a]], [[b]]); + // CHECK: [[ltp:_.*]] = Lt(copy [[a]], copy [[b]]); // CHECK: opaque::<bool>(move [[ltp]]) opaque(a < b); - // CHECK: [[lep:_.*]] = Le([[a]], [[b]]); + // CHECK: [[lep:_.*]] = Le(copy [[a]], copy [[b]]); // CHECK: opaque::<bool>(move [[lep]]) opaque(a <= b); - // CHECK: [[gtp:_.*]] = Gt([[a]], [[b]]); + // CHECK: [[gtp:_.*]] = Gt(copy [[a]], copy [[b]]); // CHECK: opaque::<bool>(move [[gtp]]) opaque(a > b); - // CHECK: [[gep:_.*]] = Ge([[a]], [[b]]); + // CHECK: [[gep:_.*]] = Ge(copy [[a]], copy [[b]]); // CHECK: opaque::<bool>(move [[gep]]) opaque(a >= b); } @@ -731,13 +730,13 @@ fn wide_ptr_integer() { fn borrowed<T: Copy + Freeze>(x: T) { // CHECK-LABEL: fn borrowed( // CHECK: bb0: { - // CHECK-NEXT: _2 = _1; + // CHECK-NEXT: _2 = copy _1; // CHECK-NEXT: _3 = &_1; - // CHECK-NEXT: _0 = opaque::<&T>(_3) + // CHECK-NEXT: _0 = opaque::<&T>(copy _3) // CHECK: bb1: { - // CHECK-NEXT: _0 = opaque::<T>(_1) + // CHECK-NEXT: _0 = opaque::<T>(copy _1) // CHECK: bb2: { - // CHECK-NEXT: _0 = opaque::<T>(_1) + // CHECK-NEXT: _0 = opaque::<T>(copy _1) mir! { { let a = x; @@ -761,13 +760,13 @@ fn borrowed<T: Copy + Freeze>(x: T) { fn non_freeze<T: Copy>(x: T) { // CHECK-LABEL: fn non_freeze( // CHECK: bb0: { - // CHECK-NEXT: _2 = _1; + // CHECK-NEXT: _2 = copy _1; // CHECK-NEXT: _3 = &_1; - // CHECK-NEXT: _0 = opaque::<&T>(_3) + // CHECK-NEXT: _0 = opaque::<&T>(copy _3) // CHECK: bb1: { - // CHECK-NEXT: _0 = opaque::<T>(_2) + // CHECK-NEXT: _0 = opaque::<T>(copy _2) // CHECK: bb2: { - // CHECK-NEXT: _0 = opaque::<T>((*_3)) + // CHECK-NEXT: _0 = opaque::<T>(copy (*_3)) mir! { { let a = x; @@ -789,7 +788,7 @@ fn non_freeze<T: Copy>(x: T) { // Check that we can const-prop into `from_raw_parts` fn slice_const_length(x: &[i32]) -> *const [i32] { // CHECK-LABEL: fn slice_const_length( - // CHECK: _0 = *const [i32] from ({{_[0-9]+}}, const 123_usize); + // CHECK: _0 = *const [i32] from (copy {{_[0-9]+}}, const 123_usize); let ptr = x.as_ptr(); let len = 123; std::intrinsics::aggregate_raw_ptr(ptr, len) @@ -804,15 +803,15 @@ fn meta_of_ref_to_slice(x: *const i32) -> usize { fn slice_from_raw_parts_as_ptr(x: *const u16, n: usize) -> (*const u16, *const f32) { // CHECK-LABEL: fn slice_from_raw_parts_as_ptr - // CHECK: _8 = _1 as *const f32 (PtrToPtr); - // CHECK: _0 = (_1, move _8); + // CHECK: _8 = copy _1 as *const f32 (PtrToPtr); + // CHECK: _0 = (copy _1, move _8); let ptr: *const [u16] = std::intrinsics::aggregate_raw_ptr(x, n); (ptr as *const u16, ptr as *const f32) } fn casts_before_aggregate_raw_ptr(x: *const u32) -> *const [u8] { // CHECK-LABEL: fn casts_before_aggregate_raw_ptr - // CHECK: _0 = *const [u8] from (_1, const 4_usize); + // CHECK: _0 = *const [u8] from (copy _1, const 4_usize); let x = x as *const [u8; 4]; let x = x as *const u8; let x = x as *const (); @@ -821,7 +820,7 @@ fn casts_before_aggregate_raw_ptr(x: *const u32) -> *const [u8] { fn manual_slice_mut_len(x: &mut [i32]) -> usize { // CHECK-LABEL: fn manual_slice_mut_len - // CHECK: _0 = PtrMetadata(_1); + // CHECK: _0 = PtrMetadata(copy _1); let x: *mut [i32] = x; let x: *const [i32] = x; std::intrinsics::ptr_metadata(x) @@ -844,38 +843,38 @@ fn generic_cast_metadata<T, A: ?Sized, B: ?Sized>(ps: *const [T], pa: *const A, // when the pointee metadata do or don't match, respectively. // Metadata usize -> (), do not optimize. - // CHECK: [[T:_.+]] = _1 as - // CHECK-NEXT: PtrMetadata([[T]]) + // CHECK: [[T:_.+]] = copy _1 as + // CHECK-NEXT: PtrMetadata(copy [[T]]) let t1 = CastPtrToPtr::<_, *const T>(ps); let m1 = PtrMetadata(t1); // `(&A, [T])` has `usize` metadata, same as `[T]`, yes optimize. - // CHECK: [[T:_.+]] = _1 as - // CHECK-NEXT: PtrMetadata(_1) + // CHECK: [[T:_.+]] = copy _1 as + // CHECK-NEXT: PtrMetadata(copy _1) let t2 = CastPtrToPtr::<_, *const (&A, [T])>(ps); let m2 = PtrMetadata(t2); // Tail `A` and tail `B`, do not optimize. - // CHECK: [[T:_.+]] = _2 as - // CHECK-NEXT: PtrMetadata([[T]]) + // CHECK: [[T:_.+]] = copy _2 as + // CHECK-NEXT: PtrMetadata(copy [[T]]) let t3 = CastPtrToPtr::<_, *const (T, B)>(pa); let m3 = PtrMetadata(t3); // Both have tail `A`, yes optimize. - // CHECK: [[T:_.+]] = _2 as - // CHECK-NEXT: PtrMetadata(_2) + // CHECK: [[T:_.+]] = copy _2 as + // CHECK-NEXT: PtrMetadata(copy _2) let t4 = CastPtrToPtr::<_, *const (T, A)>(pa); let m4 = PtrMetadata(t4); // Tail `B` and tail `A`, do not optimize. - // CHECK: [[T:_.+]] = _3 as - // CHECK-NEXT: PtrMetadata([[T]]) + // CHECK: [[T:_.+]] = copy _3 as + // CHECK-NEXT: PtrMetadata(copy [[T]]) let t5 = CastPtrToPtr::<_, *mut A>(pb); let m5 = PtrMetadata(t5); // Both have tail `B`, yes optimize. - // CHECK: [[T:_.+]] = _3 as - // CHECK-NEXT: PtrMetadata(_3) + // CHECK: [[T:_.+]] = copy _3 as + // CHECK-NEXT: PtrMetadata(copy _3) let t6 = CastPtrToPtr::<_, *mut B>(pb); let m6 = PtrMetadata(t6); @@ -891,21 +890,21 @@ fn cast_pointer_eq(p1: *mut u8, p2: *mut u32, p3: *mut u32, p4: *mut [u32]) { // CHECK: debug p3 => [[P3:_3]]; // CHECK: debug p4 => [[P4:_4]]; - // CHECK: [[M1:_.+]] = [[P1]] as *const u32 (PtrToPtr); - // CHECK: [[M2:_.+]] = [[P2]] as *const u32 (PtrToPtr); - // CHECK: [[M3:_.+]] = [[P3]] as *const u32 (PtrToPtr); - // CHECK: [[M4:_.+]] = [[P4]] as *const u32 (PtrToPtr); + // CHECK: [[M1:_.+]] = copy [[P1]] as *const u32 (PtrToPtr); + // CHECK: [[M2:_.+]] = copy [[P2]] as *const u32 (PtrToPtr); + // CHECK: [[M3:_.+]] = copy [[P3]] as *const u32 (PtrToPtr); + // CHECK: [[M4:_.+]] = copy [[P4]] as *const u32 (PtrToPtr); let m1 = p1 as *const u32; let m2 = p2 as *const u32; let m3 = p3 as *const u32; let m4 = p4 as *const u32; // CHECK-NOT: Eq - // CHECK: Eq([[M1]], [[M2]]) + // CHECK: Eq(copy [[M1]], copy [[M2]]) // CHECK-NOT: Eq - // CHECK: Eq([[P2]], [[P3]]) + // CHECK: Eq(copy [[P2]], copy [[P3]]) // CHECK-NOT: Eq - // CHECK: Eq([[M3]], [[M4]]) + // CHECK: Eq(copy [[M3]], copy [[M4]]) // CHECK-NOT: Eq let eq_different_thing = m1 == m2; let eq_optimize = m2 == m3; @@ -918,11 +917,11 @@ fn cast_pointer_eq(p1: *mut u8, p2: *mut u32, p3: *mut u32, p4: *mut [u32]) { unsafe fn cast_pointer_then_transmute(thin: *mut u32, fat: *mut [u8]) { // CHECK-LABEL: fn cast_pointer_then_transmute - // CHECK: [[UNUSED:_.+]] = _1 as *const () (PtrToPtr); - // CHECK: = _1 as usize (Transmute); + // CHECK: [[UNUSED:_.+]] = copy _1 as *const () (PtrToPtr); + // CHECK: = copy _1 as usize (Transmute); let thin_addr: usize = std::intrinsics::transmute(thin as *const ()); - // CHECK: [[TEMP2:_.+]] = _2 as *const () (PtrToPtr); + // CHECK: [[TEMP2:_.+]] = copy _2 as *const () (PtrToPtr); // CHECK: = move [[TEMP2]] as usize (Transmute); let fat_addr: usize = std::intrinsics::transmute(fat as *const ()); } @@ -935,11 +934,11 @@ fn remove_casts_must_change_both_sides(mut_a: &*mut u8, mut_b: *mut u8) -> bool // to be locals, so make sure we don't change one without the other, as // that would be a type error. { - // CHECK: [[A:_.+]] = (*_1) as *const u8 (PtrToPtr); + // CHECK: [[A:_.+]] = copy (*_1) as *const u8 (PtrToPtr); let a = *mut_a as *const u8; - // CHECK: [[B:_.+]] = _2 as *const u8 (PtrToPtr); + // CHECK: [[B:_.+]] = copy _2 as *const u8 (PtrToPtr); let b = mut_b as *const u8; - // CHECK: _0 = Eq([[A]], [[B]]); + // CHECK: _0 = Eq(copy [[A]], copy [[B]]); RET = a == b; Return() } diff --git a/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff b/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff index fd5fa035d81..1a6204e4ac8 100644 --- a/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.slice_const_length.GVN.panic-abort.diff @@ -30,12 +30,12 @@ + nop; _4 = const 123_usize; StorageLive(_5); - _5 = _2; + _5 = copy _2; StorageLive(_6); -- _6 = _4; +- _6 = copy _4; - _0 = *const [i32] from (move _5, move _6); + _6 = const 123_usize; -+ _0 = *const [i32] from (_2, const 123_usize); ++ _0 = *const [i32] from (copy _2, const 123_usize); StorageDead(_6); StorageDead(_5); - StorageDead(_4); diff --git a/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff index 98945cf9724..62d57b0fe28 100644 --- a/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.slice_const_length.GVN.panic-unwind.diff @@ -30,12 +30,12 @@ + nop; _4 = const 123_usize; StorageLive(_5); - _5 = _2; + _5 = copy _2; StorageLive(_6); -- _6 = _4; +- _6 = copy _4; - _0 = *const [i32] from (move _5, move _6); + _6 = const 123_usize; -+ _0 = *const [i32] from (_2, const 123_usize); ++ _0 = *const [i32] from (copy _2, const 123_usize); StorageDead(_6); StorageDead(_5); - StorageDead(_4); diff --git a/tests/mir-opt/gvn.slice_from_raw_parts_as_ptr.GVN.panic-abort.diff b/tests/mir-opt/gvn.slice_from_raw_parts_as_ptr.GVN.panic-abort.diff index 75bcd2a8d72..4a2cc251891 100644 --- a/tests/mir-opt/gvn.slice_from_raw_parts_as_ptr.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.slice_from_raw_parts_as_ptr.GVN.panic-abort.diff @@ -20,27 +20,27 @@ - StorageLive(_3); + nop; StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = *const [u16] from (move _4, move _5); -+ _3 = *const [u16] from (_1, _2); ++ _3 = *const [u16] from (copy _1, copy _2); StorageDead(_5); StorageDead(_4); StorageLive(_6); StorageLive(_7); - _7 = _3; + _7 = copy _3; - _6 = move _7 as *const u16 (PtrToPtr); -+ _6 = _1; ++ _6 = copy _1; StorageDead(_7); StorageLive(_8); StorageLive(_9); - _9 = _3; + _9 = copy _3; - _8 = move _9 as *const f32 (PtrToPtr); -+ _8 = _1 as *const f32 (PtrToPtr); ++ _8 = copy _1 as *const f32 (PtrToPtr); StorageDead(_9); - _0 = (move _6, move _8); -+ _0 = (_1, move _8); ++ _0 = (copy _1, move _8); StorageDead(_8); StorageDead(_6); - StorageDead(_3); diff --git a/tests/mir-opt/gvn.slice_from_raw_parts_as_ptr.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slice_from_raw_parts_as_ptr.GVN.panic-unwind.diff index 75bcd2a8d72..4a2cc251891 100644 --- a/tests/mir-opt/gvn.slice_from_raw_parts_as_ptr.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.slice_from_raw_parts_as_ptr.GVN.panic-unwind.diff @@ -20,27 +20,27 @@ - StorageLive(_3); + nop; StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = *const [u16] from (move _4, move _5); -+ _3 = *const [u16] from (_1, _2); ++ _3 = *const [u16] from (copy _1, copy _2); StorageDead(_5); StorageDead(_4); StorageLive(_6); StorageLive(_7); - _7 = _3; + _7 = copy _3; - _6 = move _7 as *const u16 (PtrToPtr); -+ _6 = _1; ++ _6 = copy _1; StorageDead(_7); StorageLive(_8); StorageLive(_9); - _9 = _3; + _9 = copy _3; - _8 = move _9 as *const f32 (PtrToPtr); -+ _8 = _1 as *const f32 (PtrToPtr); ++ _8 = copy _1 as *const f32 (PtrToPtr); StorageDead(_9); - _0 = (move _6, move _8); -+ _0 = (_1, move _8); ++ _0 = (copy _1, move _8); StorageDead(_8); StorageDead(_6); - StorageDead(_3); diff --git a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff index fb67e3d5994..e8e99b44e72 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-abort.diff @@ -87,22 +87,22 @@ _1 = const "my favourite slice"; StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = opaque::<&str>(move _3) -> [return: bb1, unwind unreachable]; -+ _2 = opaque::<&str>(_1) -> [return: bb1, unwind unreachable]; ++ _2 = opaque::<&str>(copy _1) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_3); StorageDead(_2); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); StorageLive(_6); -- _6 = _4; +- _6 = copy _4; - _5 = opaque::<&str>(move _6) -> [return: bb2, unwind unreachable]; -+ _6 = _1; -+ _5 = opaque::<&str>(_1) -> [return: bb2, unwind unreachable]; ++ _6 = copy _1; ++ _5 = opaque::<&str>(copy _1) -> [return: bb2, unwind unreachable]; } bb2: { @@ -138,24 +138,24 @@ - _8 = (move _9, move _12); - StorageDead(_12); - StorageDead(_9); -+ _8 = (_9, _12); ++ _8 = (copy _9, copy _12); + nop; + nop; StorageLive(_15); -- _15 = (_8.0: &*const u8); -+ _15 = _9; +- _15 = copy (_8.0: &*const u8); ++ _15 = copy _9; StorageLive(_16); -- _16 = (_8.1: &*const u8); -+ _16 = _12; +- _16 = copy (_8.1: &*const u8); ++ _16 = copy _12; StorageLive(_17); StorageLive(_18); -- _18 = (*_15); -+ _18 = _10; +- _18 = copy (*_15); ++ _18 = copy _10; StorageLive(_19); -- _19 = (*_16); +- _19 = copy (*_16); - _17 = Eq(move _18, move _19); -+ _19 = _13; -+ _17 = Eq(_10, _13); ++ _19 = copy _13; ++ _17 = Eq(copy _10, copy _13); switchInt(move _17) -> [0: bb6, otherwise: bb5]; } @@ -180,9 +180,9 @@ StorageDead(_30); StorageLive(_31); StorageLive(_32); - _32 = _29; + _32 = copy _29; - _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind unreachable]; -+ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind unreachable]; ++ _31 = opaque::<&[u8]>(copy _29) -> [return: bb7, unwind unreachable]; } bb6: { @@ -244,24 +244,24 @@ - _34 = (move _35, move _38); - StorageDead(_38); - StorageDead(_35); -+ _34 = (_35, _38); ++ _34 = (copy _35, copy _38); + nop; + nop; StorageLive(_41); -- _41 = (_34.0: &*const u8); -+ _41 = _35; +- _41 = copy (_34.0: &*const u8); ++ _41 = copy _35; StorageLive(_42); -- _42 = (_34.1: &*const u8); -+ _42 = _38; +- _42 = copy (_34.1: &*const u8); ++ _42 = copy _38; StorageLive(_43); StorageLive(_44); -- _44 = (*_41); -+ _44 = _36; +- _44 = copy (*_41); ++ _44 = copy _36; StorageLive(_45); -- _45 = (*_42); +- _45 = copy (*_42); - _43 = Eq(move _44, move _45); -+ _45 = _39; -+ _43 = Eq(_36, _39); ++ _45 = copy _39; ++ _43 = Eq(copy _36, copy _39); switchInt(move _43) -> [0: bb11, otherwise: bb10]; } diff --git a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff index ae3013b011e..4296d4d4a59 100644 --- a/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.slices.GVN.panic-unwind.diff @@ -87,22 +87,22 @@ _1 = const "my favourite slice"; StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = opaque::<&str>(move _3) -> [return: bb1, unwind continue]; -+ _2 = opaque::<&str>(_1) -> [return: bb1, unwind continue]; ++ _2 = opaque::<&str>(copy _1) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_3); StorageDead(_2); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); StorageLive(_6); -- _6 = _4; +- _6 = copy _4; - _5 = opaque::<&str>(move _6) -> [return: bb2, unwind continue]; -+ _6 = _1; -+ _5 = opaque::<&str>(_1) -> [return: bb2, unwind continue]; ++ _6 = copy _1; ++ _5 = opaque::<&str>(copy _1) -> [return: bb2, unwind continue]; } bb2: { @@ -138,24 +138,24 @@ - _8 = (move _9, move _12); - StorageDead(_12); - StorageDead(_9); -+ _8 = (_9, _12); ++ _8 = (copy _9, copy _12); + nop; + nop; StorageLive(_15); -- _15 = (_8.0: &*const u8); -+ _15 = _9; +- _15 = copy (_8.0: &*const u8); ++ _15 = copy _9; StorageLive(_16); -- _16 = (_8.1: &*const u8); -+ _16 = _12; +- _16 = copy (_8.1: &*const u8); ++ _16 = copy _12; StorageLive(_17); StorageLive(_18); -- _18 = (*_15); -+ _18 = _10; +- _18 = copy (*_15); ++ _18 = copy _10; StorageLive(_19); -- _19 = (*_16); +- _19 = copy (*_16); - _17 = Eq(move _18, move _19); -+ _19 = _13; -+ _17 = Eq(_10, _13); ++ _19 = copy _13; ++ _17 = Eq(copy _10, copy _13); switchInt(move _17) -> [0: bb6, otherwise: bb5]; } @@ -180,9 +180,9 @@ StorageDead(_30); StorageLive(_31); StorageLive(_32); - _32 = _29; + _32 = copy _29; - _31 = opaque::<&[u8]>(move _32) -> [return: bb7, unwind continue]; -+ _31 = opaque::<&[u8]>(_29) -> [return: bb7, unwind continue]; ++ _31 = opaque::<&[u8]>(copy _29) -> [return: bb7, unwind continue]; } bb6: { @@ -244,24 +244,24 @@ - _34 = (move _35, move _38); - StorageDead(_38); - StorageDead(_35); -+ _34 = (_35, _38); ++ _34 = (copy _35, copy _38); + nop; + nop; StorageLive(_41); -- _41 = (_34.0: &*const u8); -+ _41 = _35; +- _41 = copy (_34.0: &*const u8); ++ _41 = copy _35; StorageLive(_42); -- _42 = (_34.1: &*const u8); -+ _42 = _38; +- _42 = copy (_34.1: &*const u8); ++ _42 = copy _38; StorageLive(_43); StorageLive(_44); -- _44 = (*_41); -+ _44 = _36; +- _44 = copy (*_41); ++ _44 = copy _36; StorageLive(_45); -- _45 = (*_42); +- _45 = copy (*_42); - _43 = Eq(move _44, move _45); -+ _45 = _39; -+ _43 = Eq(_36, _39); ++ _45 = copy _39; ++ _43 = Eq(copy _36, copy _39); switchInt(move _43) -> [0: bb11, otherwise: bb10]; } diff --git a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff index ba9e507560d..7a479bc55da 100644 --- a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-abort.diff @@ -195,15 +195,15 @@ - StorageLive(_5); + nop; StorageLive(_6); - _6 = _1; + _6 = copy _1; StorageLive(_7); - _7 = _2; + _7 = copy _2; - _5 = Add(move _6, move _7); -+ _5 = Add(_1, _2); ++ _5 = Add(copy _1, copy _2); StorageDead(_7); StorageDead(_6); - _4 = opaque::<u64>(move _5) -> [return: bb1, unwind unreachable]; -+ _4 = opaque::<u64>(_5) -> [return: bb1, unwind unreachable]; ++ _4 = opaque::<u64>(copy _5) -> [return: bb1, unwind unreachable]; } bb1: { @@ -214,15 +214,15 @@ - StorageLive(_9); + nop; StorageLive(_10); - _10 = _1; + _10 = copy _1; StorageLive(_11); - _11 = _2; + _11 = copy _2; - _9 = Mul(move _10, move _11); -+ _9 = Mul(_1, _2); ++ _9 = Mul(copy _1, copy _2); StorageDead(_11); StorageDead(_10); - _8 = opaque::<u64>(move _9) -> [return: bb2, unwind unreachable]; -+ _8 = opaque::<u64>(_9) -> [return: bb2, unwind unreachable]; ++ _8 = opaque::<u64>(copy _9) -> [return: bb2, unwind unreachable]; } bb2: { @@ -233,15 +233,15 @@ - StorageLive(_13); + nop; StorageLive(_14); - _14 = _1; + _14 = copy _1; StorageLive(_15); - _15 = _2; + _15 = copy _2; - _13 = Sub(move _14, move _15); -+ _13 = Sub(_1, _2); ++ _13 = Sub(copy _1, copy _2); StorageDead(_15); StorageDead(_14); - _12 = opaque::<u64>(move _13) -> [return: bb3, unwind unreachable]; -+ _12 = opaque::<u64>(_13) -> [return: bb3, unwind unreachable]; ++ _12 = opaque::<u64>(copy _13) -> [return: bb3, unwind unreachable]; } bb3: { @@ -252,22 +252,22 @@ - StorageLive(_17); + nop; StorageLive(_18); - _18 = _1; + _18 = copy _1; StorageLive(_19); - _19 = _2; -- _20 = Eq(_19, const 0_u64); -- assert(!move _20, "attempt to divide `{}` by zero", _18) -> [success: bb4, unwind unreachable]; -+ _20 = Eq(_2, const 0_u64); -+ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb4, unwind unreachable]; + _19 = copy _2; +- _20 = Eq(copy _19, const 0_u64); +- assert(!move _20, "attempt to divide `{}` by zero", copy _18) -> [success: bb4, unwind unreachable]; ++ _20 = Eq(copy _2, const 0_u64); ++ assert(!copy _20, "attempt to divide `{}` by zero", copy _1) -> [success: bb4, unwind unreachable]; } bb4: { - _17 = Div(move _18, move _19); -+ _17 = Div(_1, _2); ++ _17 = Div(copy _1, copy _2); StorageDead(_19); StorageDead(_18); - _16 = opaque::<u64>(move _17) -> [return: bb5, unwind unreachable]; -+ _16 = opaque::<u64>(_17) -> [return: bb5, unwind unreachable]; ++ _16 = opaque::<u64>(copy _17) -> [return: bb5, unwind unreachable]; } bb5: { @@ -278,22 +278,22 @@ - StorageLive(_22); + nop; StorageLive(_23); - _23 = _1; + _23 = copy _1; StorageLive(_24); - _24 = _2; -- _25 = Eq(_24, const 0_u64); -- assert(!move _25, "attempt to calculate the remainder of `{}` with a divisor of zero", _23) -> [success: bb6, unwind unreachable]; -+ _25 = _20; -+ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb6, unwind unreachable]; + _24 = copy _2; +- _25 = Eq(copy _24, const 0_u64); +- assert(!move _25, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _23) -> [success: bb6, unwind unreachable]; ++ _25 = copy _20; ++ assert(!copy _20, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _1) -> [success: bb6, unwind unreachable]; } bb6: { - _22 = Rem(move _23, move _24); -+ _22 = Rem(_1, _2); ++ _22 = Rem(copy _1, copy _2); StorageDead(_24); StorageDead(_23); - _21 = opaque::<u64>(move _22) -> [return: bb7, unwind unreachable]; -+ _21 = opaque::<u64>(_22) -> [return: bb7, unwind unreachable]; ++ _21 = opaque::<u64>(copy _22) -> [return: bb7, unwind unreachable]; } bb7: { @@ -304,15 +304,15 @@ - StorageLive(_27); + nop; StorageLive(_28); - _28 = _1; + _28 = copy _1; StorageLive(_29); - _29 = _2; + _29 = copy _2; - _27 = BitAnd(move _28, move _29); -+ _27 = BitAnd(_1, _2); ++ _27 = BitAnd(copy _1, copy _2); StorageDead(_29); StorageDead(_28); - _26 = opaque::<u64>(move _27) -> [return: bb8, unwind unreachable]; -+ _26 = opaque::<u64>(_27) -> [return: bb8, unwind unreachable]; ++ _26 = opaque::<u64>(copy _27) -> [return: bb8, unwind unreachable]; } bb8: { @@ -323,15 +323,15 @@ - StorageLive(_31); + nop; StorageLive(_32); - _32 = _1; + _32 = copy _1; StorageLive(_33); - _33 = _2; + _33 = copy _2; - _31 = BitOr(move _32, move _33); -+ _31 = BitOr(_1, _2); ++ _31 = BitOr(copy _1, copy _2); StorageDead(_33); StorageDead(_32); - _30 = opaque::<u64>(move _31) -> [return: bb9, unwind unreachable]; -+ _30 = opaque::<u64>(_31) -> [return: bb9, unwind unreachable]; ++ _30 = opaque::<u64>(copy _31) -> [return: bb9, unwind unreachable]; } bb9: { @@ -342,15 +342,15 @@ - StorageLive(_35); + nop; StorageLive(_36); - _36 = _1; + _36 = copy _1; StorageLive(_37); - _37 = _2; + _37 = copy _2; - _35 = BitXor(move _36, move _37); -+ _35 = BitXor(_1, _2); ++ _35 = BitXor(copy _1, copy _2); StorageDead(_37); StorageDead(_36); - _34 = opaque::<u64>(move _35) -> [return: bb10, unwind unreachable]; -+ _34 = opaque::<u64>(_35) -> [return: bb10, unwind unreachable]; ++ _34 = opaque::<u64>(copy _35) -> [return: bb10, unwind unreachable]; } bb10: { @@ -361,15 +361,15 @@ - StorageLive(_39); + nop; StorageLive(_40); - _40 = _1; + _40 = copy _1; StorageLive(_41); - _41 = _2; + _41 = copy _2; - _39 = Shl(move _40, move _41); -+ _39 = Shl(_1, _2); ++ _39 = Shl(copy _1, copy _2); StorageDead(_41); StorageDead(_40); - _38 = opaque::<u64>(move _39) -> [return: bb11, unwind unreachable]; -+ _38 = opaque::<u64>(_39) -> [return: bb11, unwind unreachable]; ++ _38 = opaque::<u64>(copy _39) -> [return: bb11, unwind unreachable]; } bb11: { @@ -380,15 +380,15 @@ - StorageLive(_43); + nop; StorageLive(_44); - _44 = _1; + _44 = copy _1; StorageLive(_45); - _45 = _2; + _45 = copy _2; - _43 = Shr(move _44, move _45); -+ _43 = Shr(_1, _2); ++ _43 = Shr(copy _1, copy _2); StorageDead(_45); StorageDead(_44); - _42 = opaque::<u64>(move _43) -> [return: bb12, unwind unreachable]; -+ _42 = opaque::<u64>(_43) -> [return: bb12, unwind unreachable]; ++ _42 = opaque::<u64>(copy _43) -> [return: bb12, unwind unreachable]; } bb12: { @@ -399,12 +399,12 @@ - StorageLive(_47); + nop; StorageLive(_48); - _48 = _1; + _48 = copy _1; - _47 = move _48 as u32 (IntToInt); -+ _47 = _1 as u32 (IntToInt); ++ _47 = copy _1 as u32 (IntToInt); StorageDead(_48); - _46 = opaque::<u32>(move _47) -> [return: bb13, unwind unreachable]; -+ _46 = opaque::<u32>(_47) -> [return: bb13, unwind unreachable]; ++ _46 = opaque::<u32>(copy _47) -> [return: bb13, unwind unreachable]; } bb13: { @@ -415,12 +415,12 @@ - StorageLive(_50); + nop; StorageLive(_51); - _51 = _1; + _51 = copy _1; - _50 = move _51 as f32 (IntToFloat); -+ _50 = _1 as f32 (IntToFloat); ++ _50 = copy _1 as f32 (IntToFloat); StorageDead(_51); - _49 = opaque::<f32>(move _50) -> [return: bb14, unwind unreachable]; -+ _49 = opaque::<f32>(_50) -> [return: bb14, unwind unreachable]; ++ _49 = opaque::<f32>(copy _50) -> [return: bb14, unwind unreachable]; } bb14: { @@ -431,12 +431,12 @@ - StorageLive(_53); + nop; StorageLive(_54); - _54 = _1; + _54 = copy _1; - _53 = S::<u64>(move _54); -+ _53 = S::<u64>(_1); ++ _53 = S::<u64>(copy _1); StorageDead(_54); - _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind unreachable]; -+ _52 = opaque::<S<u64>>(_53) -> [return: bb15, unwind unreachable]; ++ _52 = opaque::<S<u64>>(copy _53) -> [return: bb15, unwind unreachable]; } bb15: { @@ -447,14 +447,14 @@ StorageLive(_56); StorageLive(_57); StorageLive(_58); - _58 = _1; + _58 = copy _1; - _57 = S::<u64>(move _58); -+ _57 = _53; ++ _57 = copy _53; StorageDead(_58); -- _56 = (_57.0: u64); +- _56 = copy (_57.0: u64); - _55 = opaque::<u64>(move _56) -> [return: bb16, unwind unreachable]; -+ _56 = _1; -+ _55 = opaque::<u64>(_1) -> [return: bb16, unwind unreachable]; ++ _56 = copy _1; ++ _55 = opaque::<u64>(copy _1) -> [return: bb16, unwind unreachable]; } bb16: { @@ -464,15 +464,15 @@ StorageLive(_59); StorageLive(_60); StorageLive(_61); - _61 = _1; + _61 = copy _1; StorageLive(_62); - _62 = _2; + _62 = copy _2; - _60 = Add(move _61, move _62); -+ _60 = _5; ++ _60 = copy _5; StorageDead(_62); StorageDead(_61); - _59 = opaque::<u64>(move _60) -> [return: bb17, unwind unreachable]; -+ _59 = opaque::<u64>(_5) -> [return: bb17, unwind unreachable]; ++ _59 = opaque::<u64>(copy _5) -> [return: bb17, unwind unreachable]; } bb17: { @@ -481,15 +481,15 @@ StorageLive(_63); StorageLive(_64); StorageLive(_65); - _65 = _1; + _65 = copy _1; StorageLive(_66); - _66 = _2; + _66 = copy _2; - _64 = Mul(move _65, move _66); -+ _64 = _9; ++ _64 = copy _9; StorageDead(_66); StorageDead(_65); - _63 = opaque::<u64>(move _64) -> [return: bb18, unwind unreachable]; -+ _63 = opaque::<u64>(_9) -> [return: bb18, unwind unreachable]; ++ _63 = opaque::<u64>(copy _9) -> [return: bb18, unwind unreachable]; } bb18: { @@ -498,15 +498,15 @@ StorageLive(_67); StorageLive(_68); StorageLive(_69); - _69 = _1; + _69 = copy _1; StorageLive(_70); - _70 = _2; + _70 = copy _2; - _68 = Sub(move _69, move _70); -+ _68 = _13; ++ _68 = copy _13; StorageDead(_70); StorageDead(_69); - _67 = opaque::<u64>(move _68) -> [return: bb19, unwind unreachable]; -+ _67 = opaque::<u64>(_13) -> [return: bb19, unwind unreachable]; ++ _67 = opaque::<u64>(copy _13) -> [return: bb19, unwind unreachable]; } bb19: { @@ -515,22 +515,22 @@ StorageLive(_71); StorageLive(_72); StorageLive(_73); - _73 = _1; + _73 = copy _1; StorageLive(_74); - _74 = _2; -- _75 = Eq(_74, const 0_u64); -- assert(!move _75, "attempt to divide `{}` by zero", _73) -> [success: bb20, unwind unreachable]; -+ _75 = _20; -+ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind unreachable]; + _74 = copy _2; +- _75 = Eq(copy _74, const 0_u64); +- assert(!move _75, "attempt to divide `{}` by zero", copy _73) -> [success: bb20, unwind unreachable]; ++ _75 = copy _20; ++ assert(!copy _20, "attempt to divide `{}` by zero", copy _1) -> [success: bb20, unwind unreachable]; } bb20: { - _72 = Div(move _73, move _74); -+ _72 = _17; ++ _72 = copy _17; StorageDead(_74); StorageDead(_73); - _71 = opaque::<u64>(move _72) -> [return: bb21, unwind unreachable]; -+ _71 = opaque::<u64>(_17) -> [return: bb21, unwind unreachable]; ++ _71 = opaque::<u64>(copy _17) -> [return: bb21, unwind unreachable]; } bb21: { @@ -539,22 +539,22 @@ StorageLive(_76); StorageLive(_77); StorageLive(_78); - _78 = _1; + _78 = copy _1; StorageLive(_79); - _79 = _2; -- _80 = Eq(_79, const 0_u64); -- assert(!move _80, "attempt to calculate the remainder of `{}` with a divisor of zero", _78) -> [success: bb22, unwind unreachable]; -+ _80 = _20; -+ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind unreachable]; + _79 = copy _2; +- _80 = Eq(copy _79, const 0_u64); +- assert(!move _80, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _78) -> [success: bb22, unwind unreachable]; ++ _80 = copy _20; ++ assert(!copy _20, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _1) -> [success: bb22, unwind unreachable]; } bb22: { - _77 = Rem(move _78, move _79); -+ _77 = _22; ++ _77 = copy _22; StorageDead(_79); StorageDead(_78); - _76 = opaque::<u64>(move _77) -> [return: bb23, unwind unreachable]; -+ _76 = opaque::<u64>(_22) -> [return: bb23, unwind unreachable]; ++ _76 = opaque::<u64>(copy _22) -> [return: bb23, unwind unreachable]; } bb23: { @@ -563,15 +563,15 @@ StorageLive(_81); StorageLive(_82); StorageLive(_83); - _83 = _1; + _83 = copy _1; StorageLive(_84); - _84 = _2; + _84 = copy _2; - _82 = BitAnd(move _83, move _84); -+ _82 = _27; ++ _82 = copy _27; StorageDead(_84); StorageDead(_83); - _81 = opaque::<u64>(move _82) -> [return: bb24, unwind unreachable]; -+ _81 = opaque::<u64>(_27) -> [return: bb24, unwind unreachable]; ++ _81 = opaque::<u64>(copy _27) -> [return: bb24, unwind unreachable]; } bb24: { @@ -580,15 +580,15 @@ StorageLive(_85); StorageLive(_86); StorageLive(_87); - _87 = _1; + _87 = copy _1; StorageLive(_88); - _88 = _2; + _88 = copy _2; - _86 = BitOr(move _87, move _88); -+ _86 = _31; ++ _86 = copy _31; StorageDead(_88); StorageDead(_87); - _85 = opaque::<u64>(move _86) -> [return: bb25, unwind unreachable]; -+ _85 = opaque::<u64>(_31) -> [return: bb25, unwind unreachable]; ++ _85 = opaque::<u64>(copy _31) -> [return: bb25, unwind unreachable]; } bb25: { @@ -597,15 +597,15 @@ StorageLive(_89); StorageLive(_90); StorageLive(_91); - _91 = _1; + _91 = copy _1; StorageLive(_92); - _92 = _2; + _92 = copy _2; - _90 = BitXor(move _91, move _92); -+ _90 = _35; ++ _90 = copy _35; StorageDead(_92); StorageDead(_91); - _89 = opaque::<u64>(move _90) -> [return: bb26, unwind unreachable]; -+ _89 = opaque::<u64>(_35) -> [return: bb26, unwind unreachable]; ++ _89 = opaque::<u64>(copy _35) -> [return: bb26, unwind unreachable]; } bb26: { @@ -614,15 +614,15 @@ StorageLive(_93); StorageLive(_94); StorageLive(_95); - _95 = _1; + _95 = copy _1; StorageLive(_96); - _96 = _2; + _96 = copy _2; - _94 = Shl(move _95, move _96); -+ _94 = _39; ++ _94 = copy _39; StorageDead(_96); StorageDead(_95); - _93 = opaque::<u64>(move _94) -> [return: bb27, unwind unreachable]; -+ _93 = opaque::<u64>(_39) -> [return: bb27, unwind unreachable]; ++ _93 = opaque::<u64>(copy _39) -> [return: bb27, unwind unreachable]; } bb27: { @@ -631,15 +631,15 @@ StorageLive(_97); StorageLive(_98); StorageLive(_99); - _99 = _1; + _99 = copy _1; StorageLive(_100); - _100 = _2; + _100 = copy _2; - _98 = Shr(move _99, move _100); -+ _98 = _43; ++ _98 = copy _43; StorageDead(_100); StorageDead(_99); - _97 = opaque::<u64>(move _98) -> [return: bb28, unwind unreachable]; -+ _97 = opaque::<u64>(_43) -> [return: bb28, unwind unreachable]; ++ _97 = opaque::<u64>(copy _43) -> [return: bb28, unwind unreachable]; } bb28: { @@ -648,12 +648,12 @@ StorageLive(_101); StorageLive(_102); StorageLive(_103); - _103 = _1; + _103 = copy _1; - _102 = move _103 as u32 (IntToInt); -+ _102 = _47; ++ _102 = copy _47; StorageDead(_103); - _101 = opaque::<u32>(move _102) -> [return: bb29, unwind unreachable]; -+ _101 = opaque::<u32>(_47) -> [return: bb29, unwind unreachable]; ++ _101 = opaque::<u32>(copy _47) -> [return: bb29, unwind unreachable]; } bb29: { @@ -662,12 +662,12 @@ StorageLive(_104); StorageLive(_105); StorageLive(_106); - _106 = _1; + _106 = copy _1; - _105 = move _106 as f32 (IntToFloat); -+ _105 = _50; ++ _105 = copy _50; StorageDead(_106); - _104 = opaque::<f32>(move _105) -> [return: bb30, unwind unreachable]; -+ _104 = opaque::<f32>(_50) -> [return: bb30, unwind unreachable]; ++ _104 = opaque::<f32>(copy _50) -> [return: bb30, unwind unreachable]; } bb30: { @@ -676,12 +676,12 @@ StorageLive(_107); StorageLive(_108); StorageLive(_109); - _109 = _1; + _109 = copy _1; - _108 = S::<u64>(move _109); -+ _108 = _53; ++ _108 = copy _53; StorageDead(_109); - _107 = opaque::<S<u64>>(move _108) -> [return: bb31, unwind unreachable]; -+ _107 = opaque::<S<u64>>(_53) -> [return: bb31, unwind unreachable]; ++ _107 = opaque::<S<u64>>(copy _53) -> [return: bb31, unwind unreachable]; } bb31: { @@ -691,14 +691,14 @@ StorageLive(_111); StorageLive(_112); StorageLive(_113); - _113 = _1; + _113 = copy _1; - _112 = S::<u64>(move _113); -+ _112 = _53; ++ _112 = copy _53; StorageDead(_113); -- _111 = (_112.0: u64); +- _111 = copy (_112.0: u64); - _110 = opaque::<u64>(move _111) -> [return: bb32, unwind unreachable]; -+ _111 = _1; -+ _110 = opaque::<u64>(_1) -> [return: bb32, unwind unreachable]; ++ _111 = copy _1; ++ _110 = opaque::<u64>(copy _1) -> [return: bb32, unwind unreachable]; } bb32: { @@ -710,21 +710,21 @@ + nop; StorageLive(_116); StorageLive(_117); - _117 = _1; + _117 = copy _1; StorageLive(_118); - _118 = _2; + _118 = copy _2; - _116 = Mul(move _117, move _118); -+ _116 = _9; ++ _116 = copy _9; StorageDead(_118); StorageDead(_117); StorageLive(_119); - _119 = _2; + _119 = copy _2; - _115 = Sub(move _116, move _119); -+ _115 = Sub(_9, _2); ++ _115 = Sub(copy _9, copy _2); StorageDead(_119); StorageDead(_116); - _114 = opaque::<u64>(move _115) -> [return: bb33, unwind unreachable]; -+ _114 = opaque::<u64>(_115) -> [return: bb33, unwind unreachable]; ++ _114 = opaque::<u64>(copy _115) -> [return: bb33, unwind unreachable]; } bb33: { @@ -735,21 +735,21 @@ StorageLive(_121); StorageLive(_122); StorageLive(_123); - _123 = _1; + _123 = copy _1; StorageLive(_124); - _124 = _2; + _124 = copy _2; - _122 = Mul(move _123, move _124); -+ _122 = _9; ++ _122 = copy _9; StorageDead(_124); StorageDead(_123); StorageLive(_125); - _125 = _2; + _125 = copy _2; - _121 = Sub(move _122, move _125); -+ _121 = _115; ++ _121 = copy _115; StorageDead(_125); StorageDead(_122); - _120 = opaque::<u64>(move _121) -> [return: bb34, unwind unreachable]; -+ _120 = opaque::<u64>(_115) -> [return: bb34, unwind unreachable]; ++ _120 = opaque::<u64>(copy _115) -> [return: bb34, unwind unreachable]; } bb34: { @@ -762,16 +762,16 @@ - StorageLive(_129); + nop; + nop; - _129 = (*_126); + _129 = copy (*_126); StorageLive(_130); - _130 = _1; + _130 = copy _1; - _128 = Add(move _129, move _130); -+ _128 = Add(_129, _1); ++ _128 = Add(copy _129, copy _1); StorageDead(_130); - StorageDead(_129); - _127 = opaque::<u64>(move _128) -> [return: bb35, unwind unreachable]; + nop; -+ _127 = opaque::<u64>(_128) -> [return: bb35, unwind unreachable]; ++ _127 = opaque::<u64>(copy _128) -> [return: bb35, unwind unreachable]; } bb35: { @@ -781,16 +781,16 @@ StorageLive(_131); StorageLive(_132); StorageLive(_133); -- _133 = (*_126); -+ _133 = _129; +- _133 = copy (*_126); ++ _133 = copy _129; StorageLive(_134); - _134 = _1; + _134 = copy _1; - _132 = Add(move _133, move _134); -+ _132 = _128; ++ _132 = copy _128; StorageDead(_134); StorageDead(_133); - _131 = opaque::<u64>(move _132) -> [return: bb36, unwind unreachable]; -+ _131 = opaque::<u64>(_128) -> [return: bb36, unwind unreachable]; ++ _131 = opaque::<u64>(copy _128) -> [return: bb36, unwind unreachable]; } bb36: { @@ -801,11 +801,11 @@ StorageLive(_136); StorageLive(_137); StorageLive(_138); - _138 = (*_135); + _138 = copy (*_135); StorageLive(_139); - _139 = _1; + _139 = copy _1; - _137 = Add(move _138, move _139); -+ _137 = Add(move _138, _1); ++ _137 = Add(move _138, copy _1); StorageDead(_139); StorageDead(_138); _136 = opaque::<u64>(move _137) -> [return: bb37, unwind unreachable]; @@ -817,11 +817,11 @@ StorageLive(_140); StorageLive(_141); StorageLive(_142); - _142 = (*_135); + _142 = copy (*_135); StorageLive(_143); - _143 = _1; + _143 = copy _1; - _141 = Add(move _142, move _143); -+ _141 = Add(move _142, _1); ++ _141 = Add(move _142, copy _1); StorageDead(_143); StorageDead(_142); _140 = opaque::<u64>(move _141) -> [return: bb38, unwind unreachable]; @@ -836,11 +836,11 @@ StorageLive(_146); StorageLive(_147); StorageLive(_148); - _148 = (*_145); + _148 = copy (*_145); StorageLive(_149); - _149 = _1; + _149 = copy _1; - _147 = Add(move _148, move _149); -+ _147 = Add(move _148, _1); ++ _147 = Add(move _148, copy _1); StorageDead(_149); StorageDead(_148); _146 = opaque::<u64>(move _147) -> [return: bb39, unwind unreachable]; @@ -852,11 +852,11 @@ StorageLive(_150); StorageLive(_151); StorageLive(_152); - _152 = (*_145); + _152 = copy (*_145); StorageLive(_153); - _153 = _1; + _153 = copy _1; - _151 = Add(move _152, move _153); -+ _151 = Add(move _152, _1); ++ _151 = Add(move _152, copy _1); StorageDead(_153); StorageDead(_152); _150 = opaque::<u64>(move _151) -> [return: bb40, unwind unreachable]; @@ -870,11 +870,11 @@ StorageLive(_155); StorageLive(_156); StorageLive(_157); - _157 = (*_154); + _157 = copy (*_154); StorageLive(_158); - _158 = _1; + _158 = copy _1; - _156 = Add(move _157, move _158); -+ _156 = Add(move _157, _1); ++ _156 = Add(move _157, copy _1); StorageDead(_158); StorageDead(_157); _155 = opaque::<u64>(move _156) -> [return: bb41, unwind unreachable]; @@ -886,11 +886,11 @@ StorageLive(_159); StorageLive(_160); StorageLive(_161); - _161 = (*_154); + _161 = copy (*_154); StorageLive(_162); - _162 = _1; + _162 = copy _1; - _160 = Add(move _161, move _162); -+ _160 = Add(move _161, _1); ++ _160 = Add(move _161, copy _1); StorageDead(_162); StorageDead(_161); _159 = opaque::<u64>(move _160) -> [return: bb42, unwind unreachable]; @@ -910,16 +910,16 @@ - StorageLive(_166); + nop; + nop; - _166 = (*_163); + _166 = copy (*_163); StorageLive(_167); - _167 = _1; + _167 = copy _1; - _165 = Add(move _166, move _167); -+ _165 = Add(_166, _1); ++ _165 = Add(copy _166, copy _1); StorageDead(_167); - StorageDead(_166); - _164 = opaque::<u64>(move _165) -> [return: bb43, unwind unreachable]; + nop; -+ _164 = opaque::<u64>(_165) -> [return: bb43, unwind unreachable]; ++ _164 = opaque::<u64>(copy _165) -> [return: bb43, unwind unreachable]; } bb43: { @@ -929,16 +929,16 @@ StorageLive(_168); StorageLive(_169); StorageLive(_170); -- _170 = (*_163); -+ _170 = _166; +- _170 = copy (*_163); ++ _170 = copy _166; StorageLive(_171); - _171 = _1; + _171 = copy _1; - _169 = Add(move _170, move _171); -+ _169 = _165; ++ _169 = copy _165; StorageDead(_171); StorageDead(_170); - _168 = opaque::<u64>(move _169) -> [return: bb44, unwind unreachable]; -+ _168 = opaque::<u64>(_165) -> [return: bb44, unwind unreachable]; ++ _168 = opaque::<u64>(copy _165) -> [return: bb44, unwind unreachable]; } bb44: { diff --git a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff index 41c01536130..3ca5238663c 100644 --- a/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.subexpression_elimination.GVN.panic-unwind.diff @@ -195,15 +195,15 @@ - StorageLive(_5); + nop; StorageLive(_6); - _6 = _1; + _6 = copy _1; StorageLive(_7); - _7 = _2; + _7 = copy _2; - _5 = Add(move _6, move _7); -+ _5 = Add(_1, _2); ++ _5 = Add(copy _1, copy _2); StorageDead(_7); StorageDead(_6); - _4 = opaque::<u64>(move _5) -> [return: bb1, unwind continue]; -+ _4 = opaque::<u64>(_5) -> [return: bb1, unwind continue]; ++ _4 = opaque::<u64>(copy _5) -> [return: bb1, unwind continue]; } bb1: { @@ -214,15 +214,15 @@ - StorageLive(_9); + nop; StorageLive(_10); - _10 = _1; + _10 = copy _1; StorageLive(_11); - _11 = _2; + _11 = copy _2; - _9 = Mul(move _10, move _11); -+ _9 = Mul(_1, _2); ++ _9 = Mul(copy _1, copy _2); StorageDead(_11); StorageDead(_10); - _8 = opaque::<u64>(move _9) -> [return: bb2, unwind continue]; -+ _8 = opaque::<u64>(_9) -> [return: bb2, unwind continue]; ++ _8 = opaque::<u64>(copy _9) -> [return: bb2, unwind continue]; } bb2: { @@ -233,15 +233,15 @@ - StorageLive(_13); + nop; StorageLive(_14); - _14 = _1; + _14 = copy _1; StorageLive(_15); - _15 = _2; + _15 = copy _2; - _13 = Sub(move _14, move _15); -+ _13 = Sub(_1, _2); ++ _13 = Sub(copy _1, copy _2); StorageDead(_15); StorageDead(_14); - _12 = opaque::<u64>(move _13) -> [return: bb3, unwind continue]; -+ _12 = opaque::<u64>(_13) -> [return: bb3, unwind continue]; ++ _12 = opaque::<u64>(copy _13) -> [return: bb3, unwind continue]; } bb3: { @@ -252,22 +252,22 @@ - StorageLive(_17); + nop; StorageLive(_18); - _18 = _1; + _18 = copy _1; StorageLive(_19); - _19 = _2; -- _20 = Eq(_19, const 0_u64); -- assert(!move _20, "attempt to divide `{}` by zero", _18) -> [success: bb4, unwind continue]; -+ _20 = Eq(_2, const 0_u64); -+ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb4, unwind continue]; + _19 = copy _2; +- _20 = Eq(copy _19, const 0_u64); +- assert(!move _20, "attempt to divide `{}` by zero", copy _18) -> [success: bb4, unwind continue]; ++ _20 = Eq(copy _2, const 0_u64); ++ assert(!copy _20, "attempt to divide `{}` by zero", copy _1) -> [success: bb4, unwind continue]; } bb4: { - _17 = Div(move _18, move _19); -+ _17 = Div(_1, _2); ++ _17 = Div(copy _1, copy _2); StorageDead(_19); StorageDead(_18); - _16 = opaque::<u64>(move _17) -> [return: bb5, unwind continue]; -+ _16 = opaque::<u64>(_17) -> [return: bb5, unwind continue]; ++ _16 = opaque::<u64>(copy _17) -> [return: bb5, unwind continue]; } bb5: { @@ -278,22 +278,22 @@ - StorageLive(_22); + nop; StorageLive(_23); - _23 = _1; + _23 = copy _1; StorageLive(_24); - _24 = _2; -- _25 = Eq(_24, const 0_u64); -- assert(!move _25, "attempt to calculate the remainder of `{}` with a divisor of zero", _23) -> [success: bb6, unwind continue]; -+ _25 = _20; -+ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb6, unwind continue]; + _24 = copy _2; +- _25 = Eq(copy _24, const 0_u64); +- assert(!move _25, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _23) -> [success: bb6, unwind continue]; ++ _25 = copy _20; ++ assert(!copy _20, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _1) -> [success: bb6, unwind continue]; } bb6: { - _22 = Rem(move _23, move _24); -+ _22 = Rem(_1, _2); ++ _22 = Rem(copy _1, copy _2); StorageDead(_24); StorageDead(_23); - _21 = opaque::<u64>(move _22) -> [return: bb7, unwind continue]; -+ _21 = opaque::<u64>(_22) -> [return: bb7, unwind continue]; ++ _21 = opaque::<u64>(copy _22) -> [return: bb7, unwind continue]; } bb7: { @@ -304,15 +304,15 @@ - StorageLive(_27); + nop; StorageLive(_28); - _28 = _1; + _28 = copy _1; StorageLive(_29); - _29 = _2; + _29 = copy _2; - _27 = BitAnd(move _28, move _29); -+ _27 = BitAnd(_1, _2); ++ _27 = BitAnd(copy _1, copy _2); StorageDead(_29); StorageDead(_28); - _26 = opaque::<u64>(move _27) -> [return: bb8, unwind continue]; -+ _26 = opaque::<u64>(_27) -> [return: bb8, unwind continue]; ++ _26 = opaque::<u64>(copy _27) -> [return: bb8, unwind continue]; } bb8: { @@ -323,15 +323,15 @@ - StorageLive(_31); + nop; StorageLive(_32); - _32 = _1; + _32 = copy _1; StorageLive(_33); - _33 = _2; + _33 = copy _2; - _31 = BitOr(move _32, move _33); -+ _31 = BitOr(_1, _2); ++ _31 = BitOr(copy _1, copy _2); StorageDead(_33); StorageDead(_32); - _30 = opaque::<u64>(move _31) -> [return: bb9, unwind continue]; -+ _30 = opaque::<u64>(_31) -> [return: bb9, unwind continue]; ++ _30 = opaque::<u64>(copy _31) -> [return: bb9, unwind continue]; } bb9: { @@ -342,15 +342,15 @@ - StorageLive(_35); + nop; StorageLive(_36); - _36 = _1; + _36 = copy _1; StorageLive(_37); - _37 = _2; + _37 = copy _2; - _35 = BitXor(move _36, move _37); -+ _35 = BitXor(_1, _2); ++ _35 = BitXor(copy _1, copy _2); StorageDead(_37); StorageDead(_36); - _34 = opaque::<u64>(move _35) -> [return: bb10, unwind continue]; -+ _34 = opaque::<u64>(_35) -> [return: bb10, unwind continue]; ++ _34 = opaque::<u64>(copy _35) -> [return: bb10, unwind continue]; } bb10: { @@ -361,15 +361,15 @@ - StorageLive(_39); + nop; StorageLive(_40); - _40 = _1; + _40 = copy _1; StorageLive(_41); - _41 = _2; + _41 = copy _2; - _39 = Shl(move _40, move _41); -+ _39 = Shl(_1, _2); ++ _39 = Shl(copy _1, copy _2); StorageDead(_41); StorageDead(_40); - _38 = opaque::<u64>(move _39) -> [return: bb11, unwind continue]; -+ _38 = opaque::<u64>(_39) -> [return: bb11, unwind continue]; ++ _38 = opaque::<u64>(copy _39) -> [return: bb11, unwind continue]; } bb11: { @@ -380,15 +380,15 @@ - StorageLive(_43); + nop; StorageLive(_44); - _44 = _1; + _44 = copy _1; StorageLive(_45); - _45 = _2; + _45 = copy _2; - _43 = Shr(move _44, move _45); -+ _43 = Shr(_1, _2); ++ _43 = Shr(copy _1, copy _2); StorageDead(_45); StorageDead(_44); - _42 = opaque::<u64>(move _43) -> [return: bb12, unwind continue]; -+ _42 = opaque::<u64>(_43) -> [return: bb12, unwind continue]; ++ _42 = opaque::<u64>(copy _43) -> [return: bb12, unwind continue]; } bb12: { @@ -399,12 +399,12 @@ - StorageLive(_47); + nop; StorageLive(_48); - _48 = _1; + _48 = copy _1; - _47 = move _48 as u32 (IntToInt); -+ _47 = _1 as u32 (IntToInt); ++ _47 = copy _1 as u32 (IntToInt); StorageDead(_48); - _46 = opaque::<u32>(move _47) -> [return: bb13, unwind continue]; -+ _46 = opaque::<u32>(_47) -> [return: bb13, unwind continue]; ++ _46 = opaque::<u32>(copy _47) -> [return: bb13, unwind continue]; } bb13: { @@ -415,12 +415,12 @@ - StorageLive(_50); + nop; StorageLive(_51); - _51 = _1; + _51 = copy _1; - _50 = move _51 as f32 (IntToFloat); -+ _50 = _1 as f32 (IntToFloat); ++ _50 = copy _1 as f32 (IntToFloat); StorageDead(_51); - _49 = opaque::<f32>(move _50) -> [return: bb14, unwind continue]; -+ _49 = opaque::<f32>(_50) -> [return: bb14, unwind continue]; ++ _49 = opaque::<f32>(copy _50) -> [return: bb14, unwind continue]; } bb14: { @@ -431,12 +431,12 @@ - StorageLive(_53); + nop; StorageLive(_54); - _54 = _1; + _54 = copy _1; - _53 = S::<u64>(move _54); -+ _53 = S::<u64>(_1); ++ _53 = S::<u64>(copy _1); StorageDead(_54); - _52 = opaque::<S<u64>>(move _53) -> [return: bb15, unwind continue]; -+ _52 = opaque::<S<u64>>(_53) -> [return: bb15, unwind continue]; ++ _52 = opaque::<S<u64>>(copy _53) -> [return: bb15, unwind continue]; } bb15: { @@ -447,14 +447,14 @@ StorageLive(_56); StorageLive(_57); StorageLive(_58); - _58 = _1; + _58 = copy _1; - _57 = S::<u64>(move _58); -+ _57 = _53; ++ _57 = copy _53; StorageDead(_58); -- _56 = (_57.0: u64); +- _56 = copy (_57.0: u64); - _55 = opaque::<u64>(move _56) -> [return: bb16, unwind continue]; -+ _56 = _1; -+ _55 = opaque::<u64>(_1) -> [return: bb16, unwind continue]; ++ _56 = copy _1; ++ _55 = opaque::<u64>(copy _1) -> [return: bb16, unwind continue]; } bb16: { @@ -464,15 +464,15 @@ StorageLive(_59); StorageLive(_60); StorageLive(_61); - _61 = _1; + _61 = copy _1; StorageLive(_62); - _62 = _2; + _62 = copy _2; - _60 = Add(move _61, move _62); -+ _60 = _5; ++ _60 = copy _5; StorageDead(_62); StorageDead(_61); - _59 = opaque::<u64>(move _60) -> [return: bb17, unwind continue]; -+ _59 = opaque::<u64>(_5) -> [return: bb17, unwind continue]; ++ _59 = opaque::<u64>(copy _5) -> [return: bb17, unwind continue]; } bb17: { @@ -481,15 +481,15 @@ StorageLive(_63); StorageLive(_64); StorageLive(_65); - _65 = _1; + _65 = copy _1; StorageLive(_66); - _66 = _2; + _66 = copy _2; - _64 = Mul(move _65, move _66); -+ _64 = _9; ++ _64 = copy _9; StorageDead(_66); StorageDead(_65); - _63 = opaque::<u64>(move _64) -> [return: bb18, unwind continue]; -+ _63 = opaque::<u64>(_9) -> [return: bb18, unwind continue]; ++ _63 = opaque::<u64>(copy _9) -> [return: bb18, unwind continue]; } bb18: { @@ -498,15 +498,15 @@ StorageLive(_67); StorageLive(_68); StorageLive(_69); - _69 = _1; + _69 = copy _1; StorageLive(_70); - _70 = _2; + _70 = copy _2; - _68 = Sub(move _69, move _70); -+ _68 = _13; ++ _68 = copy _13; StorageDead(_70); StorageDead(_69); - _67 = opaque::<u64>(move _68) -> [return: bb19, unwind continue]; -+ _67 = opaque::<u64>(_13) -> [return: bb19, unwind continue]; ++ _67 = opaque::<u64>(copy _13) -> [return: bb19, unwind continue]; } bb19: { @@ -515,22 +515,22 @@ StorageLive(_71); StorageLive(_72); StorageLive(_73); - _73 = _1; + _73 = copy _1; StorageLive(_74); - _74 = _2; -- _75 = Eq(_74, const 0_u64); -- assert(!move _75, "attempt to divide `{}` by zero", _73) -> [success: bb20, unwind continue]; -+ _75 = _20; -+ assert(!_20, "attempt to divide `{}` by zero", _1) -> [success: bb20, unwind continue]; + _74 = copy _2; +- _75 = Eq(copy _74, const 0_u64); +- assert(!move _75, "attempt to divide `{}` by zero", copy _73) -> [success: bb20, unwind continue]; ++ _75 = copy _20; ++ assert(!copy _20, "attempt to divide `{}` by zero", copy _1) -> [success: bb20, unwind continue]; } bb20: { - _72 = Div(move _73, move _74); -+ _72 = _17; ++ _72 = copy _17; StorageDead(_74); StorageDead(_73); - _71 = opaque::<u64>(move _72) -> [return: bb21, unwind continue]; -+ _71 = opaque::<u64>(_17) -> [return: bb21, unwind continue]; ++ _71 = opaque::<u64>(copy _17) -> [return: bb21, unwind continue]; } bb21: { @@ -539,22 +539,22 @@ StorageLive(_76); StorageLive(_77); StorageLive(_78); - _78 = _1; + _78 = copy _1; StorageLive(_79); - _79 = _2; -- _80 = Eq(_79, const 0_u64); -- assert(!move _80, "attempt to calculate the remainder of `{}` with a divisor of zero", _78) -> [success: bb22, unwind continue]; -+ _80 = _20; -+ assert(!_20, "attempt to calculate the remainder of `{}` with a divisor of zero", _1) -> [success: bb22, unwind continue]; + _79 = copy _2; +- _80 = Eq(copy _79, const 0_u64); +- assert(!move _80, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _78) -> [success: bb22, unwind continue]; ++ _80 = copy _20; ++ assert(!copy _20, "attempt to calculate the remainder of `{}` with a divisor of zero", copy _1) -> [success: bb22, unwind continue]; } bb22: { - _77 = Rem(move _78, move _79); -+ _77 = _22; ++ _77 = copy _22; StorageDead(_79); StorageDead(_78); - _76 = opaque::<u64>(move _77) -> [return: bb23, unwind continue]; -+ _76 = opaque::<u64>(_22) -> [return: bb23, unwind continue]; ++ _76 = opaque::<u64>(copy _22) -> [return: bb23, unwind continue]; } bb23: { @@ -563,15 +563,15 @@ StorageLive(_81); StorageLive(_82); StorageLive(_83); - _83 = _1; + _83 = copy _1; StorageLive(_84); - _84 = _2; + _84 = copy _2; - _82 = BitAnd(move _83, move _84); -+ _82 = _27; ++ _82 = copy _27; StorageDead(_84); StorageDead(_83); - _81 = opaque::<u64>(move _82) -> [return: bb24, unwind continue]; -+ _81 = opaque::<u64>(_27) -> [return: bb24, unwind continue]; ++ _81 = opaque::<u64>(copy _27) -> [return: bb24, unwind continue]; } bb24: { @@ -580,15 +580,15 @@ StorageLive(_85); StorageLive(_86); StorageLive(_87); - _87 = _1; + _87 = copy _1; StorageLive(_88); - _88 = _2; + _88 = copy _2; - _86 = BitOr(move _87, move _88); -+ _86 = _31; ++ _86 = copy _31; StorageDead(_88); StorageDead(_87); - _85 = opaque::<u64>(move _86) -> [return: bb25, unwind continue]; -+ _85 = opaque::<u64>(_31) -> [return: bb25, unwind continue]; ++ _85 = opaque::<u64>(copy _31) -> [return: bb25, unwind continue]; } bb25: { @@ -597,15 +597,15 @@ StorageLive(_89); StorageLive(_90); StorageLive(_91); - _91 = _1; + _91 = copy _1; StorageLive(_92); - _92 = _2; + _92 = copy _2; - _90 = BitXor(move _91, move _92); -+ _90 = _35; ++ _90 = copy _35; StorageDead(_92); StorageDead(_91); - _89 = opaque::<u64>(move _90) -> [return: bb26, unwind continue]; -+ _89 = opaque::<u64>(_35) -> [return: bb26, unwind continue]; ++ _89 = opaque::<u64>(copy _35) -> [return: bb26, unwind continue]; } bb26: { @@ -614,15 +614,15 @@ StorageLive(_93); StorageLive(_94); StorageLive(_95); - _95 = _1; + _95 = copy _1; StorageLive(_96); - _96 = _2; + _96 = copy _2; - _94 = Shl(move _95, move _96); -+ _94 = _39; ++ _94 = copy _39; StorageDead(_96); StorageDead(_95); - _93 = opaque::<u64>(move _94) -> [return: bb27, unwind continue]; -+ _93 = opaque::<u64>(_39) -> [return: bb27, unwind continue]; ++ _93 = opaque::<u64>(copy _39) -> [return: bb27, unwind continue]; } bb27: { @@ -631,15 +631,15 @@ StorageLive(_97); StorageLive(_98); StorageLive(_99); - _99 = _1; + _99 = copy _1; StorageLive(_100); - _100 = _2; + _100 = copy _2; - _98 = Shr(move _99, move _100); -+ _98 = _43; ++ _98 = copy _43; StorageDead(_100); StorageDead(_99); - _97 = opaque::<u64>(move _98) -> [return: bb28, unwind continue]; -+ _97 = opaque::<u64>(_43) -> [return: bb28, unwind continue]; ++ _97 = opaque::<u64>(copy _43) -> [return: bb28, unwind continue]; } bb28: { @@ -648,12 +648,12 @@ StorageLive(_101); StorageLive(_102); StorageLive(_103); - _103 = _1; + _103 = copy _1; - _102 = move _103 as u32 (IntToInt); -+ _102 = _47; ++ _102 = copy _47; StorageDead(_103); - _101 = opaque::<u32>(move _102) -> [return: bb29, unwind continue]; -+ _101 = opaque::<u32>(_47) -> [return: bb29, unwind continue]; ++ _101 = opaque::<u32>(copy _47) -> [return: bb29, unwind continue]; } bb29: { @@ -662,12 +662,12 @@ StorageLive(_104); StorageLive(_105); StorageLive(_106); - _106 = _1; + _106 = copy _1; - _105 = move _106 as f32 (IntToFloat); -+ _105 = _50; ++ _105 = copy _50; StorageDead(_106); - _104 = opaque::<f32>(move _105) -> [return: bb30, unwind continue]; -+ _104 = opaque::<f32>(_50) -> [return: bb30, unwind continue]; ++ _104 = opaque::<f32>(copy _50) -> [return: bb30, unwind continue]; } bb30: { @@ -676,12 +676,12 @@ StorageLive(_107); StorageLive(_108); StorageLive(_109); - _109 = _1; + _109 = copy _1; - _108 = S::<u64>(move _109); -+ _108 = _53; ++ _108 = copy _53; StorageDead(_109); - _107 = opaque::<S<u64>>(move _108) -> [return: bb31, unwind continue]; -+ _107 = opaque::<S<u64>>(_53) -> [return: bb31, unwind continue]; ++ _107 = opaque::<S<u64>>(copy _53) -> [return: bb31, unwind continue]; } bb31: { @@ -691,14 +691,14 @@ StorageLive(_111); StorageLive(_112); StorageLive(_113); - _113 = _1; + _113 = copy _1; - _112 = S::<u64>(move _113); -+ _112 = _53; ++ _112 = copy _53; StorageDead(_113); -- _111 = (_112.0: u64); +- _111 = copy (_112.0: u64); - _110 = opaque::<u64>(move _111) -> [return: bb32, unwind continue]; -+ _111 = _1; -+ _110 = opaque::<u64>(_1) -> [return: bb32, unwind continue]; ++ _111 = copy _1; ++ _110 = opaque::<u64>(copy _1) -> [return: bb32, unwind continue]; } bb32: { @@ -710,21 +710,21 @@ + nop; StorageLive(_116); StorageLive(_117); - _117 = _1; + _117 = copy _1; StorageLive(_118); - _118 = _2; + _118 = copy _2; - _116 = Mul(move _117, move _118); -+ _116 = _9; ++ _116 = copy _9; StorageDead(_118); StorageDead(_117); StorageLive(_119); - _119 = _2; + _119 = copy _2; - _115 = Sub(move _116, move _119); -+ _115 = Sub(_9, _2); ++ _115 = Sub(copy _9, copy _2); StorageDead(_119); StorageDead(_116); - _114 = opaque::<u64>(move _115) -> [return: bb33, unwind continue]; -+ _114 = opaque::<u64>(_115) -> [return: bb33, unwind continue]; ++ _114 = opaque::<u64>(copy _115) -> [return: bb33, unwind continue]; } bb33: { @@ -735,21 +735,21 @@ StorageLive(_121); StorageLive(_122); StorageLive(_123); - _123 = _1; + _123 = copy _1; StorageLive(_124); - _124 = _2; + _124 = copy _2; - _122 = Mul(move _123, move _124); -+ _122 = _9; ++ _122 = copy _9; StorageDead(_124); StorageDead(_123); StorageLive(_125); - _125 = _2; + _125 = copy _2; - _121 = Sub(move _122, move _125); -+ _121 = _115; ++ _121 = copy _115; StorageDead(_125); StorageDead(_122); - _120 = opaque::<u64>(move _121) -> [return: bb34, unwind continue]; -+ _120 = opaque::<u64>(_115) -> [return: bb34, unwind continue]; ++ _120 = opaque::<u64>(copy _115) -> [return: bb34, unwind continue]; } bb34: { @@ -762,16 +762,16 @@ - StorageLive(_129); + nop; + nop; - _129 = (*_126); + _129 = copy (*_126); StorageLive(_130); - _130 = _1; + _130 = copy _1; - _128 = Add(move _129, move _130); -+ _128 = Add(_129, _1); ++ _128 = Add(copy _129, copy _1); StorageDead(_130); - StorageDead(_129); - _127 = opaque::<u64>(move _128) -> [return: bb35, unwind continue]; + nop; -+ _127 = opaque::<u64>(_128) -> [return: bb35, unwind continue]; ++ _127 = opaque::<u64>(copy _128) -> [return: bb35, unwind continue]; } bb35: { @@ -781,16 +781,16 @@ StorageLive(_131); StorageLive(_132); StorageLive(_133); -- _133 = (*_126); -+ _133 = _129; +- _133 = copy (*_126); ++ _133 = copy _129; StorageLive(_134); - _134 = _1; + _134 = copy _1; - _132 = Add(move _133, move _134); -+ _132 = _128; ++ _132 = copy _128; StorageDead(_134); StorageDead(_133); - _131 = opaque::<u64>(move _132) -> [return: bb36, unwind continue]; -+ _131 = opaque::<u64>(_128) -> [return: bb36, unwind continue]; ++ _131 = opaque::<u64>(copy _128) -> [return: bb36, unwind continue]; } bb36: { @@ -801,11 +801,11 @@ StorageLive(_136); StorageLive(_137); StorageLive(_138); - _138 = (*_135); + _138 = copy (*_135); StorageLive(_139); - _139 = _1; + _139 = copy _1; - _137 = Add(move _138, move _139); -+ _137 = Add(move _138, _1); ++ _137 = Add(move _138, copy _1); StorageDead(_139); StorageDead(_138); _136 = opaque::<u64>(move _137) -> [return: bb37, unwind continue]; @@ -817,11 +817,11 @@ StorageLive(_140); StorageLive(_141); StorageLive(_142); - _142 = (*_135); + _142 = copy (*_135); StorageLive(_143); - _143 = _1; + _143 = copy _1; - _141 = Add(move _142, move _143); -+ _141 = Add(move _142, _1); ++ _141 = Add(move _142, copy _1); StorageDead(_143); StorageDead(_142); _140 = opaque::<u64>(move _141) -> [return: bb38, unwind continue]; @@ -836,11 +836,11 @@ StorageLive(_146); StorageLive(_147); StorageLive(_148); - _148 = (*_145); + _148 = copy (*_145); StorageLive(_149); - _149 = _1; + _149 = copy _1; - _147 = Add(move _148, move _149); -+ _147 = Add(move _148, _1); ++ _147 = Add(move _148, copy _1); StorageDead(_149); StorageDead(_148); _146 = opaque::<u64>(move _147) -> [return: bb39, unwind continue]; @@ -852,11 +852,11 @@ StorageLive(_150); StorageLive(_151); StorageLive(_152); - _152 = (*_145); + _152 = copy (*_145); StorageLive(_153); - _153 = _1; + _153 = copy _1; - _151 = Add(move _152, move _153); -+ _151 = Add(move _152, _1); ++ _151 = Add(move _152, copy _1); StorageDead(_153); StorageDead(_152); _150 = opaque::<u64>(move _151) -> [return: bb40, unwind continue]; @@ -870,11 +870,11 @@ StorageLive(_155); StorageLive(_156); StorageLive(_157); - _157 = (*_154); + _157 = copy (*_154); StorageLive(_158); - _158 = _1; + _158 = copy _1; - _156 = Add(move _157, move _158); -+ _156 = Add(move _157, _1); ++ _156 = Add(move _157, copy _1); StorageDead(_158); StorageDead(_157); _155 = opaque::<u64>(move _156) -> [return: bb41, unwind continue]; @@ -886,11 +886,11 @@ StorageLive(_159); StorageLive(_160); StorageLive(_161); - _161 = (*_154); + _161 = copy (*_154); StorageLive(_162); - _162 = _1; + _162 = copy _1; - _160 = Add(move _161, move _162); -+ _160 = Add(move _161, _1); ++ _160 = Add(move _161, copy _1); StorageDead(_162); StorageDead(_161); _159 = opaque::<u64>(move _160) -> [return: bb42, unwind continue]; @@ -910,16 +910,16 @@ - StorageLive(_166); + nop; + nop; - _166 = (*_163); + _166 = copy (*_163); StorageLive(_167); - _167 = _1; + _167 = copy _1; - _165 = Add(move _166, move _167); -+ _165 = Add(_166, _1); ++ _165 = Add(copy _166, copy _1); StorageDead(_167); - StorageDead(_166); - _164 = opaque::<u64>(move _165) -> [return: bb43, unwind continue]; + nop; -+ _164 = opaque::<u64>(_165) -> [return: bb43, unwind continue]; ++ _164 = opaque::<u64>(copy _165) -> [return: bb43, unwind continue]; } bb43: { @@ -929,16 +929,16 @@ StorageLive(_168); StorageLive(_169); StorageLive(_170); -- _170 = (*_163); -+ _170 = _166; +- _170 = copy (*_163); ++ _170 = copy _166; StorageLive(_171); - _171 = _1; + _171 = copy _1; - _169 = Add(move _170, move _171); -+ _169 = _165; ++ _169 = copy _165; StorageDead(_171); StorageDead(_170); - _168 = opaque::<u64>(move _169) -> [return: bb44, unwind continue]; -+ _168 = opaque::<u64>(_165) -> [return: bb44, unwind continue]; ++ _168 = opaque::<u64>(copy _165) -> [return: bb44, unwind continue]; } bb44: { diff --git a/tests/mir-opt/gvn.unary.GVN.panic-abort.diff b/tests/mir-opt/gvn.unary.GVN.panic-abort.diff index 9469032f294..d14aec6df5f 100644 --- a/tests/mir-opt/gvn.unary.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.unary.GVN.panic-abort.diff @@ -37,15 +37,15 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - _4 = Neg(move _5); -+ _4 = Neg(_1); ++ _4 = Neg(copy _1); StorageDead(_5); - _3 = Neg(move _4); -+ _3 = _1; ++ _3 = copy _1; StorageDead(_4); - _2 = opaque::<i64>(move _3) -> [return: bb1, unwind unreachable]; -+ _2 = opaque::<i64>(_1) -> [return: bb1, unwind unreachable]; ++ _2 = opaque::<i64>(copy _1) -> [return: bb1, unwind unreachable]; } bb1: { @@ -54,23 +54,23 @@ - StorageLive(_6); + nop; StorageLive(_7); - _7 = _1; + _7 = copy _1; - _6 = Lt(move _7, const 13_i64); -+ _6 = Lt(_1, const 13_i64); ++ _6 = Lt(copy _1, const 13_i64); StorageDead(_7); StorageLive(_8); StorageLive(_9); StorageLive(_10); StorageLive(_11); - _11 = _6; + _11 = copy _6; - _10 = Not(move _11); -+ _10 = Not(_6); ++ _10 = Not(copy _6); StorageDead(_11); - _9 = Not(move _10); -+ _9 = _6; ++ _9 = copy _6; StorageDead(_10); - _8 = opaque::<bool>(move _9) -> [return: bb2, unwind unreachable]; -+ _8 = opaque::<bool>(_6) -> [return: bb2, unwind unreachable]; ++ _8 = opaque::<bool>(copy _6) -> [return: bb2, unwind unreachable]; } bb2: { @@ -80,12 +80,12 @@ - StorageLive(_13); + nop; StorageLive(_14); - _14 = _1; + _14 = copy _1; - _13 = Ne(move _14, const 15_i64); -+ _13 = Ne(_1, const 15_i64); ++ _13 = Ne(copy _1, const 15_i64); StorageDead(_14); - _12 = opaque::<bool>(move _13) -> [return: bb3, unwind unreachable]; -+ _12 = opaque::<bool>(_13) -> [return: bb3, unwind unreachable]; ++ _12 = opaque::<bool>(copy _13) -> [return: bb3, unwind unreachable]; } bb3: { @@ -96,15 +96,15 @@ StorageLive(_16); StorageLive(_17); StorageLive(_18); - _18 = _1; + _18 = copy _1; - _17 = Eq(move _18, const 15_i64); -+ _17 = Eq(_1, const 15_i64); ++ _17 = Eq(copy _1, const 15_i64); StorageDead(_18); - _16 = Not(move _17); -+ _16 = _13; ++ _16 = copy _13; StorageDead(_17); - _15 = opaque::<bool>(move _16) -> [return: bb4, unwind unreachable]; -+ _15 = opaque::<bool>(_13) -> [return: bb4, unwind unreachable]; ++ _15 = opaque::<bool>(copy _13) -> [return: bb4, unwind unreachable]; } bb4: { @@ -114,12 +114,12 @@ - StorageLive(_20); + nop; StorageLive(_21); - _21 = _1; + _21 = copy _1; - _20 = Eq(move _21, const 35_i64); -+ _20 = Eq(_1, const 35_i64); ++ _20 = Eq(copy _1, const 35_i64); StorageDead(_21); - _19 = opaque::<bool>(move _20) -> [return: bb5, unwind unreachable]; -+ _19 = opaque::<bool>(_20) -> [return: bb5, unwind unreachable]; ++ _19 = opaque::<bool>(copy _20) -> [return: bb5, unwind unreachable]; } bb5: { @@ -130,15 +130,15 @@ StorageLive(_23); StorageLive(_24); StorageLive(_25); - _25 = _1; + _25 = copy _1; - _24 = Ne(move _25, const 35_i64); -+ _24 = Ne(_1, const 35_i64); ++ _24 = Ne(copy _1, const 35_i64); StorageDead(_25); - _23 = Not(move _24); -+ _23 = _20; ++ _23 = copy _20; StorageDead(_24); - _22 = opaque::<bool>(move _23) -> [return: bb6, unwind unreachable]; -+ _22 = opaque::<bool>(_20) -> [return: bb6, unwind unreachable]; ++ _22 = opaque::<bool>(copy _20) -> [return: bb6, unwind unreachable]; } bb6: { diff --git a/tests/mir-opt/gvn.unary.GVN.panic-unwind.diff b/tests/mir-opt/gvn.unary.GVN.panic-unwind.diff index e672f6fb6ba..5978f1faa1f 100644 --- a/tests/mir-opt/gvn.unary.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.unary.GVN.panic-unwind.diff @@ -37,15 +37,15 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - _4 = Neg(move _5); -+ _4 = Neg(_1); ++ _4 = Neg(copy _1); StorageDead(_5); - _3 = Neg(move _4); -+ _3 = _1; ++ _3 = copy _1; StorageDead(_4); - _2 = opaque::<i64>(move _3) -> [return: bb1, unwind continue]; -+ _2 = opaque::<i64>(_1) -> [return: bb1, unwind continue]; ++ _2 = opaque::<i64>(copy _1) -> [return: bb1, unwind continue]; } bb1: { @@ -54,23 +54,23 @@ - StorageLive(_6); + nop; StorageLive(_7); - _7 = _1; + _7 = copy _1; - _6 = Lt(move _7, const 13_i64); -+ _6 = Lt(_1, const 13_i64); ++ _6 = Lt(copy _1, const 13_i64); StorageDead(_7); StorageLive(_8); StorageLive(_9); StorageLive(_10); StorageLive(_11); - _11 = _6; + _11 = copy _6; - _10 = Not(move _11); -+ _10 = Not(_6); ++ _10 = Not(copy _6); StorageDead(_11); - _9 = Not(move _10); -+ _9 = _6; ++ _9 = copy _6; StorageDead(_10); - _8 = opaque::<bool>(move _9) -> [return: bb2, unwind continue]; -+ _8 = opaque::<bool>(_6) -> [return: bb2, unwind continue]; ++ _8 = opaque::<bool>(copy _6) -> [return: bb2, unwind continue]; } bb2: { @@ -80,12 +80,12 @@ - StorageLive(_13); + nop; StorageLive(_14); - _14 = _1; + _14 = copy _1; - _13 = Ne(move _14, const 15_i64); -+ _13 = Ne(_1, const 15_i64); ++ _13 = Ne(copy _1, const 15_i64); StorageDead(_14); - _12 = opaque::<bool>(move _13) -> [return: bb3, unwind continue]; -+ _12 = opaque::<bool>(_13) -> [return: bb3, unwind continue]; ++ _12 = opaque::<bool>(copy _13) -> [return: bb3, unwind continue]; } bb3: { @@ -96,15 +96,15 @@ StorageLive(_16); StorageLive(_17); StorageLive(_18); - _18 = _1; + _18 = copy _1; - _17 = Eq(move _18, const 15_i64); -+ _17 = Eq(_1, const 15_i64); ++ _17 = Eq(copy _1, const 15_i64); StorageDead(_18); - _16 = Not(move _17); -+ _16 = _13; ++ _16 = copy _13; StorageDead(_17); - _15 = opaque::<bool>(move _16) -> [return: bb4, unwind continue]; -+ _15 = opaque::<bool>(_13) -> [return: bb4, unwind continue]; ++ _15 = opaque::<bool>(copy _13) -> [return: bb4, unwind continue]; } bb4: { @@ -114,12 +114,12 @@ - StorageLive(_20); + nop; StorageLive(_21); - _21 = _1; + _21 = copy _1; - _20 = Eq(move _21, const 35_i64); -+ _20 = Eq(_1, const 35_i64); ++ _20 = Eq(copy _1, const 35_i64); StorageDead(_21); - _19 = opaque::<bool>(move _20) -> [return: bb5, unwind continue]; -+ _19 = opaque::<bool>(_20) -> [return: bb5, unwind continue]; ++ _19 = opaque::<bool>(copy _20) -> [return: bb5, unwind continue]; } bb5: { @@ -130,15 +130,15 @@ StorageLive(_23); StorageLive(_24); StorageLive(_25); - _25 = _1; + _25 = copy _1; - _24 = Ne(move _25, const 35_i64); -+ _24 = Ne(_1, const 35_i64); ++ _24 = Ne(copy _1, const 35_i64); StorageDead(_25); - _23 = Not(move _24); -+ _23 = _20; ++ _23 = copy _20; StorageDead(_24); - _22 = opaque::<bool>(move _23) -> [return: bb6, unwind continue]; -+ _22 = opaque::<bool>(_20) -> [return: bb6, unwind continue]; ++ _22 = opaque::<bool>(copy _20) -> [return: bb6, unwind continue]; } bb6: { diff --git a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff index 3eed0473f7f..bb938f3ba6a 100644 --- a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-abort.diff @@ -58,10 +58,10 @@ StorageLive(_5); StorageLive(_6); StorageLive(_7); -- _7 = _1; +- _7 = copy _1; + _7 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_8); -- _8 = _3; +- _8 = copy _3; - _6 = Eq(move _7, move _8); + _8 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _6 = const false; @@ -77,10 +77,10 @@ StorageLive(_9); StorageLive(_10); StorageLive(_11); -- _11 = _1; +- _11 = copy _1; + _11 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_12); -- _12 = _3; +- _12 = copy _3; - _10 = Ne(move _11, move _12); + _12 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _10 = const true; @@ -96,10 +96,10 @@ StorageLive(_13); StorageLive(_14); StorageLive(_15); -- _15 = _1; +- _15 = copy _1; + _15 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_16); -- _16 = _3; +- _16 = copy _3; - _14 = Lt(move _15, move _16); + _16 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _14 = const true; @@ -115,10 +115,10 @@ StorageLive(_17); StorageLive(_18); StorageLive(_19); -- _19 = _1; +- _19 = copy _1; + _19 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_20); -- _20 = _3; +- _20 = copy _3; - _18 = Le(move _19, move _20); + _20 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _18 = const true; @@ -134,10 +134,10 @@ StorageLive(_21); StorageLive(_22); StorageLive(_23); -- _23 = _1; +- _23 = copy _1; + _23 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_24); -- _24 = _3; +- _24 = copy _3; - _22 = Gt(move _23, move _24); + _24 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _22 = const false; @@ -153,10 +153,10 @@ StorageLive(_25); StorageLive(_26); StorageLive(_27); -- _27 = _1; +- _27 = copy _1; + _27 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_28); -- _28 = _3; +- _28 = copy _3; - _26 = Ge(move _27, move _28); + _28 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _26 = const false; diff --git a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff index 9a6e255a872..81432d687eb 100644 --- a/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wide_ptr_integer.GVN.panic-unwind.diff @@ -58,10 +58,10 @@ StorageLive(_5); StorageLive(_6); StorageLive(_7); -- _7 = _1; +- _7 = copy _1; + _7 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_8); -- _8 = _3; +- _8 = copy _3; - _6 = Eq(move _7, move _8); + _8 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _6 = const false; @@ -77,10 +77,10 @@ StorageLive(_9); StorageLive(_10); StorageLive(_11); -- _11 = _1; +- _11 = copy _1; + _11 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_12); -- _12 = _3; +- _12 = copy _3; - _10 = Ne(move _11, move _12); + _12 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _10 = const true; @@ -96,10 +96,10 @@ StorageLive(_13); StorageLive(_14); StorageLive(_15); -- _15 = _1; +- _15 = copy _1; + _15 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_16); -- _16 = _3; +- _16 = copy _3; - _14 = Lt(move _15, move _16); + _16 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _14 = const true; @@ -115,10 +115,10 @@ StorageLive(_17); StorageLive(_18); StorageLive(_19); -- _19 = _1; +- _19 = copy _1; + _19 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_20); -- _20 = _3; +- _20 = copy _3; - _18 = Le(move _19, move _20); + _20 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _18 = const true; @@ -134,10 +134,10 @@ StorageLive(_21); StorageLive(_22); StorageLive(_23); -- _23 = _1; +- _23 = copy _1; + _23 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_24); -- _24 = _3; +- _24 = copy _3; - _22 = Gt(move _23, move _24); + _24 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _22 = const false; @@ -153,10 +153,10 @@ StorageLive(_25); StorageLive(_26); StorageLive(_27); -- _27 = _1; +- _27 = copy _1; + _27 = const Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [u8]; StorageLive(_28); -- _28 = _3; +- _28 = copy _3; - _26 = Ge(move _27, move _28); + _28 = const Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [u8]; + _26 = const false; diff --git a/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-abort.diff b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-abort.diff index 629c2225682..c58362e391c 100644 --- a/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-abort.diff @@ -69,7 +69,7 @@ _2 = &raw const (*_3); - _1 = move _2 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_2); -+ _1 = _2; ++ _1 = copy _2; + nop; StorageDead(_5); StorageDead(_3); @@ -87,24 +87,24 @@ _8 = &raw const (*_9); - _7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_8); -+ _7 = _8; ++ _7 = copy _8; + nop; StorageDead(_11); StorageDead(_9); StorageLive(_13); StorageLive(_14); StorageLive(_15); -- _15 = _1; -+ _15 = _2; +- _15 = copy _1; ++ _15 = copy _2; StorageLive(_16); StorageLive(_17); -- _17 = _7; +- _17 = copy _7; - _16 = move _17 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _17 = _8; -+ _16 = _8; ++ _17 = copy _8; ++ _16 = copy _8; StorageDead(_17); - _14 = Eq(move _15, move _16); -+ _14 = Eq(_2, _8); ++ _14 = Eq(copy _2, copy _8); StorageDead(_16); StorageDead(_15); _13 = opaque::<bool>(move _14) -> [return: bb1, unwind unreachable]; @@ -116,17 +116,17 @@ StorageLive(_18); StorageLive(_19); StorageLive(_20); -- _20 = _1; -+ _20 = _2; +- _20 = copy _1; ++ _20 = copy _2; StorageLive(_21); StorageLive(_22); -- _22 = _7; +- _22 = copy _7; - _21 = move _22 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _22 = _8; -+ _21 = _8; ++ _22 = copy _8; ++ _21 = copy _8; StorageDead(_22); - _19 = Ne(move _20, move _21); -+ _19 = Ne(_2, _8); ++ _19 = Ne(copy _2, copy _8); StorageDead(_21); StorageDead(_20); _18 = opaque::<bool>(move _19) -> [return: bb2, unwind unreachable]; @@ -138,17 +138,17 @@ StorageLive(_23); StorageLive(_24); StorageLive(_25); -- _25 = _1; -+ _25 = _2; +- _25 = copy _1; ++ _25 = copy _2; StorageLive(_26); StorageLive(_27); -- _27 = _7; +- _27 = copy _7; - _26 = move _27 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _27 = _8; -+ _26 = _8; ++ _27 = copy _8; ++ _26 = copy _8; StorageDead(_27); - _24 = Lt(move _25, move _26); -+ _24 = Lt(_2, _8); ++ _24 = Lt(copy _2, copy _8); StorageDead(_26); StorageDead(_25); _23 = opaque::<bool>(move _24) -> [return: bb3, unwind unreachable]; @@ -160,17 +160,17 @@ StorageLive(_28); StorageLive(_29); StorageLive(_30); -- _30 = _1; -+ _30 = _2; +- _30 = copy _1; ++ _30 = copy _2; StorageLive(_31); StorageLive(_32); -- _32 = _7; +- _32 = copy _7; - _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _32 = _8; -+ _31 = _8; ++ _32 = copy _8; ++ _31 = copy _8; StorageDead(_32); - _29 = Le(move _30, move _31); -+ _29 = Le(_2, _8); ++ _29 = Le(copy _2, copy _8); StorageDead(_31); StorageDead(_30); _28 = opaque::<bool>(move _29) -> [return: bb4, unwind unreachable]; @@ -182,17 +182,17 @@ StorageLive(_33); StorageLive(_34); StorageLive(_35); -- _35 = _1; -+ _35 = _2; +- _35 = copy _1; ++ _35 = copy _2; StorageLive(_36); StorageLive(_37); -- _37 = _7; +- _37 = copy _7; - _36 = move _37 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _37 = _8; -+ _36 = _8; ++ _37 = copy _8; ++ _36 = copy _8; StorageDead(_37); - _34 = Gt(move _35, move _36); -+ _34 = Gt(_2, _8); ++ _34 = Gt(copy _2, copy _8); StorageDead(_36); StorageDead(_35); _33 = opaque::<bool>(move _34) -> [return: bb5, unwind unreachable]; @@ -204,17 +204,17 @@ StorageLive(_38); StorageLive(_39); StorageLive(_40); -- _40 = _1; -+ _40 = _2; +- _40 = copy _1; ++ _40 = copy _2; StorageLive(_41); StorageLive(_42); -- _42 = _7; +- _42 = copy _7; - _41 = move _42 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _42 = _8; -+ _41 = _8; ++ _42 = copy _8; ++ _41 = copy _8; StorageDead(_42); - _39 = Ge(move _40, move _41); -+ _39 = Ge(_2, _8); ++ _39 = Ge(copy _2, copy _8); StorageDead(_41); StorageDead(_40); _38 = opaque::<bool>(move _39) -> [return: bb6, unwind unreachable]; diff --git a/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-unwind.diff index 3380bc84cb8..b29ee862c81 100644 --- a/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wide_ptr_provenance.GVN.panic-unwind.diff @@ -69,7 +69,7 @@ _2 = &raw const (*_3); - _1 = move _2 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_2); -+ _1 = _2; ++ _1 = copy _2; + nop; StorageDead(_5); StorageDead(_3); @@ -87,24 +87,24 @@ _8 = &raw const (*_9); - _7 = move _8 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_8); -+ _7 = _8; ++ _7 = copy _8; + nop; StorageDead(_11); StorageDead(_9); StorageLive(_13); StorageLive(_14); StorageLive(_15); -- _15 = _1; -+ _15 = _2; +- _15 = copy _1; ++ _15 = copy _2; StorageLive(_16); StorageLive(_17); -- _17 = _7; +- _17 = copy _7; - _16 = move _17 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _17 = _8; -+ _16 = _8; ++ _17 = copy _8; ++ _16 = copy _8; StorageDead(_17); - _14 = Eq(move _15, move _16); -+ _14 = Eq(_2, _8); ++ _14 = Eq(copy _2, copy _8); StorageDead(_16); StorageDead(_15); _13 = opaque::<bool>(move _14) -> [return: bb1, unwind continue]; @@ -116,17 +116,17 @@ StorageLive(_18); StorageLive(_19); StorageLive(_20); -- _20 = _1; -+ _20 = _2; +- _20 = copy _1; ++ _20 = copy _2; StorageLive(_21); StorageLive(_22); -- _22 = _7; +- _22 = copy _7; - _21 = move _22 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _22 = _8; -+ _21 = _8; ++ _22 = copy _8; ++ _21 = copy _8; StorageDead(_22); - _19 = Ne(move _20, move _21); -+ _19 = Ne(_2, _8); ++ _19 = Ne(copy _2, copy _8); StorageDead(_21); StorageDead(_20); _18 = opaque::<bool>(move _19) -> [return: bb2, unwind continue]; @@ -138,17 +138,17 @@ StorageLive(_23); StorageLive(_24); StorageLive(_25); -- _25 = _1; -+ _25 = _2; +- _25 = copy _1; ++ _25 = copy _2; StorageLive(_26); StorageLive(_27); -- _27 = _7; +- _27 = copy _7; - _26 = move _27 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _27 = _8; -+ _26 = _8; ++ _27 = copy _8; ++ _26 = copy _8; StorageDead(_27); - _24 = Lt(move _25, move _26); -+ _24 = Lt(_2, _8); ++ _24 = Lt(copy _2, copy _8); StorageDead(_26); StorageDead(_25); _23 = opaque::<bool>(move _24) -> [return: bb3, unwind continue]; @@ -160,17 +160,17 @@ StorageLive(_28); StorageLive(_29); StorageLive(_30); -- _30 = _1; -+ _30 = _2; +- _30 = copy _1; ++ _30 = copy _2; StorageLive(_31); StorageLive(_32); -- _32 = _7; +- _32 = copy _7; - _31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _32 = _8; -+ _31 = _8; ++ _32 = copy _8; ++ _31 = copy _8; StorageDead(_32); - _29 = Le(move _30, move _31); -+ _29 = Le(_2, _8); ++ _29 = Le(copy _2, copy _8); StorageDead(_31); StorageDead(_30); _28 = opaque::<bool>(move _29) -> [return: bb4, unwind continue]; @@ -182,17 +182,17 @@ StorageLive(_33); StorageLive(_34); StorageLive(_35); -- _35 = _1; -+ _35 = _2; +- _35 = copy _1; ++ _35 = copy _2; StorageLive(_36); StorageLive(_37); -- _37 = _7; +- _37 = copy _7; - _36 = move _37 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _37 = _8; -+ _36 = _8; ++ _37 = copy _8; ++ _36 = copy _8; StorageDead(_37); - _34 = Gt(move _35, move _36); -+ _34 = Gt(_2, _8); ++ _34 = Gt(copy _2, copy _8); StorageDead(_36); StorageDead(_35); _33 = opaque::<bool>(move _34) -> [return: bb5, unwind continue]; @@ -204,17 +204,17 @@ StorageLive(_38); StorageLive(_39); StorageLive(_40); -- _40 = _1; -+ _40 = _2; +- _40 = copy _1; ++ _40 = copy _2; StorageLive(_41); StorageLive(_42); -- _42 = _7; +- _42 = copy _7; - _41 = move _42 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _42 = _8; -+ _41 = _8; ++ _42 = copy _8; ++ _41 = copy _8; StorageDead(_42); - _39 = Ge(move _40, move _41); -+ _39 = Ge(_2, _8); ++ _39 = Ge(copy _2, copy _8); StorageDead(_41); StorageDead(_40); _38 = opaque::<bool>(move _39) -> [return: bb6, unwind continue]; diff --git a/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-abort.diff b/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-abort.diff index da1662615d2..f4c38b7ab07 100644 --- a/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-abort.diff @@ -75,8 +75,8 @@ StorageLive(_8); _8 = const 0_usize; - _9 = Len((*_1)); -- _10 = Lt(_8, _9); -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb1, unwind unreachable]; +- _10 = Lt(copy _8, copy _9); +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, copy _8) -> [success: bb1, unwind unreachable]; + _9 = const 2_usize; + _10 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 2_usize, const 0_usize) -> [success: bb1, unwind unreachable]; @@ -91,7 +91,7 @@ _4 = &raw const (*_5); - _3 = move _4 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_4); -+ _3 = _4; ++ _3 = copy _4; + nop; StorageDead(_7); StorageDead(_5); @@ -104,8 +104,8 @@ StorageLive(_16); _16 = const 1_usize; - _17 = Len((*_1)); -- _18 = Lt(_16, _17); -- assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb2, unwind unreachable]; +- _18 = Lt(copy _16, copy _17); +- assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, copy _16) -> [success: bb2, unwind unreachable]; + _17 = const 2_usize; + _18 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 2_usize, const 1_usize) -> [success: bb2, unwind unreachable]; @@ -120,24 +120,24 @@ _12 = &raw const (*_13); - _11 = move _12 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_12); -+ _11 = _12; ++ _11 = copy _12; + nop; StorageDead(_15); StorageDead(_13); StorageLive(_19); StorageLive(_20); StorageLive(_21); -- _21 = _3; -+ _21 = _4; +- _21 = copy _3; ++ _21 = copy _4; StorageLive(_22); StorageLive(_23); -- _23 = _11; +- _23 = copy _11; - _22 = move _23 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _23 = _12; -+ _22 = _12; ++ _23 = copy _12; ++ _22 = copy _12; StorageDead(_23); - _20 = Eq(move _21, move _22); -+ _20 = Eq(_4, _12); ++ _20 = Eq(copy _4, copy _12); StorageDead(_22); StorageDead(_21); _19 = opaque::<bool>(move _20) -> [return: bb3, unwind unreachable]; @@ -149,17 +149,17 @@ StorageLive(_24); StorageLive(_25); StorageLive(_26); -- _26 = _3; -+ _26 = _4; +- _26 = copy _3; ++ _26 = copy _4; StorageLive(_27); StorageLive(_28); -- _28 = _11; +- _28 = copy _11; - _27 = move _28 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _28 = _12; -+ _27 = _12; ++ _28 = copy _12; ++ _27 = copy _12; StorageDead(_28); - _25 = Ne(move _26, move _27); -+ _25 = Ne(_4, _12); ++ _25 = Ne(copy _4, copy _12); StorageDead(_27); StorageDead(_26); _24 = opaque::<bool>(move _25) -> [return: bb4, unwind unreachable]; @@ -171,17 +171,17 @@ StorageLive(_29); StorageLive(_30); StorageLive(_31); -- _31 = _3; -+ _31 = _4; +- _31 = copy _3; ++ _31 = copy _4; StorageLive(_32); StorageLive(_33); -- _33 = _11; +- _33 = copy _11; - _32 = move _33 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _33 = _12; -+ _32 = _12; ++ _33 = copy _12; ++ _32 = copy _12; StorageDead(_33); - _30 = Lt(move _31, move _32); -+ _30 = Lt(_4, _12); ++ _30 = Lt(copy _4, copy _12); StorageDead(_32); StorageDead(_31); _29 = opaque::<bool>(move _30) -> [return: bb5, unwind unreachable]; @@ -193,17 +193,17 @@ StorageLive(_34); StorageLive(_35); StorageLive(_36); -- _36 = _3; -+ _36 = _4; +- _36 = copy _3; ++ _36 = copy _4; StorageLive(_37); StorageLive(_38); -- _38 = _11; +- _38 = copy _11; - _37 = move _38 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _38 = _12; -+ _37 = _12; ++ _38 = copy _12; ++ _37 = copy _12; StorageDead(_38); - _35 = Le(move _36, move _37); -+ _35 = Le(_4, _12); ++ _35 = Le(copy _4, copy _12); StorageDead(_37); StorageDead(_36); _34 = opaque::<bool>(move _35) -> [return: bb6, unwind unreachable]; @@ -215,17 +215,17 @@ StorageLive(_39); StorageLive(_40); StorageLive(_41); -- _41 = _3; -+ _41 = _4; +- _41 = copy _3; ++ _41 = copy _4; StorageLive(_42); StorageLive(_43); -- _43 = _11; +- _43 = copy _11; - _42 = move _43 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _43 = _12; -+ _42 = _12; ++ _43 = copy _12; ++ _42 = copy _12; StorageDead(_43); - _40 = Gt(move _41, move _42); -+ _40 = Gt(_4, _12); ++ _40 = Gt(copy _4, copy _12); StorageDead(_42); StorageDead(_41); _39 = opaque::<bool>(move _40) -> [return: bb7, unwind unreachable]; @@ -237,17 +237,17 @@ StorageLive(_44); StorageLive(_45); StorageLive(_46); -- _46 = _3; -+ _46 = _4; +- _46 = copy _3; ++ _46 = copy _4; StorageLive(_47); StorageLive(_48); -- _48 = _11; +- _48 = copy _11; - _47 = move _48 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _48 = _12; -+ _47 = _12; ++ _48 = copy _12; ++ _47 = copy _12; StorageDead(_48); - _45 = Ge(move _46, move _47); -+ _45 = Ge(_4, _12); ++ _45 = Ge(copy _4, copy _12); StorageDead(_47); StorageDead(_46); _44 = opaque::<bool>(move _45) -> [return: bb8, unwind unreachable]; diff --git a/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-unwind.diff index 6c4f3a91264..03f2d129a9b 100644 --- a/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wide_ptr_same_provenance.GVN.panic-unwind.diff @@ -75,8 +75,8 @@ StorageLive(_8); _8 = const 0_usize; - _9 = Len((*_1)); -- _10 = Lt(_8, _9); -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb1, unwind continue]; +- _10 = Lt(copy _8, copy _9); +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, copy _8) -> [success: bb1, unwind continue]; + _9 = const 2_usize; + _10 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 2_usize, const 0_usize) -> [success: bb1, unwind continue]; @@ -91,7 +91,7 @@ _4 = &raw const (*_5); - _3 = move _4 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_4); -+ _3 = _4; ++ _3 = copy _4; + nop; StorageDead(_7); StorageDead(_5); @@ -104,8 +104,8 @@ StorageLive(_16); _16 = const 1_usize; - _17 = Len((*_1)); -- _18 = Lt(_16, _17); -- assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb2, unwind continue]; +- _18 = Lt(copy _16, copy _17); +- assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, copy _16) -> [success: bb2, unwind continue]; + _17 = const 2_usize; + _18 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 2_usize, const 1_usize) -> [success: bb2, unwind continue]; @@ -120,24 +120,24 @@ _12 = &raw const (*_13); - _11 = move _12 as *const dyn std::marker::Send (PointerCoercion(Unsize)); - StorageDead(_12); -+ _11 = _12; ++ _11 = copy _12; + nop; StorageDead(_15); StorageDead(_13); StorageLive(_19); StorageLive(_20); StorageLive(_21); -- _21 = _3; -+ _21 = _4; +- _21 = copy _3; ++ _21 = copy _4; StorageLive(_22); StorageLive(_23); -- _23 = _11; +- _23 = copy _11; - _22 = move _23 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _23 = _12; -+ _22 = _12; ++ _23 = copy _12; ++ _22 = copy _12; StorageDead(_23); - _20 = Eq(move _21, move _22); -+ _20 = Eq(_4, _12); ++ _20 = Eq(copy _4, copy _12); StorageDead(_22); StorageDead(_21); _19 = opaque::<bool>(move _20) -> [return: bb3, unwind continue]; @@ -149,17 +149,17 @@ StorageLive(_24); StorageLive(_25); StorageLive(_26); -- _26 = _3; -+ _26 = _4; +- _26 = copy _3; ++ _26 = copy _4; StorageLive(_27); StorageLive(_28); -- _28 = _11; +- _28 = copy _11; - _27 = move _28 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _28 = _12; -+ _27 = _12; ++ _28 = copy _12; ++ _27 = copy _12; StorageDead(_28); - _25 = Ne(move _26, move _27); -+ _25 = Ne(_4, _12); ++ _25 = Ne(copy _4, copy _12); StorageDead(_27); StorageDead(_26); _24 = opaque::<bool>(move _25) -> [return: bb4, unwind continue]; @@ -171,17 +171,17 @@ StorageLive(_29); StorageLive(_30); StorageLive(_31); -- _31 = _3; -+ _31 = _4; +- _31 = copy _3; ++ _31 = copy _4; StorageLive(_32); StorageLive(_33); -- _33 = _11; +- _33 = copy _11; - _32 = move _33 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _33 = _12; -+ _32 = _12; ++ _33 = copy _12; ++ _32 = copy _12; StorageDead(_33); - _30 = Lt(move _31, move _32); -+ _30 = Lt(_4, _12); ++ _30 = Lt(copy _4, copy _12); StorageDead(_32); StorageDead(_31); _29 = opaque::<bool>(move _30) -> [return: bb5, unwind continue]; @@ -193,17 +193,17 @@ StorageLive(_34); StorageLive(_35); StorageLive(_36); -- _36 = _3; -+ _36 = _4; +- _36 = copy _3; ++ _36 = copy _4; StorageLive(_37); StorageLive(_38); -- _38 = _11; +- _38 = copy _11; - _37 = move _38 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _38 = _12; -+ _37 = _12; ++ _38 = copy _12; ++ _37 = copy _12; StorageDead(_38); - _35 = Le(move _36, move _37); -+ _35 = Le(_4, _12); ++ _35 = Le(copy _4, copy _12); StorageDead(_37); StorageDead(_36); _34 = opaque::<bool>(move _35) -> [return: bb6, unwind continue]; @@ -215,17 +215,17 @@ StorageLive(_39); StorageLive(_40); StorageLive(_41); -- _41 = _3; -+ _41 = _4; +- _41 = copy _3; ++ _41 = copy _4; StorageLive(_42); StorageLive(_43); -- _43 = _11; +- _43 = copy _11; - _42 = move _43 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _43 = _12; -+ _42 = _12; ++ _43 = copy _12; ++ _42 = copy _12; StorageDead(_43); - _40 = Gt(move _41, move _42); -+ _40 = Gt(_4, _12); ++ _40 = Gt(copy _4, copy _12); StorageDead(_42); StorageDead(_41); _39 = opaque::<bool>(move _40) -> [return: bb7, unwind continue]; @@ -237,17 +237,17 @@ StorageLive(_44); StorageLive(_45); StorageLive(_46); -- _46 = _3; -+ _46 = _4; +- _46 = copy _3; ++ _46 = copy _4; StorageLive(_47); StorageLive(_48); -- _48 = _11; +- _48 = copy _11; - _47 = move _48 as *const dyn std::marker::Send (PointerCoercion(Unsize)); -+ _48 = _12; -+ _47 = _12; ++ _48 = copy _12; ++ _47 = copy _12; StorageDead(_48); - _45 = Ge(move _46, move _47); -+ _45 = Ge(_4, _12); ++ _45 = Ge(copy _4, copy _12); StorageDead(_47); StorageDead(_46); _44 = opaque::<bool>(move _45) -> [return: bb8, unwind continue]; diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff index a5c29c191ad..0433152bb4f 100644 --- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff @@ -16,9 +16,9 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Option::<T>::Some(move _3); -+ _2 = Option::<T>::Some(_1); ++ _2 = Option::<T>::Some(copy _1); StorageDead(_3); - _4 = discriminant(_2); - switchInt(move _4) -> [0: bb2, 1: bb3, otherwise: bb1]; @@ -37,10 +37,10 @@ bb3: { StorageLive(_5); -- _5 = ((_2 as Some).0: T); -- _0 = _5; -+ _5 = _1; -+ _0 = _1; +- _5 = copy ((_2 as Some).0: T); +- _0 = copy _5; ++ _5 = copy _1; ++ _0 = copy _1; StorageDead(_5); StorageDead(_2); return; diff --git a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff index 6f2e5248271..5722c865c2f 100644 --- a/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff @@ -16,9 +16,9 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Option::<T>::Some(move _3); -+ _2 = Option::<T>::Some(_1); ++ _2 = Option::<T>::Some(copy _1); StorageDead(_3); - _4 = discriminant(_2); - switchInt(move _4) -> [0: bb2, 1: bb3, otherwise: bb1]; @@ -37,10 +37,10 @@ bb3: { StorageLive(_5); -- _5 = ((_2 as Some).0: T); -- _0 = _5; -+ _5 = _1; -+ _0 = _1; +- _5 = copy ((_2 as Some).0: T); +- _0 = copy _5; ++ _5 = copy _1; ++ _0 = copy _1; StorageDead(_5); StorageDead(_2); return; diff --git a/tests/mir-opt/gvn_copy_moves.fn0.GVN.diff b/tests/mir-opt/gvn_copy_moves.fn0.GVN.diff index b12de636f58..c364da7a3cc 100644 --- a/tests/mir-opt/gvn_copy_moves.fn0.GVN.diff +++ b/tests/mir-opt/gvn_copy_moves.fn0.GVN.diff @@ -14,10 +14,10 @@ _2 = [const 42_u128; 6]; - _2[_1] = const 1_u128; + _2[1 of 2] = const 1_u128; - _3 = (_2,); - _4 = _3; -- _5 = fn1(move (_3.0: [u128; 6]), _4) -> [return: bb1, unwind unreachable]; -+ _5 = fn1((_3.0: [u128; 6]), _3) -> [return: bb1, unwind unreachable]; + _3 = (copy _2,); + _4 = copy _3; +- _5 = fn1(move (_3.0: [u128; 6]), copy _4) -> [return: bb1, unwind unreachable]; ++ _5 = fn1(copy (_3.0: [u128; 6]), copy _3) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/gvn_copy_moves.rs b/tests/mir-opt/gvn_copy_moves.rs index 1812de16d69..b1fe2caf3a1 100644 --- a/tests/mir-opt/gvn_copy_moves.rs +++ b/tests/mir-opt/gvn_copy_moves.rs @@ -18,9 +18,9 @@ fn fn0() { // CHECK-NEXT: _1 = const 1_usize; // CHECK-NEXT: _2 = [const 42_u128; 6]; // CHECK-NEXT: _2[1 of 2] = const 1_u128; - // CHECK-NEXT: _3 = (_2,); - // CHECK-NEXT: _4 = _3; - // CHECK-NEXT: _5 = fn1((_3.0: [u128; 6]), _3) + // CHECK-NEXT: _3 = (copy _2,); + // CHECK-NEXT: _4 = copy _3; + // CHECK-NEXT: _5 = fn1(copy (_3.0: [u128; 6]), copy _3) a = 1_usize; b = [42; 6]; b[a] = 1; diff --git a/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff b/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff index 3af78d9b6ce..1e378d30a3e 100644 --- a/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff +++ b/tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff @@ -25,20 +25,20 @@ StorageLive(_2); StorageLive(_3); - _3 = AlignOf(u8); -- _2 = _3 as *mut u8 (Transmute); +- _2 = copy _3 as *mut u8 (Transmute); + _3 = const 1_usize; + _2 = const {0x1 as *mut u8}; StorageDead(_3); StorageLive(_4); StorageLive(_5); -- _5 = _2; -- _4 = _2 as *const u8 (PtrToPtr); +- _5 = copy _2; +- _4 = copy _2 as *const u8 (PtrToPtr); + _5 = const {0x1 as *mut u8}; + _4 = const {0x1 as *const u8}; StorageDead(_5); StorageLive(_6); - _6 = const Foo::<u8>::SENTINEL as *const u8 (PtrToPtr); -- _1 = Eq(_4, _6); +- _1 = Eq(copy _4, copy _6); + _6 = const {0x1 as *const u8}; + _1 = const true; StorageDead(_6); diff --git a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff index 626367766d7..37b7b0d2c9d 100644 --- a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff +++ b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-abort.diff @@ -17,14 +17,14 @@ StorageLive(_3); _5 = const f::promoted[0]; _3 = &(*_5); -- _2 = ((*_3).1: E); -+ _2 = ((*_5).1: E); +- _2 = copy ((*_3).1: E); ++ _2 = copy ((*_5).1: E); StorageLive(_1); -- _1 = ((_2 as A).1: u32); +- _1 = copy ((_2 as A).1: u32); + _1 = const 0_u32; StorageDead(_3); StorageDead(_2); -- _0 = _1; +- _0 = copy _1; + _0 = const 0_u32; StorageDead(_1); return; diff --git a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff index 626367766d7..37b7b0d2c9d 100644 --- a/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff +++ b/tests/mir-opt/gvn_uninhabited.f.GVN.panic-unwind.diff @@ -17,14 +17,14 @@ StorageLive(_3); _5 = const f::promoted[0]; _3 = &(*_5); -- _2 = ((*_3).1: E); -+ _2 = ((*_5).1: E); +- _2 = copy ((*_3).1: E); ++ _2 = copy ((*_5).1: E); StorageLive(_1); -- _1 = ((_2 as A).1: u32); +- _1 = copy ((_2 as A).1: u32); + _1 = const 0_u32; StorageDead(_3); StorageDead(_2); -- _0 = _1; +- _0 = copy _1; + _0 = const 0_u32; StorageDead(_1); return; diff --git a/tests/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff index 083515aebc6..2350faa05d3 100644 --- a/tests/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_2); - _2 = _1; + _2 = copy _1; switchInt(move _2) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff index 15319586062..94570017730 100644 --- a/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = Eq(move _3, const -42f32); switchInt(move _2) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff index 218d7fd59b7..d19b4148405 100644 --- a/tests/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.dont_remove_comparison.SimplifyComparisonIntegral.diff @@ -17,11 +17,11 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Eq(move _3, const 17_i8); - StorageDead(_3); -- switchInt(_2) -> [0: bb2, otherwise: bb1]; -+ _2 = Eq(_3, const 17_i8); +- switchInt(copy _2) -> [0: bb2, otherwise: bb1]; ++ _2 = Eq(copy _3, const 17_i8); + nop; + switchInt(move _3) -> [17: bb1, otherwise: bb2]; } @@ -30,7 +30,7 @@ + StorageDead(_3); StorageLive(_6); StorageLive(_7); - _7 = _2; + _7 = copy _2; _6 = move _7 as i32 (IntToInt); StorageDead(_7); _0 = Add(const 100_i32, move _6); @@ -42,7 +42,7 @@ + StorageDead(_3); StorageLive(_4); StorageLive(_5); - _5 = _2; + _5 = copy _2; _4 = move _5 as i32 (IntToInt); StorageDead(_5); _0 = Add(const 10_i32, move _4); diff --git a/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff index fedbd6cdd24..e47b7e52259 100644 --- a/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Eq(move _3, const 'x'); - switchInt(move _2) -> [0: bb2, otherwise: bb1]; + nop; diff --git a/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff index 9c38d8fe065..b6cdc6af8bf 100644 --- a/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Eq(move _3, const 42_i8); - switchInt(move _2) -> [0: bb2, otherwise: bb1]; + nop; diff --git a/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff index 8c85ce78565..31745ac732a 100644 --- a/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff @@ -12,7 +12,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Eq(move _3, const 42_u32); - switchInt(move _2) -> [0: bb2, otherwise: bb1]; + nop; @@ -29,7 +29,7 @@ StorageDead(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - _4 = Ne(move _5, const 21_u32); - switchInt(move _4) -> [0: bb4, otherwise: bb3]; + nop; diff --git a/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff index 876ed61e9fa..d747985f6e1 100644 --- a/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Eq(move _3, const -42_i32); - switchInt(move _2) -> [0: bb2, otherwise: bb1]; + nop; diff --git a/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff b/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff index ed3eb47dd3d..1d6809a9438 100644 --- a/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff +++ b/tests/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Eq(move _3, const 42_u32); - switchInt(move _2) -> [0: bb2, otherwise: bb1]; + nop; diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff index 4e495c37fbc..2d64d49ce5c 100644 --- a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-abort.diff @@ -21,17 +21,17 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = <Q as Query>::cache::<T>(move _3) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_3); StorageLive(_4); - _4 = _2; + _4 = copy _2; - _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind unreachable]; + StorageLive(_5); -+ _5 = _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize)); ++ _5 = copy _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize)); + _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(move _5) -> [return: bb2, unwind unreachable]; } diff --git a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff index 7fdb7618212..c5e9654e19c 100644 --- a/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.get_query.Inline.panic-unwind.diff @@ -21,17 +21,17 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = <Q as Query>::cache::<T>(move _3) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_3); StorageLive(_4); - _4 = _2; + _4 = copy _2; - _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind continue]; + StorageLive(_5); -+ _5 = _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize)); ++ _5 = copy _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize)); + _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(move _5) -> [return: bb2, unwind continue]; } diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff index 8df4408690b..13bc54424d1 100644 --- a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-abort.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_2); - _2 = _1; + _2 = copy _1; _0 = <dyn Cache<V = V> as Cache>::store_nocache(move _2) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff index 43a0621f766..35d4db37802 100644 --- a/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.mk_cycle.Inline.panic-unwind.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_2); - _2 = _1; + _2 = copy _1; _0 = <dyn Cache<V = V> as Cache>::store_nocache(move _2) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff index e72c312f549..f02ca623317 100644 --- a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-abort.diff @@ -13,7 +13,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = move _3 as &dyn Cache<V = <C as Cache>::V> (PointerCoercion(Unsize)); StorageDead(_3); - _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff index 46728f9e2e6..31080dff4de 100644 --- a/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/dyn_trait.try_execute_query.Inline.panic-unwind.diff @@ -13,7 +13,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = move _3 as &dyn Cache<V = <C as Cache>::V> (PointerCoercion(Unsize)); StorageDead(_3); - _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind continue]; diff --git a/tests/mir-opt/inline/inline_any_operand.bar.Inline.after.mir b/tests/mir-opt/inline/inline_any_operand.bar.Inline.after.mir index 2d0b71e0a64..0ee5968419a 100644 --- a/tests/mir-opt/inline/inline_any_operand.bar.Inline.after.mir +++ b/tests/mir-opt/inline/inline_any_operand.bar.Inline.after.mir @@ -18,12 +18,12 @@ fn bar() -> bool { StorageLive(_1); _1 = foo; StorageLive(_2); - _2 = _1; + _2 = copy _1; StorageLive(_3); _3 = const 1_i32; StorageLive(_4); _4 = const -1_i32; - _0 = Eq(_3, _4); + _0 = Eq(copy _3, copy _4); StorageDead(_4); StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir index 8a60f4b1bdc..5bc227c87df 100644 --- a/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir +++ b/tests/mir-opt/inline/inline_closure.foo.Inline.after.mir @@ -26,15 +26,15 @@ fn foo(_1: T, _2: i32) -> i32 { _4 = &_3; StorageLive(_5); StorageLive(_6); - _6 = _2; + _6 = copy _2; StorageLive(_7); - _7 = _2; + _7 = copy _2; _5 = (move _6, move _7); StorageLive(_8); _8 = move (_5.0: i32); StorageLive(_9); _9 = move (_5.1: i32); - _0 = _8; + _0 = copy _8; StorageDead(_9); StorageDead(_8); StorageDead(_7); diff --git a/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir index f524b054b61..7930111cf22 100644 --- a/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir +++ b/tests/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir @@ -26,15 +26,15 @@ fn foo(_1: T, _2: &i32) -> i32 { _4 = &_3; StorageLive(_5); StorageLive(_6); - _6 = _2; + _6 = copy _2; StorageLive(_7); - _7 = _2; + _7 = copy _2; _5 = (move _6, move _7); StorageLive(_8); _8 = move (_5.0: &i32); StorageLive(_9); _9 = move (_5.1: &i32); - _0 = (*_8); + _0 = copy (*_8); StorageDead(_9); StorageDead(_8); StorageDead(_7); diff --git a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir index 2f9d28ea093..17e6e39a86b 100644 --- a/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir +++ b/tests/mir-opt/inline/inline_closure_captures.foo.Inline.after.mir @@ -34,18 +34,18 @@ fn foo(_1: T, _2: i32) -> (i32, T) { _6 = &_3; StorageLive(_7); StorageLive(_8); - _8 = _2; + _8 = copy _2; _7 = (move _8,); StorageLive(_9); _9 = move (_7.0: i32); StorageLive(_10); StorageLive(_12); StorageLive(_11); - _10 = ((*_6).0: &i32); - _11 = (*_10); + _10 = copy ((*_6).0: &i32); + _11 = copy (*_10); StorageLive(_13); - _12 = ((*_6).1: &T); - _13 = (*_12); + _12 = copy ((*_6).1: &T); + _13 = copy (*_12); _0 = (move _11, move _13); StorageDead(_13); StorageDead(_11); diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff index 07031a298bc..94017f028cc 100644 --- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-abort.diff @@ -34,13 +34,13 @@ - _4 = g() -> [return: bb1, unwind unreachable]; + _4 = {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8 (#0)}; + _3 = &mut _4; -+ _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}> { __pointer: _3 }; ++ _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}> { __pointer: copy _3 }; + StorageDead(_3); + StorageLive(_5); + _5 = const false; + StorageLive(_6); + StorageLive(_7); -+ _6 = (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}); ++ _6 = copy (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}); + _7 = discriminant((*_6)); + switchInt(move _7) -> [0: bb3, 1: bb7, 3: bb8, otherwise: bb9]; } @@ -68,7 +68,7 @@ - StorageDead(_2); - drop(_4) -> [return: bb4, unwind unreachable]; + StorageLive(_8); -+ switchInt(_5) -> [0: bb4, otherwise: bb5]; ++ switchInt(copy _5) -> [0: bb4, otherwise: bb5]; } bb4: { @@ -99,7 +99,7 @@ + bb8: { + StorageLive(_8); + StorageDead(_8); -+ _1 = CoroutineState::<i32, bool>::Complete(_5); ++ _1 = CoroutineState::<i32, bool>::Complete(copy _5); + discriminant((*_6)) = 1; + goto -> bb2; + } diff --git a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff index ab6c62b0baf..858f9ace9b4 100644 --- a/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_coroutine.main.Inline.panic-unwind.diff @@ -34,13 +34,13 @@ - _4 = g() -> [return: bb1, unwind continue]; + _4 = {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8 (#0)}; + _3 = &mut _4; -+ _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}> { __pointer: _3 }; ++ _2 = Pin::<&mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}> { __pointer: copy _3 }; + StorageDead(_3); + StorageLive(_5); + _5 = const false; + StorageLive(_6); + StorageLive(_7); -+ _6 = (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}); ++ _6 = copy (_2.0: &mut {coroutine@$DIR/inline_coroutine.rs:20:5: 20:8}); + _7 = discriminant((*_6)); + switchInt(move _7) -> [0: bb5, 1: bb9, 3: bb10, otherwise: bb11]; } @@ -84,7 +84,7 @@ - drop(_4) -> [return: bb6, unwind terminate(cleanup)]; + bb5: { + StorageLive(_8); -+ switchInt(_5) -> [0: bb6, otherwise: bb7]; ++ switchInt(copy _5) -> [0: bb6, otherwise: bb7]; } - bb6 (cleanup): { @@ -113,7 +113,7 @@ + bb10: { + StorageLive(_8); + StorageDead(_8); -+ _1 = CoroutineState::<i32, bool>::Complete(_5); ++ _1 = CoroutineState::<i32, bool>::Complete(copy _5); + discriminant((*_6)) = 1; + goto -> bb4; + } diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff index d675695eb10..bda85586515 100644 --- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-abort.diff @@ -16,7 +16,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = Gt(move _3, const 0_i32); switchInt(move _2) -> [0: bb2, otherwise: bb1]; } @@ -24,7 +24,7 @@ bb1: { StorageDead(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; _0 = move _4 as u32 (IntToInt); StorageDead(_4); StorageDead(_2); diff --git a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff index 1142616115f..ecd72d2b37f 100644 --- a/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_diverging.g.Inline.panic-unwind.diff @@ -16,7 +16,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = Gt(move _3, const 0_i32); switchInt(move _2) -> [0: bb2, otherwise: bb1]; } @@ -24,7 +24,7 @@ bb1: { StorageDead(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; _0 = move _4 as u32 (IntToInt); StorageDead(_4); StorageDead(_2); diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff index 2bbb830fc77..338dca85e5c 100644 --- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-abort.diff @@ -40,7 +40,7 @@ + + bb2: { + StorageDead(_5); -+ _1 = (_4, _6); ++ _1 = (copy _4, copy _6); + drop(_2) -> [return: bb3, unwind unreachable]; + } + diff --git a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff index bc4f2d24df0..a77cb913bfd 100644 --- a/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_diverging.h.Inline.panic-unwind.diff @@ -43,7 +43,7 @@ + StorageDead(_5); + StorageLive(_7); + _7 = move _4; -+ _1 = (move _7, _6); ++ _1 = (move _7, copy _6); + StorageDead(_7); + StorageDead(_4); + drop(_2) -> [return: bb3, unwind continue]; diff --git a/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_direct.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_direct.Inline.after.panic-abort.mir index 522f772c6f4..9b28aeb271d 100644 --- a/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_direct.Inline.after.panic-abort.mir +++ b/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_direct.Inline.after.panic-abort.mir @@ -9,7 +9,7 @@ fn marked_inline_direct(_1: i32) -> () { bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = call_twice(move _3) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_direct.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_direct.Inline.after.panic-unwind.mir index 722b02eeba8..929c89940dc 100644 --- a/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_direct.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_direct.Inline.after.panic-unwind.mir @@ -9,7 +9,7 @@ fn marked_inline_direct(_1: i32) -> () { bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = call_twice(move _3) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_indirect.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_indirect.Inline.after.panic-abort.mir index 63b91cbce2d..374ed294d8b 100644 --- a/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_indirect.Inline.after.panic-abort.mir +++ b/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_indirect.Inline.after.panic-abort.mir @@ -12,7 +12,7 @@ fn marked_inline_indirect(_1: i32) -> () { bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; StorageLive(_4); _4 = call_twice(move _3) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_indirect.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_indirect.Inline.after.panic-unwind.mir index 7c84e98dd51..97bed8020ba 100644 --- a/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_indirect.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_more_in_non_inline.marked_inline_indirect.Inline.after.panic-unwind.mir @@ -12,7 +12,7 @@ fn marked_inline_indirect(_1: i32) -> () { bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; StorageLive(_4); _4 = call_twice(move _3) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/inline/inline_more_in_non_inline.monomorphic_not_inline.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_more_in_non_inline.monomorphic_not_inline.Inline.after.panic-abort.mir index 989014b8b47..cffe0e96f5c 100644 --- a/tests/mir-opt/inline/inline_more_in_non_inline.monomorphic_not_inline.Inline.after.panic-abort.mir +++ b/tests/mir-opt/inline/inline_more_in_non_inline.monomorphic_not_inline.Inline.after.panic-abort.mir @@ -13,10 +13,10 @@ fn monomorphic_not_inline(_1: i32) -> () { bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; StorageLive(_4); StorageLive(_5); - _4 = other_thing(_3) -> [return: bb2, unwind unreachable]; + _4 = other_thing(copy _3) -> [return: bb2, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/inline/inline_more_in_non_inline.monomorphic_not_inline.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_more_in_non_inline.monomorphic_not_inline.Inline.after.panic-unwind.mir index bd200719bbb..7f3a093012b 100644 --- a/tests/mir-opt/inline/inline_more_in_non_inline.monomorphic_not_inline.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_more_in_non_inline.monomorphic_not_inline.Inline.after.panic-unwind.mir @@ -13,10 +13,10 @@ fn monomorphic_not_inline(_1: i32) -> () { bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; StorageLive(_4); StorageLive(_5); - _4 = other_thing(_3) -> [return: bb2, unwind continue]; + _4 = other_thing(copy _3) -> [return: bb2, unwind continue]; } bb1: { diff --git a/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir b/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir index ec3c79e2a37..9a256ea1949 100644 --- a/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir +++ b/tests/mir-opt/inline/inline_retag.bar.Inline.after.mir @@ -26,25 +26,25 @@ fn bar() -> bool { StorageLive(_1); _1 = foo; StorageLive(_2); - _2 = _1; + _2 = copy _1; StorageLive(_3); StorageLive(_4); _10 = const bar::promoted[1]; Retag(_10); - _4 = _10; - _3 = _4; + _4 = copy _10; + _3 = copy _4; StorageLive(_6); StorageLive(_7); _9 = const bar::promoted[0]; Retag(_9); - _7 = _9; - _6 = _7; + _7 = copy _9; + _6 = copy _7; Retag(_3); Retag(_6); StorageLive(_11); - _11 = (*_3); + _11 = copy (*_3); StorageLive(_12); - _12 = (*_6); + _12 = copy (*_6); _0 = Eq(move _11, move _12); StorageDead(_12); StorageDead(_11); diff --git a/tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff index 8117e58fa51..26b4dc357f3 100644 --- a/tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-abort.diff @@ -15,7 +15,7 @@ - } - - bb1: { -+ _0 = (*_2); ++ _0 = copy (*_2); StorageDead(_2); return; } diff --git a/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff index 00e92a0f5e5..faa12d5c736 100644 --- a/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_shims.clone.Inline.panic-unwind.diff @@ -15,7 +15,7 @@ - } - - bb1: { -+ _0 = (*_2); ++ _0 = copy (*_2); StorageDead(_2); return; } diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff index 2a36ccaab11..581244074b3 100644 --- a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff @@ -20,7 +20,7 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; - _3 = std::ptr::drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind unreachable]; + StorageLive(_6); + StorageLive(_7); @@ -34,7 +34,7 @@ StorageDead(_4); StorageDead(_3); StorageLive(_5); - _5 = _2; + _5 = copy _2; - _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind unreachable]; + StorageLive(_8); + StorageLive(_9); diff --git a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff index e11561076e6..d89ca003d77 100644 --- a/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff @@ -16,7 +16,7 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; _3 = std::ptr::drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind continue]; } @@ -24,7 +24,7 @@ StorageDead(_4); StorageDead(_3); StorageLive(_5); - _5 = _2; + _5 = copy _2; - _0 = std::ptr::drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind continue]; + StorageLive(_6); + StorageLive(_7); diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir index d7b4302b06d..8355cd0070d 100644 --- a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir +++ b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-abort.mir @@ -7,7 +7,7 @@ fn test(_1: &dyn X) -> u32 { bb0: { StorageLive(_2); - _2 = _1; + _2 = copy _1; _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir index 0d6f3e61f71..ebfbfeb0b13 100644 --- a/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_trait_method.test.Inline.after.panic-unwind.mir @@ -7,7 +7,7 @@ fn test(_1: &dyn X) -> u32 { bb0: { StorageLive(_2); - _2 = _1; + _2 = copy _1; _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind continue]; } diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir index af79c7ce196..1105dba06ac 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir +++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-abort.mir @@ -12,7 +12,7 @@ fn test2(_1: &dyn X) -> bool { bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = move _3; StorageDead(_3); _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir index bf5a56b8e62..faa6ef47b18 100644 --- a/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir +++ b/tests/mir-opt/inline/inline_trait_method_2.test2.Inline.after.panic-unwind.mir @@ -12,7 +12,7 @@ fn test2(_1: &dyn X) -> bool { bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = move _3; StorageDead(_3); _0 = <dyn X as X>::y(move _2) -> [return: bb1, unwind continue]; diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff index 2ab79cc2a50..e87a565f0fc 100644 --- a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-abort.diff @@ -25,12 +25,12 @@ bb1: { + StorageLive(_3); -+ _2 = Lt(_0, const 1_usize); -+ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, _0) -> [success: bb2, unwind unreachable]; ++ _2 = Lt(copy _0, const 1_usize); ++ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, copy _0) -> [success: bb2, unwind unreachable]; + } + + bb2: { -+ _3 = (*_1)[_0]; ++ _3 = copy (*_1)[_0]; + switchInt(move _3) -> [0: bb3, otherwise: bb4]; + } + diff --git a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff index 4d96a862885..834851b75ad 100644 --- a/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/issue_106141.outer.Inline.panic-unwind.diff @@ -25,12 +25,12 @@ bb1: { + StorageLive(_3); -+ _2 = Lt(_0, const 1_usize); -+ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, _0) -> [success: bb2, unwind continue]; ++ _2 = Lt(copy _0, const 1_usize); ++ assert(move _2, "index out of bounds: the length is {} but the index is {}", const 1_usize, copy _0) -> [success: bb2, unwind continue]; + } + + bb2: { -+ _3 = (*_1)[_0]; ++ _3 = copy (*_1)[_0]; + switchInt(move _3) -> [0: bb3, otherwise: bb4]; + } + diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir index 8c457037ec9..a48a9a0bb0c 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.a.Inline.after.mir @@ -14,11 +14,11 @@ fn a(_1: &mut [T]) -> &mut [T] { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; - _3 = _4; - _2 = _3; + _4 = copy _1; + _3 = copy _4; + _2 = copy _3; StorageDead(_4); - _0 = _2; + _0 = copy _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir index e27d9fe38c7..02aadfc1de0 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir @@ -16,17 +16,17 @@ fn b(_1: &mut Box<T>) -> &mut T { StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); StorageLive(_6); - _5 = (*_4); - _6 = (((_5.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T); + _5 = copy (*_4); + _6 = copy (((_5.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T); _3 = &mut (*_6); StorageDead(_6); StorageDead(_5); - _2 = _3; + _2 = copy _3; StorageDead(_4); - _0 = _2; + _0 = copy _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir index da0464c64d6..2d88f9e5524 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.c.Inline.after.mir @@ -12,9 +12,9 @@ fn c(_1: &[T]) -> &[T] { bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; - _2 = _3; - _0 = _2; + _3 = copy _1; + _2 = copy _3; + _0 = copy _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir index 25eaedfc842..1ea347510fd 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir @@ -14,15 +14,15 @@ fn d(_1: &Box<T>) -> &T { bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; StorageLive(_4); StorageLive(_5); - _4 = (*_3); - _5 = (((_4.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T); + _4 = copy (*_3); + _5 = copy (((_4.0: std::ptr::Unique<T>).0: std::ptr::NonNull<T>).0: *const T); _2 = &(*_5); StorageDead(_5); StorageDead(_4); - _0 = _2; + _0 = copy _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/inline/type_overflow.rs b/tests/mir-opt/inline/type_overflow.rs new file mode 100644 index 00000000000..bfd9e71b9e7 --- /dev/null +++ b/tests/mir-opt/inline/type_overflow.rs @@ -0,0 +1,32 @@ +// This is a regression test for one of the problems in #128887; it checks that the +// strategy in #129714 avoids trait solver overflows in this specific case. + +// skip-filecheck +//@ compile-flags: -Zinline-mir + +pub trait Foo { + type Associated; + type Chain: Foo<Associated = Self::Associated>; +} + +trait FooExt { + fn do_ext() {} +} +impl<T: Foo<Associated = f64>> FooExt for T {} + +#[allow(unconditional_recursion)] +fn recurse<T: Foo<Associated = f64>>() { + T::do_ext(); + recurse::<T::Chain>(); +} + +macro_rules! emit { + ($($m:ident)*) => {$( + pub fn $m<T: Foo<Associated = f64>>() { + recurse::<T>(); + } + )*} +} + +// Increase the chance of triggering the bug +emit!(m00 m01 m02 m03 m04 m05 m06 m07 m08 m09 m10 m11 m12 m13 m14 m15 m16 m17 m18 m19); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff index 0d9d58316ea..f36157a762c 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-abort.diff @@ -18,9 +18,9 @@ bb0: { StorageLive(_3); - _3 = _1; + _3 = copy _1; StorageLive(_4); - _4 = _2; + _4 = copy _2; - _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind unreachable]; + StorageLive(_6); + StorageLive(_5); @@ -29,12 +29,12 @@ } bb1: { -+ _6 = core::num::<impl u16>::unchecked_shl::precondition_check(_4) -> [return: bb2, unwind unreachable]; ++ _6 = core::num::<impl u16>::unchecked_shl::precondition_check(copy _4) -> [return: bb2, unwind unreachable]; + } + + bb2: { + StorageDead(_5); -+ _0 = ShlUnchecked(_3, _4); ++ _0 = ShlUnchecked(copy _3, copy _4); + StorageDead(_6); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff index 82f7eceaa18..be1b066c6c1 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff @@ -18,9 +18,9 @@ bb0: { StorageLive(_3); - _3 = _1; + _3 = copy _1; StorageLive(_4); - _4 = _2; + _4 = copy _2; - _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind continue]; + StorageLive(_6); + StorageLive(_5); @@ -29,12 +29,12 @@ } bb1: { -+ _6 = core::num::<impl u16>::unchecked_shl::precondition_check(_4) -> [return: bb2, unwind unreachable]; ++ _6 = core::num::<impl u16>::unchecked_shl::precondition_check(copy _4) -> [return: bb2, unwind unreachable]; + } + + bb2: { + StorageDead(_5); -+ _0 = ShlUnchecked(_3, _4); ++ _0 = ShlUnchecked(copy _3, copy _4); + StorageDead(_6); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir index dc27685ee79..611273ab08d 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-abort.mir @@ -12,7 +12,7 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { } bb0: { - _0 = ShlUnchecked(_1, _2); + _0 = ShlUnchecked(copy _1, copy _2); return; } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir index dc27685ee79..611273ab08d 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir @@ -12,7 +12,7 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { } bb0: { - _0 = ShlUnchecked(_1, _2); + _0 = ShlUnchecked(copy _1, copy _2); return; } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff index 6894b246699..360687f3c4e 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-abort.diff @@ -18,9 +18,9 @@ bb0: { StorageLive(_3); - _3 = _1; + _3 = copy _1; StorageLive(_4); - _4 = _2; + _4 = copy _2; - _0 = core::num::<impl i64>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind unreachable]; + StorageLive(_6); + StorageLive(_5); @@ -29,12 +29,12 @@ } bb1: { -+ _6 = core::num::<impl i64>::unchecked_shr::precondition_check(_4) -> [return: bb2, unwind unreachable]; ++ _6 = core::num::<impl i64>::unchecked_shr::precondition_check(copy _4) -> [return: bb2, unwind unreachable]; + } + + bb2: { + StorageDead(_5); -+ _0 = ShrUnchecked(_3, _4); ++ _0 = ShrUnchecked(copy _3, copy _4); + StorageDead(_6); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff index 070f4a1c5c8..986df55df03 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.Inline.panic-unwind.diff @@ -18,9 +18,9 @@ bb0: { StorageLive(_3); - _3 = _1; + _3 = copy _1; StorageLive(_4); - _4 = _2; + _4 = copy _2; - _0 = core::num::<impl i64>::unchecked_shr(move _3, move _4) -> [return: bb1, unwind continue]; + StorageLive(_6); + StorageLive(_5); @@ -29,12 +29,12 @@ } bb1: { -+ _6 = core::num::<impl i64>::unchecked_shr::precondition_check(_4) -> [return: bb2, unwind unreachable]; ++ _6 = core::num::<impl i64>::unchecked_shr::precondition_check(copy _4) -> [return: bb2, unwind unreachable]; + } + + bb2: { + StorageDead(_5); -+ _0 = ShrUnchecked(_3, _4); ++ _0 = ShrUnchecked(copy _3, copy _4); + StorageDead(_6); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir index 54f093b87d1..f4ddd0bca04 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-abort.mir @@ -12,7 +12,7 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 { } bb0: { - _0 = ShrUnchecked(_1, _2); + _0 = ShrUnchecked(copy _1, copy _2); return; } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir index 54f093b87d1..f4ddd0bca04 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_bigger.PreCodegen.after.panic-unwind.mir @@ -12,7 +12,7 @@ fn unchecked_shr_signed_bigger(_1: i64, _2: u32) -> i64 { } bb0: { - _0 = ShrUnchecked(_1, _2); + _0 = ShrUnchecked(copy _1, copy _2); return; } } diff --git a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff index 37083973fd1..70671e2089a 100644 --- a/tests/mir-opt/inline/unsized_argument.caller.Inline.diff +++ b/tests/mir-opt/inline/unsized_argument.caller.Inline.diff @@ -12,7 +12,7 @@ StorageLive(_2); StorageLive(_3); _3 = move _1; - _4 = (((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>).0: *const [i32]); + _4 = copy (((_3.0: std::ptr::Unique<[i32]>).0: std::ptr::NonNull<[i32]>).0: *const [i32]); _2 = callee(move (*_4)) -> [return: bb1, unwind: bb3]; } diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff index c1f7879cf0e..28878736ed7 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-abort.diff @@ -36,7 +36,7 @@ + bb2: { + StorageLive(_4); + _4 = UbChecks(); -+ assume(_4); ++ assume(copy _4); + _5 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable]; + } + diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff index 5271e538daf..27b6bb6a5bb 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.panic-unwind.diff @@ -40,7 +40,7 @@ + bb2: { + StorageLive(_4); + _4 = UbChecks(); -+ assume(_4); ++ assume(copy _4); + _5 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable]; + } + diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir index dcab8a679a8..66ab5e1b962 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-abort.mir @@ -22,7 +22,7 @@ fn unwrap_unchecked(_1: Option<T>) -> T { } bb1: { - _0 = ((_1 as Some).0: T); + _0 = copy ((_1 as Some).0: T); StorageDead(_2); return; } diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir index dcab8a679a8..66ab5e1b962 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.panic-unwind.mir @@ -22,7 +22,7 @@ fn unwrap_unchecked(_1: Option<T>) -> T { } bb1: { - _0 = ((_1 as Some).0: T); + _0 = copy ((_1 as Some).0: T); StorageDead(_2); return; } diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff index f8715789cec..1e33e222b27 100644 --- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff +++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff @@ -85,7 +85,7 @@ - } - - bb2: { -+ _4 = Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}> { __pointer: _5 }; ++ _4 = Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}> { __pointer: copy _5 }; StorageDead(_5); StorageLive(_6); StorageLive(_7); @@ -160,7 +160,7 @@ + StorageLive(_14); + _14 = (); + StorageLive(_41); -+ _41 = Option::<()>::Some(_14); ++ _41 = Option::<()>::Some(copy _14); + _13 = std::future::Ready::<()>(move _41); + StorageDead(_41); + StorageDead(_14); @@ -193,7 +193,7 @@ + StorageLive(_22); + StorageLive(_23); + StorageLive(_24); -+ _24 = _31; ++ _24 = copy _31; + _23 = move _24; + _22 = &mut (*_23); + StorageDead(_24); @@ -231,8 +231,8 @@ + + bb10: { + StorageLive(_26); -+ _26 = ((_18 as Ready).0: ()); -+ _30 = _26; ++ _26 = copy ((_18 as Ready).0: ()); ++ _30 = copy _26; + StorageDead(_26); + StorageDead(_23); + StorageDead(_21); diff --git a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff index 494f5591e32..b1840beb3ef 100644 --- a/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff +++ b/tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff @@ -87,7 +87,7 @@ - } - - bb2: { -+ _4 = Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}> { __pointer: _5 }; ++ _4 = Pin::<&mut {async fn body of ActionPermit<'_, T>::perform()}> { __pointer: copy _5 }; StorageDead(_5); StorageLive(_6); StorageLive(_7); @@ -177,7 +177,7 @@ + StorageLive(_14); + _14 = (); + StorageLive(_43); -+ _43 = Option::<()>::Some(_14); ++ _43 = Option::<()>::Some(copy _14); + _13 = std::future::Ready::<()>(move _43); + StorageDead(_43); + StorageDead(_14); @@ -212,7 +212,7 @@ + StorageLive(_22); + StorageLive(_23); + StorageLive(_24); -+ _24 = _31; ++ _24 = copy _31; + _23 = move _24; + _22 = &mut (*_23); + StorageDead(_24); @@ -250,8 +250,8 @@ + + bb12: { + StorageLive(_26); -+ _26 = ((_18 as Ready).0: ()); -+ _30 = _26; ++ _26 = copy ((_18 as Ready).0: ()); ++ _30 = copy _26; + StorageDead(_26); + StorageDead(_23); + StorageDead(_21); diff --git a/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify-after-simplifycfg.diff index fea5f4f02ce..4762123184b 100644 --- a/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify-after-simplifycfg.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Eq(move _3, const false); + _2 = Not(move _3); switchInt(move _2) -> [0: bb2, otherwise: bb1]; diff --git a/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify-after-simplifycfg.diff index 9a509ccfa67..6fae0acf439 100644 --- a/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify-after-simplifycfg.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Eq(move _3, const true); + _2 = move _3; switchInt(move _2) -> [0: bb2, otherwise: bb1]; diff --git a/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify-after-simplifycfg.diff index e4ec4c80579..7975a808d4f 100644 --- a/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify-after-simplifycfg.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Eq(const false, move _3); + _2 = Not(move _3); switchInt(move _2) -> [0: bb2, otherwise: bb1]; diff --git a/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify-after-simplifycfg.diff index 3aea55f4db4..80d0cd62007 100644 --- a/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify-after-simplifycfg.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Ne(const false, move _3); + _2 = move _3; switchInt(move _2) -> [0: bb2, otherwise: bb1]; diff --git a/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify-after-simplifycfg.diff index b6e891088a1..c0f8b5261c2 100644 --- a/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify-after-simplifycfg.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Ne(move _3, const false); + _2 = move _3; switchInt(move _2) -> [0: bb2, otherwise: bb1]; diff --git a/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify-after-simplifycfg.diff index 974738bb3a9..4627b314408 100644 --- a/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify-after-simplifycfg.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Ne(move _3, const true); + _2 = Not(move _3); switchInt(move _2) -> [0: bb2, otherwise: bb1]; diff --git a/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify-after-simplifycfg.diff index 240835bf7f2..91ca1ba553e 100644 --- a/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify-after-simplifycfg.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Eq(const true, move _3); + _2 = move _3; switchInt(move _2) -> [0: bb2, otherwise: bb1]; diff --git a/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify-after-simplifycfg.diff index 1e2b2c27f57..744c61b987d 100644 --- a/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify-after-simplifycfg.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = Ne(const true, move _3); + _2 = Not(move _3); switchInt(move _2) -> [0: bb2, otherwise: bb1]; diff --git a/tests/mir-opt/instsimplify/casts.redundant.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify-after-simplifycfg.diff index 7001589d9e3..afa25ecdbfb 100644 --- a/tests/mir-opt/instsimplify/casts.redundant.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/casts.redundant.InstSimplify-after-simplifycfg.diff @@ -15,16 +15,16 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _4; + _5 = copy _4; - _3 = move _5 as *const &u8 (PtrToPtr); + _3 = move _5; StorageDead(_5); StorageDead(_4); - _2 = move _3 as *const &u8 (PtrToPtr); + _2 = move _3; - _0 = _2; + _0 = copy _2; StorageDead(_3); StorageDead(_2); return; diff --git a/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify-after-simplifycfg.diff index e1045db9730..12e2913a8ca 100644 --- a/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify-after-simplifycfg.diff @@ -12,7 +12,7 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; _3 = move _4 as *mut u8 (PtrToPtr); _2 = move _3 as *const u8 (PtrToPtr); StorageDead(_4); diff --git a/tests/mir-opt/instsimplify/casts.rs b/tests/mir-opt/instsimplify/casts.rs index 24dbb67b42d..27308ee52bc 100644 --- a/tests/mir-opt/instsimplify/casts.rs +++ b/tests/mir-opt/instsimplify/casts.rs @@ -19,7 +19,7 @@ pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 { // EMIT_MIR casts.roundtrip.InstSimplify-after-simplifycfg.diff pub fn roundtrip(x: *const u8) -> *const u8 { // CHECK-LABEL: fn roundtrip( - // CHECK: _4 = _1; + // CHECK: _4 = copy _1; // CHECK: _3 = move _4 as *mut u8 (PtrToPtr); // CHECK: _2 = move _3 as *const u8 (PtrToPtr); x as *mut u8 as *const u8 @@ -28,7 +28,7 @@ pub fn roundtrip(x: *const u8) -> *const u8 { // EMIT_MIR casts.roundtrip.InstSimplify-after-simplifycfg.diff pub fn cast_thin_via_aggregate(x: *const u8) -> *const () { // CHECK-LABEL: fn cast_thin_via_aggregate( - // CHECK: _2 = _1; + // CHECK: _2 = copy _1; // CHECK: _0 = move _2 as *const () (PtrToPtr); std::intrinsics::aggregate_raw_ptr(x, ()) } diff --git a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-abort.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-abort.diff index a7de09ca386..f39df7ffca0 100644 --- a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-abort.diff +++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-abort.diff @@ -31,38 +31,38 @@ _3 = const 0_usize; - _4 = Len(_1); + _4 = const 2_usize; - _5 = Lt(_3, _4); - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable]; + _5 = Lt(copy _3, copy _4); + assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind unreachable]; } bb1: { - _2 = _1[_3]; + _2 = copy _1[_3]; StorageDead(_3); StorageLive(_6); StorageLive(_7); _7 = const 1_usize; - _8 = Len(_1); + _8 = const 2_usize; - _9 = Lt(_7, _8); - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind unreachable]; + _9 = Lt(copy _7, copy _8); + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, copy _7) -> [success: bb2, unwind unreachable]; } bb2: { - _6 = _1[_7]; + _6 = copy _1[_7]; StorageDead(_7); StorageLive(_10); StorageLive(_11); - _11 = _2; + _11 = copy _2; StorageLive(_12); - _12 = _2; + _12 = copy _2; _10 = Mul(move _11, move _12); StorageDead(_12); StorageDead(_11); StorageLive(_13); StorageLive(_14); - _14 = _6; + _14 = copy _6; StorageLive(_15); - _15 = _6; + _15 = copy _6; _13 = Mul(move _14, move _15); StorageDead(_15); StorageDead(_14); diff --git a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-unwind.diff index c15f7e47fe3..0e7d5653c68 100644 --- a/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-unwind.diff +++ b/tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-after-simplifycfg.panic-unwind.diff @@ -31,38 +31,38 @@ _3 = const 0_usize; - _4 = Len(_1); + _4 = const 2_usize; - _5 = Lt(_3, _4); - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue]; + _5 = Lt(copy _3, copy _4); + assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind continue]; } bb1: { - _2 = _1[_3]; + _2 = copy _1[_3]; StorageDead(_3); StorageLive(_6); StorageLive(_7); _7 = const 1_usize; - _8 = Len(_1); + _8 = const 2_usize; - _9 = Lt(_7, _8); - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb2, unwind continue]; + _9 = Lt(copy _7, copy _8); + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, copy _7) -> [success: bb2, unwind continue]; } bb2: { - _6 = _1[_7]; + _6 = copy _1[_7]; StorageDead(_7); StorageLive(_10); StorageLive(_11); - _11 = _2; + _11 = copy _2; StorageLive(_12); - _12 = _2; + _12 = copy _2; _10 = Mul(move _11, move _12); StorageDead(_12); StorageDead(_11); StorageLive(_13); StorageLive(_14); - _14 = _6; + _14 = copy _6; StorageLive(_15); - _15 = _6; + _15 = copy _6; _13 = Mul(move _14, move _15); StorageDead(_15); StorageDead(_14); diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff index c6f858d89eb..d0b50c597c4 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-abort.diff @@ -20,7 +20,7 @@ StorageLive(_4); _4 = &((*_1).0: T); - _3 = &(*_4); -+ _3 = _4; ++ _3 = copy _4; _2 = <T as Clone>::clone(move _3) -> [return: bb1, unwind unreachable]; } @@ -32,8 +32,8 @@ _7 = &((*_1).1: u64); - _6 = &(*_7); - _5 = <u64 as Clone>::clone(move _6) -> [return: bb2, unwind unreachable]; -+ _6 = _7; -+ _5 = (*_6); ++ _6 = copy _7; ++ _5 = copy (*_6); + goto -> bb2; } @@ -45,8 +45,8 @@ _10 = &((*_1).2: [f32; 3]); - _9 = &(*_10); - _8 = <[f32; 3] as Clone>::clone(move _9) -> [return: bb3, unwind unreachable]; -+ _9 = _10; -+ _8 = (*_9); ++ _9 = copy _10; ++ _8 = copy (*_9); + goto -> bb3; } diff --git a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff index 691ab1f0e7f..b8f4f348530 100644 --- a/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff +++ b/tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-after-simplifycfg.panic-unwind.diff @@ -20,7 +20,7 @@ StorageLive(_4); _4 = &((*_1).0: T); - _3 = &(*_4); -+ _3 = _4; ++ _3 = copy _4; _2 = <T as Clone>::clone(move _3) -> [return: bb1, unwind continue]; } @@ -32,8 +32,8 @@ _7 = &((*_1).1: u64); - _6 = &(*_7); - _5 = <u64 as Clone>::clone(move _6) -> [return: bb2, unwind: bb4]; -+ _6 = _7; -+ _5 = (*_6); ++ _6 = copy _7; ++ _5 = copy (*_6); + goto -> bb2; } @@ -45,8 +45,8 @@ _10 = &((*_1).2: [f32; 3]); - _9 = &(*_10); - _8 = <[f32; 3] as Clone>::clone(move _9) -> [return: bb3, unwind: bb4]; -+ _9 = _10; -+ _8 = (*_9); ++ _9 = copy _10; ++ _8 = copy (*_9); + goto -> bb3; } diff --git a/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff index 7596aa20308..5d74f0f75db 100644 --- a/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/duplicate_switch_targets.assert_zero.InstSimplify-after-simplifycfg.diff @@ -5,8 +5,8 @@ let mut _0: u8; bb0: { -- switchInt(_1) -> [0: bb2, 1: bb1, otherwise: bb1]; -+ switchInt(_1) -> [0: bb2, otherwise: bb1]; +- switchInt(copy _1) -> [0: bb2, 1: bb1, otherwise: bb1]; ++ switchInt(copy _1) -> [0: bb2, otherwise: bb1]; } bb1: { @@ -14,7 +14,7 @@ } bb2: { - _0 = _1; + _0 = copy _1; return; } } diff --git a/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff index ca26f0240f9..b2f720be9e1 100644 --- a/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/ref_of_deref.pointers.InstSimplify-after-simplifycfg.diff @@ -39,12 +39,12 @@ _5 = &mut (*_2); StorageLive(_6); - _6 = &raw const (*_1); -+ _6 = _1; ++ _6 = copy _1; StorageLive(_7); _7 = &raw const (*_2); StorageLive(_8); - _8 = &raw mut (*_2); -+ _8 = _2; ++ _8 = copy _2; _0 = const (); StorageDead(_8); StorageDead(_7); diff --git a/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify-after-simplifycfg.diff index 928ee3acaa0..4ea9da46c55 100644 --- a/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/ref_of_deref.references.InstSimplify-after-simplifycfg.diff @@ -33,12 +33,12 @@ bb0: { StorageLive(_3); - _3 = &(*_1); -+ _3 = _1; ++ _3 = copy _1; StorageLive(_4); _4 = &(*_2); StorageLive(_5); - _5 = &mut (*_2); -+ _5 = _2; ++ _5 = copy _2; StorageLive(_6); _6 = &raw const (*_1); StorageLive(_7); diff --git a/tests/mir-opt/instsimplify/ref_of_deref.rs b/tests/mir-opt/instsimplify/ref_of_deref.rs index dc0f5f8198b..5372d906bda 100644 --- a/tests/mir-opt/instsimplify/ref_of_deref.rs +++ b/tests/mir-opt/instsimplify/ref_of_deref.rs @@ -1,6 +1,5 @@ //@ test-mir-pass: InstSimplify-after-simplifycfg #![crate_type = "lib"] -#![feature(raw_ref_op)] // For each of these, only 2 of the 6 should simplify, // as the others have the wrong types. @@ -8,11 +7,11 @@ // EMIT_MIR ref_of_deref.references.InstSimplify-after-simplifycfg.diff // CHECK-LABEL: references pub fn references(const_ref: &i32, mut_ref: &mut [i32]) { - // CHECK: _3 = _1; + // CHECK: _3 = copy _1; let _a = &*const_ref; // CHECK: _4 = &(*_2); let _b = &*mut_ref; - // CHECK: _5 = _2; + // CHECK: _5 = copy _2; let _c = &mut *mut_ref; // CHECK: _6 = &raw const (*_1); let _d = &raw const *const_ref; @@ -31,10 +30,10 @@ pub unsafe fn pointers(const_ptr: *const [i32], mut_ptr: *mut i32) { let _b = &*mut_ptr; // CHECK: _5 = &mut (*_2); let _c = &mut *mut_ptr; - // CHECK: _6 = _1; + // CHECK: _6 = copy _1; let _d = &raw const *const_ptr; // CHECK: _7 = &raw const (*_2); let _e = &raw const *mut_ptr; - // CHECK: _8 = _2; + // CHECK: _8 = copy _2; let _f = &raw mut *mut_ptr; } diff --git a/tests/mir-opt/instsimplify/ub_check.rs b/tests/mir-opt/instsimplify/ub_check.rs index ee72511c132..b513f60dc7b 100644 --- a/tests/mir-opt/instsimplify/ub_check.rs +++ b/tests/mir-opt/instsimplify/ub_check.rs @@ -6,7 +6,7 @@ pub fn unwrap_unchecked(x: Option<i32>) -> i32 { // CHECK-LABEL: fn unwrap_unchecked( // CHECK-NOT: UbChecks() // CHECK: [[assume:_.*]] = const false; - // CHECK-NEXT: assume([[assume]]); + // CHECK-NEXT: assume(copy [[assume]]); // CHECK-NEXT: unreachable_unchecked::precondition_check unsafe { x.unwrap_unchecked() } } diff --git a/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff index 7ef77e76d12..5fee9a6733d 100644 --- a/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/instsimplify/ub_check.unwrap_unchecked.InstSimplify-after-simplifycfg.diff @@ -21,7 +21,7 @@ bb0: { StorageLive(_2); - _2 = _1; + _2 = copy _1; StorageLive(_3); StorageLive(_5); _3 = discriminant(_2); @@ -36,7 +36,7 @@ StorageLive(_4); - _4 = UbChecks(); + _4 = const false; - assume(_4); + assume(copy _4); _5 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable]; } diff --git a/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff b/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff index 311de9e1c93..ac88fe67bb8 100644 --- a/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff +++ b/tests/mir-opt/issue_101973.inner.GVN.panic-abort.diff @@ -29,22 +29,22 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; nop; - StorageLive(_14); -- _14 = BitAnd(_5, const 255_u32); +- _14 = BitAnd(copy _5, const 255_u32); - _4 = BitOr(const 0_u32, move _14); - StorageDead(_14); + nop; -+ _14 = BitAnd(_1, const 255_u32); -+ _4 = _14; ++ _14 = BitAnd(copy _1, const 255_u32); ++ _4 = copy _14; + nop; StorageDead(_5); StorageLive(_6); StorageLive(_7); StorageLive(_8); StorageLive(_9); - _9 = _1; + _9 = copy _1; - _10 = const 8_i32 as u32 (IntToInt); - _11 = Lt(move _10, const 32_u32); - assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind unreachable]; @@ -55,7 +55,7 @@ bb1: { - _8 = Shr(move _9, const 8_i32); -+ _8 = Shr(_1, const 8_i32); ++ _8 = Shr(copy _1, const 8_i32); StorageDead(_9); _7 = BitAnd(move _8, const 15_u32); StorageDead(_8); @@ -71,7 +71,7 @@ _6 = Shl(move _7, const 1_i32); StorageDead(_7); - _3 = rotate_right::<u32>(move _4, move _6) -> [return: bb3, unwind unreachable]; -+ _3 = rotate_right::<u32>(_14, move _6) -> [return: bb3, unwind unreachable]; ++ _3 = rotate_right::<u32>(copy _14, move _6) -> [return: bb3, unwind unreachable]; } bb3: { diff --git a/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff b/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff index c5fd042161d..96c3cae2d33 100644 --- a/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff +++ b/tests/mir-opt/issue_101973.inner.GVN.panic-unwind.diff @@ -29,22 +29,22 @@ StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; nop; - StorageLive(_14); -- _14 = BitAnd(_5, const 255_u32); +- _14 = BitAnd(copy _5, const 255_u32); - _4 = BitOr(const 0_u32, move _14); - StorageDead(_14); + nop; -+ _14 = BitAnd(_1, const 255_u32); -+ _4 = _14; ++ _14 = BitAnd(copy _1, const 255_u32); ++ _4 = copy _14; + nop; StorageDead(_5); StorageLive(_6); StorageLive(_7); StorageLive(_8); StorageLive(_9); - _9 = _1; + _9 = copy _1; - _10 = const 8_i32 as u32 (IntToInt); - _11 = Lt(move _10, const 32_u32); - assert(move _11, "attempt to shift right by `{}`, which would overflow", const 8_i32) -> [success: bb1, unwind continue]; @@ -55,7 +55,7 @@ bb1: { - _8 = Shr(move _9, const 8_i32); -+ _8 = Shr(_1, const 8_i32); ++ _8 = Shr(copy _1, const 8_i32); StorageDead(_9); _7 = BitAnd(move _8, const 15_u32); StorageDead(_8); @@ -71,7 +71,7 @@ _6 = Shl(move _7, const 1_i32); StorageDead(_7); - _3 = rotate_right::<u32>(move _4, move _6) -> [return: bb3, unwind unreachable]; -+ _3 = rotate_right::<u32>(_14, move _6) -> [return: bb3, unwind unreachable]; ++ _3 = rotate_right::<u32>(copy _14, move _6) -> [return: bb3, unwind unreachable]; } bb3: { diff --git a/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir b/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir index 632b5580656..66dbbc0c044 100644 --- a/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir @@ -25,7 +25,7 @@ fn main() -> () { bb2: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; switchInt(move _4) -> [0: bb4, otherwise: bb3]; } diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff index 4469270a9b2..cf952230128 100644 --- a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-abort.diff @@ -63,7 +63,7 @@ + } + + bb8 (cleanup): { -+ switchInt(_5) -> [0: bb6, otherwise: bb7]; ++ switchInt(copy _5) -> [0: bb6, otherwise: bb7]; } } diff --git a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff index 4469270a9b2..cf952230128 100644 --- a/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41110.main.ElaborateDrops.panic-unwind.diff @@ -63,7 +63,7 @@ + } + + bb8 (cleanup): { -+ switchInt(_5) -> [0: bb6, otherwise: bb7]; ++ switchInt(copy _5) -> [0: bb6, otherwise: bb7]; } } diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff index 78184f6aeeb..15fd95a63ff 100644 --- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-abort.diff @@ -93,7 +93,7 @@ + } + + bb12 (cleanup): { -+ switchInt(_6) -> [0: bb10, otherwise: bb11]; ++ switchInt(copy _6) -> [0: bb10, otherwise: bb11]; } } diff --git a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff index 688887c3c1f..4a0067981cb 100644 --- a/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41110.test.ElaborateDrops.panic-unwind.diff @@ -93,7 +93,7 @@ + } + + bb12 (cleanup): { -+ switchInt(_6) -> [0: bb10, otherwise: bb11]; ++ switchInt(copy _6) -> [0: bb10, otherwise: bb11]; } } diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff index 55d2629a551..e2726464ef3 100644 --- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-abort.diff @@ -115,7 +115,7 @@ + } + + bb15 (cleanup): { -+ switchInt(_7) -> [0: bb12, otherwise: bb14]; ++ switchInt(copy _7) -> [0: bb12, otherwise: bb14]; + } + + bb16: { @@ -132,7 +132,7 @@ + } + + bb19: { -+ switchInt(_7) -> [0: bb13, otherwise: bb18]; ++ switchInt(copy _7) -> [0: bb13, otherwise: bb18]; + } + + bb20 (cleanup): { @@ -141,7 +141,7 @@ + } + + bb21 (cleanup): { -+ switchInt(_7) -> [0: bb12, otherwise: bb20]; ++ switchInt(copy _7) -> [0: bb12, otherwise: bb20]; } } diff --git a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff index c731b5646f6..7efa3330e66 100644 --- a/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/issue_41888.main.ElaborateDrops.panic-unwind.diff @@ -115,7 +115,7 @@ + } + + bb15 (cleanup): { -+ switchInt(_7) -> [0: bb12, otherwise: bb14]; ++ switchInt(copy _7) -> [0: bb12, otherwise: bb14]; + } + + bb16: { @@ -132,7 +132,7 @@ + } + + bb19: { -+ switchInt(_7) -> [0: bb13, otherwise: bb18]; ++ switchInt(copy _7) -> [0: bb13, otherwise: bb18]; + } + + bb20 (cleanup): { @@ -141,7 +141,7 @@ + } + + bb21 (cleanup): { -+ switchInt(_7) -> [0: bb12, otherwise: bb20]; ++ switchInt(copy _7) -> [0: bb12, otherwise: bb20]; } } diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir index 3104baa5fdb..736a8bbca49 100644 --- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-abort.mir @@ -54,8 +54,8 @@ fn test() -> Option<Box<u32>> { bb4: { StorageLive(_12); - _12 = ((_6 as Continue).0: u32); - (*_5) = _12; + _12 = copy ((_6 as Continue).0: u32); + (*_5) = copy _12; StorageDead(_12); _1 = move _5; drop(_5) -> [return: bb7, unwind: bb11]; @@ -63,9 +63,9 @@ fn test() -> Option<Box<u32>> { bb5: { StorageLive(_9); - _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>); + _9 = copy ((_6 as Break).0: std::option::Option<std::convert::Infallible>); StorageLive(_11); - _11 = _9; + _11 = copy _9; _0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _11) -> [return: bb6, unwind: bb12]; } diff --git a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir index da33c830115..1acb1ae20b6 100644 --- a/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir +++ b/tests/mir-opt/issue_62289.test.ElaborateDrops.before.panic-unwind.mir @@ -54,8 +54,8 @@ fn test() -> Option<Box<u32>> { bb4: { StorageLive(_12); - _12 = ((_6 as Continue).0: u32); - (*_5) = _12; + _12 = copy ((_6 as Continue).0: u32); + (*_5) = copy _12; StorageDead(_12); _1 = move _5; drop(_5) -> [return: bb7, unwind: bb11]; @@ -63,9 +63,9 @@ fn test() -> Option<Box<u32>> { bb5: { StorageLive(_9); - _9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>); + _9 = copy ((_6 as Break).0: std::option::Option<std::convert::Infallible>); StorageLive(_11); - _11 = _9; + _11 = copy _9; _0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _11) -> [return: bb6, unwind: bb12]; } diff --git a/tests/mir-opt/issue_72181.bar.built.after.mir b/tests/mir-opt/issue_72181.bar.built.after.mir index b6cc7d22195..569c4a00628 100644 --- a/tests/mir-opt/issue_72181.bar.built.after.mir +++ b/tests/mir-opt/issue_72181.bar.built.after.mir @@ -9,8 +9,8 @@ fn bar(_1: [(Never, u32); 1]) -> u32 { bb0: { StorageLive(_2); - _2 = (_1[0 of 1].1: u32); - _0 = _2; + _2 = copy (_1[0 of 1].1: u32); + _0 = copy _2; StorageDead(_2); return; } diff --git a/tests/mir-opt/issue_72181.foo.built.after.mir b/tests/mir-opt/issue_72181.foo.built.after.mir index f78942cc56f..314cf8b367f 100644 --- a/tests/mir-opt/issue_72181.foo.built.after.mir +++ b/tests/mir-opt/issue_72181.foo.built.after.mir @@ -11,12 +11,12 @@ fn foo(_1: [(Never, u32); 1]) -> u32 { StorageLive(_2); _2 = const 0_usize; _3 = Len(_1); - _4 = Lt(_2, _3); - assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> [success: bb1, unwind: bb2]; + _4 = Lt(copy _2, copy _3); + assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, copy _2) -> [success: bb1, unwind: bb2]; } bb1: { - _0 = (_1[_2].1: u32); + _0 = copy (_1[_2].1: u32); StorageDead(_2); return; } diff --git a/tests/mir-opt/issue_72181.main.built.after.mir b/tests/mir-opt/issue_72181.main.built.after.mir index 89d351d5172..aade84a6dd2 100644 --- a/tests/mir-opt/issue_72181.main.built.after.mir +++ b/tests/mir-opt/issue_72181.main.built.after.mir @@ -39,8 +39,8 @@ fn main() -> () { StorageLive(_6); _6 = const 0_usize; _7 = Len(_2); - _8 = Lt(_6, _7); - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb3, unwind: bb5]; + _8 = Lt(copy _6, copy _7); + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb3, unwind: bb5]; } bb2: { @@ -49,7 +49,7 @@ fn main() -> () { } bb3: { - _5 = (_2[_6].0: u64); + _5 = copy (_2[_6].0: u64); PlaceMention(_5); StorageDead(_6); StorageDead(_5); diff --git a/tests/mir-opt/issue_72181_1.main.built.after.mir b/tests/mir-opt/issue_72181_1.main.built.after.mir index e8ad5cd8d16..293aa37944d 100644 --- a/tests/mir-opt/issue_72181_1.main.built.after.mir +++ b/tests/mir-opt/issue_72181_1.main.built.after.mir @@ -19,7 +19,7 @@ fn main() -> () { StorageLive(_2); StorageLive(_3); _3 = (); - _2 = transmute::<(), Void>(move _3) -> bb4; + _2 = std::intrinsics::transmute::<(), Void>(move _3) -> bb4; } bb1: { diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff index 861ee1d3d3d..f03691ad673 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff @@ -24,9 +24,9 @@ bb0: { StorageLive(_4); - _4 = [_1, _1, _1]; + _4 = [copy _1, copy _1, copy _1]; _3 = &_4; - _2 = _3 as &[T] (PointerCoercion(Unsize)); + _2 = copy _3 as &[T] (PointerCoercion(Unsize)); nop; nop; goto -> bb2; diff --git a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff index f27be953384..633e5c740a1 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff @@ -24,9 +24,9 @@ bb0: { StorageLive(_4); - _4 = [_1, _1, _1]; + _4 = [copy _1, copy _1, copy _1]; _3 = &_4; - _2 = _3 as &[T] (PointerCoercion(Unsize)); + _2 = copy _3 as &[T] (PointerCoercion(Unsize)); nop; nop; goto -> bb2; diff --git a/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff b/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff index 53957bb3cb1..aae0570973d 100644 --- a/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff +++ b/tests/mir-opt/issue_78192.f.InstSimplify-after-simplifycfg.diff @@ -17,9 +17,9 @@ StorageLive(_4); _4 = &raw const (*_1); _3 = &_4; - _2 = _3; + _2 = copy _3; StorageDead(_3); - _0 = (*_2); + _0 = copy (*_2); StorageDead(_4); StorageDead(_2); return; diff --git a/tests/mir-opt/issue_91633.foo.built.after.mir b/tests/mir-opt/issue_91633.foo.built.after.mir index a66769f0d11..50fdf08375a 100644 --- a/tests/mir-opt/issue_91633.foo.built.after.mir +++ b/tests/mir-opt/issue_91633.foo.built.after.mir @@ -18,8 +18,8 @@ fn foo(_1: Box<[T]>) -> T { StorageLive(_4); _4 = const 0_usize; _5 = Len((*_1)); - _6 = Lt(_4, _5); - assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind: bb5]; + _6 = Lt(copy _4, copy _5); + assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, copy _4) -> [success: bb1, unwind: bb5]; } bb1: { diff --git a/tests/mir-opt/issue_91633.fun.built.after.mir b/tests/mir-opt/issue_91633.fun.built.after.mir index 7175c9e8006..5b41b376719 100644 --- a/tests/mir-opt/issue_91633.fun.built.after.mir +++ b/tests/mir-opt/issue_91633.fun.built.after.mir @@ -16,8 +16,8 @@ fn fun(_1: &[T]) -> &T { StorageLive(_3); _3 = const 0_usize; _4 = Len((*_1)); - _5 = Lt(_3, _4); - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb2]; + _5 = Lt(copy _3, copy _4); + assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind: bb2]; } bb1: { diff --git a/tests/mir-opt/issue_99325.main.built.after.32bit.mir b/tests/mir-opt/issue_99325.main.built.after.32bit.mir index 72e7f4794f9..161c73529f5 100644 --- a/tests/mir-opt/issue_99325.main.built.after.32bit.mir +++ b/tests/mir-opt/issue_99325.main.built.after.32bit.mir @@ -83,9 +83,9 @@ fn main() -> () { StorageDead(_3); PlaceMention(_2); StorageLive(_8); - _8 = (_2.0: &&[u8]); + _8 = copy (_2.0: &&[u8]); StorageLive(_9); - _9 = (_2.1: &&[u8; 4]); + _9 = copy (_2.1: &&[u8; 4]); StorageLive(_10); StorageLive(_11); _11 = &(*_8); @@ -187,9 +187,9 @@ fn main() -> () { StorageDead(_24); PlaceMention(_23); StorageLive(_28); - _28 = (_23.0: &&[u8]); + _28 = copy (_23.0: &&[u8]); StorageLive(_29); - _29 = (_23.1: &&[u8; 4]); + _29 = copy (_23.1: &&[u8; 4]); StorageLive(_30); StorageLive(_31); _31 = &(*_28); diff --git a/tests/mir-opt/issue_99325.main.built.after.64bit.mir b/tests/mir-opt/issue_99325.main.built.after.64bit.mir index 72e7f4794f9..161c73529f5 100644 --- a/tests/mir-opt/issue_99325.main.built.after.64bit.mir +++ b/tests/mir-opt/issue_99325.main.built.after.64bit.mir @@ -83,9 +83,9 @@ fn main() -> () { StorageDead(_3); PlaceMention(_2); StorageLive(_8); - _8 = (_2.0: &&[u8]); + _8 = copy (_2.0: &&[u8]); StorageLive(_9); - _9 = (_2.1: &&[u8; 4]); + _9 = copy (_2.1: &&[u8; 4]); StorageLive(_10); StorageLive(_11); _11 = &(*_8); @@ -187,9 +187,9 @@ fn main() -> () { StorageDead(_24); PlaceMention(_23); StorageLive(_28); - _28 = (_23.0: &&[u8]); + _28 = copy (_23.0: &&[u8]); StorageLive(_29); - _29 = (_23.1: &&[u8; 4]); + _29 = copy (_23.1: &&[u8; 4]); StorageLive(_30); StorageLive(_31); _31 = &(*_28); diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir index 8da56d59aaa..573c0a12bc1 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-abort.mir @@ -19,7 +19,7 @@ fn num_to_digit(_1: char) -> u32 { bb0: { StorageLive(_2); - _2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind unreachable]; + _2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind unreachable]; } bb1: { diff --git a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir index 61bc09d901c..049803041d4 100644 --- a/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.panic-unwind.mir @@ -19,7 +19,7 @@ fn num_to_digit(_1: char) -> u32 { bb0: { StorageLive(_2); - _2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind continue]; + _2 = char::methods::<impl char>::to_digit(copy _1, const 8_u32) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index 25ed1b4d0c7..1ab9be96652 100644 --- a/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/tests/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -19,26 +19,26 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = move _3 as [u32; 4] (Transmute); StorageDead(_3); - switchInt(_2[0 of 4]) -> [0: bb1, otherwise: bb4]; + switchInt(copy _2[0 of 4]) -> [0: bb1, otherwise: bb4]; } bb1: { - switchInt(_2[1 of 4]) -> [0: bb2, otherwise: bb4]; + switchInt(copy _2[1 of 4]) -> [0: bb2, otherwise: bb4]; } bb2: { - switchInt(_2[2 of 4]) -> [0: bb3, 4294901760: bb3, otherwise: bb4]; + switchInt(copy _2[2 of 4]) -> [0: bb3, 4294901760: bb3, otherwise: bb4]; } bb3: { StorageLive(_4); - _4 = _2[3 of 4]; + _4 = copy _2[3 of 4]; StorageLive(_5); StorageLive(_6); - _6 = _4; + _6 = copy _4; _5 = move _6 as [u8; 4] (Transmute); StorageDead(_6); _0 = Option::<[u8; 4]>::Some(move _5); diff --git a/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-abort.diff index e955e669014..a7551c3fb5b 100644 --- a/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-abort.diff @@ -18,13 +18,13 @@ StorageLive(_4); _4 = const aggregate::FOO; StorageLive(_2); - _2 = (_4.0: u8); + _2 = copy (_4.0: u8); StorageLive(_3); - _3 = (_4.1: u8); + _3 = copy (_4.1: u8); StorageDead(_4); StorageLive(_5); StorageLive(_6); - _6 = _2; + _6 = copy _2; _5 = Eq(move _6, const 7_u8); - switchInt(move _5) -> [0: bb2, otherwise: bb1]; + goto -> bb2; @@ -32,13 +32,13 @@ bb1: { StorageDead(_6); - _0 = _3; + _0 = copy _3; goto -> bb3; } bb2: { StorageDead(_6); - _0 = _2; + _0 = copy _2; goto -> bb3; } diff --git a/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-unwind.diff index e955e669014..a7551c3fb5b 100644 --- a/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.aggregate.JumpThreading.panic-unwind.diff @@ -18,13 +18,13 @@ StorageLive(_4); _4 = const aggregate::FOO; StorageLive(_2); - _2 = (_4.0: u8); + _2 = copy (_4.0: u8); StorageLive(_3); - _3 = (_4.1: u8); + _3 = copy (_4.1: u8); StorageDead(_4); StorageLive(_5); StorageLive(_6); - _6 = _2; + _6 = copy _2; _5 = Eq(move _6, const 7_u8); - switchInt(move _5) -> [0: bb2, otherwise: bb1]; + goto -> bb2; @@ -32,13 +32,13 @@ bb1: { StorageDead(_6); - _0 = _3; + _0 = copy _3; goto -> bb3; } bb2: { StorageDead(_6); - _0 = _2; + _0 = copy _2; goto -> bb3; } diff --git a/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-abort.diff index 0c8e04a1e74..4d639d89f0d 100644 --- a/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-abort.diff @@ -22,12 +22,12 @@ StorageLive(_1); _1 = const aggregate_copy::Foo; StorageLive(_2); - _2 = _1; + _2 = copy _1; StorageLive(_3); - _3 = (_2.1: u32); + _3 = copy (_2.1: u32); StorageLive(_4); StorageLive(_5); - _5 = _3; + _5 = copy _3; _4 = Eq(move _5, const 2_u32); - switchInt(move _4) -> [0: bb2, otherwise: bb1]; + goto -> bb2; @@ -35,7 +35,7 @@ bb1: { StorageDead(_5); - _0 = (_2.0: u32); + _0 = copy (_2.0: u32); goto -> bb3; } diff --git a/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-unwind.diff index 0c8e04a1e74..4d639d89f0d 100644 --- a/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.aggregate_copy.JumpThreading.panic-unwind.diff @@ -22,12 +22,12 @@ StorageLive(_1); _1 = const aggregate_copy::Foo; StorageLive(_2); - _2 = _1; + _2 = copy _1; StorageLive(_3); - _3 = (_2.1: u32); + _3 = copy (_2.1: u32); StorageLive(_4); StorageLive(_5); - _5 = _3; + _5 = copy _3; _4 = Eq(move _5, const 2_u32); - switchInt(move _4) -> [0: bb2, otherwise: bb1]; + goto -> bb2; @@ -35,7 +35,7 @@ bb1: { StorageDead(_5); - _0 = (_2.0: u32); + _0 = copy (_2.0: u32); goto -> bb3; } diff --git a/tests/mir-opt/jump_threading.assume.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.assume.JumpThreading.panic-abort.diff index f1f0106fdbc..519cb0f0ab1 100644 --- a/tests/mir-opt/jump_threading.assume.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.assume.JumpThreading.panic-abort.diff @@ -5,11 +5,11 @@ let mut _0: u8; bb0: { - switchInt(_1) -> [7: bb1, otherwise: bb2]; + switchInt(copy _1) -> [7: bb1, otherwise: bb2]; } bb1: { - assume(_2); + assume(copy _2); - goto -> bb3; + goto -> bb6; } @@ -19,7 +19,7 @@ } bb3: { - switchInt(_2) -> [0: bb4, otherwise: bb5]; + switchInt(copy _2) -> [0: bb4, otherwise: bb5]; } bb4: { diff --git a/tests/mir-opt/jump_threading.assume.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.assume.JumpThreading.panic-unwind.diff index f1f0106fdbc..519cb0f0ab1 100644 --- a/tests/mir-opt/jump_threading.assume.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.assume.JumpThreading.panic-unwind.diff @@ -5,11 +5,11 @@ let mut _0: u8; bb0: { - switchInt(_1) -> [7: bb1, otherwise: bb2]; + switchInt(copy _1) -> [7: bb1, otherwise: bb2]; } bb1: { - assume(_2); + assume(copy _2); - goto -> bb3; + goto -> bb6; } @@ -19,7 +19,7 @@ } bb3: { - switchInt(_2) -> [0: bb4, otherwise: bb5]; + switchInt(copy _2) -> [0: bb4, otherwise: bb5]; } bb4: { diff --git a/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff index 462cc207785..a86371794eb 100644 --- a/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-abort.diff @@ -11,7 +11,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; switchInt(move _3) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff index 462cc207785..a86371794eb 100644 --- a/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.custom_discr.JumpThreading.panic-unwind.diff @@ -11,7 +11,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; switchInt(move _3) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff index f290da84e5d..d17f2752f58 100644 --- a/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-abort.diff @@ -9,7 +9,7 @@ bb0: { _2 = const true; _3 = const true; - switchInt(_1) -> [0: bb3, 1: bb3, 2: bb1, otherwise: bb2]; + switchInt(copy _1) -> [0: bb3, 1: bb3, 2: bb1, otherwise: bb2]; } bb1: { @@ -28,11 +28,11 @@ } bb4: { - switchInt(_3) -> [0: bb5, otherwise: bb7]; + switchInt(copy _3) -> [0: bb5, otherwise: bb7]; } bb5: { - switchInt(_2) -> [0: bb6, otherwise: bb8]; + switchInt(copy _2) -> [0: bb6, otherwise: bb8]; } bb6: { diff --git a/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff index f290da84e5d..d17f2752f58 100644 --- a/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.disappearing_bb.JumpThreading.panic-unwind.diff @@ -9,7 +9,7 @@ bb0: { _2 = const true; _3 = const true; - switchInt(_1) -> [0: bb3, 1: bb3, 2: bb1, otherwise: bb2]; + switchInt(copy _1) -> [0: bb3, 1: bb3, 2: bb1, otherwise: bb2]; } bb1: { @@ -28,11 +28,11 @@ } bb4: { - switchInt(_3) -> [0: bb5, otherwise: bb7]; + switchInt(copy _3) -> [0: bb5, otherwise: bb7]; } bb5: { - switchInt(_2) -> [0: bb6, otherwise: bb8]; + switchInt(copy _2) -> [0: bb6, otherwise: bb8]; } bb6: { diff --git a/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff index adcedfb3667..083a6e7487a 100644 --- a/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-abort.diff @@ -8,7 +8,7 @@ let mut _4: i32; bb0: { - switchInt(_1) -> [1: bb1, otherwise: bb2]; + switchInt(copy _1) -> [1: bb1, otherwise: bb2]; } bb1: { @@ -28,7 +28,7 @@ bb4: { _4 = const 15_i32; -- switchInt(_2) -> [5: bb5, otherwise: bb6]; +- switchInt(copy _2) -> [5: bb5, otherwise: bb6]; + goto -> bb5; } diff --git a/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff index adcedfb3667..083a6e7487a 100644 --- a/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.duplicate_chain.JumpThreading.panic-unwind.diff @@ -8,7 +8,7 @@ let mut _4: i32; bb0: { - switchInt(_1) -> [1: bb1, otherwise: bb2]; + switchInt(copy _1) -> [1: bb1, otherwise: bb2]; } bb1: { @@ -28,7 +28,7 @@ bb4: { _4 = const 15_i32; -- switchInt(_2) -> [5: bb5, otherwise: bb6]; +- switchInt(copy _2) -> [5: bb5, otherwise: bb6]; + goto -> bb5; } diff --git a/tests/mir-opt/jump_threading.floats.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.floats.JumpThreading.panic-abort.diff index 6ca37e96d29..1192f7c23e1 100644 --- a/tests/mir-opt/jump_threading.floats.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.floats.JumpThreading.panic-abort.diff @@ -33,7 +33,7 @@ StorageDead(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; _3 = Eq(move _4, const 0f64); switchInt(move _3) -> [0: bb5, otherwise: bb4]; } diff --git a/tests/mir-opt/jump_threading.floats.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.floats.JumpThreading.panic-unwind.diff index 6ca37e96d29..1192f7c23e1 100644 --- a/tests/mir-opt/jump_threading.floats.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.floats.JumpThreading.panic-unwind.diff @@ -33,7 +33,7 @@ StorageDead(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; _3 = Eq(move _4, const 0f64); switchInt(move _3) -> [0: bb5, otherwise: bb4]; } diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff index 65379ae8b89..79599f85611 100644 --- a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-abort.diff @@ -45,7 +45,7 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_10); StorageLive(_11); StorageLive(_12); @@ -59,8 +59,8 @@ bb2: { StorageLive(_9); - _9 = ((_3 as Continue).0: i32); - _2 = _9; + _9 = copy ((_3 as Continue).0: i32); + _2 = copy _9; StorageDead(_9); _0 = Result::<i32, i32>::Ok(move _2); StorageDead(_2); @@ -70,9 +70,9 @@ bb3: { StorageLive(_6); - _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); + _6 = copy ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); StorageLive(_8); - _8 = _6; + _8 = copy _6; StorageLive(_14); _14 = move ((_8 as Err).0: i32); StorageLive(_15); @@ -104,7 +104,7 @@ bb6: { _12 = move ((_4 as Err).0: i32); StorageLive(_13); - _13 = Result::<Infallible, i32>::Err(_12); + _13 = Result::<Infallible, i32>::Err(copy _12); _3 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _13); StorageDead(_13); - goto -> bb5; @@ -113,7 +113,7 @@ bb7: { _11 = move ((_4 as Ok).0: i32); - _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(_11); + _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(copy _11); goto -> bb5; + } + diff --git a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff index 65379ae8b89..79599f85611 100644 --- a/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.identity.JumpThreading.panic-unwind.diff @@ -45,7 +45,7 @@ StorageLive(_2); StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_10); StorageLive(_11); StorageLive(_12); @@ -59,8 +59,8 @@ bb2: { StorageLive(_9); - _9 = ((_3 as Continue).0: i32); - _2 = _9; + _9 = copy ((_3 as Continue).0: i32); + _2 = copy _9; StorageDead(_9); _0 = Result::<i32, i32>::Ok(move _2); StorageDead(_2); @@ -70,9 +70,9 @@ bb3: { StorageLive(_6); - _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); + _6 = copy ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); StorageLive(_8); - _8 = _6; + _8 = copy _6; StorageLive(_14); _14 = move ((_8 as Err).0: i32); StorageLive(_15); @@ -104,7 +104,7 @@ bb6: { _12 = move ((_4 as Err).0: i32); StorageLive(_13); - _13 = Result::<Infallible, i32>::Err(_12); + _13 = Result::<Infallible, i32>::Err(copy _12); _3 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _13); StorageDead(_13); - goto -> bb5; @@ -113,7 +113,7 @@ bb7: { _11 = move ((_4 as Ok).0: i32); - _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(_11); + _3 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(copy _11); goto -> bb5; + } + diff --git a/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff index 2ca03e439a0..09c0ad6d485 100644 --- a/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-abort.diff @@ -7,18 +7,18 @@ let mut _3: u8; bb0: { - switchInt(_1) -> [3: bb1, otherwise: bb2]; + switchInt(copy _1) -> [3: bb1, otherwise: bb2]; } bb1: { - _2 = _1; -- switchInt(_2) -> [3: bb3, otherwise: bb4]; + _2 = copy _1; +- switchInt(copy _2) -> [3: bb3, otherwise: bb4]; + goto -> bb3; } bb2: { - _3 = _1; -- switchInt(_3) -> [3: bb5, otherwise: bb6]; + _3 = copy _1; +- switchInt(copy _3) -> [3: bb5, otherwise: bb6]; + goto -> bb6; } @@ -38,7 +38,7 @@ } bb6: { - switchInt(_3) -> [1: bb7, otherwise: bb8]; + switchInt(copy _3) -> [1: bb7, otherwise: bb8]; } bb7: { diff --git a/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff index 2ca03e439a0..09c0ad6d485 100644 --- a/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.multiple_match.JumpThreading.panic-unwind.diff @@ -7,18 +7,18 @@ let mut _3: u8; bb0: { - switchInt(_1) -> [3: bb1, otherwise: bb2]; + switchInt(copy _1) -> [3: bb1, otherwise: bb2]; } bb1: { - _2 = _1; -- switchInt(_2) -> [3: bb3, otherwise: bb4]; + _2 = copy _1; +- switchInt(copy _2) -> [3: bb3, otherwise: bb4]; + goto -> bb3; } bb2: { - _3 = _1; -- switchInt(_3) -> [3: bb5, otherwise: bb6]; + _3 = copy _1; +- switchInt(copy _3) -> [3: bb5, otherwise: bb6]; + goto -> bb6; } @@ -38,7 +38,7 @@ } bb6: { - switchInt(_3) -> [1: bb7, otherwise: bb8]; + switchInt(copy _3) -> [1: bb7, otherwise: bb8]; } bb7: { diff --git a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff index e9d4352014f..bb47f57b542 100644 --- a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-abort.diff @@ -27,7 +27,7 @@ StorageDead(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; _4 = Eq(move _5, const 7_i32); switchInt(move _4) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff index e9d4352014f..bb47f57b542 100644 --- a/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.mutable_ref.JumpThreading.panic-unwind.diff @@ -27,7 +27,7 @@ StorageDead(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; _4 = Eq(move _5, const 7_i32); switchInt(move _4) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff index 8821b47c345..7014146cb86 100644 --- a/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-abort.diff @@ -10,7 +10,7 @@ discriminant(_1) = 1; (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize; _2 = discriminant(_1); - switchInt(_2) -> [0: bb1, otherwise: bb2]; + switchInt(copy _2) -> [0: bb1, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff index 8821b47c345..7014146cb86 100644 --- a/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.mutate_discriminant.JumpThreading.panic-unwind.diff @@ -10,7 +10,7 @@ discriminant(_1) = 1; (((_1 as variant#1).0: NonZeroUsize).0: usize) = const 0_usize; _2 = discriminant(_1); - switchInt(_2) -> [0: bb1, otherwise: bb2]; + switchInt(copy _2) -> [0: bb1, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff index 2d943a4bee2..9a8bdc8f4d9 100644 --- a/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-abort.diff @@ -8,7 +8,7 @@ bb0: { _3 = const false; - switchInt(_1) -> [1: bb1, otherwise: bb2]; + switchInt(copy _1) -> [1: bb1, otherwise: bb2]; } bb1: { @@ -18,17 +18,17 @@ } bb2: { - _2 = _1; - _3 = _1; + _2 = copy _1; + _3 = copy _1; goto -> bb3; } bb3: { - switchInt(_2) -> [0: bb4, otherwise: bb5]; + switchInt(copy _2) -> [0: bb4, otherwise: bb5]; } bb4: { - switchInt(_3) -> [0: bb6, otherwise: bb7]; + switchInt(copy _3) -> [0: bb6, otherwise: bb7]; } bb5: { diff --git a/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff index 2d943a4bee2..9a8bdc8f4d9 100644 --- a/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.renumbered_bb.JumpThreading.panic-unwind.diff @@ -8,7 +8,7 @@ bb0: { _3 = const false; - switchInt(_1) -> [1: bb1, otherwise: bb2]; + switchInt(copy _1) -> [1: bb1, otherwise: bb2]; } bb1: { @@ -18,17 +18,17 @@ } bb2: { - _2 = _1; - _3 = _1; + _2 = copy _1; + _3 = copy _1; goto -> bb3; } bb3: { - switchInt(_2) -> [0: bb4, otherwise: bb5]; + switchInt(copy _2) -> [0: bb4, otherwise: bb5]; } bb4: { - switchInt(_3) -> [0: bb6, otherwise: bb7]; + switchInt(copy _3) -> [0: bb6, otherwise: bb7]; } bb5: { diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs index 6486a321e69..9487a4e7e5f 100644 --- a/tests/mir-opt/jump_threading.rs +++ b/tests/mir-opt/jump_threading.rs @@ -24,11 +24,11 @@ fn too_complex(x: Result<i32, usize>) -> Option<i32> { // CHECK: bb4: { // CHECK: goto -> bb6; // CHECK: bb5: { - // CHECK: {{_.*}} = (([[controlflow]] as Break).0: usize); + // CHECK: {{_.*}} = copy (([[controlflow]] as Break).0: usize); // CHECK: _0 = Option::<i32>::None; // CHECK: goto -> bb7; // CHECK: bb6: { - // CHECK: {{_.*}} = (([[controlflow]] as Continue).0: i32); + // CHECK: {{_.*}} = copy (([[controlflow]] as Continue).0: i32); // CHECK: _0 = Option::<i32>::Some( // CHECK: goto -> bb7; // CHECK: bb7: { @@ -49,16 +49,16 @@ fn too_complex(x: Result<i32, usize>) -> Option<i32> { fn identity(x: Result<i32, i32>) -> Result<i32, i32> { // CHECK-LABEL: fn identity( // CHECK: bb0: { - // CHECK: [[x:_.*]] = _1; + // CHECK: [[x:_.*]] = copy _1; // CHECK: switchInt(move {{_.*}}) -> [0: bb7, 1: bb6, otherwise: bb1]; // CHECK: bb1: { // CHECK: unreachable; // CHECK: bb2: { - // CHECK: {{_.*}} = (([[controlflow:_.*]] as Continue).0: i32); + // CHECK: {{_.*}} = copy (([[controlflow:_.*]] as Continue).0: i32); // CHECK: _0 = Result::<i32, i32>::Ok( // CHECK: goto -> bb4; // CHECK: bb3: { - // CHECK: {{_.*}} = (([[controlflow]] as Break).0: std::result::Result<std::convert::Infallible, i32>); + // CHECK: {{_.*}} = copy (([[controlflow]] as Break).0: std::result::Result<std::convert::Infallible, i32>); // CHECK: _0 = Result::<i32, i32>::Err( // CHECK: goto -> bb4; // CHECK: bb4: { @@ -160,13 +160,13 @@ fn multiple_match(x: u8) -> u8 { mir! { { // CHECK: bb0: { - // CHECK: switchInt([[x:_.*]]) -> [3: bb1, otherwise: bb2]; + // CHECK: switchInt(copy [[x:_.*]]) -> [3: bb1, otherwise: bb2]; match x { 3 => bb1, _ => bb2 } } bb1 = { // We know `x == 3`, so we can take `bb3`. // CHECK: bb1: { - // CHECK: {{_.*}} = [[x]]; + // CHECK: {{_.*}} = copy [[x]]; // CHECK: goto -> bb3; let y = x; match y { 3 => bb3, _ => bb4 } @@ -174,7 +174,7 @@ fn multiple_match(x: u8) -> u8 { bb2 = { // We know `x != 3`, so we can take `bb6`. // CHECK: bb2: { - // CHECK: [[z:_.*]] = [[x]]; + // CHECK: [[z:_.*]] = copy [[x]]; // CHECK: goto -> bb6; let z = x; match z { 3 => bb5, _ => bb6 } @@ -203,7 +203,7 @@ fn multiple_match(x: u8) -> u8 { bb6 = { // We know `z != 3`, so we CANNOT take `bb7`. // CHECK: bb6: { - // CHECK: switchInt([[z]]) -> [1: bb7, otherwise: bb8]; + // CHECK: switchInt(copy [[z]]) -> [1: bb7, otherwise: bb8]; match z { 1 => bb7, _ => bb8 } } bb7 = { @@ -467,12 +467,12 @@ fn assume(a: u8, b: bool) -> u8 { mir! { { // CHECK: bb0: { - // CHECK-NEXT: switchInt(_1) -> [7: bb1, otherwise: bb2] + // CHECK-NEXT: switchInt(copy _1) -> [7: bb1, otherwise: bb2] match a { 7 => bb1, _ => bb2 } } bb1 = { // CHECK: bb1: { - // CHECK-NEXT: assume(_2); + // CHECK-NEXT: assume(copy _2); // CHECK-NEXT: goto -> bb6; Assume(b); Goto(bb3) @@ -484,7 +484,7 @@ fn assume(a: u8, b: bool) -> u8 { } bb3 = { // CHECK: bb3: { - // CHECK-NEXT: switchInt(_2) -> [0: bb4, otherwise: bb5]; + // CHECK-NEXT: switchInt(copy _2) -> [0: bb4, otherwise: bb5]; match b { false => bb4, _ => bb5 } } bb4 = { diff --git a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff index 365d9d6b32b..7de35929892 100644 --- a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff +++ b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-abort.diff @@ -39,9 +39,9 @@ bb2: { StorageLive(_6); - _6 = ((_1 as Err).0: usize); + _6 = copy ((_1 as Err).0: usize); StorageLive(_7); - _7 = _6; + _7 = copy _6; _2 = ControlFlow::<usize, i32>::Break(move _7); StorageDead(_7); StorageDead(_6); @@ -51,9 +51,9 @@ bb3: { StorageLive(_4); - _4 = ((_1 as Ok).0: i32); + _4 = copy ((_1 as Ok).0: i32); StorageLive(_5); - _5 = _4; + _5 = copy _4; _2 = ControlFlow::<usize, i32>::Continue(move _5); StorageDead(_5); StorageDead(_4); @@ -68,7 +68,7 @@ bb5: { StorageLive(_11); - _11 = ((_2 as Break).0: usize); + _11 = copy ((_2 as Break).0: usize); _0 = Option::<i32>::None; StorageDead(_11); goto -> bb7; @@ -76,9 +76,9 @@ bb6: { StorageLive(_9); - _9 = ((_2 as Continue).0: i32); + _9 = copy ((_2 as Continue).0: i32); StorageLive(_10); - _10 = _9; + _10 = copy _9; _0 = Option::<i32>::Some(move _10); StorageDead(_10); StorageDead(_9); diff --git a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff index 365d9d6b32b..7de35929892 100644 --- a/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff +++ b/tests/mir-opt/jump_threading.too_complex.JumpThreading.panic-unwind.diff @@ -39,9 +39,9 @@ bb2: { StorageLive(_6); - _6 = ((_1 as Err).0: usize); + _6 = copy ((_1 as Err).0: usize); StorageLive(_7); - _7 = _6; + _7 = copy _6; _2 = ControlFlow::<usize, i32>::Break(move _7); StorageDead(_7); StorageDead(_6); @@ -51,9 +51,9 @@ bb3: { StorageLive(_4); - _4 = ((_1 as Ok).0: i32); + _4 = copy ((_1 as Ok).0: i32); StorageLive(_5); - _5 = _4; + _5 = copy _4; _2 = ControlFlow::<usize, i32>::Continue(move _5); StorageDead(_5); StorageDead(_4); @@ -68,7 +68,7 @@ bb5: { StorageLive(_11); - _11 = ((_2 as Break).0: usize); + _11 = copy ((_2 as Break).0: usize); _0 = Option::<i32>::None; StorageDead(_11); goto -> bb7; @@ -76,9 +76,9 @@ bb6: { StorageLive(_9); - _9 = ((_2 as Continue).0: i32); + _9 = copy ((_2 as Continue).0: i32); StorageLive(_10); - _10 = _9; + _10 = copy _9; _0 = Option::<i32>::Some(move _10); StorageDead(_10); StorageDead(_9); diff --git a/tests/mir-opt/lower_array_len.array_bound.GVN.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-abort.diff index 7aca2cb0007..8223cbbb412 100644 --- a/tests/mir-opt/lower_array_len.array_bound.GVN.panic-abort.diff +++ b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-abort.diff @@ -18,7 +18,7 @@ - StorageLive(_3); + nop; StorageLive(_4); - _4 = _1; + _4 = copy _1; - StorageLive(_5); + nop; StorageLive(_6); @@ -35,8 +35,8 @@ StorageDead(_6); - _3 = Lt(move _4, move _5); - switchInt(move _3) -> [0: bb4, otherwise: bb2]; -+ _3 = Lt(_1, const N); -+ switchInt(_3) -> [0: bb4, otherwise: bb2]; ++ _3 = Lt(copy _1, const N); ++ switchInt(copy _3) -> [0: bb4, otherwise: bb2]; } bb2: { @@ -44,18 +44,18 @@ + nop; StorageDead(_4); StorageLive(_8); - _8 = _1; + _8 = copy _1; - _9 = Len((*_2)); -- _10 = Lt(_8, _9); -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind unreachable]; +- _10 = Lt(copy _8, copy _9); +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, copy _8) -> [success: bb3, unwind unreachable]; + _9 = const N; -+ _10 = _3; -+ assert(_3, "index out of bounds: the length is {} but the index is {}", const N, _1) -> [success: bb3, unwind unreachable]; ++ _10 = copy _3; ++ assert(copy _3, "index out of bounds: the length is {} but the index is {}", const N, copy _1) -> [success: bb3, unwind unreachable]; } bb3: { -- _0 = (*_2)[_8]; -+ _0 = (*_2)[_1]; +- _0 = copy (*_2)[_8]; ++ _0 = copy (*_2)[_1]; StorageDead(_8); goto -> bb5; } diff --git a/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff index ed39c11319a..d8f33accbc0 100644 --- a/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff +++ b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff @@ -18,7 +18,7 @@ - StorageLive(_3); + nop; StorageLive(_4); - _4 = _1; + _4 = copy _1; - StorageLive(_5); + nop; StorageLive(_6); @@ -35,8 +35,8 @@ StorageDead(_6); - _3 = Lt(move _4, move _5); - switchInt(move _3) -> [0: bb4, otherwise: bb2]; -+ _3 = Lt(_1, const N); -+ switchInt(_3) -> [0: bb4, otherwise: bb2]; ++ _3 = Lt(copy _1, const N); ++ switchInt(copy _3) -> [0: bb4, otherwise: bb2]; } bb2: { @@ -44,18 +44,18 @@ + nop; StorageDead(_4); StorageLive(_8); - _8 = _1; + _8 = copy _1; - _9 = Len((*_2)); -- _10 = Lt(_8, _9); -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind continue]; +- _10 = Lt(copy _8, copy _9); +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, copy _8) -> [success: bb3, unwind continue]; + _9 = const N; -+ _10 = _3; -+ assert(_3, "index out of bounds: the length is {} but the index is {}", const N, _1) -> [success: bb3, unwind continue]; ++ _10 = copy _3; ++ assert(copy _3, "index out of bounds: the length is {} but the index is {}", const N, copy _1) -> [success: bb3, unwind continue]; } bb3: { -- _0 = (*_2)[_8]; -+ _0 = (*_2)[_1]; +- _0 = copy (*_2)[_8]; ++ _0 = copy (*_2)[_1]; StorageDead(_8); goto -> bb5; } diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.GVN.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound_mut.GVN.panic-abort.diff index 734d28e9546..1cb9963c00e 100644 --- a/tests/mir-opt/lower_array_len.array_bound_mut.GVN.panic-abort.diff +++ b/tests/mir-opt/lower_array_len.array_bound_mut.GVN.panic-abort.diff @@ -21,7 +21,7 @@ - StorageLive(_3); + nop; StorageLive(_4); - _4 = _1; + _4 = copy _1; - StorageLive(_5); + nop; StorageLive(_6); @@ -38,8 +38,8 @@ StorageDead(_6); - _3 = Lt(move _4, move _5); - switchInt(move _3) -> [0: bb4, otherwise: bb2]; -+ _3 = Lt(_1, const N); -+ switchInt(_3) -> [0: bb4, otherwise: bb2]; ++ _3 = Lt(copy _1, const N); ++ switchInt(copy _3) -> [0: bb4, otherwise: bb2]; } bb2: { @@ -47,18 +47,18 @@ + nop; StorageDead(_4); StorageLive(_8); - _8 = _1; + _8 = copy _1; - _9 = Len((*_2)); -- _10 = Lt(_8, _9); -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind unreachable]; +- _10 = Lt(copy _8, copy _9); +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, copy _8) -> [success: bb3, unwind unreachable]; + _9 = const N; -+ _10 = _3; -+ assert(_3, "index out of bounds: the length is {} but the index is {}", const N, _1) -> [success: bb3, unwind unreachable]; ++ _10 = copy _3; ++ assert(copy _3, "index out of bounds: the length is {} but the index is {}", const N, copy _1) -> [success: bb3, unwind unreachable]; } bb3: { -- _0 = (*_2)[_8]; -+ _0 = (*_2)[_1]; +- _0 = copy (*_2)[_8]; ++ _0 = copy (*_2)[_1]; StorageDead(_8); goto -> bb6; } @@ -70,8 +70,8 @@ StorageLive(_11); _11 = const 0_usize; - _12 = Len((*_2)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind unreachable]; +- _13 = Lt(copy _11, copy _12); +- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb5, unwind unreachable]; + _12 = const N; + _13 = Lt(const 0_usize, const N); + assert(move _13, "index out of bounds: the length is {} but the index is {}", const N, const 0_usize) -> [success: bb5, unwind unreachable]; diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.GVN.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_bound_mut.GVN.panic-unwind.diff index ec569ab5042..fa4e11ed201 100644 --- a/tests/mir-opt/lower_array_len.array_bound_mut.GVN.panic-unwind.diff +++ b/tests/mir-opt/lower_array_len.array_bound_mut.GVN.panic-unwind.diff @@ -21,7 +21,7 @@ - StorageLive(_3); + nop; StorageLive(_4); - _4 = _1; + _4 = copy _1; - StorageLive(_5); + nop; StorageLive(_6); @@ -38,8 +38,8 @@ StorageDead(_6); - _3 = Lt(move _4, move _5); - switchInt(move _3) -> [0: bb4, otherwise: bb2]; -+ _3 = Lt(_1, const N); -+ switchInt(_3) -> [0: bb4, otherwise: bb2]; ++ _3 = Lt(copy _1, const N); ++ switchInt(copy _3) -> [0: bb4, otherwise: bb2]; } bb2: { @@ -47,18 +47,18 @@ + nop; StorageDead(_4); StorageLive(_8); - _8 = _1; + _8 = copy _1; - _9 = Len((*_2)); -- _10 = Lt(_8, _9); -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind continue]; +- _10 = Lt(copy _8, copy _9); +- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, copy _8) -> [success: bb3, unwind continue]; + _9 = const N; -+ _10 = _3; -+ assert(_3, "index out of bounds: the length is {} but the index is {}", const N, _1) -> [success: bb3, unwind continue]; ++ _10 = copy _3; ++ assert(copy _3, "index out of bounds: the length is {} but the index is {}", const N, copy _1) -> [success: bb3, unwind continue]; } bb3: { -- _0 = (*_2)[_8]; -+ _0 = (*_2)[_1]; +- _0 = copy (*_2)[_8]; ++ _0 = copy (*_2)[_1]; StorageDead(_8); goto -> bb6; } @@ -70,8 +70,8 @@ StorageLive(_11); _11 = const 0_usize; - _12 = Len((*_2)); -- _13 = Lt(_11, _12); -- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind continue]; +- _13 = Lt(copy _11, copy _12); +- assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, copy _11) -> [success: bb5, unwind continue]; + _12 = const N; + _13 = Lt(const 0_usize, const N); + assert(move _13, "index out of bounds: the length is {} but the index is {}", const N, const 0_usize) -> [success: bb5, unwind continue]; diff --git a/tests/mir-opt/lower_array_len.rs b/tests/mir-opt/lower_array_len.rs index f7ed376726c..6553343cbf0 100644 --- a/tests/mir-opt/lower_array_len.rs +++ b/tests/mir-opt/lower_array_len.rs @@ -6,7 +6,7 @@ pub fn array_bound<const N: usize>(index: usize, slice: &[u8; N]) -> u8 { // CHECK-LABEL: fn array_bound( // CHECK-NOT: Lt - // CHECK: Lt(_1, const N); + // CHECK: Lt(copy _1, const N); // CHECK-NOT: Lt if index < slice.len() { slice[index] } else { 42 } } @@ -15,7 +15,7 @@ pub fn array_bound<const N: usize>(index: usize, slice: &[u8; N]) -> u8 { pub fn array_bound_mut<const N: usize>(index: usize, slice: &mut [u8; N]) -> u8 { // CHECK-LABEL: fn array_bound_mut( // CHECK-NOT: Lt - // CHECK: Lt(_1, const N); + // CHECK: Lt(copy _1, const N); // CHECK-NOT: Lt // CHECK: Lt(const 0_usize, const N) // CHECK-NOT: Lt diff --git a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff index 96b66af66a2..7f325245bce 100644 --- a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-abort.diff @@ -33,7 +33,7 @@ StorageLive(_7); _7 = &_1; _6 = &raw const (*_7); - _5 = _6; + _5 = copy _6; _4 = move _5 as *const i32 (PtrToPtr); StorageDead(_5); StorageLive(_8); @@ -42,7 +42,7 @@ StorageLive(_11); _11 = &mut _2; _10 = &raw mut (*_11); - _9 = _10; + _9 = copy _10; _8 = move _9 as *mut i32 (PtrToPtr); StorageDead(_9); - _3 = copy_nonoverlapping::<i32>(move _4, move _8, const 0_usize) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff index 96b66af66a2..7f325245bce 100644 --- a/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.f_copy_nonoverlapping.LowerIntrinsics.panic-unwind.diff @@ -33,7 +33,7 @@ StorageLive(_7); _7 = &_1; _6 = &raw const (*_7); - _5 = _6; + _5 = copy _6; _4 = move _5 as *const i32 (PtrToPtr); StorageDead(_5); StorageLive(_8); @@ -42,7 +42,7 @@ StorageLive(_11); _11 = &mut _2; _10 = &raw mut (*_11); - _9 = _10; + _9 = copy _10; _8 = move _9 as *mut i32 (PtrToPtr); StorageDead(_9); - _3 = copy_nonoverlapping::<i32>(move _4, move _8, const 0_usize) -> [return: bb1, unwind unreachable]; diff --git a/tests/mir-opt/lower_intrinsics.get_metadata.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.get_metadata.LowerIntrinsics.panic-abort.diff index d256058c05e..f2cfce1b6e3 100644 --- a/tests/mir-opt/lower_intrinsics.get_metadata.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.get_metadata.LowerIntrinsics.panic-abort.diff @@ -25,7 +25,7 @@ bb0: { StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - _4 = ptr_metadata::<i32, ()>(move _5) -> [return: bb1, unwind unreachable]; + _4 = PtrMetadata(move _5); + goto -> bb1; @@ -35,7 +35,7 @@ StorageDead(_5); StorageLive(_6); StorageLive(_7); - _7 = _2; + _7 = copy _2; - _6 = ptr_metadata::<[u8], usize>(move _7) -> [return: bb2, unwind unreachable]; + _6 = PtrMetadata(move _7); + goto -> bb2; @@ -45,7 +45,7 @@ StorageDead(_7); StorageLive(_8); StorageLive(_9); - _9 = _3; + _9 = copy _3; - _8 = ptr_metadata::<dyn Debug, DynMetadata<dyn Debug>>(move _9) -> [return: bb3, unwind unreachable]; + _8 = PtrMetadata(move _9); + goto -> bb3; diff --git a/tests/mir-opt/lower_intrinsics.get_metadata.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.get_metadata.LowerIntrinsics.panic-unwind.diff index d256058c05e..f2cfce1b6e3 100644 --- a/tests/mir-opt/lower_intrinsics.get_metadata.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.get_metadata.LowerIntrinsics.panic-unwind.diff @@ -25,7 +25,7 @@ bb0: { StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; - _4 = ptr_metadata::<i32, ()>(move _5) -> [return: bb1, unwind unreachable]; + _4 = PtrMetadata(move _5); + goto -> bb1; @@ -35,7 +35,7 @@ StorageDead(_5); StorageLive(_6); StorageLive(_7); - _7 = _2; + _7 = copy _2; - _6 = ptr_metadata::<[u8], usize>(move _7) -> [return: bb2, unwind unreachable]; + _6 = PtrMetadata(move _7); + goto -> bb2; @@ -45,7 +45,7 @@ StorageDead(_7); StorageLive(_8); StorageLive(_9); - _9 = _3; + _9 = copy _3; - _8 = ptr_metadata::<dyn Debug, DynMetadata<dyn Debug>>(move _9) -> [return: bb3, unwind unreachable]; + _8 = PtrMetadata(move _9); + goto -> bb3; diff --git a/tests/mir-opt/lower_intrinsics.make_pointers.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.make_pointers.LowerIntrinsics.panic-abort.diff index 02934d4c01e..b282509c068 100644 --- a/tests/mir-opt/lower_intrinsics.make_pointers.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.make_pointers.LowerIntrinsics.panic-abort.diff @@ -34,7 +34,7 @@ bb0: { StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; StorageLive(_6); _6 = (); - _4 = aggregate_raw_ptr::<*const i32, *const u8, ()>(move _5, move _6) -> [return: bb1, unwind unreachable]; @@ -47,7 +47,7 @@ StorageDead(_5); StorageLive(_7); StorageLive(_8); - _8 = _2; + _8 = copy _2; StorageLive(_9); _9 = (); - _7 = aggregate_raw_ptr::<*mut u8, *mut (), ()>(move _8, move _9) -> [return: bb2, unwind unreachable]; @@ -60,9 +60,9 @@ StorageDead(_8); StorageLive(_10); StorageLive(_11); - _11 = _1; + _11 = copy _1; StorageLive(_12); - _12 = _3; + _12 = copy _3; - _10 = aggregate_raw_ptr::<*const [u16], *const u8, usize>(move _11, move _12) -> [return: bb3, unwind unreachable]; + _10 = *const [u16] from (move _11, move _12); + goto -> bb3; @@ -73,9 +73,9 @@ StorageDead(_11); StorageLive(_13); StorageLive(_14); - _14 = _2; + _14 = copy _2; StorageLive(_15); - _15 = _3; + _15 = copy _3; - _13 = aggregate_raw_ptr::<*mut [u64], *mut (), usize>(move _14, move _15) -> [return: bb4, unwind unreachable]; + _13 = *mut [u64] from (move _14, move _15); + goto -> bb4; diff --git a/tests/mir-opt/lower_intrinsics.make_pointers.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.make_pointers.LowerIntrinsics.panic-unwind.diff index 02934d4c01e..b282509c068 100644 --- a/tests/mir-opt/lower_intrinsics.make_pointers.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.make_pointers.LowerIntrinsics.panic-unwind.diff @@ -34,7 +34,7 @@ bb0: { StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; StorageLive(_6); _6 = (); - _4 = aggregate_raw_ptr::<*const i32, *const u8, ()>(move _5, move _6) -> [return: bb1, unwind unreachable]; @@ -47,7 +47,7 @@ StorageDead(_5); StorageLive(_7); StorageLive(_8); - _8 = _2; + _8 = copy _2; StorageLive(_9); _9 = (); - _7 = aggregate_raw_ptr::<*mut u8, *mut (), ()>(move _8, move _9) -> [return: bb2, unwind unreachable]; @@ -60,9 +60,9 @@ StorageDead(_8); StorageLive(_10); StorageLive(_11); - _11 = _1; + _11 = copy _1; StorageLive(_12); - _12 = _3; + _12 = copy _3; - _10 = aggregate_raw_ptr::<*const [u16], *const u8, usize>(move _11, move _12) -> [return: bb3, unwind unreachable]; + _10 = *const [u16] from (move _11, move _12); + goto -> bb3; @@ -73,9 +73,9 @@ StorageDead(_11); StorageLive(_13); StorageLive(_14); - _14 = _2; + _14 = copy _2; StorageLive(_15); - _15 = _3; + _15 = copy _3; - _13 = aggregate_raw_ptr::<*mut [u64], *mut (), usize>(move _14, move _15) -> [return: bb4, unwind unreachable]; + _13 = *mut [u64] from (move _14, move _15); + goto -> bb4; diff --git a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-abort.diff index 069a82b9521..5aa98698476 100644 --- a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-abort.diff @@ -13,7 +13,7 @@ StorageLive(_1); _1 = std::intrinsics::size_of::<T>; StorageLive(_2); - _2 = _1; + _2 = copy _1; - _0 = move _2() -> [return: bb1, unwind unreachable]; + _0 = SizeOf(T); + goto -> bb1; diff --git a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff index 069a82b9521..5aa98698476 100644 --- a/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.non_const.LowerIntrinsics.panic-unwind.diff @@ -13,7 +13,7 @@ StorageLive(_1); _1 = std::intrinsics::size_of::<T>; StorageLive(_2); - _2 = _1; + _2 = copy _1; - _0 = move _2() -> [return: bb1, unwind unreachable]; + _0 = SizeOf(T); + goto -> bb1; diff --git a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-abort.diff index 4f7ad0b6094..62cce84f695 100644 --- a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-abort.diff @@ -10,9 +10,9 @@ bb0: { StorageLive(_3); - _3 = _1; + _3 = copy _1; StorageLive(_4); - _4 = _2; + _4 = copy _2; - _0 = offset::<*const i32, isize>(move _3, move _4) -> [return: bb1, unwind unreachable]; + _0 = Offset(move _3, move _4); + goto -> bb1; diff --git a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff index 4f7ad0b6094..62cce84f695 100644 --- a/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.ptr_offset.LowerIntrinsics.panic-unwind.diff @@ -10,9 +10,9 @@ bb0: { StorageLive(_3); - _3 = _1; + _3 = copy _1; StorageLive(_4); - _4 = _2; + _4 = copy _2; - _0 = offset::<*const i32, isize>(move _3, move _4) -> [return: bb1, unwind unreachable]; + _0 = Offset(move _3, move _4); + goto -> bb1; diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff index 781104be290..95717d03b61 100644 --- a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-abort.diff @@ -10,7 +10,7 @@ StorageLive(_2); _2 = &raw const (*_1); - _0 = read_via_copy::<i32>(move _2) -> [return: bb1, unwind unreachable]; -+ _0 = (*_2); ++ _0 = copy (*_2); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff index 781104be290..95717d03b61 100644 --- a/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_primitive.LowerIntrinsics.panic-unwind.diff @@ -10,7 +10,7 @@ StorageLive(_2); _2 = &raw const (*_1); - _0 = read_via_copy::<i32>(move _2) -> [return: bb1, unwind unreachable]; -+ _0 = (*_2); ++ _0 = copy (*_2); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff index 56c357b3776..8828549249e 100644 --- a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-abort.diff @@ -10,7 +10,7 @@ StorageLive(_2); _2 = &raw const (*_1); - _0 = read_via_copy::<Never>(move _2) -> unwind unreachable; -+ _0 = (*_2); ++ _0 = copy (*_2); + unreachable; } } diff --git a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff index 56c357b3776..8828549249e 100644 --- a/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.read_via_copy_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -10,7 +10,7 @@ StorageLive(_2); _2 = &raw const (*_1); - _0 = read_via_copy::<Never>(move _2) -> unwind unreachable; -+ _0 = (*_2); ++ _0 = copy (*_2); + unreachable; } } diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index 2569f4f4de5..4859d935461 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -197,7 +197,7 @@ pub fn with_overflow(a: i32, b: i32) { pub fn read_via_copy_primitive(r: &i32) -> i32 { // CHECK-LABEL: fn read_via_copy_primitive( // CHECK: [[tmp:_.*]] = &raw const (*_1); - // CHECK: _0 = (*[[tmp]]); + // CHECK: _0 = copy (*[[tmp]]); // CHECK: return; unsafe { core::intrinsics::read_via_copy(r) } @@ -207,7 +207,7 @@ pub fn read_via_copy_primitive(r: &i32) -> i32 { pub fn read_via_copy_uninhabited(r: &Never) -> Never { // CHECK-LABEL: fn read_via_copy_uninhabited( // CHECK: [[tmp:_.*]] = &raw const (*_1); - // CHECK: _0 = (*[[tmp]]); + // CHECK: _0 = copy (*[[tmp]]); // CHECK: unreachable; unsafe { core::intrinsics::read_via_copy(r) } diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-abort.diff index 816d6209715..f29bc5dfc6e 100644 --- a/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-abort.diff @@ -15,9 +15,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = three_way_compare::<char>(move _4, move _5) -> [return: bb1, unwind unreachable]; + _3 = Cmp(move _4, move _5); + goto -> bb1; diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-unwind.diff index 80b4bd7a2be..596ad70b3bf 100644 --- a/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_char.LowerIntrinsics.panic-unwind.diff @@ -15,9 +15,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = three_way_compare::<char>(move _4, move _5) -> [return: bb1, unwind continue]; + _3 = Cmp(move _4, move _5); + goto -> bb1; diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-abort.diff index 05c20aaa09a..654cb2503df 100644 --- a/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-abort.diff @@ -12,9 +12,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = three_way_compare::<i16>(move _4, move _5) -> [return: bb1, unwind unreachable]; + _3 = Cmp(move _4, move _5); + goto -> bb1; diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-unwind.diff index 8a254d02a47..987c2166692 100644 --- a/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_signed.LowerIntrinsics.panic-unwind.diff @@ -12,9 +12,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = three_way_compare::<i16>(move _4, move _5) -> [return: bb1, unwind continue]; + _3 = Cmp(move _4, move _5); + goto -> bb1; diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-abort.diff index 437614ec673..82c89b7ce54 100644 --- a/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-abort.diff @@ -15,9 +15,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = three_way_compare::<u32>(move _4, move _5) -> [return: bb1, unwind unreachable]; + _3 = Cmp(move _4, move _5); + goto -> bb1; diff --git a/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-unwind.diff index 7d6137979c8..d7ec6dcfa2c 100644 --- a/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.three_way_compare_unsigned.LowerIntrinsics.panic-unwind.diff @@ -15,9 +15,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = three_way_compare::<u32>(move _4, move _5) -> [return: bb1, unwind continue]; + _3 = Cmp(move _4, move _5); + goto -> bb1; diff --git a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff index 6e542c4b5a7..b1104c70e46 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-abort.diff @@ -8,8 +8,8 @@ bb0: { StorageLive(_2); - _2 = _1; -- _0 = transmute::<std::cmp::Ordering, i8>(move _2) -> [return: bb1, unwind unreachable]; + _2 = copy _1; +- _0 = std::intrinsics::transmute::<std::cmp::Ordering, i8>(move _2) -> [return: bb1, unwind unreachable]; + _0 = move _2 as i8 (Transmute); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff index 6e542c4b5a7..b1104c70e46 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_inhabited.LowerIntrinsics.panic-unwind.diff @@ -8,8 +8,8 @@ bb0: { StorageLive(_2); - _2 = _1; -- _0 = transmute::<std::cmp::Ordering, i8>(move _2) -> [return: bb1, unwind unreachable]; + _2 = copy _1; +- _0 = std::intrinsics::transmute::<std::cmp::Ordering, i8>(move _2) -> [return: bb1, unwind unreachable]; + _0 = move _2 as i8 (Transmute); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff index ab4646370f1..169e48a31dd 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-abort.diff @@ -8,8 +8,8 @@ bb0: { StorageLive(_2); - _2 = _1; -- _0 = transmute::<&T, *const T>(move _2) -> [return: bb1, unwind unreachable]; + _2 = copy _1; +- _0 = std::intrinsics::transmute::<&T, *const T>(move _2) -> [return: bb1, unwind unreachable]; + _0 = move _2 as *const T (Transmute); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff index ab4646370f1..169e48a31dd 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_ref_dst.LowerIntrinsics.panic-unwind.diff @@ -8,8 +8,8 @@ bb0: { StorageLive(_2); - _2 = _1; -- _0 = transmute::<&T, *const T>(move _2) -> [return: bb1, unwind unreachable]; + _2 = copy _1; +- _0 = std::intrinsics::transmute::<&T, *const T>(move _2) -> [return: bb1, unwind unreachable]; + _0 = move _2 as *const T (Transmute); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff index c4a3358ffa3..7098b4d3168 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-abort.diff @@ -11,13 +11,13 @@ bb0: { StorageLive(_1); -- _1 = transmute::<usize, Box<Never>>(const 1_usize) -> [return: bb1, unwind unreachable]; +- _1 = std::intrinsics::transmute::<usize, Box<Never>>(const 1_usize) -> [return: bb1, unwind unreachable]; + _1 = const 1_usize as std::boxed::Box<Never> (Transmute); + goto -> bb1; } bb1: { - _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); + _2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); PlaceMention((*_2)); unreachable; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff index c4a3358ffa3..7098b4d3168 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_to_box_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -11,13 +11,13 @@ bb0: { StorageLive(_1); -- _1 = transmute::<usize, Box<Never>>(const 1_usize) -> [return: bb1, unwind unreachable]; +- _1 = std::intrinsics::transmute::<usize, Box<Never>>(const 1_usize) -> [return: bb1, unwind unreachable]; + _1 = const 1_usize as std::boxed::Box<Never> (Transmute); + goto -> bb1; } bb1: { - _2 = (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); + _2 = copy (((_1.0: std::ptr::Unique<Never>).0: std::ptr::NonNull<Never>).0: *const Never); PlaceMention((*_2)); unreachable; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff index c2c4ec0003c..06225fffd7c 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-abort.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_1); -- _1 = transmute::<usize, &mut Never>(const 1_usize) -> [return: bb1, unwind unreachable]; +- _1 = std::intrinsics::transmute::<usize, &mut Never>(const 1_usize) -> [return: bb1, unwind unreachable]; + _1 = const 1_usize as &mut Never (Transmute); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff index c2c4ec0003c..06225fffd7c 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_to_mut_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_1); -- _1 = transmute::<usize, &mut Never>(const 1_usize) -> [return: bb1, unwind unreachable]; +- _1 = std::intrinsics::transmute::<usize, &mut Never>(const 1_usize) -> [return: bb1, unwind unreachable]; + _1 = const 1_usize as &mut Never (Transmute); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff index 1b516a1f53b..dd6ab3a9c97 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-abort.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_1); -- _1 = transmute::<usize, &Never>(const 1_usize) -> [return: bb1, unwind unreachable]; +- _1 = std::intrinsics::transmute::<usize, &Never>(const 1_usize) -> [return: bb1, unwind unreachable]; + _1 = const 1_usize as &Never (Transmute); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff index 1b516a1f53b..dd6ab3a9c97 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_to_ref_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_1); -- _1 = transmute::<usize, &Never>(const 1_usize) -> [return: bb1, unwind unreachable]; +- _1 = std::intrinsics::transmute::<usize, &Never>(const 1_usize) -> [return: bb1, unwind unreachable]; + _1 = const 1_usize as &Never (Transmute); + goto -> bb1; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff index 6d3ad348988..6571f3d9db8 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-abort.diff @@ -8,8 +8,8 @@ bb0: { StorageLive(_2); - _2 = _1; -- _0 = transmute::<(), Never>(move _2) -> unwind unreachable; + _2 = copy _1; +- _0 = std::intrinsics::transmute::<(), Never>(move _2) -> unwind unreachable; + _0 = move _2 as Never (Transmute); + unreachable; } diff --git a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff index 6d3ad348988..6571f3d9db8 100644 --- a/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.transmute_uninhabited.LowerIntrinsics.panic-unwind.diff @@ -8,8 +8,8 @@ bb0: { StorageLive(_2); - _2 = _1; -- _0 = transmute::<(), Never>(move _2) -> unwind unreachable; + _2 = copy _1; +- _0 = std::intrinsics::transmute::<(), Never>(move _2) -> unwind unreachable; + _0 = move _2 as Never (Transmute); + unreachable; } diff --git a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff index 3c9694d0370..d0d38462f8d 100644 --- a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-abort.diff @@ -64,9 +64,9 @@ bb0: { StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; StorageLive(_6); - _6 = _2; + _6 = copy _2; - _4 = unchecked_add::<i32>(move _5, move _6) -> [return: bb1, unwind unreachable]; + _4 = AddUnchecked(move _5, move _6); + goto -> bb1; @@ -77,9 +77,9 @@ StorageDead(_5); StorageLive(_7); StorageLive(_8); - _8 = _1; + _8 = copy _1; StorageLive(_9); - _9 = _2; + _9 = copy _2; - _7 = unchecked_sub::<i32>(move _8, move _9) -> [return: bb2, unwind unreachable]; + _7 = SubUnchecked(move _8, move _9); + goto -> bb2; @@ -90,9 +90,9 @@ StorageDead(_8); StorageLive(_10); StorageLive(_11); - _11 = _1; + _11 = copy _1; StorageLive(_12); - _12 = _2; + _12 = copy _2; - _10 = unchecked_mul::<i32>(move _11, move _12) -> [return: bb3, unwind unreachable]; + _10 = MulUnchecked(move _11, move _12); + goto -> bb3; @@ -103,9 +103,9 @@ StorageDead(_11); StorageLive(_13); StorageLive(_14); - _14 = _1; + _14 = copy _1; StorageLive(_15); - _15 = _2; + _15 = copy _2; - _13 = unchecked_div::<i32>(move _14, move _15) -> [return: bb4, unwind unreachable]; + _13 = Div(move _14, move _15); + goto -> bb4; @@ -116,9 +116,9 @@ StorageDead(_14); StorageLive(_16); StorageLive(_17); - _17 = _1; + _17 = copy _1; StorageLive(_18); - _18 = _2; + _18 = copy _2; - _16 = unchecked_rem::<i32>(move _17, move _18) -> [return: bb5, unwind unreachable]; + _16 = Rem(move _17, move _18); + goto -> bb5; @@ -129,9 +129,9 @@ StorageDead(_17); StorageLive(_19); StorageLive(_20); - _20 = _1; + _20 = copy _1; StorageLive(_21); - _21 = _2; + _21 = copy _2; - _19 = unchecked_shl::<i32, i32>(move _20, move _21) -> [return: bb6, unwind unreachable]; + _19 = ShlUnchecked(move _20, move _21); + goto -> bb6; @@ -142,9 +142,9 @@ StorageDead(_20); StorageLive(_22); StorageLive(_23); - _23 = _1; + _23 = copy _1; StorageLive(_24); - _24 = _2; + _24 = copy _2; - _22 = unchecked_shr::<i32, i32>(move _23, move _24) -> [return: bb7, unwind unreachable]; + _22 = ShrUnchecked(move _23, move _24); + goto -> bb7; @@ -155,9 +155,9 @@ StorageDead(_23); StorageLive(_25); StorageLive(_26); - _26 = _1; + _26 = copy _1; StorageLive(_27); - _27 = _3; + _27 = copy _3; - _25 = unchecked_shl::<i32, u32>(move _26, move _27) -> [return: bb8, unwind unreachable]; + _25 = ShlUnchecked(move _26, move _27); + goto -> bb8; @@ -168,9 +168,9 @@ StorageDead(_26); StorageLive(_28); StorageLive(_29); - _29 = _1; + _29 = copy _1; StorageLive(_30); - _30 = _3; + _30 = copy _3; - _28 = unchecked_shr::<i32, u32>(move _29, move _30) -> [return: bb9, unwind unreachable]; + _28 = ShrUnchecked(move _29, move _30); + goto -> bb9; diff --git a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff index 3c9694d0370..d0d38462f8d 100644 --- a/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.unchecked.LowerIntrinsics.panic-unwind.diff @@ -64,9 +64,9 @@ bb0: { StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; StorageLive(_6); - _6 = _2; + _6 = copy _2; - _4 = unchecked_add::<i32>(move _5, move _6) -> [return: bb1, unwind unreachable]; + _4 = AddUnchecked(move _5, move _6); + goto -> bb1; @@ -77,9 +77,9 @@ StorageDead(_5); StorageLive(_7); StorageLive(_8); - _8 = _1; + _8 = copy _1; StorageLive(_9); - _9 = _2; + _9 = copy _2; - _7 = unchecked_sub::<i32>(move _8, move _9) -> [return: bb2, unwind unreachable]; + _7 = SubUnchecked(move _8, move _9); + goto -> bb2; @@ -90,9 +90,9 @@ StorageDead(_8); StorageLive(_10); StorageLive(_11); - _11 = _1; + _11 = copy _1; StorageLive(_12); - _12 = _2; + _12 = copy _2; - _10 = unchecked_mul::<i32>(move _11, move _12) -> [return: bb3, unwind unreachable]; + _10 = MulUnchecked(move _11, move _12); + goto -> bb3; @@ -103,9 +103,9 @@ StorageDead(_11); StorageLive(_13); StorageLive(_14); - _14 = _1; + _14 = copy _1; StorageLive(_15); - _15 = _2; + _15 = copy _2; - _13 = unchecked_div::<i32>(move _14, move _15) -> [return: bb4, unwind unreachable]; + _13 = Div(move _14, move _15); + goto -> bb4; @@ -116,9 +116,9 @@ StorageDead(_14); StorageLive(_16); StorageLive(_17); - _17 = _1; + _17 = copy _1; StorageLive(_18); - _18 = _2; + _18 = copy _2; - _16 = unchecked_rem::<i32>(move _17, move _18) -> [return: bb5, unwind unreachable]; + _16 = Rem(move _17, move _18); + goto -> bb5; @@ -129,9 +129,9 @@ StorageDead(_17); StorageLive(_19); StorageLive(_20); - _20 = _1; + _20 = copy _1; StorageLive(_21); - _21 = _2; + _21 = copy _2; - _19 = unchecked_shl::<i32, i32>(move _20, move _21) -> [return: bb6, unwind unreachable]; + _19 = ShlUnchecked(move _20, move _21); + goto -> bb6; @@ -142,9 +142,9 @@ StorageDead(_20); StorageLive(_22); StorageLive(_23); - _23 = _1; + _23 = copy _1; StorageLive(_24); - _24 = _2; + _24 = copy _2; - _22 = unchecked_shr::<i32, i32>(move _23, move _24) -> [return: bb7, unwind unreachable]; + _22 = ShrUnchecked(move _23, move _24); + goto -> bb7; @@ -155,9 +155,9 @@ StorageDead(_23); StorageLive(_25); StorageLive(_26); - _26 = _1; + _26 = copy _1; StorageLive(_27); - _27 = _3; + _27 = copy _3; - _25 = unchecked_shl::<i32, u32>(move _26, move _27) -> [return: bb8, unwind unreachable]; + _25 = ShlUnchecked(move _26, move _27); + goto -> bb8; @@ -168,9 +168,9 @@ StorageDead(_26); StorageLive(_28); StorageLive(_29); - _29 = _1; + _29 = copy _1; StorageLive(_30); - _30 = _3; + _30 = copy _3; - _28 = unchecked_shr::<i32, u32>(move _29, move _30) -> [return: bb9, unwind unreachable]; + _28 = ShrUnchecked(move _29, move _30); + goto -> bb9; diff --git a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-abort.diff index efbbeeeac73..a9bb5e7e3a4 100644 --- a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-abort.diff @@ -27,9 +27,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = add_with_overflow::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; + _3 = AddWithOverflow(move _4, move _5); + goto -> bb1; @@ -40,9 +40,9 @@ StorageDead(_4); StorageLive(_6); StorageLive(_7); - _7 = _1; + _7 = copy _1; StorageLive(_8); - _8 = _2; + _8 = copy _2; - _6 = sub_with_overflow::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; + _6 = SubWithOverflow(move _7, move _8); + goto -> bb2; @@ -53,9 +53,9 @@ StorageDead(_7); StorageLive(_9); StorageLive(_10); - _10 = _1; + _10 = copy _1; StorageLive(_11); - _11 = _2; + _11 = copy _2; - _9 = mul_with_overflow::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable]; + _9 = MulWithOverflow(move _10, move _11); + goto -> bb3; diff --git a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff index efbbeeeac73..a9bb5e7e3a4 100644 --- a/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.with_overflow.LowerIntrinsics.panic-unwind.diff @@ -27,9 +27,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = add_with_overflow::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; + _3 = AddWithOverflow(move _4, move _5); + goto -> bb1; @@ -40,9 +40,9 @@ StorageDead(_4); StorageLive(_6); StorageLive(_7); - _7 = _1; + _7 = copy _1; StorageLive(_8); - _8 = _2; + _8 = copy _2; - _6 = sub_with_overflow::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; + _6 = SubWithOverflow(move _7, move _8); + goto -> bb2; @@ -53,9 +53,9 @@ StorageDead(_7); StorageLive(_9); StorageLive(_10); - _10 = _1; + _10 = copy _1; StorageLive(_11); - _11 = _2; + _11 = copy _2; - _9 = mul_with_overflow::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable]; + _9 = MulWithOverflow(move _10, move _11); + goto -> bb3; diff --git a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-abort.diff b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-abort.diff index 2acb193e054..552b1a9a32b 100644 --- a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-abort.diff +++ b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-abort.diff @@ -27,9 +27,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = std::intrinsics::wrapping_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; + _3 = Add(move _4, move _5); + goto -> bb1; @@ -40,9 +40,9 @@ StorageDead(_4); StorageLive(_6); StorageLive(_7); - _7 = _1; + _7 = copy _1; StorageLive(_8); - _8 = _2; + _8 = copy _2; - _6 = std::intrinsics::wrapping_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; + _6 = Sub(move _7, move _8); + goto -> bb2; @@ -53,9 +53,9 @@ StorageDead(_7); StorageLive(_9); StorageLive(_10); - _10 = _1; + _10 = copy _1; StorageLive(_11); - _11 = _2; + _11 = copy _2; - _9 = wrapping_mul::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable]; + _9 = Mul(move _10, move _11); + goto -> bb3; diff --git a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff index 2acb193e054..552b1a9a32b 100644 --- a/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff +++ b/tests/mir-opt/lower_intrinsics.wrapping.LowerIntrinsics.panic-unwind.diff @@ -27,9 +27,9 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); - _5 = _2; + _5 = copy _2; - _3 = std::intrinsics::wrapping_add::<i32>(move _4, move _5) -> [return: bb1, unwind unreachable]; + _3 = Add(move _4, move _5); + goto -> bb1; @@ -40,9 +40,9 @@ StorageDead(_4); StorageLive(_6); StorageLive(_7); - _7 = _1; + _7 = copy _1; StorageLive(_8); - _8 = _2; + _8 = copy _2; - _6 = std::intrinsics::wrapping_sub::<i32>(move _7, move _8) -> [return: bb2, unwind unreachable]; + _6 = Sub(move _7, move _8); + goto -> bb2; @@ -53,9 +53,9 @@ StorageDead(_7); StorageLive(_9); StorageLive(_10); - _10 = _1; + _10 = copy _1; StorageLive(_11); - _11 = _2; + _11 = copy _2; - _9 = wrapping_mul::<i32>(move _10, move _11) -> [return: bb3, unwind unreachable]; + _9 = Mul(move _10, move _11); + goto -> bb3; diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff index a212ee67881..20001f1248e 100644 --- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff +++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff @@ -16,7 +16,7 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); StorageLive(_6); _6 = &(*_2); @@ -35,14 +35,14 @@ StorageDead(_5); StorageDead(_4); StorageLive(_7); - _7 = _1; + _7 = copy _1; _8 = Len((*_2)); - _9 = Lt(_7, _8); - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb3, unwind unreachable]; + _9 = Lt(copy _7, copy _8); + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, copy _7) -> [success: bb3, unwind unreachable]; } bb3: { - _0 = (*_2)[_7]; + _0 = copy (*_2)[_7]; StorageDead(_7); goto -> bb5; } diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff index 38ec8a5b0c7..ca8f92df5de 100644 --- a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff +++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-unwind.diff @@ -16,7 +16,7 @@ bb0: { StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); StorageLive(_6); _6 = &(*_2); @@ -35,14 +35,14 @@ StorageDead(_5); StorageDead(_4); StorageLive(_7); - _7 = _1; + _7 = copy _1; _8 = Len((*_2)); - _9 = Lt(_7, _8); - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb3, unwind continue]; + _9 = Lt(copy _7, copy _8); + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, copy _7) -> [success: bb3, unwind continue]; } bb3: { - _0 = (*_2)[_7]; + _0 = copy (*_2)[_7]; StorageDead(_7); goto -> bb5; } diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff index 3c4a84bc243..b3eb3e1f8b9 100644 --- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-abort.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -32,22 +32,22 @@ bb0: { PlaceMention(_2); -- switchInt((_2.0: bool)) -> [0: bb2, otherwise: bb1]; -+ switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb1]; +- switchInt(copy (_2.0: bool)) -> [0: bb2, otherwise: bb1]; ++ switchInt(copy (_2.0: bool)) -> [0: bb6, otherwise: bb1]; } bb1: { -- switchInt((_2.1: bool)) -> [0: bb4, otherwise: bb3]; -+ switchInt((_2.1: bool)) -> [0: bb5, otherwise: bb2]; +- switchInt(copy (_2.1: bool)) -> [0: bb4, otherwise: bb3]; ++ switchInt(copy (_2.1: bool)) -> [0: bb5, otherwise: bb2]; } bb2: { - falseEdge -> [real: bb9, imaginary: bb1]; -+ switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb4]; ++ switchInt(copy (_2.0: bool)) -> [0: bb3, otherwise: bb4]; } bb3: { -- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb5]; +- switchInt(copy (_2.0: bool)) -> [0: bb6, otherwise: bb5]; - } - - bb4: { @@ -60,7 +60,7 @@ - - bb6: { StorageLive(_15); - _15 = (_2.1: bool); + _15 = copy (_2.1: bool); StorageLive(_16); _16 = move (_2.2: std::string::String); - goto -> bb20; @@ -70,7 +70,7 @@ - bb7: { + bb4: { StorageLive(_15); - _15 = (_2.1: bool); + _15 = copy (_2.1: bool); StorageLive(_16); _16 = move (_2.2: std::string::String); - goto -> bb20; @@ -87,7 +87,7 @@ - _4 = &fake shallow (_2.1: bool); StorageLive(_12); StorageLive(_13); - _13 = _1; + _13 = copy _1; - switchInt(move _13) -> [0: bb16, otherwise: bb15]; + switchInt(move _13) -> [0: bb13, otherwise: bb12]; } @@ -102,7 +102,7 @@ - _4 = &fake shallow (_2.1: bool); StorageLive(_9); StorageLive(_10); - _10 = _1; + _10 = copy _1; - switchInt(move _10) -> [0: bb12, otherwise: bb11]; + switchInt(move _10) -> [0: bb9, otherwise: bb8]; } @@ -125,7 +125,7 @@ - bb12: { + bb9: { - _9 = (*_6); + _9 = copy (*_6); - switchInt(move _9) -> [0: bb14, otherwise: bb13]; + switchInt(move _9) -> [0: bb11, otherwise: bb10]; } @@ -139,7 +139,7 @@ - FakeRead(ForGuardBinding, _6); - FakeRead(ForGuardBinding, _8); StorageLive(_5); - _5 = (_2.1: bool); + _5 = copy (_2.1: bool); StorageLive(_7); _7 = move (_2.2: std::string::String); - goto -> bb10; @@ -167,7 +167,7 @@ - bb16: { + bb13: { - _12 = (*_6); + _12 = copy (*_6); - switchInt(move _12) -> [0: bb18, otherwise: bb17]; + switchInt(move _12) -> [0: bb15, otherwise: bb14]; } @@ -181,7 +181,7 @@ - FakeRead(ForGuardBinding, _6); - FakeRead(ForGuardBinding, _8); StorageLive(_5); - _5 = (_2.0: bool); + _5 = copy (_2.0: bool); StorageLive(_7); _7 = move (_2.2: std::string::String); - goto -> bb10; diff --git a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff index 3c4a84bc243..b3eb3e1f8b9 100644 --- a/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/tests/mir-opt/match_arm_scopes.complicated_match.panic-unwind.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -32,22 +32,22 @@ bb0: { PlaceMention(_2); -- switchInt((_2.0: bool)) -> [0: bb2, otherwise: bb1]; -+ switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb1]; +- switchInt(copy (_2.0: bool)) -> [0: bb2, otherwise: bb1]; ++ switchInt(copy (_2.0: bool)) -> [0: bb6, otherwise: bb1]; } bb1: { -- switchInt((_2.1: bool)) -> [0: bb4, otherwise: bb3]; -+ switchInt((_2.1: bool)) -> [0: bb5, otherwise: bb2]; +- switchInt(copy (_2.1: bool)) -> [0: bb4, otherwise: bb3]; ++ switchInt(copy (_2.1: bool)) -> [0: bb5, otherwise: bb2]; } bb2: { - falseEdge -> [real: bb9, imaginary: bb1]; -+ switchInt((_2.0: bool)) -> [0: bb3, otherwise: bb4]; ++ switchInt(copy (_2.0: bool)) -> [0: bb3, otherwise: bb4]; } bb3: { -- switchInt((_2.0: bool)) -> [0: bb6, otherwise: bb5]; +- switchInt(copy (_2.0: bool)) -> [0: bb6, otherwise: bb5]; - } - - bb4: { @@ -60,7 +60,7 @@ - - bb6: { StorageLive(_15); - _15 = (_2.1: bool); + _15 = copy (_2.1: bool); StorageLive(_16); _16 = move (_2.2: std::string::String); - goto -> bb20; @@ -70,7 +70,7 @@ - bb7: { + bb4: { StorageLive(_15); - _15 = (_2.1: bool); + _15 = copy (_2.1: bool); StorageLive(_16); _16 = move (_2.2: std::string::String); - goto -> bb20; @@ -87,7 +87,7 @@ - _4 = &fake shallow (_2.1: bool); StorageLive(_12); StorageLive(_13); - _13 = _1; + _13 = copy _1; - switchInt(move _13) -> [0: bb16, otherwise: bb15]; + switchInt(move _13) -> [0: bb13, otherwise: bb12]; } @@ -102,7 +102,7 @@ - _4 = &fake shallow (_2.1: bool); StorageLive(_9); StorageLive(_10); - _10 = _1; + _10 = copy _1; - switchInt(move _10) -> [0: bb12, otherwise: bb11]; + switchInt(move _10) -> [0: bb9, otherwise: bb8]; } @@ -125,7 +125,7 @@ - bb12: { + bb9: { - _9 = (*_6); + _9 = copy (*_6); - switchInt(move _9) -> [0: bb14, otherwise: bb13]; + switchInt(move _9) -> [0: bb11, otherwise: bb10]; } @@ -139,7 +139,7 @@ - FakeRead(ForGuardBinding, _6); - FakeRead(ForGuardBinding, _8); StorageLive(_5); - _5 = (_2.1: bool); + _5 = copy (_2.1: bool); StorageLive(_7); _7 = move (_2.2: std::string::String); - goto -> bb10; @@ -167,7 +167,7 @@ - bb16: { + bb13: { - _12 = (*_6); + _12 = copy (*_6); - switchInt(move _12) -> [0: bb18, otherwise: bb17]; + switchInt(move _12) -> [0: bb15, otherwise: bb14]; } @@ -181,7 +181,7 @@ - FakeRead(ForGuardBinding, _6); - FakeRead(ForGuardBinding, _8); StorageLive(_5); - _5 = (_2.0: bool); + _5 = copy (_2.0: bool); StorageLive(_7); _7 = move (_2.2: std::string::String); - goto -> bb10; diff --git a/tests/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff index 65da13eec50..597d93926f1 100644 --- a/tests/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff @@ -33,16 +33,16 @@ StorageLive(_4); StorageLive(_5); StorageLive(_6); -- switchInt(_1) -> [7: bb2, otherwise: bb1]; +- switchInt(copy _1) -> [7: bb2, otherwise: bb1]; - } - - bb1: { - _2 = const true; - _3 = const false; + StorageLive(_11); -+ _11 = _1; -+ _2 = Ne(_11, const 7_i32); -+ _3 = Eq(_11, const 7_i32); ++ _11 = copy _1; ++ _2 = Ne(copy _11, const 7_i32); ++ _3 = Eq(copy _11, const 7_i32); _4 = const false; _5 = const true; _6 = (); @@ -62,13 +62,13 @@ + StorageDead(_11); StorageDead(_6); StorageLive(_7); - _7 = _2; + _7 = copy _2; StorageLive(_8); - _8 = _3; + _8 = copy _3; StorageLive(_9); - _9 = _4; + _9 = copy _4; StorageLive(_10); - _10 = _5; + _10 = copy _5; _0 = (move _7, move _8, move _9, move _10); StorageDead(_10); StorageDead(_9); diff --git a/tests/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff index 052e2e12664..281f43b355d 100644 --- a/tests/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff @@ -14,7 +14,7 @@ - switchInt(move _3) -> [0: bb2, otherwise: bb1]; + StorageLive(_4); + _4 = move _3; -+ _2 = Eq(_4, const 0_isize); ++ _2 = Eq(copy _4, const 0_isize); + StorageDead(_4); + switchInt(move _2) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/matches_reduce_branches.match_i128_u128.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_i128_u128.MatchBranchSimplification.diff index fc34ce7125e..cc7e863d135 100644 --- a/tests/mir-opt/matches_reduce_branches.match_i128_u128.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_i128_u128.MatchBranchSimplification.diff @@ -39,7 +39,7 @@ - bb6: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as u128 (IntToInt); ++ _0 = copy _3 as u128 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff index 5a71bef9341..e9143ef1636 100644 --- a/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff @@ -46,7 +46,7 @@ - bb4: { + StorageLive(_7); + _7 = move _6; -+ _5 = Ne(_7, const false); ++ _5 = Ne(copy _7, const false); + StorageDead(_7); + StorageLive(_8); + _8 = move _5; @@ -66,7 +66,7 @@ - } - - bb7: { -+ _4 = Ne(_8, const false); ++ _4 = Ne(copy _8, const false); + StorageDead(_8); + StorageLive(_9); + _9 = move _4; @@ -86,7 +86,7 @@ - } - - bb10: { -+ _3 = Ne(_9, const false); ++ _3 = Ne(copy _9, const false); + StorageDead(_9); + StorageLive(_10); + _10 = move _3; @@ -104,10 +104,10 @@ - } - - bb12: { -+ _1 = Ne(_10, const false); ++ _1 = Ne(copy _10, const false); + StorageDead(_10); StorageDead(_2); - _0 = _1; + _0 = copy _1; StorageDead(_1); return; } diff --git a/tests/mir-opt/matches_reduce_branches.match_sext_i8_i16.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_sext_i8_i16.MatchBranchSimplification.diff index 7f8c2ab8d37..dbd26adc20f 100644 --- a/tests/mir-opt/matches_reduce_branches.match_sext_i8_i16.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_sext_i8_i16.MatchBranchSimplification.diff @@ -44,7 +44,7 @@ - bb7: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as i16 (IntToInt); ++ _0 = copy _3 as i16 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/matches_reduce_branches.match_sext_i8_u16.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_sext_i8_u16.MatchBranchSimplification.diff index 86d0d0ba6cf..f273d538835 100644 --- a/tests/mir-opt/matches_reduce_branches.match_sext_i8_u16.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_sext_i8_u16.MatchBranchSimplification.diff @@ -44,7 +44,7 @@ - bb7: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as u16 (IntToInt); ++ _0 = copy _3 as u16 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/matches_reduce_branches.match_trunc_i16_i8.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_trunc_i16_i8.MatchBranchSimplification.diff index d3d27be2070..6170cf13c00 100644 --- a/tests/mir-opt/matches_reduce_branches.match_trunc_i16_i8.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_trunc_i16_i8.MatchBranchSimplification.diff @@ -69,7 +69,7 @@ - bb12: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as i8 (IntToInt); ++ _0 = copy _3 as i8 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/matches_reduce_branches.match_trunc_i16_u8.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_trunc_i16_u8.MatchBranchSimplification.diff index 5fe899148eb..c18719ebb55 100644 --- a/tests/mir-opt/matches_reduce_branches.match_trunc_i16_u8.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_trunc_i16_u8.MatchBranchSimplification.diff @@ -69,7 +69,7 @@ - bb12: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as u8 (IntToInt); ++ _0 = copy _3 as u8 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/matches_reduce_branches.match_trunc_u16_i8.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_trunc_u16_i8.MatchBranchSimplification.diff index 85f97a13cac..401049026f2 100644 --- a/tests/mir-opt/matches_reduce_branches.match_trunc_u16_i8.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_trunc_u16_i8.MatchBranchSimplification.diff @@ -59,7 +59,7 @@ - bb10: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as i8 (IntToInt); ++ _0 = copy _3 as i8 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/matches_reduce_branches.match_trunc_u16_u8.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_trunc_u16_u8.MatchBranchSimplification.diff index 768d838eaa6..d4dafbd886f 100644 --- a/tests/mir-opt/matches_reduce_branches.match_trunc_u16_u8.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_trunc_u16_u8.MatchBranchSimplification.diff @@ -59,7 +59,7 @@ - bb10: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as u8 (IntToInt); ++ _0 = copy _3 as u8 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/matches_reduce_branches.match_u8_i8.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_u8_i8.MatchBranchSimplification.diff index d63eed7c019..5ab6f5eac84 100644 --- a/tests/mir-opt/matches_reduce_branches.match_u8_i8.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_u8_i8.MatchBranchSimplification.diff @@ -39,7 +39,7 @@ - bb6: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as i8 (IntToInt); ++ _0 = copy _3 as i8 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/matches_reduce_branches.match_u8_i8_2.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_u8_i8_2.MatchBranchSimplification.diff index 98dee1835a8..f14b3af9660 100644 --- a/tests/mir-opt/matches_reduce_branches.match_u8_i8_2.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_u8_i8_2.MatchBranchSimplification.diff @@ -35,8 +35,8 @@ - _3 = const -1_i8; + StorageLive(_8); + _8 = move _5; -+ _2 = _8 as i8 (IntToInt); -+ _3 = _8 as i8 (IntToInt); ++ _2 = copy _8 as i8 (IntToInt); ++ _3 = copy _8 as i8 (IntToInt); _4 = (); - goto -> bb6; - } @@ -66,9 +66,9 @@ + StorageDead(_8); StorageDead(_4); StorageLive(_6); - _6 = _2; + _6 = copy _2; StorageLive(_7); - _7 = _3; + _7 = copy _3; _0 = (move _6, move _7); StorageDead(_7); StorageDead(_6); diff --git a/tests/mir-opt/matches_reduce_branches.match_u8_i8_2_failed.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_u8_i8_2_failed.MatchBranchSimplification.diff index 901dda58617..92e1a7dbc7d 100644 --- a/tests/mir-opt/matches_reduce_branches.match_u8_i8_2_failed.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_u8_i8_2_failed.MatchBranchSimplification.diff @@ -60,9 +60,9 @@ bb6: { StorageDead(_4); StorageLive(_6); - _6 = _2; + _6 = copy _2; StorageLive(_7); - _7 = _3; + _7 = copy _3; _0 = (move _6, move _7); StorageDead(_7); StorageDead(_6); diff --git a/tests/mir-opt/matches_reduce_branches.match_u8_i8_failed_len_1.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_u8_i8_failed_len_1.MatchBranchSimplification.diff index 9ebf2cf27cb..a1d58424ecd 100644 --- a/tests/mir-opt/matches_reduce_branches.match_u8_i8_failed_len_1.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_u8_i8_failed_len_1.MatchBranchSimplification.diff @@ -7,7 +7,7 @@ bb0: { _2 = discriminant(_1); - switchInt(_2) -> [0: bb1, 127: bb2, 128: bb3, 255: bb4, otherwise: bb5]; + switchInt(copy _2) -> [0: bb1, 127: bb2, 128: bb3, 255: bb4, otherwise: bb5]; } bb1: { diff --git a/tests/mir-opt/matches_reduce_branches.match_u8_i8_failed_len_2.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_u8_i8_failed_len_2.MatchBranchSimplification.diff index 554856777eb..6c4ade1b6ca 100644 --- a/tests/mir-opt/matches_reduce_branches.match_u8_i8_failed_len_2.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_u8_i8_failed_len_2.MatchBranchSimplification.diff @@ -7,7 +7,7 @@ bb0: { _2 = discriminant(_1); - switchInt(_2) -> [0: bb1, 127: bb2, 128: bb3, 255: bb4, otherwise: bb5]; + switchInt(copy _2) -> [0: bb1, 127: bb2, 128: bb3, 255: bb4, otherwise: bb5]; } bb1: { diff --git a/tests/mir-opt/matches_reduce_branches.match_zext_u8_i16.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_zext_u8_i16.MatchBranchSimplification.diff index e00a604fe25..fdf83d91bbd 100644 --- a/tests/mir-opt/matches_reduce_branches.match_zext_u8_i16.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_zext_u8_i16.MatchBranchSimplification.diff @@ -39,7 +39,7 @@ - bb6: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as i16 (IntToInt); ++ _0 = copy _3 as i16 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/matches_reduce_branches.match_zext_u8_u16.MatchBranchSimplification.diff b/tests/mir-opt/matches_reduce_branches.match_zext_u8_u16.MatchBranchSimplification.diff index befb9118907..a888d247275 100644 --- a/tests/mir-opt/matches_reduce_branches.match_zext_u8_u16.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_reduce_branches.match_zext_u8_u16.MatchBranchSimplification.diff @@ -39,7 +39,7 @@ - bb6: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as u16 (IntToInt); ++ _0 = copy _3 as u16 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff b/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff index 11a18f58e3a..99985b28382 100644 --- a/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff @@ -29,7 +29,7 @@ - bb4: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as u8 (IntToInt); ++ _0 = copy _3 as u8 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff b/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff index 809badc41ba..0fc5032691f 100644 --- a/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff +++ b/tests/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff @@ -29,7 +29,7 @@ - bb4: { + StorageLive(_3); + _3 = move _2; -+ _0 = _3 as i8 (IntToInt); ++ _0 = copy _3 as i8 (IntToInt); + StorageDead(_3); return; } diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir index ad456600b0a..7294302609a 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir +++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir @@ -20,6 +20,9 @@ | '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:19:13: 19:18 (#0) | '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:20:13: 20:14 (#0) | +| Borrows +| bw0: issued at bb1[0] in '?2 +| fn main() -> () { let mut _0: (); let mut _1: [usize; ValTree(Leaf(0x00000003): usize)]; @@ -50,15 +53,15 @@ fn main() -> () { StorageLive(_3); _3 = const ConstValue(Scalar(0x00000000): usize); _4 = Len(_1); - _5 = Lt(_3, _4); - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb7]; + _5 = Lt(copy _3, copy _4); + assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind: bb7]; } bb1: { _2 = &'?2 _1[_3]; FakeRead(ForLet(None), _2); StorageLive(_6); - _6 = _2; + _6 = copy _2; FakeRead(ForLet(None), _6); StorageLive(_7); _7 = const ConstValue(Scalar(0x01): bool); @@ -68,7 +71,7 @@ fn main() -> () { bb2: { StorageLive(_8); StorageLive(_9); - _9 = (*_6); + _9 = copy (*_6); _8 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7]; } diff --git a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir index a15d47cd66f..85b89a013c4 100644 --- a/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir +++ b/tests/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir @@ -20,6 +20,9 @@ | '?2: '?3 due to Assignment at Single(bb1[0]) ($DIR/region_subtyping_basic.rs:19:13: 19:18 (#0) | '?3: '?4 due to Assignment at Single(bb1[3]) ($DIR/region_subtyping_basic.rs:20:13: 20:14 (#0) | +| Borrows +| bw0: issued at bb1[0] in '?2 +| fn main() -> () { let mut _0: (); let mut _1: [usize; ValTree(Leaf(0x0000000000000003): usize)]; @@ -50,15 +53,15 @@ fn main() -> () { StorageLive(_3); _3 = const ConstValue(Scalar(0x0000000000000000): usize); _4 = Len(_1); - _5 = Lt(_3, _4); - assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind: bb7]; + _5 = Lt(copy _3, copy _4); + assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, copy _3) -> [success: bb1, unwind: bb7]; } bb1: { _2 = &'?2 _1[_3]; FakeRead(ForLet(None), _2); StorageLive(_6); - _6 = _2; + _6 = copy _2; FakeRead(ForLet(None), _6); StorageLive(_7); _7 = const ConstValue(Scalar(0x01): bool); @@ -68,7 +71,7 @@ fn main() -> () { bb2: { StorageLive(_8); StorageLive(_9); - _9 = (*_6); + _9 = copy (*_6); _8 = ConstValue(ZeroSized: fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7]; } diff --git a/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff b/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff index 260b472daa9..d248c76f261 100644 --- a/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff +++ b/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff @@ -6,10 +6,10 @@ let mut _2: char; bb0: { -- _2 = _1; -- _0 = _2; +- _2 = copy _1; +- _0 = copy _2; - _2 = const 'b'; -+ _0 = _1; ++ _0 = copy _1; + _0 = const 'b'; return; } diff --git a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff index f7bc5559ab7..6dce3ec5303 100644 --- a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff +++ b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-abort.diff @@ -20,7 +20,7 @@ + _0 = [const 0_u8; 1024]; StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); StorageLive(_6); - _6 = &mut _2; @@ -34,7 +34,7 @@ StorageDead(_4); StorageDead(_6); StorageDead(_3); -- _0 = _2; +- _0 = copy _2; - StorageDead(_2); return; } diff --git a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff index 3df8e567f1f..54cbe2871f1 100644 --- a/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff +++ b/tests/mir-opt/nrvo_simple.nrvo.RenameReturnPlace.panic-unwind.diff @@ -20,7 +20,7 @@ + _0 = [const 0_u8; 1024]; StorageLive(_3); StorageLive(_4); - _4 = _1; + _4 = copy _1; StorageLive(_5); StorageLive(_6); - _6 = &mut _2; @@ -34,7 +34,7 @@ StorageDead(_4); StorageDead(_6); StorageDead(_3); -- _0 = _2; +- _0 = copy _2; - StorageDead(_2); return; } diff --git a/tests/mir-opt/or_pattern.shortcut_second_or.SimplifyCfg-initial.after.mir b/tests/mir-opt/or_pattern.shortcut_second_or.SimplifyCfg-initial.after.mir index 6c76a72b775..c5d7a6a1d99 100644 --- a/tests/mir-opt/or_pattern.shortcut_second_or.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/or_pattern.shortcut_second_or.SimplifyCfg-initial.after.mir @@ -18,15 +18,15 @@ fn shortcut_second_or() -> () { _1 = (move _2, const 0_i32); StorageDead(_2); PlaceMention(_1); - switchInt(((_1.0: (i32, i32)).0: i32)) -> [0: bb2, otherwise: bb1]; + switchInt(copy ((_1.0: (i32, i32)).0: i32)) -> [0: bb2, otherwise: bb1]; } bb1: { - switchInt(((_1.0: (i32, i32)).1: i32)) -> [1: bb4, otherwise: bb3]; + switchInt(copy ((_1.0: (i32, i32)).1: i32)) -> [1: bb4, otherwise: bb3]; } bb2: { - switchInt((_1.1: i32)) -> [2: bb5, 3: bb6, otherwise: bb3]; + switchInt(copy (_1.1: i32)) -> [2: bb5, 3: bb6, otherwise: bb3]; } bb3: { @@ -35,7 +35,7 @@ fn shortcut_second_or() -> () { } bb4: { - switchInt((_1.1: i32)) -> [2: bb7, 3: bb8, otherwise: bb3]; + switchInt(copy (_1.1: i32)) -> [2: bb7, 3: bb8, otherwise: bb3]; } bb5: { @@ -56,33 +56,33 @@ fn shortcut_second_or() -> () { bb9: { StorageLive(_3); - _3 = (_1.0: (i32, i32)); + _3 = copy (_1.0: (i32, i32)); StorageLive(_4); - _4 = (_1.1: i32); + _4 = copy (_1.1: i32); goto -> bb13; } bb10: { StorageLive(_3); - _3 = (_1.0: (i32, i32)); + _3 = copy (_1.0: (i32, i32)); StorageLive(_4); - _4 = (_1.1: i32); + _4 = copy (_1.1: i32); goto -> bb13; } bb11: { StorageLive(_3); - _3 = (_1.0: (i32, i32)); + _3 = copy (_1.0: (i32, i32)); StorageLive(_4); - _4 = (_1.1: i32); + _4 = copy (_1.1: i32); goto -> bb13; } bb12: { StorageLive(_3); - _3 = (_1.0: (i32, i32)); + _3 = copy (_1.0: (i32, i32)); StorageLive(_4); - _4 = (_1.1: i32); + _4 = copy (_1.1: i32); goto -> bb13; } diff --git a/tests/mir-opt/or_pattern.single_switchint.SimplifyCfg-initial.after.mir b/tests/mir-opt/or_pattern.single_switchint.SimplifyCfg-initial.after.mir index 8b0ef7b29d7..889ff6f9f5e 100644 --- a/tests/mir-opt/or_pattern.single_switchint.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/or_pattern.single_switchint.SimplifyCfg-initial.after.mir @@ -10,15 +10,15 @@ fn single_switchint() -> () { StorageLive(_2); _2 = (const 1_i32, const true); PlaceMention(_2); - switchInt((_2.0: i32)) -> [1: bb2, 2: bb4, otherwise: bb1]; + switchInt(copy (_2.0: i32)) -> [1: bb2, 2: bb4, otherwise: bb1]; } bb1: { - switchInt((_2.0: i32)) -> [3: bb8, 4: bb8, otherwise: bb7]; + switchInt(copy (_2.0: i32)) -> [3: bb8, 4: bb8, otherwise: bb7]; } bb2: { - switchInt((_2.1: bool)) -> [0: bb6, otherwise: bb3]; + switchInt(copy (_2.1: bool)) -> [0: bb6, otherwise: bb3]; } bb3: { @@ -26,7 +26,7 @@ fn single_switchint() -> () { } bb4: { - switchInt((_2.1: bool)) -> [0: bb5, otherwise: bb6]; + switchInt(copy (_2.1: bool)) -> [0: bb5, otherwise: bb6]; } bb5: { diff --git a/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir index 99ca659c637..9b77bdb7cf6 100644 --- a/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir @@ -29,17 +29,17 @@ fn bitand(_1: &Blueprint, _2: &Blueprint) -> bool { StorageLive(_9); StorageLive(_5); StorageLive(_3); - _3 = ((*_1).0: u32); + _3 = copy ((*_1).0: u32); StorageLive(_4); - _4 = ((*_2).0: u32); + _4 = copy ((*_2).0: u32); _5 = Eq(move _3, move _4); StorageDead(_4); StorageDead(_3); StorageLive(_8); StorageLive(_6); - _6 = ((*_1).1: u32); + _6 = copy ((*_1).1: u32); StorageLive(_7); - _7 = ((*_2).1: u32); + _7 = copy ((*_2).1: u32); _8 = Eq(move _6, move _7); StorageDead(_7); StorageDead(_6); @@ -48,9 +48,9 @@ fn bitand(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_5); StorageLive(_12); StorageLive(_10); - _10 = ((*_1).2: u32); + _10 = copy ((*_1).2: u32); StorageLive(_11); - _11 = ((*_2).2: u32); + _11 = copy ((*_2).2: u32); _12 = Eq(move _10, move _11); StorageDead(_11); StorageDead(_10); @@ -59,9 +59,9 @@ fn bitand(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_9); StorageLive(_16); StorageLive(_14); - _14 = ((*_1).3: u32); + _14 = copy ((*_1).3: u32); StorageLive(_15); - _15 = ((*_2).3: u32); + _15 = copy ((*_2).3: u32); _16 = Eq(move _14, move _15); StorageDead(_15); StorageDead(_14); @@ -70,9 +70,9 @@ fn bitand(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_13); StorageLive(_20); StorageLive(_18); - _18 = ((*_1).4: u32); + _18 = copy ((*_1).4: u32); StorageLive(_19); - _19 = ((*_2).4: u32); + _19 = copy ((*_2).4: u32); _20 = Eq(move _18, move _19); StorageDead(_19); StorageDead(_18); diff --git a/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir index 838e30fa35e..9b3e28ab5b8 100644 --- a/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir @@ -22,9 +22,9 @@ fn naive(_1: &Blueprint, _2: &Blueprint) -> bool { bb0: { StorageLive(_5); StorageLive(_3); - _3 = ((*_1).0: u32); + _3 = copy ((*_1).0: u32); StorageLive(_4); - _4 = ((*_2).0: u32); + _4 = copy ((*_2).0: u32); _5 = Eq(move _3, move _4); switchInt(move _5) -> [0: bb1, otherwise: bb2]; } @@ -40,9 +40,9 @@ fn naive(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_3); StorageLive(_8); StorageLive(_6); - _6 = ((*_1).1: u32); + _6 = copy ((*_1).1: u32); StorageLive(_7); - _7 = ((*_2).1: u32); + _7 = copy ((*_2).1: u32); _8 = Eq(move _6, move _7); switchInt(move _8) -> [0: bb3, otherwise: bb4]; } @@ -58,9 +58,9 @@ fn naive(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_6); StorageLive(_11); StorageLive(_9); - _9 = ((*_1).2: u32); + _9 = copy ((*_1).2: u32); StorageLive(_10); - _10 = ((*_2).2: u32); + _10 = copy ((*_2).2: u32); _11 = Eq(move _9, move _10); switchInt(move _11) -> [0: bb5, otherwise: bb6]; } @@ -76,9 +76,9 @@ fn naive(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_9); StorageLive(_14); StorageLive(_12); - _12 = ((*_1).3: u32); + _12 = copy ((*_1).3: u32); StorageLive(_13); - _13 = ((*_2).3: u32); + _13 = copy ((*_2).3: u32); _14 = Eq(move _12, move _13); switchInt(move _14) -> [0: bb7, otherwise: bb9]; } @@ -98,9 +98,9 @@ fn naive(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_13); StorageDead(_12); StorageLive(_15); - _15 = ((*_1).4: u32); + _15 = copy ((*_1).4: u32); StorageLive(_16); - _16 = ((*_2).4: u32); + _16 = copy ((*_2).4: u32); _0 = Eq(move _15, move _16); StorageDead(_16); StorageDead(_15); diff --git a/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir index 8452fa12f31..72d52701d11 100644 --- a/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir @@ -23,9 +23,9 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool { bb0: { StorageLive(_5); StorageLive(_3); - _3 = ((*_1).0: u32); + _3 = copy ((*_1).0: u32); StorageLive(_4); - _4 = ((*_2).0: u32); + _4 = copy ((*_2).0: u32); _5 = Ne(move _3, move _4); switchInt(move _5) -> [0: bb1, otherwise: bb10]; } @@ -36,9 +36,9 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_5); StorageLive(_8); StorageLive(_6); - _6 = ((*_1).1: u32); + _6 = copy ((*_1).1: u32); StorageLive(_7); - _7 = ((*_2).1: u32); + _7 = copy ((*_2).1: u32); _8 = Ne(move _6, move _7); switchInt(move _8) -> [0: bb2, otherwise: bb9]; } @@ -49,9 +49,9 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_8); StorageLive(_11); StorageLive(_9); - _9 = ((*_1).2: u32); + _9 = copy ((*_1).2: u32); StorageLive(_10); - _10 = ((*_2).2: u32); + _10 = copy ((*_2).2: u32); _11 = Ne(move _9, move _10); switchInt(move _11) -> [0: bb3, otherwise: bb8]; } @@ -62,9 +62,9 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_11); StorageLive(_14); StorageLive(_12); - _12 = ((*_1).3: u32); + _12 = copy ((*_1).3: u32); StorageLive(_13); - _13 = ((*_2).3: u32); + _13 = copy ((*_2).3: u32); _14 = Ne(move _12, move _13); switchInt(move _14) -> [0: bb4, otherwise: bb7]; } @@ -75,9 +75,9 @@ fn returning(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_14); StorageLive(_17); StorageLive(_15); - _15 = ((*_1).4: u32); + _15 = copy ((*_1).4: u32); StorageLive(_16); - _16 = ((*_2).4: u32); + _16 = copy ((*_2).4: u32); _17 = Ne(move _15, move _16); switchInt(move _17) -> [0: bb5, otherwise: bb6]; } diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-abort.mir index 4edf0d2c47c..a9dd8886577 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-abort.mir @@ -17,7 +17,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> { bb0: { StorageLive(_3); - _3 = Lt(_2, const core::num::<impl u32>::BITS); + _3 = Lt(copy _2, const core::num::<impl u32>::BITS); switchInt(move _3) -> [0: bb1, otherwise: bb2]; } @@ -28,7 +28,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> { bb2: { StorageLive(_4); - _4 = ShlUnchecked(_1, _2); + _4 = ShlUnchecked(copy _1, copy _2); _0 = Option::<u32>::Some(move _4); StorageDead(_4); goto -> bb3; diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-unwind.mir index 4edf0d2c47c..a9dd8886577 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.panic-unwind.mir @@ -17,7 +17,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> { bb0: { StorageLive(_3); - _3 = Lt(_2, const core::num::<impl u32>::BITS); + _3 = Lt(copy _2, const core::num::<impl u32>::BITS); switchInt(move _3) -> [0: bb1, otherwise: bb2]; } @@ -28,7 +28,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option<u32> { bb2: { StorageLive(_4); - _4 = ShlUnchecked(_1, _2); + _4 = ShlUnchecked(copy _1, copy _2); _0 = Option::<u32>::Some(move _4); StorageDead(_4); goto -> bb3; diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir index 69c11ebcacc..935e67fc3c0 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-abort.mir @@ -32,18 +32,18 @@ fn step_forward(_1: u16, _2: usize) -> u16 { bb0: { StorageLive(_4); StorageLive(_3); - _3 = Gt(_2, const 65535_usize); + _3 = Gt(copy _2, const 65535_usize); switchInt(move _3) -> [0: bb1, otherwise: bb5]; } bb1: { - _4 = _2 as u16 (IntToInt); + _4 = copy _2 as u16 (IntToInt); StorageDead(_3); StorageLive(_7); StorageLive(_6); StorageLive(_5); - _5 = AddWithOverflow(_1, _4); - _6 = (_5.1: bool); + _5 = AddWithOverflow(copy _1, copy _4); + _6 = copy (_5.1: bool); _7 = unlikely(move _6) -> [return: bb2, unwind unreachable]; } @@ -76,8 +76,8 @@ fn step_forward(_1: u16, _2: usize) -> u16 { bb7: { StorageLive(_8); - _8 = _2 as u16 (IntToInt); - _0 = Add(_1, _8); + _8 = copy _2 as u16 (IntToInt); + _0 = Add(copy _1, copy _8); StorageDead(_8); StorageDead(_4); return; diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir index e6ea6c51001..bf1ffd1ef32 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.panic-unwind.mir @@ -32,18 +32,18 @@ fn step_forward(_1: u16, _2: usize) -> u16 { bb0: { StorageLive(_4); StorageLive(_3); - _3 = Gt(_2, const 65535_usize); + _3 = Gt(copy _2, const 65535_usize); switchInt(move _3) -> [0: bb1, otherwise: bb5]; } bb1: { - _4 = _2 as u16 (IntToInt); + _4 = copy _2 as u16 (IntToInt); StorageDead(_3); StorageLive(_7); StorageLive(_6); StorageLive(_5); - _5 = AddWithOverflow(_1, _4); - _6 = (_5.1: bool); + _5 = AddWithOverflow(copy _1, copy _4); + _6 = copy (_5.1: bool); _7 = unlikely(move _6) -> [return: bb2, unwind unreachable]; } @@ -76,8 +76,8 @@ fn step_forward(_1: u16, _2: usize) -> u16 { bb7: { StorageLive(_8); - _8 = _2 as u16 (IntToInt); - _0 = Add(_1, _8); + _8 = copy _2 as u16 (IntToInt); + _0 = Add(copy _1, copy _8); StorageDead(_8); StorageDead(_4); return; diff --git a/tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir index 47f10451b05..5f4ec1de270 100644 --- a/tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/derived_ord.{impl#0}-partial_cmp.PreCodegen.after.mir @@ -22,13 +22,13 @@ fn <impl at $DIR/derived_ord.rs:6:10: 6:20>::partial_cmp(_1: &MultiField, _2: &M bb0: { StorageLive(_3); - _3 = ((*_1).0: char); + _3 = copy ((*_1).0: char); StorageLive(_4); - _4 = ((*_2).0: char); + _4 = copy ((*_2).0: char); _5 = Cmp(move _3, move _4); StorageDead(_4); StorageDead(_3); - _6 = Option::<std::cmp::Ordering>::Some(_5); + _6 = Option::<std::cmp::Ordering>::Some(copy _5); _7 = discriminant(_5); switchInt(move _7) -> [0: bb1, otherwise: bb2]; } @@ -36,9 +36,9 @@ fn <impl at $DIR/derived_ord.rs:6:10: 6:20>::partial_cmp(_1: &MultiField, _2: &M bb1: { StorageLive(_10); StorageLive(_8); - _8 = ((*_1).1: i16); + _8 = copy ((*_1).1: i16); StorageLive(_9); - _9 = ((*_2).1: i16); + _9 = copy ((*_2).1: i16); _10 = Cmp(move _8, move _9); StorageDead(_9); StorageDead(_8); @@ -48,7 +48,7 @@ fn <impl at $DIR/derived_ord.rs:6:10: 6:20>::partial_cmp(_1: &MultiField, _2: &M } bb2: { - _0 = _6; + _0 = copy _6; goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff index 30c122ddea0..6cac8b109ee 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff @@ -73,12 +73,12 @@ StorageLive(_6); StorageLive(_7); _9 = const main::promoted[0]; - _7 = _9; + _7 = copy _9; StorageLive(_8); -- _8 = _1; +- _8 = copy _1; - _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb4, unwind unreachable]; + _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}; -+ _6 = std::alloc::Global::alloc_impl(_9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb4, unwind unreachable]; ++ _6 = std::alloc::Global::alloc_impl(copy _9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb4, unwind unreachable]; } bb4: { @@ -93,7 +93,7 @@ bb5: { StorageLive(_15); _16 = &_13; - _15 = _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); + _15 = copy _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); _14 = result::unwrap_failed(const "called `Result::unwrap()` on an `Err` value", move _15) -> unwind unreachable; } @@ -104,14 +104,14 @@ StorageDead(_6); - StorageLive(_17); + nop; - _17 = (_5.0: *const [u8]); + _17 = copy (_5.0: *const [u8]); - _4 = move _17 as *mut [u8] (PtrToPtr); - StorageDead(_17); -+ _4 = _17 as *mut [u8] (PtrToPtr); ++ _4 = copy _17 as *mut [u8] (PtrToPtr); + nop; StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); -+ _3 = _17 as *mut u8 (PtrToPtr); ++ _3 = copy _17 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); - StorageDead(_1); diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff index 93449462c3d..5fcece2280d 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff @@ -47,14 +47,14 @@ StorageDead(_6); - StorageLive(_12); + nop; - _12 = (_5.0: *const [u8]); + _12 = copy (_5.0: *const [u8]); - _4 = move _12 as *mut [u8] (PtrToPtr); - StorageDead(_12); -+ _4 = _12 as *mut [u8] (PtrToPtr); ++ _4 = copy _12 as *mut [u8] (PtrToPtr); + nop; StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); -+ _3 = _12 as *mut u8 (PtrToPtr); ++ _3 = copy _12 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); - StorageDead(_1); @@ -81,12 +81,12 @@ StorageLive(_6); StorageLive(_7); _9 = const main::promoted[0]; - _7 = _9; + _7 = copy _9; StorageLive(_8); -- _8 = _1; +- _8 = copy _1; - _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb5, unwind continue]; + _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}; -+ _6 = std::alloc::Global::alloc_impl(_9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb5, unwind continue]; ++ _6 = std::alloc::Global::alloc_impl(copy _9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb5, unwind continue]; } bb5: { diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff index 44435956ec4..10fde25e317 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff @@ -73,12 +73,12 @@ StorageLive(_6); StorageLive(_7); _9 = const main::promoted[0]; - _7 = _9; + _7 = copy _9; StorageLive(_8); -- _8 = _1; +- _8 = copy _1; - _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb4, unwind unreachable]; + _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}; -+ _6 = std::alloc::Global::alloc_impl(_9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb4, unwind unreachable]; ++ _6 = std::alloc::Global::alloc_impl(copy _9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb4, unwind unreachable]; } bb4: { @@ -93,7 +93,7 @@ bb5: { StorageLive(_15); _16 = &_13; - _15 = _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); + _15 = copy _16 as &dyn std::fmt::Debug (PointerCoercion(Unsize)); _14 = result::unwrap_failed(const "called `Result::unwrap()` on an `Err` value", move _15) -> unwind unreachable; } @@ -104,14 +104,14 @@ StorageDead(_6); - StorageLive(_17); + nop; - _17 = (_5.0: *const [u8]); + _17 = copy (_5.0: *const [u8]); - _4 = move _17 as *mut [u8] (PtrToPtr); - StorageDead(_17); -+ _4 = _17 as *mut [u8] (PtrToPtr); ++ _4 = copy _17 as *mut [u8] (PtrToPtr); + nop; StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); -+ _3 = _17 as *mut u8 (PtrToPtr); ++ _3 = copy _17 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); - StorageDead(_1); diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff index c958480a9c7..0821ea272bf 100644 --- a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff @@ -47,14 +47,14 @@ StorageDead(_6); - StorageLive(_12); + nop; - _12 = (_5.0: *const [u8]); + _12 = copy (_5.0: *const [u8]); - _4 = move _12 as *mut [u8] (PtrToPtr); - StorageDead(_12); -+ _4 = _12 as *mut [u8] (PtrToPtr); ++ _4 = copy _12 as *mut [u8] (PtrToPtr); + nop; StorageDead(_5); - _3 = move _4 as *mut u8 (PtrToPtr); -+ _3 = _12 as *mut u8 (PtrToPtr); ++ _3 = copy _12 as *mut u8 (PtrToPtr); StorageDead(_4); StorageDead(_3); - StorageDead(_1); @@ -81,12 +81,12 @@ StorageLive(_6); StorageLive(_7); _9 = const main::promoted[0]; - _7 = _9; + _7 = copy _9; StorageLive(_8); -- _8 = _1; +- _8 = copy _1; - _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb5, unwind continue]; + _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}; -+ _6 = std::alloc::Global::alloc_impl(_9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb5, unwind continue]; ++ _6 = std::alloc::Global::alloc_impl(copy _9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb5, unwind continue]; } bb5: { diff --git a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir index 8d182069adc..75e8cb1d861 100644 --- a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir @@ -32,7 +32,7 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () bb1: { StorageLive(_4); - _4 = _3; + _4 = copy _3; goto -> bb2; } diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir index cdb7eea74fb..be69bbf10e7 100644 --- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir @@ -41,9 +41,9 @@ fn int_range(_1: usize, _2: usize) -> () { } bb0: { - _3 = std::ops::Range::<usize> { start: _1, end: _2 }; + _3 = std::ops::Range::<usize> { start: copy _1, end: copy _2 }; StorageLive(_4); - _4 = _3; + _4 = copy _3; goto -> bb1; } @@ -57,9 +57,9 @@ fn int_range(_1: usize, _2: usize) -> () { StorageLive(_7); _7 = &(_4.1: usize); StorageLive(_8); - _8 = (_4.0: usize); + _8 = copy (_4.0: usize); StorageLive(_9); - _9 = (_4.1: usize); + _9 = copy (_4.1: usize); _10 = Lt(move _8, move _9); StorageDead(_9); StorageDead(_8); @@ -79,18 +79,18 @@ fn int_range(_1: usize, _2: usize) -> () { bb3: { StorageDead(_7); StorageDead(_6); - _11 = (_4.0: usize); + _11 = copy (_4.0: usize); StorageLive(_12); - _12 = <usize as Step>::forward_unchecked(_11, const 1_usize) -> [return: bb4, unwind continue]; + _12 = <usize as Step>::forward_unchecked(copy _11, const 1_usize) -> [return: bb4, unwind continue]; } bb4: { (_4.0: usize) = move _12; StorageDead(_12); - _13 = Option::<usize>::Some(_11); + _13 = Option::<usize>::Some(copy _11); StorageDead(_10); StorageDead(_11); - _14 = ((_13 as Some).0: usize); + _14 = copy ((_13 as Some).0: usize); _15 = opaque::<usize>(move _14) -> [return: bb5, unwind continue]; } diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir index 51d41e9ff05..4977f39ccef 100644 --- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir @@ -43,7 +43,7 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () { bb1: { StorageLive(_4); - _4 = _3; + _4 = copy _3; goto -> bb2; } @@ -84,7 +84,7 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () { _10 = move ((_7 as Some).0: T); StorageLive(_12); StorageLive(_11); - _11 = (_10,); + _11 = (copy _10,); _12 = <&mut impl Fn(T) -> U as FnOnce<(T,)>>::call_once(move _8, move _11) -> [return: bb7, unwind: bb10]; } diff --git a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-abort.mir index 3ca24e152a4..c10f3c42962 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-abort.mir @@ -9,8 +9,8 @@ fn manual_replace(_1: &mut u32, _2: u32) -> u32 { } bb0: { - _0 = (*_1); - (*_1) = _2; + _0 = copy (*_1); + (*_1) = copy _2; return; } } diff --git a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-unwind.mir index 3ca24e152a4..c10f3c42962 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.panic-unwind.mir @@ -9,8 +9,8 @@ fn manual_replace(_1: &mut u32, _2: u32) -> u32 { } bb0: { - _0 = (*_1); - (*_1) = _2; + _0 = copy (*_1); + (*_1) = copy _2; return; } } diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir index a3dc54f73c8..ed494f6e74c 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-abort.mir @@ -14,8 +14,8 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { } bb0: { - _0 = (*_1); - (*_1) = _2; + _0 = copy (*_1); + (*_1) = copy _2; return; } } diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir index a3dc54f73c8..ed494f6e74c 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.panic-unwind.mir @@ -14,8 +14,8 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { } bb0: { - _0 = (*_1); - (*_1) = _2; + _0 = copy (*_1); + (*_1) = copy _2; return; } } diff --git a/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir index 71898daa1bf..62a9cd9131f 100644 --- a/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/no_inlined_clone.{impl#0}-clone.PreCodegen.after.mir @@ -7,7 +7,7 @@ fn <impl at $DIR/no_inlined_clone.rs:9:10: 9:15>::clone(_1: &Foo) -> Foo { bb0: { StorageLive(_2); - _2 = ((*_1).0: i32); + _2 = copy ((*_1).0: i32); _0 = Foo { a: move _2 }; StorageDead(_2); return; diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff index 45b8d89c0f4..6575610727b 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-abort.diff @@ -39,21 +39,21 @@ StorageLive(_5); _5 = const 3_usize; _6 = const 6_usize; -- _7 = Lt(_5, _6); -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb2, unwind unreachable]; + _7 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; } bb2: { -- _3 = _4[_5]; +- _3 = copy _4[_5]; + _3 = const 3_i32; StorageDead(_5); StorageDead(_4); StorageLive(_8); StorageLive(_9); _9 = const 42_u32; -- _8 = _9; +- _8 = copy _9; + _8 = const 42_u32; StorageDead(_9); StorageDead(_8); diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff index e6ee1e6f9a3..1a4ed5767fe 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.32bit.panic-unwind.diff @@ -39,21 +39,21 @@ StorageLive(_5); _5 = const 3_usize; _6 = const 6_usize; -- _7 = Lt(_5, _6); -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb2, unwind continue]; + _7 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; } bb2: { -- _3 = _4[_5]; +- _3 = copy _4[_5]; + _3 = const 3_i32; StorageDead(_5); StorageDead(_4); StorageLive(_8); StorageLive(_9); _9 = const 42_u32; -- _8 = _9; +- _8 = copy _9; + _8 = const 42_u32; StorageDead(_9); StorageDead(_8); diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff index 45b8d89c0f4..6575610727b 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-abort.diff @@ -39,21 +39,21 @@ StorageLive(_5); _5 = const 3_usize; _6 = const 6_usize; -- _7 = Lt(_5, _6); -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb2, unwind unreachable]; + _7 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind unreachable]; } bb2: { -- _3 = _4[_5]; +- _3 = copy _4[_5]; + _3 = const 3_i32; StorageDead(_5); StorageDead(_4); StorageLive(_8); StorageLive(_9); _9 = const 42_u32; -- _8 = _9; +- _8 = copy _9; + _8 = const 42_u32; StorageDead(_9); StorageDead(_8); diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff index e6ee1e6f9a3..1a4ed5767fe 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.GVN.64bit.panic-unwind.diff @@ -39,21 +39,21 @@ StorageLive(_5); _5 = const 3_usize; _6 = const 6_usize; -- _7 = Lt(_5, _6); -- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; +- _7 = Lt(copy _5, copy _6); +- assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb2, unwind continue]; + _7 = const true; + assert(const true, "index out of bounds: the length is {} but the index is {}", const 6_usize, const 3_usize) -> [success: bb2, unwind continue]; } bb2: { -- _3 = _4[_5]; +- _3 = copy _4[_5]; + _3 = const 3_i32; StorageDead(_5); StorageDead(_4); StorageLive(_8); StorageLive(_9); _9 = const 42_u32; -- _8 = _9; +- _8 = copy _9; + _8 = const 42_u32; StorageDead(_9); StorageDead(_8); diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff index c01a12eaa4f..e2420a341e0 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-abort.diff @@ -38,18 +38,18 @@ StorageLive(_5); _5 = const 3_usize; _6 = const 6_usize; - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; + _7 = Lt(copy _5, copy _6); + assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb2, unwind unreachable]; } bb2: { - _3 = _4[_5]; + _3 = copy _4[_5]; StorageDead(_5); StorageDead(_4); StorageLive(_8); - StorageLive(_9); - _9 = Point { x: const 12_u32, y: const 42_u32 }; -- _8 = (_9.1: u32); +- _8 = copy (_9.1: u32); - StorageDead(_9); + StorageLive(_10); + StorageLive(_11); @@ -57,7 +57,7 @@ + _10 = const 12_u32; + _11 = const 42_u32; + nop; -+ _8 = _11; ++ _8 = copy _11; + StorageDead(_10); + StorageDead(_11); + nop; diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff index 64028e4437b..a2fb3b979e6 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.32bit.panic-unwind.diff @@ -38,18 +38,18 @@ StorageLive(_5); _5 = const 3_usize; _6 = const 6_usize; - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; + _7 = Lt(copy _5, copy _6); + assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb2, unwind continue]; } bb2: { - _3 = _4[_5]; + _3 = copy _4[_5]; StorageDead(_5); StorageDead(_4); StorageLive(_8); - StorageLive(_9); - _9 = Point { x: const 12_u32, y: const 42_u32 }; -- _8 = (_9.1: u32); +- _8 = copy (_9.1: u32); - StorageDead(_9); + StorageLive(_10); + StorageLive(_11); @@ -57,7 +57,7 @@ + _10 = const 12_u32; + _11 = const 42_u32; + nop; -+ _8 = _11; ++ _8 = copy _11; + StorageDead(_10); + StorageDead(_11); + nop; diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff index c01a12eaa4f..e2420a341e0 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-abort.diff @@ -38,18 +38,18 @@ StorageLive(_5); _5 = const 3_usize; _6 = const 6_usize; - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind unreachable]; + _7 = Lt(copy _5, copy _6); + assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb2, unwind unreachable]; } bb2: { - _3 = _4[_5]; + _3 = copy _4[_5]; StorageDead(_5); StorageDead(_4); StorageLive(_8); - StorageLive(_9); - _9 = Point { x: const 12_u32, y: const 42_u32 }; -- _8 = (_9.1: u32); +- _8 = copy (_9.1: u32); - StorageDead(_9); + StorageLive(_10); + StorageLive(_11); @@ -57,7 +57,7 @@ + _10 = const 12_u32; + _11 = const 42_u32; + nop; -+ _8 = _11; ++ _8 = copy _11; + StorageDead(_10); + StorageDead(_11); + nop; diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff index 64028e4437b..a2fb3b979e6 100644 --- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff +++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ScalarReplacementOfAggregates.64bit.panic-unwind.diff @@ -38,18 +38,18 @@ StorageLive(_5); _5 = const 3_usize; _6 = const 6_usize; - _7 = Lt(_5, _6); - assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, _5) -> [success: bb2, unwind continue]; + _7 = Lt(copy _5, copy _6); + assert(move _7, "index out of bounds: the length is {} but the index is {}", move _6, copy _5) -> [success: bb2, unwind continue]; } bb2: { - _3 = _4[_5]; + _3 = copy _4[_5]; StorageDead(_5); StorageDead(_4); StorageLive(_8); - StorageLive(_9); - _9 = Point { x: const 12_u32, y: const 42_u32 }; -- _8 = (_9.1: u32); +- _8 = copy (_9.1: u32); - StorageDead(_9); + StorageLive(_10); + StorageLive(_11); @@ -57,7 +57,7 @@ + _10 = const 12_u32; + _11 = const 42_u32; + nop; -+ _8 = _11; ++ _8 = copy _11; + StorageDead(_10); + StorageDead(_11); + nop; diff --git a/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_fat.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_fat.PreCodegen.after.panic-abort.mir index 2f6139712ff..5faa1e210cf 100644 --- a/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_fat.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_fat.PreCodegen.after.panic-abort.mir @@ -23,12 +23,12 @@ fn demo_byte_add_fat(_1: *const [u32], _2: usize) -> *const [u32] { bb0: { StorageLive(_4); StorageLive(_3); - _3 = _1 as *const u8 (PtrToPtr); - _4 = Offset(_3, _2); + _3 = copy _1 as *const u8 (PtrToPtr); + _4 = Offset(copy _3, copy _2); StorageDead(_3); StorageLive(_5); - _5 = PtrMetadata(_1); - _0 = *const [u32] from (_4, _5); + _5 = PtrMetadata(copy _1); + _0 = *const [u32] from (copy _4, copy _5); StorageDead(_5); StorageDead(_4); return; diff --git a/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_fat.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_fat.PreCodegen.after.panic-unwind.mir index 2f6139712ff..5faa1e210cf 100644 --- a/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_fat.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_fat.PreCodegen.after.panic-unwind.mir @@ -23,12 +23,12 @@ fn demo_byte_add_fat(_1: *const [u32], _2: usize) -> *const [u32] { bb0: { StorageLive(_4); StorageLive(_3); - _3 = _1 as *const u8 (PtrToPtr); - _4 = Offset(_3, _2); + _3 = copy _1 as *const u8 (PtrToPtr); + _4 = Offset(copy _3, copy _2); StorageDead(_3); StorageLive(_5); - _5 = PtrMetadata(_1); - _0 = *const [u32] from (_4, _5); + _5 = PtrMetadata(copy _1); + _0 = *const [u32] from (copy _4, copy _5); StorageDead(_5); StorageDead(_4); return; diff --git a/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_thin.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_thin.PreCodegen.after.panic-abort.mir index 8d47e63eff2..9429785045a 100644 --- a/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_thin.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_thin.PreCodegen.after.panic-abort.mir @@ -22,10 +22,10 @@ fn demo_byte_add_thin(_1: *const u32, _2: usize) -> *const u32 { bb0: { StorageLive(_4); StorageLive(_3); - _3 = _1 as *const u8 (PtrToPtr); - _4 = Offset(_3, _2); + _3 = copy _1 as *const u8 (PtrToPtr); + _4 = Offset(copy _3, copy _2); StorageDead(_3); - _0 = _4 as *const u32 (PtrToPtr); + _0 = copy _4 as *const u32 (PtrToPtr); StorageDead(_4); return; } diff --git a/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_thin.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_thin.PreCodegen.after.panic-unwind.mir index 8d47e63eff2..9429785045a 100644 --- a/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_thin.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/ptr_offset.demo_byte_add_thin.PreCodegen.after.panic-unwind.mir @@ -22,10 +22,10 @@ fn demo_byte_add_thin(_1: *const u32, _2: usize) -> *const u32 { bb0: { StorageLive(_4); StorageLive(_3); - _3 = _1 as *const u8 (PtrToPtr); - _4 = Offset(_3, _2); + _3 = copy _1 as *const u8 (PtrToPtr); + _4 = Offset(copy _3, copy _2); StorageDead(_3); - _0 = _4 as *const u32 (PtrToPtr); + _0 = copy _4 as *const u32 (PtrToPtr); StorageDead(_4); return; } diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir index 96b4962854d..5d33c33d73f 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -35,7 +35,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb0: { StorageLive(_4); - _4 = _1; + _4 = copy _1; goto -> bb1; } @@ -44,8 +44,8 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { StorageLive(_7); StorageLive(_6); StorageLive(_5); - _5 = _4; - _6 = Lt(move _5, _2); + _5 = copy _4; + _6 = Lt(move _5, copy _2); StorageDead(_5); switchInt(move _6) -> [0: bb2, otherwise: bb4]; } @@ -63,22 +63,22 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb4: { - _7 = _4; + _7 = copy _4; StorageLive(_8); - _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb5, unwind unreachable]; + _8 = <u32 as Step>::forward_unchecked(copy _7, const 1_usize) -> [return: bb5, unwind unreachable]; } bb5: { _4 = move _8; StorageDead(_8); - _9 = Option::<u32>::Some(_7); + _9 = Option::<u32>::Some(copy _7); StorageDead(_6); StorageDead(_7); - _10 = ((_9 as Some).0: u32); + _10 = copy ((_9 as Some).0: u32); StorageLive(_11); _11 = &_3; StorageLive(_12); - _12 = (_10,); + _12 = (copy _10,); _13 = <impl Fn(u32) as Fn<(u32,)>>::call(move _11, move _12) -> [return: bb6, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir index ce8e2bd083e..ded30a15520 100644 --- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -35,7 +35,7 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb0: { StorageLive(_4); - _4 = _1; + _4 = copy _1; goto -> bb1; } @@ -44,8 +44,8 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { StorageLive(_7); StorageLive(_6); StorageLive(_5); - _5 = _4; - _6 = Lt(move _5, _2); + _5 = copy _4; + _6 = Lt(move _5, copy _2); StorageDead(_5); switchInt(move _6) -> [0: bb2, otherwise: bb4]; } @@ -63,22 +63,22 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb4: { - _7 = _4; + _7 = copy _4; StorageLive(_8); - _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb5, unwind: bb7]; + _8 = <u32 as Step>::forward_unchecked(copy _7, const 1_usize) -> [return: bb5, unwind: bb7]; } bb5: { _4 = move _8; StorageDead(_8); - _9 = Option::<u32>::Some(_7); + _9 = Option::<u32>::Some(copy _7); StorageDead(_6); StorageDead(_7); - _10 = ((_9 as Some).0: u32); + _10 = copy ((_9 as Some).0: u32); StorageLive(_11); _11 = &_3; StorageLive(_12); - _12 = (_10,); + _12 = (copy _10,); _13 = <impl Fn(u32) as Fn<(u32,)>>::call(move _11, move _12) -> [return: bb6, unwind: bb7]; } diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir index a7fe52d8390..60c0b8afa53 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-abort.mir @@ -28,9 +28,9 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb0: { - _4 = RangeInclusive::<u32> { start: _1, end: _2, exhausted: const false }; + _4 = RangeInclusive::<u32> { start: copy _1, end: copy _2, exhausted: const false }; StorageLive(_5); - _5 = _4; + _5 = copy _4; goto -> bb1; } @@ -56,11 +56,11 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb5: { - _9 = ((_7 as Some).0: u32); + _9 = copy ((_7 as Some).0: u32); StorageLive(_10); _10 = &_3; StorageLive(_11); - _11 = (_9,); + _11 = (copy _9,); _12 = <impl Fn(u32) as Fn<(u32,)>>::call(move _10, move _11) -> [return: bb6, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir index 3e2bbcd3c91..7145da58ce1 100644 --- a/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.inclusive_loop.PreCodegen.after.panic-unwind.mir @@ -28,9 +28,9 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb0: { - _4 = RangeInclusive::<u32> { start: _1, end: _2, exhausted: const false }; + _4 = RangeInclusive::<u32> { start: copy _1, end: copy _2, exhausted: const false }; StorageLive(_5); - _5 = _4; + _5 = copy _4; goto -> bb1; } @@ -56,11 +56,11 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb5: { - _9 = ((_7 as Some).0: u32); + _9 = copy ((_7 as Some).0: u32); StorageLive(_10); _10 = &_3; StorageLive(_11); - _11 = (_9,); + _11 = (copy _9,); _12 = <impl Fn(u32) as Fn<(u32,)>>::call(move _10, move _11) -> [return: bb6, unwind: bb8]; } diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir index 2ac7e880ccb..2621ec67531 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir @@ -21,9 +21,9 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { StorageLive(_5); StorageLive(_4); StorageLive(_2); - _2 = ((*_1).0: u32); + _2 = copy ((*_1).0: u32); StorageLive(_3); - _3 = ((*_1).1: u32); + _3 = copy ((*_1).1: u32); _4 = Lt(move _2, move _3); StorageDead(_3); StorageDead(_2); @@ -36,15 +36,15 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { } bb2: { - _5 = ((*_1).0: u32); + _5 = copy ((*_1).0: u32); StorageLive(_6); - _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind unreachable]; + _6 = <u32 as Step>::forward_unchecked(copy _5, const 1_usize) -> [return: bb3, unwind unreachable]; } bb3: { ((*_1).0: u32) = move _6; StorageDead(_6); - _0 = Option::<u32>::Some(_5); + _0 = Option::<u32>::Some(copy _5); goto -> bb4; } diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir index 60bf644fce6..338fb4b9523 100644 --- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir @@ -21,9 +21,9 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { StorageLive(_5); StorageLive(_4); StorageLive(_2); - _2 = ((*_1).0: u32); + _2 = copy ((*_1).0: u32); StorageLive(_3); - _3 = ((*_1).1: u32); + _3 = copy ((*_1).1: u32); _4 = Lt(move _2, move _3); StorageDead(_3); StorageDead(_2); @@ -36,15 +36,15 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { } bb2: { - _5 = ((*_1).0: u32); + _5 = copy ((*_1).0: u32); StorageLive(_6); - _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind continue]; + _6 = <u32 as Step>::forward_unchecked(copy _5, const 1_usize) -> [return: bb3, unwind continue]; } bb3: { ((*_1).0: u32) = move _6; StorageDead(_6); - _0 = Option::<u32>::Some(_5); + _0 = Option::<u32>::Some(copy _5); goto -> bb4; } diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir index 030f9c3b93e..cbfc58194cc 100644 --- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir @@ -25,9 +25,9 @@ fn ezmap(_1: Option<i32>) -> Option<i32> { } bb2: { - _3 = ((_1 as Some).0: i32); + _3 = copy ((_1 as Some).0: i32); StorageLive(_4); - _4 = Add(_3, const 1_i32); + _4 = Add(copy _3, const 1_i32); _0 = Option::<i32>::Some(move _4); StorageDead(_4); goto -> bb3; diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir index e382f744723..cbdd194afd3 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir @@ -68,7 +68,7 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 } bb0: { - _3 = (*_2); + _3 = copy (*_2); _4 = &((*_3).0: usize); _5 = &((*_3).1: usize); _6 = &((*_3).2: usize); @@ -78,11 +78,11 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 _8 = &_4; StorageLive(_10); StorageLive(_9); - _9 = _6; + _9 = copy _6; _10 = &_9; - _11 = ((*_3).0: usize); - _12 = ((*_3).2: usize); - _13 = Le(_11, _12); + _11 = copy ((*_3).0: usize); + _12 = copy ((*_3).2: usize); + _13 = Le(copy _11, copy _12); switchInt(move _13) -> [0: bb1, otherwise: bb2]; } @@ -102,12 +102,12 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 _14 = &_7; StorageLive(_16); StorageLive(_15); - _15 = _5; + _15 = copy _5; _16 = &_15; StorageLive(_17); - _17 = ((*_3).3: usize); + _17 = copy ((*_3).3: usize); StorageLive(_18); - _18 = ((*_3).1: usize); + _18 = copy ((*_3).1: usize); _19 = Le(move _17, move _18); StorageDead(_18); StorageDead(_17); @@ -127,9 +127,9 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 _20 = &_6; StorageLive(_22); StorageLive(_21); - _21 = _4; + _21 = copy _4; _22 = &_21; - _23 = Le(_12, _11); + _23 = Le(copy _12, copy _11); switchInt(move _23) -> [0: bb5, otherwise: bb6]; } @@ -149,12 +149,12 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2 _24 = &_5; StorageLive(_26); StorageLive(_25); - _25 = _7; + _25 = copy _7; _26 = &_25; StorageLive(_27); - _27 = ((*_3).1: usize); + _27 = copy ((*_3).1: usize); StorageLive(_28); - _28 = ((*_3).3: usize); + _28 = copy ((*_3).3: usize); _0 = Le(move _27, move _28); StorageDead(_28); StorageDead(_27); diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir index d9e118d879a..bc7a31d5219 100644 --- a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir @@ -18,25 +18,25 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41}, } bb0: { - _3 = (*_2); - _4 = ((*_3).0: usize); - _5 = ((*_3).1: usize); - _6 = ((*_3).2: usize); - _7 = ((*_3).3: usize); + _3 = copy (*_2); + _4 = copy ((*_3).0: usize); + _5 = copy ((*_3).1: usize); + _6 = copy ((*_3).2: usize); + _7 = copy ((*_3).3: usize); StorageLive(_8); - _8 = Le(_4, _6); + _8 = Le(copy _4, copy _6); switchInt(move _8) -> [0: bb2, otherwise: bb1]; } bb1: { StorageLive(_9); - _9 = Le(_7, _5); + _9 = Le(copy _7, copy _5); switchInt(move _9) -> [0: bb2, otherwise: bb6]; } bb2: { StorageLive(_10); - _10 = Le(_6, _4); + _10 = Le(copy _6, copy _4); switchInt(move _10) -> [0: bb3, otherwise: bb4]; } @@ -46,7 +46,7 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41}, } bb4: { - _0 = Le(_5, _7); + _0 = Le(copy _5, copy _7); goto -> bb5; } diff --git a/tests/mir-opt/pre-codegen/slice_index.rs b/tests/mir-opt/pre-codegen/slice_index.rs index 6ddc4ad0220..574062d6c35 100644 --- a/tests/mir-opt/pre-codegen/slice_index.rs +++ b/tests/mir-opt/pre-codegen/slice_index.rs @@ -10,17 +10,17 @@ use std::ops::Range; pub fn slice_index_usize(slice: &[u32], index: usize) -> u32 { // CHECK-LABEL: slice_index_usize // CHECK: [[LEN:_[0-9]+]] = Len((*_1)) - // CHECK: Lt(_2, [[LEN]]) + // CHECK: Lt(copy _2, copy [[LEN]]) // CHECK-NOT: precondition_check - // CHECK: _0 = (*_1)[_2]; + // CHECK: _0 = copy (*_1)[_2]; slice[index] } // EMIT_MIR slice_index.slice_get_mut_usize.PreCodegen.after.mir pub fn slice_get_mut_usize(slice: &mut [u32], index: usize) -> Option<&mut u32> { // CHECK-LABEL: slice_get_mut_usize - // CHECK: [[LEN:_[0-9]+]] = PtrMetadata(_1) - // CHECK: Lt(_2, move [[LEN]]) + // CHECK: [[LEN:_[0-9]+]] = PtrMetadata(copy _1) + // CHECK: Lt(copy _2, move [[LEN]]) // CHECK-NOT: precondition_check slice.get_mut(index) } @@ -37,9 +37,9 @@ pub unsafe fn slice_get_unchecked_mut_range(slice: &mut [u32], index: Range<usiz // CHECK: [[START:_[0-9]+]] = move (_2.0: usize); // CHECK: [[END:_[0-9]+]] = move (_2.1: usize); // CHECK: precondition_check - // CHECK: [[LEN:_[0-9]+]] = SubUnchecked([[END]], [[START]]); - // CHECK: [[PTR:_[0-9]+]] = Offset({{_[0-9]+}}, [[START]]); - // CHECK: [[SLICE:_[0-9]+]] = *mut [u32] from ([[PTR]], [[LEN]]) + // CHECK: [[LEN:_[0-9]+]] = SubUnchecked(copy [[END]], copy [[START]]); + // CHECK: [[PTR:_[0-9]+]] = Offset(copy {{_[0-9]+}}, copy [[START]]); + // CHECK: [[SLICE:_[0-9]+]] = *mut [u32] from (copy [[PTR]], copy [[LEN]]) // CHECK: _0 = &mut (*[[SLICE]]); slice.get_unchecked_mut(index) } @@ -53,8 +53,8 @@ pub unsafe fn slice_ptr_get_unchecked_range( // CHECK: [[START:_[0-9]+]] = move (_2.0: usize); // CHECK: [[END:_[0-9]+]] = move (_2.1: usize); // CHECK: precondition_check - // CHECK: [[LEN:_[0-9]+]] = SubUnchecked([[END]], [[START]]); - // CHECK: [[PTR:_[0-9]+]] = Offset({{_[0-9]+}}, [[START]]); - // CHECK: _0 = *const [u32] from ([[PTR]], [[LEN]]) + // CHECK: [[LEN:_[0-9]+]] = SubUnchecked(copy [[END]], copy [[START]]); + // CHECK: [[PTR:_[0-9]+]] = Offset(copy {{_[0-9]+}}, copy [[START]]); + // CHECK: _0 = *const [u32] from (copy [[PTR]], copy [[LEN]]) slice.get_unchecked(index) } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir index 58e9b45a4a0..ec67193bc79 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-abort.mir @@ -23,8 +23,8 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageLive(_8); StorageLive(_4); StorageLive(_3); - _3 = PtrMetadata(_1); - _4 = Lt(_2, move _3); + _3 = PtrMetadata(copy _1); + _4 = Lt(copy _2, move _3); switchInt(move _4) -> [0: bb1, otherwise: bb2]; } @@ -40,12 +40,12 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_6); - _6 = _5 as *mut u32 (PtrToPtr); - _7 = Offset(_6, _2); + _6 = copy _5 as *mut u32 (PtrToPtr); + _7 = Offset(copy _6, copy _2); StorageDead(_6); StorageDead(_5); _8 = &mut (*_7); - _0 = Option::<&mut u32>::Some(_8); + _0 = Option::<&mut u32>::Some(copy _8); StorageDead(_7); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir index 58e9b45a4a0..ec67193bc79 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_mut_usize.PreCodegen.after.panic-unwind.mir @@ -23,8 +23,8 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageLive(_8); StorageLive(_4); StorageLive(_3); - _3 = PtrMetadata(_1); - _4 = Lt(_2, move _3); + _3 = PtrMetadata(copy _1); + _4 = Lt(copy _2, move _3); switchInt(move _4) -> [0: bb1, otherwise: bb2]; } @@ -40,12 +40,12 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_6); - _6 = _5 as *mut u32 (PtrToPtr); - _7 = Offset(_6, _2); + _6 = copy _5 as *mut u32 (PtrToPtr); + _7 = Offset(copy _6, copy _2); StorageDead(_6); StorageDead(_5); _8 = &mut (*_7); - _0 = Option::<&mut u32>::Some(_8); + _0 = Option::<&mut u32>::Some(copy _8); StorageDead(_7); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir index ee80726a675..220e881f866 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir @@ -40,19 +40,19 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> _5 = &raw mut (*_1); StorageLive(_8); StorageLive(_6); - _6 = PtrMetadata(_1); - _7 = <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::precondition_check(_3, _4, move _6) -> [return: bb1, unwind unreachable]; + _6 = PtrMetadata(copy _1); + _7 = <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::precondition_check(copy _3, copy _4, move _6) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_6); - _8 = SubUnchecked(_4, _3); + _8 = SubUnchecked(copy _4, copy _3); StorageLive(_10); StorageLive(_9); - _9 = _5 as *mut u32 (PtrToPtr); - _10 = Offset(_9, _3); + _9 = copy _5 as *mut u32 (PtrToPtr); + _10 = Offset(copy _9, copy _3); StorageDead(_9); - _11 = *mut [u32] from (_10, _8); + _11 = *mut [u32] from (copy _10, copy _8); StorageDead(_10); StorageDead(_8); StorageDead(_5); diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir index ee80726a675..220e881f866 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir @@ -40,19 +40,19 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> _5 = &raw mut (*_1); StorageLive(_8); StorageLive(_6); - _6 = PtrMetadata(_1); - _7 = <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::precondition_check(_3, _4, move _6) -> [return: bb1, unwind unreachable]; + _6 = PtrMetadata(copy _1); + _7 = <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::precondition_check(copy _3, copy _4, move _6) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_6); - _8 = SubUnchecked(_4, _3); + _8 = SubUnchecked(copy _4, copy _3); StorageLive(_10); StorageLive(_9); - _9 = _5 as *mut u32 (PtrToPtr); - _10 = Offset(_9, _3); + _9 = copy _5 as *mut u32 (PtrToPtr); + _10 = Offset(copy _9, copy _3); StorageDead(_9); - _11 = *mut [u32] from (_10, _8); + _11 = *mut [u32] from (copy _10, copy _8); StorageDead(_10); StorageDead(_8); StorageDead(_5); diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir index 210f9d6a124..cc1034229fc 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-abort.mir @@ -9,12 +9,12 @@ fn slice_index_usize(_1: &[u32], _2: usize) -> u32 { bb0: { _3 = Len((*_1)); - _4 = Lt(_2, _3); - assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> [success: bb1, unwind unreachable]; + _4 = Lt(copy _2, copy _3); + assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, copy _2) -> [success: bb1, unwind unreachable]; } bb1: { - _0 = (*_1)[_2]; + _0 = copy (*_1)[_2]; return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir index d576520a8d5..358226fb529 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_usize.PreCodegen.after.panic-unwind.mir @@ -9,12 +9,12 @@ fn slice_index_usize(_1: &[u32], _2: usize) -> u32 { bb0: { _3 = Len((*_1)); - _4 = Lt(_2, _3); - assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> [success: bb1, unwind continue]; + _4 = Lt(copy _2, copy _3); + assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, copy _2) -> [success: bb1, unwind continue]; } bb1: { - _0 = (*_1)[_2]; + _0 = copy (*_1)[_2]; return; } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-abort.mir index c61bebe6cc3..1e0df94b67f 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-abort.mir @@ -35,19 +35,19 @@ fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) - _4 = move (_2.1: usize); StorageLive(_7); StorageLive(_5); - _5 = PtrMetadata(_1); - _6 = <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked::precondition_check(_3, _4, move _5) -> [return: bb1, unwind unreachable]; + _5 = PtrMetadata(copy _1); + _6 = <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked::precondition_check(copy _3, copy _4, move _5) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_5); - _7 = SubUnchecked(_4, _3); + _7 = SubUnchecked(copy _4, copy _3); StorageLive(_9); StorageLive(_8); - _8 = _1 as *const u32 (PtrToPtr); - _9 = Offset(_8, _3); + _8 = copy _1 as *const u32 (PtrToPtr); + _9 = Offset(copy _8, copy _3); StorageDead(_8); - _0 = *const [u32] from (_9, _7); + _0 = *const [u32] from (copy _9, copy _7); StorageDead(_9); StorageDead(_7); return; diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-unwind.mir index c61bebe6cc3..1e0df94b67f 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-unwind.mir @@ -35,19 +35,19 @@ fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) - _4 = move (_2.1: usize); StorageLive(_7); StorageLive(_5); - _5 = PtrMetadata(_1); - _6 = <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked::precondition_check(_3, _4, move _5) -> [return: bb1, unwind unreachable]; + _5 = PtrMetadata(copy _1); + _6 = <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked::precondition_check(copy _3, copy _4, move _5) -> [return: bb1, unwind unreachable]; } bb1: { StorageDead(_5); - _7 = SubUnchecked(_4, _3); + _7 = SubUnchecked(copy _4, copy _3); StorageLive(_9); StorageLive(_8); - _8 = _1 as *const u32 (PtrToPtr); - _9 = Offset(_8, _3); + _8 = copy _1 as *const u32 (PtrToPtr); + _9 = Offset(copy _8, copy _3); StorageDead(_8); - _0 = *const [u32] from (_9, _7); + _0 = *const [u32] from (copy _9, copy _7); StorageDead(_9); StorageDead(_7); return; diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir index 953e7550479..3aa483ed1ae 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir @@ -31,7 +31,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } scope 19 { scope 20 { - scope 26 (inlined <Option<(usize, &T)> as FromResidual>::from_residual) { + scope 26 (inlined <Option<(usize, &T)> as FromResidual<Option<Infallible>>>::from_residual) { } } } @@ -90,10 +90,10 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { StorageLive(_6); StorageLive(_4); StorageLive(_5); - _3 = PtrMetadata(_1); + _3 = PtrMetadata(copy _1); _4 = &raw const (*_1); - _5 = _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: _5 }; + _5 = copy _4 as *const T (PtrToPtr); + _6 = NonNull::<T> { pointer: copy _5 }; StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; } @@ -101,8 +101,8 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb1: { StorageLive(_8); StorageLive(_7); - _7 = _4 as *mut T (PtrToPtr); - _8 = Offset(_7, _3); + _7 = copy _4 as *mut T (PtrToPtr); + _8 = Offset(copy _7, copy _3); StorageDead(_7); _9 = move _8 as *const T (PtrToPtr); StorageDead(_8); @@ -110,24 +110,24 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb2: { - _9 = _3 as *const T (Transmute); + _9 = copy _3 as *const T (Transmute); goto -> bb3; } bb3: { StorageLive(_10); - _10 = _9; - _11 = std::slice::Iter::<'_, T> { ptr: _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; + _10 = copy _9; + _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_10); StorageDead(_9); StorageDead(_5); StorageDead(_4); StorageDead(_6); StorageDead(_3); - _12 = Enumerate::<std::slice::Iter<'_, T>> { iter: _11, count: const 0_usize }; + _12 = Enumerate::<std::slice::Iter<'_, T>> { iter: copy _11, count: const 0_usize }; StorageDead(_11); StorageLive(_13); - _13 = _12; + _13 = copy _12; goto -> bb4; } @@ -166,25 +166,25 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _17 = move ((_15 as Some).0: &T); StorageDead(_16); StorageDead(_15); - _18 = (_13.1: usize); - _19 = AddWithOverflow((_13.1: usize), const 1_usize); - assert(!move (_19.1: bool), "attempt to compute `{} + {}`, which would overflow", (_13.1: usize), const 1_usize) -> [success: bb9, unwind unreachable]; + _18 = copy (_13.1: usize); + _19 = AddWithOverflow(copy (_13.1: usize), const 1_usize); + assert(!move (_19.1: bool), "attempt to compute `{} + {}`, which would overflow", copy (_13.1: usize), const 1_usize) -> [success: bb9, unwind unreachable]; } bb9: { (_13.1: usize) = move (_19.0: usize); StorageLive(_20); - _20 = (_18, _17); + _20 = (copy _18, copy _17); _21 = Option::<(usize, &T)>::Some(move _20); StorageDead(_20); StorageDead(_19); StorageDead(_18); - _22 = (((_21 as Some).0: (usize, &T)).0: usize); - _23 = (((_21 as Some).0: (usize, &T)).1: &T); + _22 = copy (((_21 as Some).0: (usize, &T)).0: usize); + _23 = copy (((_21 as Some).0: (usize, &T)).1: &T); StorageLive(_24); _24 = &_2; StorageLive(_25); - _25 = (_22, _23); + _25 = (copy _22, copy _23); _26 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _24, move _25) -> [return: bb10, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir index 4c766c6497a..4cc0aa0ed78 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir @@ -65,10 +65,10 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { StorageLive(_6); StorageLive(_4); StorageLive(_5); - _3 = PtrMetadata(_1); + _3 = PtrMetadata(copy _1); _4 = &raw const (*_1); - _5 = _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: _5 }; + _5 = copy _4 as *const T (PtrToPtr); + _6 = NonNull::<T> { pointer: copy _5 }; StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; } @@ -76,8 +76,8 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb1: { StorageLive(_8); StorageLive(_7); - _7 = _4 as *mut T (PtrToPtr); - _8 = Offset(_7, _3); + _7 = copy _4 as *mut T (PtrToPtr); + _8 = Offset(copy _7, copy _3); StorageDead(_7); _9 = move _8 as *const T (PtrToPtr); StorageDead(_8); @@ -85,24 +85,24 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb2: { - _9 = _3 as *const T (Transmute); + _9 = copy _3 as *const T (Transmute); goto -> bb3; } bb3: { StorageLive(_10); - _10 = _9; - _11 = std::slice::Iter::<'_, T> { ptr: _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; + _10 = copy _9; + _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_10); StorageDead(_9); StorageDead(_5); StorageDead(_4); StorageDead(_6); StorageDead(_3); - _12 = Enumerate::<std::slice::Iter<'_, T>> { iter: _11, count: const 0_usize }; + _12 = Enumerate::<std::slice::Iter<'_, T>> { iter: copy _11, count: const 0_usize }; StorageDead(_11); StorageLive(_13); - _13 = _12; + _13 = copy _12; goto -> bb4; } @@ -128,12 +128,12 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb8: { - _17 = (((_15 as Some).0: (usize, &T)).0: usize); - _18 = (((_15 as Some).0: (usize, &T)).1: &T); + _17 = copy (((_15 as Some).0: (usize, &T)).0: usize); + _18 = copy (((_15 as Some).0: (usize, &T)).1: &T); StorageLive(_19); _19 = &_2; StorageLive(_20); - _20 = (_17, _18); + _20 = (copy _17, copy _18); _21 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _19, move _20) -> [return: bb9, unwind: bb11]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir index 03de9fd938e..507afa63c68 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -57,10 +57,10 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_6); StorageLive(_4); StorageLive(_5); - _3 = PtrMetadata(_1); + _3 = PtrMetadata(copy _1); _4 = &raw const (*_1); - _5 = _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: _5 }; + _5 = copy _4 as *const T (PtrToPtr); + _6 = NonNull::<T> { pointer: copy _5 }; StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; } @@ -68,8 +68,8 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb1: { StorageLive(_8); StorageLive(_7); - _7 = _4 as *mut T (PtrToPtr); - _8 = Offset(_7, _3); + _7 = copy _4 as *mut T (PtrToPtr); + _8 = Offset(copy _7, copy _3); StorageDead(_7); _9 = move _8 as *const T (PtrToPtr); StorageDead(_8); @@ -77,14 +77,14 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb2: { - _9 = _3 as *const T (Transmute); + _9 = copy _3 as *const T (Transmute); goto -> bb3; } bb3: { StorageLive(_10); - _10 = _9; - _11 = std::slice::Iter::<'_, T> { ptr: _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; + _10 = copy _9; + _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_10); StorageDead(_9); StorageDead(_5); @@ -92,7 +92,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageDead(_6); StorageDead(_3); StorageLive(_12); - _12 = _11; + _12 = copy _11; goto -> bb4; } @@ -118,11 +118,11 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _16 = ((_14 as Some).0: &T); + _16 = copy ((_14 as Some).0: &T); StorageLive(_17); _17 = &_2; StorageLive(_18); - _18 = (_16,); + _18 = (copy _16,); _19 = <impl Fn(&T) as Fn<(&T,)>>::call(move _17, move _18) -> [return: bb9, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir index c7c722274f2..a25f12edc28 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -57,10 +57,10 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_6); StorageLive(_4); StorageLive(_5); - _3 = PtrMetadata(_1); + _3 = PtrMetadata(copy _1); _4 = &raw const (*_1); - _5 = _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: _5 }; + _5 = copy _4 as *const T (PtrToPtr); + _6 = NonNull::<T> { pointer: copy _5 }; StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; } @@ -68,8 +68,8 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb1: { StorageLive(_8); StorageLive(_7); - _7 = _4 as *mut T (PtrToPtr); - _8 = Offset(_7, _3); + _7 = copy _4 as *mut T (PtrToPtr); + _8 = Offset(copy _7, copy _3); StorageDead(_7); _9 = move _8 as *const T (PtrToPtr); StorageDead(_8); @@ -77,14 +77,14 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb2: { - _9 = _3 as *const T (Transmute); + _9 = copy _3 as *const T (Transmute); goto -> bb3; } bb3: { StorageLive(_10); - _10 = _9; - _11 = std::slice::Iter::<'_, T> { ptr: _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; + _10 = copy _9; + _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_10); StorageDead(_9); StorageDead(_5); @@ -92,7 +92,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageDead(_6); StorageDead(_3); StorageLive(_12); - _12 = _11; + _12 = copy _11; goto -> bb4; } @@ -118,11 +118,11 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _16 = ((_14 as Some).0: &T); + _16 = copy ((_14 as Some).0: &T); StorageLive(_17); _17 = &_2; StorageLive(_18); - _18 = (_16,); + _18 = (copy _16,); _19 = <impl Fn(&T) as Fn<(&T,)>>::call(move _17, move _18) -> [return: bb9, unwind: bb11]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir index cea2fcbcdc0..ecac03ad0f9 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir @@ -40,7 +40,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb0: { - _3 = PtrMetadata(_1); + _3 = PtrMetadata(copy _1); StorageLive(_4); _4 = const 0_usize; goto -> bb1; @@ -51,8 +51,8 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { StorageLive(_7); StorageLive(_6); StorageLive(_5); - _5 = _4; - _6 = Lt(move _5, _3); + _5 = copy _4; + _6 = Lt(move _5, copy _3); StorageDead(_5); switchInt(move _6) -> [0: bb2, otherwise: bb4]; } @@ -70,21 +70,21 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb4: { - _7 = _4; + _7 = copy _4; StorageLive(_8); - _8 = <usize as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb5, unwind unreachable]; + _8 = <usize as Step>::forward_unchecked(copy _7, const 1_usize) -> [return: bb5, unwind unreachable]; } bb5: { _4 = move _8; StorageDead(_8); - _9 = Option::<usize>::Some(_7); + _9 = Option::<usize>::Some(copy _7); StorageDead(_6); StorageDead(_7); - _10 = ((_9 as Some).0: usize); + _10 = copy ((_9 as Some).0: usize); _11 = Len((*_1)); - _12 = Lt(_10, _11); - assert(move _12, "index out of bounds: the length is {} but the index is {}", move _11, _10) -> [success: bb6, unwind unreachable]; + _12 = Lt(copy _10, copy _11); + assert(move _12, "index out of bounds: the length is {} but the index is {}", move _11, copy _10) -> [success: bb6, unwind unreachable]; } bb6: { @@ -92,7 +92,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { StorageLive(_14); _14 = &_2; StorageLive(_15); - _15 = (_10, _13); + _15 = (copy _10, copy _13); _16 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _14, move _15) -> [return: bb7, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir index bd658a770ea..1032473b9b2 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir @@ -40,7 +40,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb0: { - _3 = PtrMetadata(_1); + _3 = PtrMetadata(copy _1); StorageLive(_4); _4 = const 0_usize; goto -> bb1; @@ -51,8 +51,8 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { StorageLive(_7); StorageLive(_6); StorageLive(_5); - _5 = _4; - _6 = Lt(move _5, _3); + _5 = copy _4; + _6 = Lt(move _5, copy _3); StorageDead(_5); switchInt(move _6) -> [0: bb2, otherwise: bb4]; } @@ -70,21 +70,21 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb4: { - _7 = _4; + _7 = copy _4; StorageLive(_8); - _8 = <usize as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb5, unwind: bb8]; + _8 = <usize as Step>::forward_unchecked(copy _7, const 1_usize) -> [return: bb5, unwind: bb8]; } bb5: { _4 = move _8; StorageDead(_8); - _9 = Option::<usize>::Some(_7); + _9 = Option::<usize>::Some(copy _7); StorageDead(_6); StorageDead(_7); - _10 = ((_9 as Some).0: usize); + _10 = copy ((_9 as Some).0: usize); _11 = Len((*_1)); - _12 = Lt(_10, _11); - assert(move _12, "index out of bounds: the length is {} but the index is {}", move _11, _10) -> [success: bb6, unwind: bb8]; + _12 = Lt(copy _10, copy _11); + assert(move _12, "index out of bounds: the length is {} but the index is {}", move _11, copy _10) -> [success: bb6, unwind: bb8]; } bb6: { @@ -92,7 +92,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { StorageLive(_14); _14 = &_2; StorageLive(_15); - _15 = (_10, _13); + _15 = (copy _10, copy _13); _16 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _14, move _15) -> [return: bb7, unwind: bb8]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir index fbb887fe76a..1b397a4e4cd 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir @@ -65,10 +65,10 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_6); StorageLive(_4); StorageLive(_5); - _3 = PtrMetadata(_1); + _3 = PtrMetadata(copy _1); _4 = &raw const (*_1); - _5 = _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: _5 }; + _5 = copy _4 as *const T (PtrToPtr); + _6 = NonNull::<T> { pointer: copy _5 }; StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; } @@ -76,8 +76,8 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb1: { StorageLive(_8); StorageLive(_7); - _7 = _4 as *mut T (PtrToPtr); - _8 = Offset(_7, _3); + _7 = copy _4 as *mut T (PtrToPtr); + _8 = Offset(copy _7, copy _3); StorageDead(_7); _9 = move _8 as *const T (PtrToPtr); StorageDead(_8); @@ -85,24 +85,24 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb2: { - _9 = _3 as *const T (Transmute); + _9 = copy _3 as *const T (Transmute); goto -> bb3; } bb3: { StorageLive(_10); - _10 = _9; - _11 = std::slice::Iter::<'_, T> { ptr: _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; + _10 = copy _9; + _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_10); StorageDead(_9); StorageDead(_5); StorageDead(_4); StorageDead(_6); StorageDead(_3); - _12 = Rev::<std::slice::Iter<'_, T>> { iter: _11 }; + _12 = Rev::<std::slice::Iter<'_, T>> { iter: copy _11 }; StorageDead(_11); StorageLive(_13); - _13 = _12; + _13 = copy _12; goto -> bb4; } @@ -130,11 +130,11 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _17 = ((_15 as Some).0: &T); + _17 = copy ((_15 as Some).0: &T); StorageLive(_18); _18 = &_2; StorageLive(_19); - _19 = (_17,); + _19 = (copy _17,); _20 = <impl Fn(&T) as Fn<(&T,)>>::call(move _18, move _19) -> [return: bb9, unwind unreachable]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir index db9409f72ab..77689dd9b51 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir @@ -65,10 +65,10 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_6); StorageLive(_4); StorageLive(_5); - _3 = PtrMetadata(_1); + _3 = PtrMetadata(copy _1); _4 = &raw const (*_1); - _5 = _4 as *const T (PtrToPtr); - _6 = NonNull::<T> { pointer: _5 }; + _5 = copy _4 as *const T (PtrToPtr); + _6 = NonNull::<T> { pointer: copy _5 }; StorageLive(_9); switchInt(const <T as std::mem::SizedTypeProperties>::IS_ZST) -> [0: bb1, otherwise: bb2]; } @@ -76,8 +76,8 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb1: { StorageLive(_8); StorageLive(_7); - _7 = _4 as *mut T (PtrToPtr); - _8 = Offset(_7, _3); + _7 = copy _4 as *mut T (PtrToPtr); + _8 = Offset(copy _7, copy _3); StorageDead(_7); _9 = move _8 as *const T (PtrToPtr); StorageDead(_8); @@ -85,24 +85,24 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb2: { - _9 = _3 as *const T (Transmute); + _9 = copy _3 as *const T (Transmute); goto -> bb3; } bb3: { StorageLive(_10); - _10 = _9; - _11 = std::slice::Iter::<'_, T> { ptr: _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; + _10 = copy _9; + _11 = std::slice::Iter::<'_, T> { ptr: copy _6, end_or_len: move _10, _marker: const ZeroSized: PhantomData<&T> }; StorageDead(_10); StorageDead(_9); StorageDead(_5); StorageDead(_4); StorageDead(_6); StorageDead(_3); - _12 = Rev::<std::slice::Iter<'_, T>> { iter: _11 }; + _12 = Rev::<std::slice::Iter<'_, T>> { iter: copy _11 }; StorageDead(_11); StorageLive(_13); - _13 = _12; + _13 = copy _12; goto -> bb4; } @@ -130,11 +130,11 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _17 = ((_15 as Some).0: &T); + _17 = copy ((_15 as Some).0: &T); StorageLive(_18); _18 = &_2; StorageLive(_19); - _19 = (_17,); + _19 = (copy _17,); _20 = <impl Fn(&T) as Fn<(&T,)>>::call(move _18, move _19) -> [return: bb9, unwind: bb11]; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir index 96e71c298e0..f8b0e749bfc 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-abort.mir @@ -43,27 +43,27 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { StorageLive(_3); StorageLive(_2); _2 = &raw const ((*_1).1: *const T); - _3 = _2 as *const std::ptr::NonNull<T> (PtrToPtr); + _3 = copy _2 as *const std::ptr::NonNull<T> (PtrToPtr); StorageDead(_2); - _4 = (*_3); + _4 = copy (*_3); StorageDead(_3); StorageLive(_6); StorageLive(_7); StorageLive(_5); - _5 = ((*_1).0: std::ptr::NonNull<T>); - _6 = (_5.0: *const T); + _5 = copy ((*_1).0: std::ptr::NonNull<T>); + _6 = copy (_5.0: *const T); StorageDead(_5); - _7 = (_4.0: *const T); - _0 = Eq(_6, _7); + _7 = copy (_4.0: *const T); + _0 = Eq(copy _6, copy _7); StorageDead(_7); StorageDead(_6); goto -> bb3; } bb2: { - _8 = ((*_1).1: *const T); - _9 = _8 as usize (Transmute); - _0 = Eq(_9, const 0_usize); + _8 = copy ((*_1).1: *const T); + _9 = copy _8 as usize (Transmute); + _0 = Eq(copy _9, const 0_usize); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir index 96e71c298e0..f8b0e749bfc 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.slice_iter_generic_is_empty.PreCodegen.after.panic-unwind.mir @@ -43,27 +43,27 @@ fn slice_iter_generic_is_empty(_1: &std::slice::Iter<'_, T>) -> bool { StorageLive(_3); StorageLive(_2); _2 = &raw const ((*_1).1: *const T); - _3 = _2 as *const std::ptr::NonNull<T> (PtrToPtr); + _3 = copy _2 as *const std::ptr::NonNull<T> (PtrToPtr); StorageDead(_2); - _4 = (*_3); + _4 = copy (*_3); StorageDead(_3); StorageLive(_6); StorageLive(_7); StorageLive(_5); - _5 = ((*_1).0: std::ptr::NonNull<T>); - _6 = (_5.0: *const T); + _5 = copy ((*_1).0: std::ptr::NonNull<T>); + _6 = copy (_5.0: *const T); StorageDead(_5); - _7 = (_4.0: *const T); - _0 = Eq(_6, _7); + _7 = copy (_4.0: *const T); + _0 = Eq(copy _6, copy _7); StorageDead(_7); StorageDead(_6); goto -> bb3; } bb2: { - _8 = ((*_1).1: *const T); - _9 = _8 as usize (Transmute); - _0 = Eq(_9, const 0_usize); + _8 = copy ((*_1).1: *const T); + _9 = copy _8 as usize (Transmute); + _0 = Eq(copy _9, const 0_usize); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir index c76e5315db9..fe4e2deab87 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir @@ -10,7 +10,7 @@ fn outer(_1: u8) -> u8 { bb0: { _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 - _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 + _0 = copy _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir index c76e5315db9..fe4e2deab87 100644 --- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir @@ -10,7 +10,7 @@ fn outer(_1: u8) -> u8 { bb0: { _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 - _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 + _0 = copy _1; // scope 1 at $DIR/spans.rs:15:5: 15:7 return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir index 16d6d9719b6..baa01e28a94 100644 --- a/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/try_identity.new.PreCodegen.after.mir @@ -30,18 +30,18 @@ fn new(_1: Result<T, E>) -> Result<T, E> { bb1: { _3 = move ((_1 as Ok).0: T); - _4 = ControlFlow::<E, T>::Continue(_3); + _4 = ControlFlow::<E, T>::Continue(copy _3); _5 = move ((_4 as Continue).0: T); - _0 = Result::<T, E>::Ok(_5); + _0 = Result::<T, E>::Ok(copy _5); StorageDead(_4); goto -> bb3; } bb2: { _6 = move ((_1 as Err).0: E); - _4 = ControlFlow::<E, T>::Break(_6); + _4 = ControlFlow::<E, T>::Break(copy _6); _7 = move ((_4 as Break).0: E); - _0 = Result::<T, E>::Err(_7); + _0 = Result::<T, E>::Err(copy _7); StorageDead(_4); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir index d6883ac9fda..ac485f485b1 100644 --- a/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/try_identity.old.PreCodegen.after.mir @@ -20,13 +20,13 @@ fn old(_1: Result<T, E>) -> Result<T, E> { bb1: { _3 = move ((_1 as Ok).0: T); - _0 = Result::<T, E>::Ok(_3); + _0 = Result::<T, E>::Ok(copy _3); goto -> bb3; } bb2: { _4 = move ((_1 as Err).0: E); - _0 = Result::<T, E>::Err(_4); + _0 = Result::<T, E>::Err(copy _4); goto -> bb3; } diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir index 0fe4fd37072..ce1e4a0abd6 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir @@ -78,17 +78,17 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { _3 = &(((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner); StorageLive(_6); StorageLive(_4); - _4 = (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); - _5 = (_4.0: *const u8); - _6 = NonNull::<u8> { pointer: _5 }; + _4 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); + _5 = copy (_4.0: *const u8); + _6 = NonNull::<u8> { pointer: copy _5 }; StorageDead(_4); StorageDead(_6); StorageDead(_3); StorageDead(_2); StorageLive(_7); - _7 = ((*_1).1: usize); + _7 = copy ((*_1).1: usize); StorageLive(_8); - _8 = *const [u8] from (_5, _7); + _8 = *const [u8] from (copy _5, copy _7); _0 = &(*_8); StorageDead(_8); StorageDead(_7); diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir index 0fe4fd37072..ce1e4a0abd6 100644 --- a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir @@ -78,17 +78,17 @@ fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { _3 = &(((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner); StorageLive(_6); StorageLive(_4); - _4 = (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); - _5 = (_4.0: *const u8); - _6 = NonNull::<u8> { pointer: _5 }; + _4 = copy (((((*_1).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>); + _5 = copy (_4.0: *const u8); + _6 = NonNull::<u8> { pointer: copy _5 }; StorageDead(_4); StorageDead(_6); StorageDead(_3); StorageDead(_2); StorageLive(_7); - _7 = ((*_1).1: usize); + _7 = copy ((*_1).1: usize); StorageLive(_8); - _8 = *const [u8] from (_5, _7); + _8 = *const [u8] from (copy _5, copy _7); _0 = &(*_8); StorageDead(_8); StorageDead(_7); diff --git a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff index 012efa9693e..4715f5110eb 100644 --- a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff @@ -21,15 +21,15 @@ } bb2: { - _5 = (*_2); - _0 = opaque::<i32>(_5) -> [return: bb3, unwind continue]; + _5 = copy (*_2); + _0 = opaque::<i32>(copy _5) -> [return: bb3, unwind continue]; } bb3: { StorageDead(_1); StorageLive(_1); _6 = const true; - switchInt(_6) -> [0: bb3, otherwise: bb1]; + switchInt(copy _6) -> [0: bb3, otherwise: bb1]; } } diff --git a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff index c6bd6c21210..b1de380d84d 100644 --- a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff @@ -19,25 +19,25 @@ _4 = &_2; _5 = &mut _3; (*_5) = const 7_i32; -- _6 = (*_4); -+ _6 = _2; - switchInt(_1) -> [1: bb1, otherwise: bb2]; +- _6 = copy (*_4); ++ _6 = copy _2; + switchInt(copy _1) -> [1: bb1, otherwise: bb2]; } bb1: { StorageDead(_2); StorageDead(_3); - _0 = opaque::<i32>(_6) -> [return: bb2, unwind continue]; + _0 = opaque::<i32>(copy _6) -> [return: bb2, unwind continue]; } bb2: { - _7 = (*_4); - _0 = opaque::<i32>(_7) -> [return: bb3, unwind continue]; + _7 = copy (*_4); + _0 = opaque::<i32>(copy _7) -> [return: bb3, unwind continue]; } bb3: { - _8 = (*_5); - _0 = opaque::<i32>(_8) -> [return: bb4, unwind continue]; + _8 = copy (*_5); + _0 = opaque::<i32>(copy _8) -> [return: bb4, unwind continue]; } bb4: { diff --git a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff index 0fd74155aa3..2368edea5ba 100644 --- a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff @@ -13,8 +13,8 @@ _2 = &_1; StorageDead(_1); StorageLive(_1); - _3 = (*_2); - _0 = opaque::<i32>(_3) -> [return: bb1, unwind continue]; + _3 = copy (*_2); + _0 = opaque::<i32>(copy _3) -> [return: bb1, unwind continue]; } bb1: { diff --git a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff index 859097d3966..90fd91764cb 100644 --- a/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.mut_raw_then_mut_shr.ReferencePropagation.diff @@ -41,23 +41,23 @@ - StorageLive(_5); - _5 = &mut (*_2); - _4 = &raw mut (*_5); -- _3 = _4; +- _3 = copy _4; - StorageDead(_5); - StorageDead(_4); - StorageLive(_6); - _6 = &(*_2); StorageLive(_7); -- _7 = (*_6); +- _7 = copy (*_6); - StorageLive(_8); - (*_3) = const 4_i32; - _8 = const (); - StorageDead(_8); -+ _7 = _1; ++ _7 = copy _1; + _1 = const 4_i32; StorageLive(_9); - _9 = _7; + _9 = copy _7; StorageLive(_10); - _10 = _1; + _10 = copy _1; _0 = (move _9, move _10); StorageDead(_10); StorageDead(_9); diff --git a/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff b/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff index 371b0e468b1..064711925e0 100644 --- a/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff @@ -13,10 +13,10 @@ - _3 = &mut (*_2); - _4 = &raw mut (*_2); - _5 = &raw mut (*_3); -- _0 = (*_4); -- _0 = (*_5); -+ _0 = (*_1); -+ _0 = (*_1); +- _0 = copy (*_4); +- _0 = copy (*_5); ++ _0 = copy (*_1); ++ _0 = copy (*_1); return; } } diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff index 0dfe8781c18..3c6a9a9614c 100644 --- a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff @@ -191,8 +191,8 @@ StorageLive(_5); _5 = &_4; StorageLive(_6); -- _6 = (*_5); -+ _6 = _4; +- _6 = copy (*_5); ++ _6 = copy _4; StorageLive(_7); StorageLive(_8); _8 = (); @@ -223,7 +223,7 @@ StorageDead(_13); - StorageDead(_14); StorageLive(_15); - _15 = (*_12); + _15 = copy (*_12); StorageLive(_16); StorageLive(_17); _17 = (); @@ -247,11 +247,11 @@ StorageLive(_21); _21 = &_20; StorageLive(_22); -- _22 = (*_20); -+ _22 = _19; +- _22 = copy (*_20); ++ _22 = copy _19; StorageLive(_23); StorageLive(_24); - _24 = _21; + _24 = copy _21; _23 = opaque::<&&usize>(move _24) -> [return: bb3, unwind continue]; } @@ -272,10 +272,10 @@ StorageLive(_28); _28 = &raw mut _27; StorageLive(_29); - _29 = (*_27); + _29 = copy (*_27); StorageLive(_30); StorageLive(_31); - _31 = _28; + _31 = copy _28; _30 = opaque::<*mut &usize>(move _31) -> [return: bb4, unwind continue]; } @@ -294,11 +294,11 @@ StorageLive(_34); _34 = &_33; StorageLive(_35); -- _35 = (*_34); -+ _35 = _33; +- _35 = copy (*_34); ++ _35 = copy _33; StorageLive(_36); StorageLive(_37); - _37 = _34; + _37 = copy _34; _36 = opaque::<&usize>(move _37) -> [return: bb5, unwind continue]; } @@ -316,18 +316,18 @@ StorageLive(_40); _40 = &_39; StorageLive(_41); -- _41 = (*_40); -+ _41 = _39; +- _41 = copy (*_40); ++ _41 = copy _39; StorageLive(_42); - _42 = _40; + _42 = copy _40; StorageLive(_43); -- _43 = (*_42); -+ _43 = _39; +- _43 = copy (*_42); ++ _43 = copy _39; StorageLive(_44); - _44 = _42; + _44 = copy _42; StorageLive(_45); StorageLive(_46); - _46 = _44; + _46 = copy _44; _45 = opaque::<&usize>(move _46) -> [return: bb6, unwind continue]; } @@ -346,8 +346,8 @@ - StorageLive(_48); - _48 = &(*_1); StorageLive(_49); -- _49 = (*_48); -+ _49 = (*_1); +- _49 = copy (*_48); ++ _49 = copy (*_1); StorageLive(_50); StorageLive(_51); _51 = (); @@ -373,7 +373,7 @@ StorageDead(_54); - StorageDead(_55); StorageLive(_56); - _56 = (*_53); + _56 = copy (*_53); StorageLive(_57); StorageLive(_58); _58 = (); @@ -395,8 +395,8 @@ StorageLive(_62); _62 = &_61; StorageLive(_63); -- _63 = (*_61); -+ _63 = _60; +- _63 = copy (*_61); ++ _63 = copy _60; StorageLive(_64); StorageLive(_65); _65 = (); @@ -419,7 +419,7 @@ StorageLive(_68); _68 = &mut _67; StorageLive(_69); - _69 = (*_67); + _69 = copy (*_67); StorageLive(_70); StorageLive(_71); _71 = (); diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff index 21486a8616a..75fe99de938 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff @@ -208,8 +208,8 @@ StorageLive(_5); _5 = &raw const _4; StorageLive(_6); -- _6 = (*_5); -+ _6 = _4; +- _6 = copy (*_5); ++ _6 = copy _4; StorageLive(_7); StorageLive(_8); _8 = (); @@ -236,7 +236,7 @@ _12 = move _13; StorageDead(_13); StorageLive(_14); - _14 = (*_12); + _14 = copy (*_12); StorageLive(_15); StorageLive(_16); _16 = (); @@ -260,11 +260,11 @@ StorageLive(_20); _20 = &_19; StorageLive(_21); -- _21 = (*_19); -+ _21 = _18; +- _21 = copy (*_19); ++ _21 = copy _18; StorageLive(_22); StorageLive(_23); - _23 = _20; + _23 = copy _20; _22 = opaque::<&*const usize>(move _23) -> [return: bb3, unwind continue]; } @@ -285,10 +285,10 @@ StorageLive(_27); _27 = &raw mut _26; StorageLive(_28); - _28 = (*_26); + _28 = copy (*_26); StorageLive(_29); StorageLive(_30); - _30 = _27; + _30 = copy _27; _29 = opaque::<*mut *const usize>(move _30) -> [return: bb4, unwind continue]; } @@ -307,11 +307,11 @@ StorageLive(_33); _33 = &raw const _32; StorageLive(_34); -- _34 = (*_33); -+ _34 = _32; +- _34 = copy (*_33); ++ _34 = copy _32; StorageLive(_35); StorageLive(_36); - _36 = _33; + _36 = copy _33; _35 = opaque::<*const usize>(move _36) -> [return: bb5, unwind continue]; } @@ -329,18 +329,18 @@ StorageLive(_39); _39 = &raw const _38; StorageLive(_40); -- _40 = (*_39); -+ _40 = _38; +- _40 = copy (*_39); ++ _40 = copy _38; StorageLive(_41); - _41 = _39; + _41 = copy _39; StorageLive(_42); -- _42 = (*_41); -+ _42 = _38; +- _42 = copy (*_41); ++ _42 = copy _38; StorageLive(_43); - _43 = _41; + _43 = copy _41; StorageLive(_44); StorageLive(_45); - _45 = _43; + _45 = copy _43; _44 = opaque::<*const usize>(move _45) -> [return: bb6, unwind continue]; } @@ -359,8 +359,8 @@ - StorageLive(_47); - _47 = &raw const (*_1); StorageLive(_48); -- _48 = (*_47); -+ _48 = (*_1); +- _48 = copy (*_47); ++ _48 = copy (*_1); StorageLive(_49); StorageLive(_50); _50 = (); @@ -382,7 +382,7 @@ _2 = move _53; StorageDead(_53); StorageLive(_54); - _54 = (*_52); + _54 = copy (*_52); StorageLive(_55); StorageLive(_56); _56 = (); @@ -405,8 +405,8 @@ - _60 = &raw const (*_59); + _60 = &raw const _58; StorageLive(_61); -- _61 = (*_60); -+ _61 = _58; +- _61 = copy (*_60); ++ _61 = copy _58; StorageLive(_62); StorageLive(_63); _63 = (); @@ -430,8 +430,8 @@ StorageLive(_67); _67 = &_66; StorageLive(_68); -- _68 = (*_66); -+ _68 = _65; +- _68 = copy (*_66); ++ _68 = copy _65; StorageLive(_69); StorageLive(_70); _70 = (); @@ -454,7 +454,7 @@ StorageLive(_73); _73 = &mut _72; StorageLive(_74); - _74 = (*_72); + _74 = copy (*_72); StorageLive(_75); StorageLive(_76); _76 = (); diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff index 7c7f424bba2..f35b4974d6e 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff @@ -191,8 +191,8 @@ StorageLive(_5); _5 = &mut _4; StorageLive(_6); -- _6 = (*_5); -+ _6 = _4; +- _6 = copy (*_5); ++ _6 = copy _4; StorageLive(_7); StorageLive(_8); _8 = (); @@ -223,7 +223,7 @@ StorageDead(_13); - StorageDead(_14); StorageLive(_15); - _15 = (*_12); + _15 = copy (*_12); StorageLive(_16); StorageLive(_17); _17 = (); @@ -247,10 +247,10 @@ StorageLive(_21); _21 = &_20; StorageLive(_22); - _22 = (*_20); + _22 = copy (*_20); StorageLive(_23); StorageLive(_24); - _24 = _21; + _24 = copy _21; _23 = opaque::<&&mut usize>(move _24) -> [return: bb3, unwind continue]; } @@ -271,10 +271,10 @@ StorageLive(_28); _28 = &raw mut _27; StorageLive(_29); - _29 = (*_27); + _29 = copy (*_27); StorageLive(_30); StorageLive(_31); - _31 = _28; + _31 = copy _28; _30 = opaque::<*mut &mut usize>(move _31) -> [return: bb4, unwind continue]; } @@ -293,7 +293,7 @@ StorageLive(_34); _34 = &mut _33; StorageLive(_35); - _35 = (*_34); + _35 = copy (*_34); StorageLive(_36); StorageLive(_37); _37 = move _34; @@ -314,11 +314,11 @@ StorageLive(_40); _40 = &mut _39; StorageLive(_41); - _41 = (*_40); + _41 = copy (*_40); StorageLive(_42); _42 = move _40; StorageLive(_43); - _43 = (*_42); + _43 = copy (*_42); StorageLive(_44); _44 = move _42; StorageLive(_45); @@ -342,8 +342,8 @@ - StorageLive(_48); - _48 = &mut (*_1); StorageLive(_49); -- _49 = (*_48); -+ _49 = (*_1); +- _49 = copy (*_48); ++ _49 = copy (*_1); StorageLive(_50); StorageLive(_51); _51 = (); @@ -369,7 +369,7 @@ StorageDead(_54); - StorageDead(_55); StorageLive(_56); - _56 = (*_53); + _56 = copy (*_53); StorageLive(_57); StorageLive(_58); _58 = (); @@ -391,7 +391,7 @@ StorageLive(_62); _62 = &_61; StorageLive(_63); - _63 = (*_61); + _63 = copy (*_61); StorageLive(_64); StorageLive(_65); _65 = (); @@ -414,7 +414,7 @@ StorageLive(_68); _68 = &mut _67; StorageLive(_69); - _69 = (*_67); + _69 = copy (*_67); StorageLive(_70); StorageLive(_71); _71 = (); diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff index 5629d04f1b1..21b322b7218 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff @@ -189,8 +189,8 @@ StorageLive(_5); _5 = &raw mut _4; StorageLive(_6); -- _6 = (*_5); -+ _6 = _4; +- _6 = copy (*_5); ++ _6 = copy _4; StorageLive(_7); StorageLive(_8); _8 = (); @@ -217,7 +217,7 @@ _12 = move _13; StorageDead(_13); StorageLive(_14); - _14 = (*_12); + _14 = copy (*_12); StorageLive(_15); StorageLive(_16); _16 = (); @@ -241,10 +241,10 @@ StorageLive(_20); _20 = &_19; StorageLive(_21); - _21 = (*_19); + _21 = copy (*_19); StorageLive(_22); StorageLive(_23); - _23 = _20; + _23 = copy _20; _22 = opaque::<&*mut usize>(move _23) -> [return: bb3, unwind continue]; } @@ -265,10 +265,10 @@ StorageLive(_27); _27 = &raw mut _26; StorageLive(_28); - _28 = (*_26); + _28 = copy (*_26); StorageLive(_29); StorageLive(_30); - _30 = _27; + _30 = copy _27; _29 = opaque::<*mut *mut usize>(move _30) -> [return: bb4, unwind continue]; } @@ -287,10 +287,10 @@ StorageLive(_33); _33 = &raw mut _32; StorageLive(_34); - _34 = (*_33); + _34 = copy (*_33); StorageLive(_35); StorageLive(_36); - _36 = _33; + _36 = copy _33; _35 = opaque::<*mut usize>(move _36) -> [return: bb5, unwind continue]; } @@ -308,16 +308,16 @@ StorageLive(_39); _39 = &raw mut _38; StorageLive(_40); - _40 = (*_39); + _40 = copy (*_39); StorageLive(_41); - _41 = _39; + _41 = copy _39; StorageLive(_42); - _42 = (*_41); + _42 = copy (*_41); StorageLive(_43); - _43 = _41; + _43 = copy _41; StorageLive(_44); StorageLive(_45); - _45 = _43; + _45 = copy _43; _44 = opaque::<*mut usize>(move _45) -> [return: bb6, unwind continue]; } @@ -336,8 +336,8 @@ - StorageLive(_47); - _47 = &raw mut (*_1); StorageLive(_48); -- _48 = (*_47); -+ _48 = (*_1); +- _48 = copy (*_47); ++ _48 = copy (*_1); StorageLive(_49); StorageLive(_50); _50 = (); @@ -359,7 +359,7 @@ _2 = move _53; StorageDead(_53); StorageLive(_54); - _54 = (*_52); + _54 = copy (*_52); StorageLive(_55); StorageLive(_56); _56 = (); @@ -381,7 +381,7 @@ StorageLive(_60); _60 = &_59; StorageLive(_61); - _61 = (*_59); + _61 = copy (*_59); StorageLive(_62); StorageLive(_63); _63 = (); @@ -404,7 +404,7 @@ StorageLive(_66); _66 = &mut _65; StorageLive(_67); - _67 = (*_65); + _67 = copy (*_65); StorageLive(_68); StorageLive(_69); _69 = (); diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs index 58d8b524ad6..00d48938071 100644 --- a/tests/mir-opt/reference_prop.rs +++ b/tests/mir-opt/reference_prop.rs @@ -2,7 +2,6 @@ //@ test-mir-pass: ReferencePropagation //@ needs-unwind -#![feature(raw_ref_op)] #![feature(core_intrinsics, custom_mir)] #[inline(never)] @@ -16,7 +15,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &[[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &a; // This borrow is only used once. @@ -32,7 +31,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[btmp:_.*]] = &[[a2]]; // CHECK: [[b]] = move [[btmp]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let a2 = 7_usize; @@ -49,7 +48,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &a; @@ -64,7 +63,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[d:_.*]] = &raw mut [[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let mut b = &a; @@ -78,7 +77,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: bb4: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &[[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 7_usize; let b = &a; @@ -91,10 +90,10 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: bb5: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b1:_.*]] = &[[a]]; - // CHECK: [[c:_.*]] = [[a]]; - // CHECK: [[b2:_.*]] = [[b1]]; - // CHECK: [[c2:_.*]] = [[a]]; - // CHECK: [[b3:_.*]] = [[b2]]; + // CHECK: [[c:_.*]] = copy [[a]]; + // CHECK: [[b2:_.*]] = copy [[b1]]; + // CHECK: [[c2:_.*]] = copy [[a]]; + // CHECK: [[b3:_.*]] = copy [[b2]]; let a = 7_usize; let b1 = &a; @@ -111,7 +110,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { { // CHECK: bb6: { // CHECK-NOT: {{_.*}} = &(*_1); - // CHECK: [[b:_.*]] = (*_1); + // CHECK: [[b:_.*]] = copy (*_1); let a = &*single; let b = *a; // This should be optimized as `*single`. @@ -124,7 +123,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[a:_.*]] = &(*_2); // CHECK: [[tmp:_.*]] = &(*_1); // CHECK: _2 = move [[tmp]]; - // CHECK: [[b:_.*]] = (*[[a]]); + // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &*multiple; multiple = &*single; @@ -138,7 +137,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &a; @@ -154,7 +153,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[d:_.*]] = &mut [[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let mut b = &a; @@ -172,7 +171,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &mut [[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let mut a = 5_usize; let b = &mut a; // This borrow is only used once. @@ -188,7 +187,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[b:_.*]] = &mut [[a]]; // CHECK: [[btmp:_.*]] = &mut [[a2]]; // CHECK: [[b]] = move [[btmp]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut a2 = 7_usize; @@ -205,7 +204,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &mut [[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let b = &mut a; @@ -220,7 +219,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &mut [[a]]; // CHECK: [[d:_.*]] = &raw mut [[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut b = &mut a; @@ -234,7 +233,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: bb4: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &mut [[a]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 7_usize; let b = &mut a; @@ -247,9 +246,9 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: bb5: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b1:_.*]] = &mut [[a]]; - // CHECK: [[c:_.*]] = (*[[b1]]); + // CHECK: [[c:_.*]] = copy (*[[b1]]); // CHECK: [[b2:_.*]] = move [[b1]]; - // CHECK: [[c2:_.*]] = (*[[b2]]); + // CHECK: [[c2:_.*]] = copy (*[[b2]]); // CHECK: [[b3:_.*]] = move [[b2]]; let mut a = 7_usize; @@ -267,7 +266,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m { // CHECK: bb6: { // CHECK-NOT: {{_.*}} = &(*_1); - // CHECK: [[b:_.*]] = (*_1); + // CHECK: [[b:_.*]] = copy (*_1); let a = &mut *single; let b = *a; // This should be optimized as `*single`. @@ -280,7 +279,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[a:_.*]] = &mut (*_2); // CHECK: [[tmp:_.*]] = &mut (*_1); // CHECK: _2 = move [[tmp]]; - // CHECK: [[b:_.*]] = (*[[a]]); + // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &mut *multiple; multiple = &mut *single; @@ -295,7 +294,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[b:_.*]] = &mut [[a]]; // CHECK: [[d:_.*]] = &[[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let b = &mut a; @@ -311,7 +310,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[b:_.*]] = &mut [[a]]; // CHECK: [[d:_.*]] = &mut [[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut b = &mut a; @@ -329,7 +328,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &raw const a; // This borrow is only used once. @@ -345,7 +344,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[btmp:_.*]] = &raw const [[a2]]; // CHECK: [[b]] = move [[btmp]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let a2 = 7_usize; @@ -362,7 +361,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &raw const a; @@ -377,7 +376,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[d:_.*]] = &raw mut [[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let mut b = &raw const a; @@ -391,7 +390,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: bb4: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 7_usize; let b = &raw const a; @@ -404,10 +403,10 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: bb5: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b1:_.*]] = &raw const [[a]]; - // CHECK: [[c:_.*]] = [[a]]; - // CHECK: [[b2:_.*]] = [[b1]]; - // CHECK: [[c2:_.*]] = [[a]]; - // CHECK: [[b3:_.*]] = [[b2]]; + // CHECK: [[c:_.*]] = copy [[a]]; + // CHECK: [[b2:_.*]] = copy [[b1]]; + // CHECK: [[c2:_.*]] = copy [[a]]; + // CHECK: [[b3:_.*]] = copy [[b2]]; let a = 7_usize; let b1 = &raw const a; @@ -424,7 +423,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con unsafe { // CHECK: bb6: { // CHECK-NOT: {{_.*}} = &(*_1); - // CHECK: [[b:_.*]] = (*_1); + // CHECK: [[b:_.*]] = copy (*_1); let a = &raw const *single; let b = *a; // This should be optimized as `*single`. @@ -437,7 +436,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: [[a:_.*]] = &raw const (*_2); // CHECK: [[tmp:_.*]] = &raw const (*_1); // CHECK: _2 = move [[tmp]]; - // CHECK: [[b:_.*]] = (*[[a]]); + // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &raw const *multiple; multiple = &raw const *single; @@ -451,7 +450,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: [[a:_.*]] = const 13_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[d:_.*]] = &raw const [[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 13_usize; let b = &raw const a; @@ -466,7 +465,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &raw const a; @@ -482,7 +481,7 @@ fn reference_propagation_const_ptr<T: Copy>(single: *const T, mut multiple: *con // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[d:_.*]] = &mut [[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let mut b = &raw const a; @@ -500,7 +499,7 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw mut [[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let mut a = 5_usize; let b = &raw mut a; // This borrow is only used once. @@ -516,7 +515,7 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) // CHECK: [[b:_.*]] = &raw mut [[a]]; // CHECK: [[btmp:_.*]] = &raw mut [[a2]]; // CHECK: [[b]] = move [[btmp]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut a2 = 7_usize; @@ -533,7 +532,7 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw mut [[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let b = &raw mut a; @@ -548,7 +547,7 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw mut [[a]]; // CHECK: [[d:_.*]] = &raw mut [[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut b = &raw mut a; @@ -562,7 +561,7 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) // CHECK: bb4: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &raw mut [[a]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 7_usize; let b = &raw mut a; @@ -575,10 +574,10 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) // CHECK: bb5: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b1:_.*]] = &raw mut [[a]]; - // CHECK: [[c:_.*]] = (*[[b1]]); - // CHECK: [[b2:_.*]] = [[b1]]; - // CHECK: [[c2:_.*]] = (*[[b2]]); - // CHECK: [[b3:_.*]] = [[b2]]; + // CHECK: [[c:_.*]] = copy (*[[b1]]); + // CHECK: [[b2:_.*]] = copy [[b1]]; + // CHECK: [[c2:_.*]] = copy (*[[b2]]); + // CHECK: [[b3:_.*]] = copy [[b2]]; let mut a = 7_usize; let b1 = &raw mut a; @@ -595,7 +594,7 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) unsafe { // CHECK: bb6: { // CHECK-NOT: {{_.*}} = &(*_1); - // CHECK: [[b:_.*]] = (*_1); + // CHECK: [[b:_.*]] = copy (*_1); let a = &raw mut *single; let b = *a; // This should be optimized as `*single`. @@ -608,7 +607,7 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) // CHECK: [[a:_.*]] = &raw mut (*_2); // CHECK: [[tmp:_.*]] = &raw mut (*_1); // CHECK: _2 = move [[tmp]]; - // CHECK: [[b:_.*]] = (*[[a]]); + // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &raw mut *multiple; multiple = &raw mut *single; @@ -623,7 +622,7 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) // CHECK: [[b:_.*]] = &raw mut [[a]]; // CHECK: [[d:_.*]] = &[[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let b = &raw mut a; @@ -639,7 +638,7 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) // CHECK: [[b:_.*]] = &raw mut [[a]]; // CHECK: [[d:_.*]] = &mut [[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut b = &raw mut a; @@ -653,8 +652,8 @@ fn reference_propagation_mut_ptr<T: Copy>(single: *mut T, mut multiple: *mut T) fn read_through_raw(x: &mut usize) -> usize { // CHECK-LABEL: read_through_raw // CHECK: bb0: { - // CHECK-NEXT: _0 = (*_1); - // CHECK-NEXT: _0 = (*_1); + // CHECK-NEXT: _0 = copy (*_1); + // CHECK-NEXT: _0 = copy (*_1); // CHECK-NEXT: return; use std::intrinsics::mir::*; @@ -680,7 +679,7 @@ fn read_through_raw(x: &mut usize) -> usize { #[custom_mir(dialect = "runtime", phase = "post-cleanup")] fn multiple_storage() { // CHECK-LABEL: multiple_storage - // CHECK: _3 = (*_2); + // CHECK: _3 = copy (*_2); use std::intrinsics::mir::*; mir! { @@ -706,7 +705,7 @@ fn multiple_storage() { #[custom_mir(dialect = "runtime", phase = "post-cleanup")] fn dominate_storage() { // CHECK-LABEL: dominate_storage - // CHECK: _5 = (*_2); + // CHECK: _5 = copy (*_2); use std::intrinsics::mir::*; mir! { @@ -798,12 +797,12 @@ fn unique_with_copies() { // CHECK: [[a:_.*]] = const 0_i32; // CHECK: [[x:_.*]] = &raw mut [[a]]; // CHECK-NOT: [[a]] - // CHECK: [[tmp:_.*]] = (*[[x]]); + // CHECK: [[tmp:_.*]] = copy (*[[x]]); // CHECK-NEXT: opaque::<i32>(move [[tmp]]) // CHECK-NOT: [[a]] // CHECK: StorageDead([[a]]); // CHECK-NOT: [[a]] - // CHECK: [[tmp:_.*]] = (*[[x]]); + // CHECK: [[tmp:_.*]] = copy (*[[x]]); // CHECK-NEXT: opaque::<i32>(move [[tmp]]) let y = { diff --git a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff index a5427cea1f8..d2ba9db2b89 100644 --- a/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.unique_with_copies.ReferencePropagation.diff @@ -29,20 +29,20 @@ _3 = &raw mut _2; StorageLive(_4); StorageLive(_5); - _5 = (*_3); + _5 = copy (*_3); _4 = opaque::<i32>(move _5) -> [return: bb1, unwind continue]; } bb1: { StorageDead(_5); StorageDead(_4); -- _1 = _3; +- _1 = copy _3; - StorageDead(_3); StorageDead(_2); StorageLive(_6); StorageLive(_7); -- _7 = (*_1); -+ _7 = (*_3); +- _7 = copy (*_1); ++ _7 = copy (*_3); _6 = opaque::<i32>(move _7) -> [return: bb2, unwind continue]; } diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff index d76d65a18a7..8c6c5e0d993 100644 --- a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff +++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-abort.diff @@ -24,7 +24,7 @@ } bb2: { - switchInt((*(*((_1 as Some).0: &&i32)))) -> [0: bb3, otherwise: bb1]; + switchInt(copy (*(*((_1 as Some).0: &&i32)))) -> [0: bb3, otherwise: bb1]; } bb3: { @@ -42,7 +42,7 @@ + nop; + nop; StorageLive(_8); - _8 = _2; + _8 = copy _2; switchInt(move _8) -> [0: bb6, otherwise: bb5]; } diff --git a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff index d76d65a18a7..8c6c5e0d993 100644 --- a/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff +++ b/tests/mir-opt/remove_fake_borrows.match_guard.CleanupPostBorrowck.panic-unwind.diff @@ -24,7 +24,7 @@ } bb2: { - switchInt((*(*((_1 as Some).0: &&i32)))) -> [0: bb3, otherwise: bb1]; + switchInt(copy (*(*((_1 as Some).0: &&i32)))) -> [0: bb3, otherwise: bb1]; } bb3: { @@ -42,7 +42,7 @@ + nop; + nop; StorageLive(_8); - _8 = _2; + _8 = copy _2; switchInt(move _8) -> [0: bb6, otherwise: bb5]; } diff --git a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff index 14762b9c40f..38cdbf5684b 100644 --- a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff +++ b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-abort.diff @@ -64,10 +64,10 @@ bb5: { - StorageLive(_12); - _12 = ((_7 as Some).0: i32); + _12 = copy ((_7 as Some).0: i32); - StorageLive(_13); - _13 = _12; - _1 = Add(_1, move _13); + _13 = copy _12; + _1 = Add(copy _1, move _13); - StorageDead(_13); _6 = const (); - StorageDead(_12); diff --git a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff index 24797424b5c..2b5aaa95fe1 100644 --- a/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff +++ b/tests/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.panic-unwind.diff @@ -64,10 +64,10 @@ bb5: { - StorageLive(_12); - _12 = ((_7 as Some).0: i32); + _12 = copy ((_7 as Some).0: i32); - StorageLive(_13); - _13 = _12; - _1 = Add(_1, move _13); + _13 = copy _12; + _1 = Add(copy _1, move _13); - StorageDead(_13); _6 = const (); - StorageDead(_12); diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff index 5afeb8620a1..01eb6d4901f 100644 --- a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff +++ b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-abort.diff @@ -12,7 +12,7 @@ bb0: { - nop; StorageLive(_3); - _3 = _1; + _3 = copy _1; - drop(_3) -> [return: bb1, unwind unreachable]; - } - diff --git a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff index b9919ddea56..c2c3cb76e83 100644 --- a/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff +++ b/tests/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.panic-unwind.diff @@ -12,7 +12,7 @@ bb0: { - nop; StorageLive(_3); - _3 = _1; + _3 = copy _1; - drop(_3) -> [return: bb1, unwind continue]; - } - diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff index b89432dd6d6..a82ede6196e 100644 --- a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff +++ b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-abort.diff @@ -12,7 +12,7 @@ bb0: { - nop; StorageLive(_3); - _3 = _1; + _3 = copy _1; - drop(_3) -> [return: bb1, unwind unreachable]; - } - diff --git a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff index 48d02605332..6e7c9ead740 100644 --- a/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff +++ b/tests/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.panic-unwind.diff @@ -12,7 +12,7 @@ bb0: { - nop; StorageLive(_3); - _3 = _1; + _3 = copy _1; - drop(_3) -> [return: bb1, unwind continue]; - } - diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-abort.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-abort.mir index 6dba667dd15..ae7b2cc0b6f 100644 --- a/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-abort.mir +++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-abort.mir @@ -70,7 +70,7 @@ fn array_casts() -> () { StorageLive(_5); StorageLive(_6); StorageLive(_7); - _7 = _2; + _7 = copy _2; _6 = std::ptr::mut_ptr::<impl *mut usize>::add(move _7, const 1_usize) -> [return: bb1, unwind unreachable]; } @@ -96,13 +96,13 @@ fn array_casts() -> () { StorageLive(_15); StorageLive(_16); StorageLive(_17); - _17 = _9; + _17 = copy _9; _16 = std::ptr::const_ptr::<impl *const usize>::add(move _17, const 1_usize) -> [return: bb2, unwind unreachable]; } bb2: { StorageDead(_17); - _15 = (*_16); + _15 = copy (*_16); _14 = &_15; StorageLive(_18); _34 = const array_casts::promoted[0]; @@ -113,16 +113,16 @@ fn array_casts() -> () { StorageDead(_18); StorageDead(_14); StorageLive(_20); - _20 = (_13.0: &usize); + _20 = copy (_13.0: &usize); Retag(_20); StorageLive(_21); - _21 = (_13.1: &usize); + _21 = copy (_13.1: &usize); Retag(_21); StorageLive(_22); StorageLive(_23); - _23 = (*_20); + _23 = copy (*_20); StorageLive(_24); - _24 = (*_21); + _24 = copy (*_21); _22 = Eq(move _23, move _24); switchInt(move _22) -> [0: bb4, otherwise: bb3]; } diff --git a/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-unwind.mir b/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-unwind.mir index fa812002e26..789bc342638 100644 --- a/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-unwind.mir +++ b/tests/mir-opt/retag.array_casts.SimplifyCfg-pre-optimizations.after.panic-unwind.mir @@ -70,7 +70,7 @@ fn array_casts() -> () { StorageLive(_5); StorageLive(_6); StorageLive(_7); - _7 = _2; + _7 = copy _2; _6 = std::ptr::mut_ptr::<impl *mut usize>::add(move _7, const 1_usize) -> [return: bb1, unwind continue]; } @@ -96,13 +96,13 @@ fn array_casts() -> () { StorageLive(_15); StorageLive(_16); StorageLive(_17); - _17 = _9; + _17 = copy _9; _16 = std::ptr::const_ptr::<impl *const usize>::add(move _17, const 1_usize) -> [return: bb2, unwind continue]; } bb2: { StorageDead(_17); - _15 = (*_16); + _15 = copy (*_16); _14 = &_15; StorageLive(_18); _34 = const array_casts::promoted[0]; @@ -113,16 +113,16 @@ fn array_casts() -> () { StorageDead(_18); StorageDead(_14); StorageLive(_20); - _20 = (_13.0: &usize); + _20 = copy (_13.0: &usize); Retag(_20); StorageLive(_21); - _21 = (_13.1: &usize); + _21 = copy (_13.1: &usize); Retag(_21); StorageLive(_22); StorageLive(_23); - _23 = (*_20); + _23 = copy (*_20); StorageLive(_24); - _24 = (*_21); + _24 = copy (*_21); _22 = Eq(move _23, move _24); switchInt(move _22) -> [0: bb4, otherwise: bb3]; } diff --git a/tests/mir-opt/retag.box_to_raw_mut.SimplifyCfg-pre-optimizations.after.panic-abort.mir b/tests/mir-opt/retag.box_to_raw_mut.SimplifyCfg-pre-optimizations.after.panic-abort.mir index 0e568f6a568..ca02e7b49cc 100644 --- a/tests/mir-opt/retag.box_to_raw_mut.SimplifyCfg-pre-optimizations.after.panic-abort.mir +++ b/tests/mir-opt/retag.box_to_raw_mut.SimplifyCfg-pre-optimizations.after.panic-abort.mir @@ -9,7 +9,7 @@ fn box_to_raw_mut(_1: &mut Box<i32>) -> *mut i32 { bb0: { Retag([fn entry] _1); _2 = deref_copy (*_1); - _3 = (((_2.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); + _3 = copy (((_2.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); _0 = &raw mut (*_3); Retag([raw] _0); return; diff --git a/tests/mir-opt/retag.box_to_raw_mut.SimplifyCfg-pre-optimizations.after.panic-unwind.mir b/tests/mir-opt/retag.box_to_raw_mut.SimplifyCfg-pre-optimizations.after.panic-unwind.mir index 0e568f6a568..ca02e7b49cc 100644 --- a/tests/mir-opt/retag.box_to_raw_mut.SimplifyCfg-pre-optimizations.after.panic-unwind.mir +++ b/tests/mir-opt/retag.box_to_raw_mut.SimplifyCfg-pre-optimizations.after.panic-unwind.mir @@ -9,7 +9,7 @@ fn box_to_raw_mut(_1: &mut Box<i32>) -> *mut i32 { bb0: { Retag([fn entry] _1); _2 = deref_copy (*_1); - _3 = (((_2.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); + _3 = copy (((_2.0: std::ptr::Unique<i32>).0: std::ptr::NonNull<i32>).0: *const i32); _0 = &raw mut (*_3); Retag([raw] _0); return; diff --git a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-pre-optimizations.after.panic-abort.mir b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-pre-optimizations.after.panic-abort.mir index 2620929e896..63b32ceb5c0 100644 --- a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-pre-optimizations.after.panic-abort.mir +++ b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-pre-optimizations.after.panic-abort.mir @@ -12,7 +12,7 @@ fn main::{closure#0}(_1: &{closure@main::{closure#0}}, _2: &i32) -> &i32 { Retag([fn entry] _1); Retag([fn entry] _2); StorageLive(_3); - _3 = _2; + _3 = copy _2; Retag(_3); _0 = &(*_2); StorageDead(_3); diff --git a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-pre-optimizations.after.panic-unwind.mir b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-pre-optimizations.after.panic-unwind.mir index 2620929e896..63b32ceb5c0 100644 --- a/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-pre-optimizations.after.panic-unwind.mir +++ b/tests/mir-opt/retag.main-{closure#0}.SimplifyCfg-pre-optimizations.after.panic-unwind.mir @@ -12,7 +12,7 @@ fn main::{closure#0}(_1: &{closure@main::{closure#0}}, _2: &i32) -> &i32 { Retag([fn entry] _1); Retag([fn entry] _2); StorageLive(_3); - _3 = _2; + _3 = copy _2; Retag(_3); _0 = &(*_2); StorageDead(_3); diff --git a/tests/mir-opt/retag.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir b/tests/mir-opt/retag.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir index a35af43cefd..d0f454e4569 100644 --- a/tests/mir-opt/retag.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir +++ b/tests/mir-opt/retag.main.SimplifyCfg-pre-optimizations.after.panic-abort.mir @@ -93,7 +93,7 @@ fn main() -> () { StorageLive(_11); StorageLive(_12); _12 = &raw mut (*_10); - _11 = _12; + _11 = copy _12; StorageDead(_12); _2 = const (); StorageDead(_11); @@ -109,7 +109,7 @@ fn main() -> () { StorageDead(_14); StorageLive(_15); StorageLive(_16); - _16 = _13; + _16 = copy _13; StorageLive(_17); StorageLive(_18); _18 = &_1; @@ -150,7 +150,7 @@ fn main() -> () { StorageLive(_25); StorageLive(_26); _26 = &raw const (*_15); - _25 = _26; + _25 = copy _26; StorageDead(_26); StorageLive(_27); _27 = array_casts() -> [return: bb6, unwind unreachable]; diff --git a/tests/mir-opt/retag.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir b/tests/mir-opt/retag.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir index 2495719ec1c..685277d7a53 100644 --- a/tests/mir-opt/retag.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir +++ b/tests/mir-opt/retag.main.SimplifyCfg-pre-optimizations.after.panic-unwind.mir @@ -93,7 +93,7 @@ fn main() -> () { StorageLive(_11); StorageLive(_12); _12 = &raw mut (*_10); - _11 = _12; + _11 = copy _12; StorageDead(_12); _2 = const (); StorageDead(_11); @@ -109,7 +109,7 @@ fn main() -> () { StorageDead(_14); StorageLive(_15); StorageLive(_16); - _16 = _13; + _16 = copy _13; StorageLive(_17); StorageLive(_18); _18 = &_1; @@ -150,7 +150,7 @@ fn main() -> () { StorageLive(_25); StorageLive(_26); _26 = &raw const (*_15); - _25 = _26; + _25 = copy _26; StorageDead(_26); StorageLive(_27); _27 = array_casts() -> [return: bb6, unwind continue]; diff --git a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-pre-optimizations.after.panic-abort.mir b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-pre-optimizations.after.panic-abort.mir index 4f90413e38b..b873c5aabbf 100644 --- a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-pre-optimizations.after.panic-abort.mir +++ b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-pre-optimizations.after.panic-abort.mir @@ -8,7 +8,7 @@ fn <impl at $DIR/retag.rs:13:1: 13:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 { bb0: { Retag([fn entry] _1); Retag([fn entry] _2); - _0 = _2; + _0 = copy _2; Retag(_0); return; } diff --git a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-pre-optimizations.after.panic-unwind.mir b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-pre-optimizations.after.panic-unwind.mir index 4f90413e38b..b873c5aabbf 100644 --- a/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-pre-optimizations.after.panic-unwind.mir +++ b/tests/mir-opt/retag.{impl#0}-foo_shr.SimplifyCfg-pre-optimizations.after.panic-unwind.mir @@ -8,7 +8,7 @@ fn <impl at $DIR/retag.rs:13:1: 13:10>::foo_shr(_1: &Test, _2: &i32) -> &i32 { bb0: { Retag([fn entry] _1); Retag([fn entry] _2); - _0 = _2; + _0 = copy _2; Retag(_0); return; } diff --git a/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff b/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff index 8dd904c7d7b..ce9d812701a 100644 --- a/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff +++ b/tests/mir-opt/separate_const_switch.identity.JumpThreading.diff @@ -50,16 +50,16 @@ } bb2: { - _5 = ((_2 as Continue).0: i32); - _0 = Result::<i32, i32>::Ok(_5); + _5 = copy ((_2 as Continue).0: i32); + _0 = Result::<i32, i32>::Ok(copy _5); StorageDead(_2); return; } bb3: { - _4 = ((_2 as Break).0: std::result::Result<std::convert::Infallible, i32>); - _10 = ((_4 as Err).0: i32); - _0 = Result::<i32, i32>::Err(_10); + _4 = copy ((_2 as Break).0: std::result::Result<std::convert::Infallible, i32>); + _10 = copy ((_4 as Err).0: i32); + _0 = Result::<i32, i32>::Err(copy _10); StorageDead(_2); return; } @@ -74,9 +74,9 @@ } bb5: { - _8 = ((_1 as Err).0: i32); + _8 = copy ((_1 as Err).0: i32); StorageLive(_9); - _9 = Result::<Infallible, i32>::Err(_8); + _9 = Result::<Infallible, i32>::Err(copy _8); _2 = ControlFlow::<Result<Infallible, i32>, i32>::Break(move _9); StorageDead(_9); - goto -> bb4; @@ -84,8 +84,8 @@ } bb6: { - _7 = ((_1 as Ok).0: i32); - _2 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(_7); + _7 = copy ((_1 as Ok).0: i32); + _2 = ControlFlow::<Result<Infallible, i32>, i32>::Continue(copy _7); goto -> bb4; + } + diff --git a/tests/mir-opt/separate_const_switch.too_complex.JumpThreading.diff b/tests/mir-opt/separate_const_switch.too_complex.JumpThreading.diff index f7495862992..c88c63e0c13 100644 --- a/tests/mir-opt/separate_const_switch.too_complex.JumpThreading.diff +++ b/tests/mir-opt/separate_const_switch.too_complex.JumpThreading.diff @@ -35,15 +35,15 @@ } bb2: { - _5 = ((_1 as Err).0: usize); - _2 = ControlFlow::<usize, i32>::Break(_5); + _5 = copy ((_1 as Err).0: usize); + _2 = ControlFlow::<usize, i32>::Break(copy _5); - goto -> bb4; + goto -> bb8; } bb3: { - _4 = ((_1 as Ok).0: i32); - _2 = ControlFlow::<usize, i32>::Continue(_4); + _4 = copy ((_1 as Ok).0: i32); + _2 = ControlFlow::<usize, i32>::Continue(copy _4); goto -> bb4; } @@ -55,15 +55,15 @@ bb5: { StorageLive(_8); - _8 = ((_2 as Break).0: usize); + _8 = copy ((_2 as Break).0: usize); _0 = const Option::<i32>::None; StorageDead(_8); goto -> bb7; } bb6: { - _7 = ((_2 as Continue).0: i32); - _0 = Option::<i32>::Some(_7); + _7 = copy ((_2 as Continue).0: i32); + _0 = Option::<i32>::Some(copy _7); goto -> bb7; } diff --git a/tests/mir-opt/set_no_discriminant.f.JumpThreading.diff b/tests/mir-opt/set_no_discriminant.f.JumpThreading.diff index bc28e81c9a8..3d9852aef65 100644 --- a/tests/mir-opt/set_no_discriminant.f.JumpThreading.diff +++ b/tests/mir-opt/set_no_discriminant.f.JumpThreading.diff @@ -10,7 +10,7 @@ _2 = E::<char>::A; discriminant(_2) = 1; _1 = discriminant(_2); - switchInt(_1) -> [0: bb1, otherwise: bb2]; + switchInt(copy _1) -> [0: bb1, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/set_no_discriminant.generic.JumpThreading.diff b/tests/mir-opt/set_no_discriminant.generic.JumpThreading.diff index 78bfeef3c64..c7af1638316 100644 --- a/tests/mir-opt/set_no_discriminant.generic.JumpThreading.diff +++ b/tests/mir-opt/set_no_discriminant.generic.JumpThreading.diff @@ -10,7 +10,7 @@ _2 = E::<T>::A; discriminant(_2) = 1; _1 = discriminant(_2); - switchInt(_1) -> [0: bb1, otherwise: bb2]; + switchInt(copy _1) -> [0: bb1, otherwise: bb2]; } bb1: { diff --git a/tests/mir-opt/simplify_dead_blocks.assert_nonzero_nonmax.SimplifyCfg-after-unreachable-enum-branching.diff b/tests/mir-opt/simplify_dead_blocks.assert_nonzero_nonmax.SimplifyCfg-after-unreachable-enum-branching.diff index 4400cfaef81..9c8efab5c84 100644 --- a/tests/mir-opt/simplify_dead_blocks.assert_nonzero_nonmax.SimplifyCfg-after-unreachable-enum-branching.diff +++ b/tests/mir-opt/simplify_dead_blocks.assert_nonzero_nonmax.SimplifyCfg-after-unreachable-enum-branching.diff @@ -5,8 +5,8 @@ let mut _0: u8; bb0: { -- switchInt(_1) -> [0: bb3, 1: bb2, 255: bb3, otherwise: bb4]; -+ switchInt(_1) -> [0: bb2, 1: bb1, 255: bb2, otherwise: bb3]; +- switchInt(copy _1) -> [0: bb3, 1: bb2, 255: bb3, otherwise: bb4]; ++ switchInt(copy _1) -> [0: bb2, 1: bb1, 255: bb2, otherwise: bb3]; } bb1: { @@ -26,7 +26,7 @@ - bb4: { + bb3: { - _0 = _1; + _0 = copy _1; return; } } diff --git a/tests/mir-opt/simplify_dead_blocks.rs b/tests/mir-opt/simplify_dead_blocks.rs index b9a404fd35c..7f2134c6121 100644 --- a/tests/mir-opt/simplify_dead_blocks.rs +++ b/tests/mir-opt/simplify_dead_blocks.rs @@ -10,7 +10,7 @@ use std::intrinsics::mir::*; pub unsafe fn assert_nonzero_nonmax(x: u8) -> u8 { // CHECK-LABEL: fn assert_nonzero_nonmax( // CHECK: bb0: { - // CHECK-NEXT: switchInt({{.*}}) -> [0: [[unreachable:bb.*]], 1: [[retblock2:bb.*]], 255: [[unreachable:bb.*]], otherwise: [[retblock:bb.*]]]; + // CHECK-NEXT: switchInt(copy {{_[0-9]+}}) -> [0: [[unreachable:bb.*]], 1: [[retblock2:bb.*]], 255: [[unreachable:bb.*]], otherwise: [[retblock:bb.*]]]; // CHECK-NEXT: } // CHECK-NOT: _0 = const 1_u8; // CHECK: [[retblock2]]: { @@ -21,7 +21,7 @@ pub unsafe fn assert_nonzero_nonmax(x: u8) -> u8 { // CHECK-NEXT: unreachable; // CHECK-NEXT: } // CHECK: [[retblock]]: { - // CHECK-NEXT: _0 = _1; + // CHECK-NEXT: _0 = copy _1; // CHECK-NEXT: return; // CHECK-NEXT: } mir! { diff --git a/tests/mir-opt/simplify_locals.expose_provenance.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.expose_provenance.SimplifyLocals-before-const-prop.diff index cc5c642407e..420fb4270b2 100644 --- a/tests/mir-opt/simplify_locals.expose_provenance.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals.expose_provenance.SimplifyLocals-before-const-prop.diff @@ -10,7 +10,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = move _3 as usize (PointerExposeProvenance); StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff index 526ff2f25cf..f05a3935d65 100644 --- a/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals.t1.SimplifyLocals-before-const-prop.diff @@ -10,7 +10,7 @@ - StorageLive(_1); - StorageLive(_2); - _2 = &/*tls*/ mut X; -- _1 = (*_2); +- _1 = copy (*_2); - StorageDead(_2); - StorageDead(_1); _0 = const (); diff --git a/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff index 5d45d7ac781..a57c136e64d 100644 --- a/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals.t3.SimplifyLocals-before-const-prop.diff @@ -13,7 +13,7 @@ - StorageLive(_3); - _3 = &/*tls*/ mut X; - _2 = &mut (*_3); -- _1 = (*_2); +- _1 = copy (*_2); - StorageDead(_3); - StorageDead(_2); - StorageDead(_1); diff --git a/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff b/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff index 4f4855dbaaf..118193fd4fd 100644 --- a/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff +++ b/tests/mir-opt/simplify_locals.t4.SimplifyLocals-before-const-prop.diff @@ -10,7 +10,7 @@ StorageLive(_1); StorageLive(_2); _2 = &/*tls*/ mut X; - _1 = (*_2); + _1 = copy (*_2); _0 = Add(move _1, const 1_u32); StorageDead(_1); StorageDead(_2); diff --git a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff index c520a159f47..c363dfcbf70 100644 --- a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff +++ b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-abort.diff @@ -33,7 +33,7 @@ bb2: { StorageLive(_6); - _6 = (((_1.0: std::option::Option<u8>) as Some).0: u8); + _6 = copy (((_1.0: std::option::Option<u8>) as Some).0: u8); StorageDead(_6); goto -> bb3; } diff --git a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff index 686581591fc..895b0067d2e 100644 --- a/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff +++ b/tests/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals-final.panic-unwind.diff @@ -33,7 +33,7 @@ bb2: { StorageLive(_6); - _6 = (((_1.0: std::option::Option<u8>) as Some).0: u8); + _6 = copy (((_1.0: std::option::Option<u8>) as Some).0: u8); StorageDead(_6); goto -> bb3; } diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff index 54d254ee374..58c265c5e60 100644 --- a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff +++ b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-abort.diff @@ -51,7 +51,7 @@ - _5 = (move _6, move _7); + StorageLive(_8); + _8 = Temp { x: const 40_u8 }; -+ _7 = (_8.0: u8); ++ _7 = copy (_8.0: u8); + _6 = Add(move _7, const 2_u8); StorageDead(_7); - StorageDead(_6); @@ -67,7 +67,7 @@ - StorageLive(_10); - StorageLive(_11); - _11 = Temp { x: const 40_u8 }; -- _10 = (_11.0: u8); +- _10 = copy (_11.0: u8); - _9 = Add(move _10, const 2_u8); - StorageDead(_10); - _8 = use_u8(move _9) -> [return: bb2, unwind unreachable]; diff --git a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff index a5d9bbc49af..748e1661c98 100644 --- a/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff +++ b/tests/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals-before-const-prop.panic-unwind.diff @@ -51,7 +51,7 @@ - _5 = (move _6, move _7); + StorageLive(_8); + _8 = Temp { x: const 40_u8 }; -+ _7 = (_8.0: u8); ++ _7 = copy (_8.0: u8); + _6 = Add(move _7, const 2_u8); StorageDead(_7); - StorageDead(_6); @@ -67,7 +67,7 @@ - StorageLive(_10); - StorageLive(_11); - _11 = Temp { x: const 40_u8 }; -- _10 = (_11.0: u8); +- _10 = copy (_11.0: u8); - _9 = Add(move _10, const 2_u8); - StorageDead(_10); - _8 = use_u8(move _9) -> [return: bb2, unwind continue]; diff --git a/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff b/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff index 33b36f660cb..9e798cbcac0 100644 --- a/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff +++ b/tests/mir-opt/simplify_match.main.GVN.panic-abort.diff @@ -14,9 +14,9 @@ - StorageLive(_2); + nop; _2 = const false; -- _1 = _2; +- _1 = copy _2; - StorageDead(_2); -- switchInt(_1) -> [0: bb2, otherwise: bb1]; +- switchInt(copy _1) -> [0: bb2, otherwise: bb1]; + _1 = const false; + nop; + switchInt(const false) -> [0: bb2, otherwise: bb1]; diff --git a/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff b/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff index e5c3adff623..e243ff45ab0 100644 --- a/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff +++ b/tests/mir-opt/simplify_match.main.GVN.panic-unwind.diff @@ -14,9 +14,9 @@ - StorageLive(_2); + nop; _2 = const false; -- _1 = _2; +- _1 = copy _2; - StorageDead(_2); -- switchInt(_1) -> [0: bb2, otherwise: bb1]; +- switchInt(copy _1) -> [0: bb2, otherwise: bb1]; + _1 = const false; + nop; + switchInt(const false) -> [0: bb2, otherwise: bb1]; diff --git a/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-abort.diff index ad1a2b300f2..0269c2cba20 100644 --- a/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-abort.diff @@ -22,7 +22,7 @@ bb1: { StorageDead(_2); StorageLive(_3); -- _3 = _1; +- _3 = copy _1; + _3 = const <T as MyTrait>::ASSOC_BOOL; switchInt(move _3) -> [0: bb3, otherwise: bb2]; } diff --git a/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-unwind.diff index 827a292e5d0..1285b8b33ba 100644 --- a/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.if_const_debug.SingleUseConsts.panic-unwind.diff @@ -22,7 +22,7 @@ bb1: { StorageDead(_2); StorageLive(_3); -- _3 = _1; +- _3 = copy _1; + _3 = const <T as MyTrait>::ASSOC_BOOL; switchInt(move _3) -> [0: bb3, otherwise: bb2]; } diff --git a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-abort.diff index 998b89919d1..354e0988a00 100644 --- a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-abort.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_1); - _1 = const <T as MyTrait>::ASSOC_INT; -- switchInt(_1) -> [7: bb3, 42: bb2, otherwise: bb1]; +- switchInt(copy _1) -> [7: bb3, 42: bb2, otherwise: bb1]; + nop; + switchInt(const <T as MyTrait>::ASSOC_INT) -> [7: bb3, 42: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-unwind.diff index 998b89919d1..354e0988a00 100644 --- a/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.match_const.SingleUseConsts.panic-unwind.diff @@ -8,7 +8,7 @@ bb0: { StorageLive(_1); - _1 = const <T as MyTrait>::ASSOC_INT; -- switchInt(_1) -> [7: bb3, 42: bb2, otherwise: bb1]; +- switchInt(copy _1) -> [7: bb3, 42: bb2, otherwise: bb1]; + nop; + switchInt(const <T as MyTrait>::ASSOC_INT) -> [7: bb3, 42: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-abort.diff b/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-abort.diff index 30f66ef6b82..5cf37dc97cb 100644 --- a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-abort.diff +++ b/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-abort.diff @@ -20,7 +20,7 @@ bb1: { StorageDead(_2); -- switchInt(_1) -> [7: bb4, 42: bb3, otherwise: bb2]; +- switchInt(copy _1) -> [7: bb4, 42: bb3, otherwise: bb2]; + switchInt(const <T as MyTrait>::ASSOC_INT) -> [7: bb4, 42: bb3, otherwise: bb2]; } diff --git a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-unwind.diff b/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-unwind.diff index ed12ad4b93e..bdcf086e8d9 100644 --- a/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-unwind.diff +++ b/tests/mir-opt/single_use_consts.match_const_debug.SingleUseConsts.panic-unwind.diff @@ -20,7 +20,7 @@ bb1: { StorageDead(_2); -- switchInt(_1) -> [7: bb4, 42: bb3, otherwise: bb2]; +- switchInt(copy _1) -> [7: bb4, 42: bb3, otherwise: bb2]; + switchInt(const <T as MyTrait>::ASSOC_INT) -> [7: bb4, 42: bb3, otherwise: bb2]; } diff --git a/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir b/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir index 3a8b457a7a1..4d1eaa6ffe3 100644 --- a/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir +++ b/tests/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir @@ -28,7 +28,7 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () { } bb4 (cleanup): { - _5 = Eq(_3, _2); + _5 = Eq(copy _3, copy _2); switchInt(move _5) -> [0: bb3, otherwise: bb2]; } @@ -39,7 +39,7 @@ fn std::ptr::drop_in_place(_1: *mut [String]) -> () { } bb6: { - _7 = Eq(_3, _2); + _7 = Eq(copy _3, copy _2); switchInt(move _7) -> [0: bb5, otherwise: bb1]; } diff --git a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff index 819f3f86d14..478dacc3276 100644 --- a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff @@ -75,8 +75,8 @@ - _5 = move (_1.0: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>); + _5 = move _29; StorageLive(_6); -- _6 = (_1.1: u32); -+ _6 = _30; +- _6 = copy (_1.1: u32); ++ _6 = copy _30; _7 = discriminant(_5); switchInt(move _7) -> [0: bb2, otherwise: bb7]; } @@ -171,7 +171,7 @@ } bb11: { - switchInt(_25) -> [0: bb10, otherwise: bb12]; + switchInt(copy _25) -> [0: bb10, otherwise: bb12]; } bb12: { diff --git a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff index 5d21e793982..4da3eb0ed76 100644 --- a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff @@ -29,11 +29,11 @@ + _4 = move (_1.0: usize); + _5 = move (_1.1: u8); StorageLive(_2); -- _2 = (_1.0: usize); -+ _2 = _4; +- _2 = copy (_1.0: usize); ++ _2 = copy _4; StorageLive(_3); -- _3 = (_1.1: u8); -+ _3 = _5; +- _3 = copy (_1.1: u8); ++ _3 = copy _5; _0 = const (); StorageDead(_3); StorageDead(_2); diff --git a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff index 3621338635e..cfc086d6596 100644 --- a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff @@ -43,38 +43,38 @@ bb0: { - StorageLive(_2); -- _2 = _1; +- _2 = copy _1; + StorageLive(_11); + StorageLive(_12); + StorageLive(_13); + StorageLive(_14); + nop; -+ _11 = (_1.0: u8); -+ _12 = (_1.1: ()); -+ _13 = (_1.2: &str); -+ _14 = (_1.3: std::option::Option<isize>); ++ _11 = copy (_1.0: u8); ++ _12 = copy (_1.1: ()); ++ _13 = copy (_1.2: &str); ++ _14 = copy (_1.3: std::option::Option<isize>); + nop; StorageLive(_3); -- _3 = (_2.0: u8); -+ _3 = _11; +- _3 = copy (_2.0: u8); ++ _3 = copy _11; StorageLive(_4); -- _4 = (_2.2: &str); +- _4 = copy (_2.2: &str); - StorageLive(_5); -- _5 = _2; -+ _4 = _13; +- _5 = copy _2; ++ _4 = copy _13; + StorageLive(_7); + StorageLive(_8); + StorageLive(_9); + StorageLive(_10); + nop; -+ _7 = _11; -+ _8 = _12; -+ _9 = _13; -+ _10 = _14; ++ _7 = copy _11; ++ _8 = copy _12; ++ _9 = copy _13; ++ _10 = copy _14; + nop; StorageLive(_6); -- _6 = (_5.1: ()); -+ _6 = _8; +- _6 = copy (_5.1: ()); ++ _6 = copy _8; _0 = const (); StorageDead(_6); - StorageDead(_5); diff --git a/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff index b5e39e63247..eda884de822 100644 --- a/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff @@ -15,7 +15,7 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = Option::<usize>::Some(move _3); StorageDead(_3); _4 = discriminant(_2); @@ -24,8 +24,8 @@ bb1: { StorageLive(_5); - _5 = ((_2 as Some).0: usize); - _0 = _5; + _5 = copy ((_2 as Some).0: usize); + _0 = copy _5; StorageDead(_5); goto -> bb3; } diff --git a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff index a84048365a4..77c7c1a9012 100644 --- a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff @@ -49,18 +49,18 @@ StorageDead(_7); StorageDead(_6); StorageLive(_1); -- _1 = (_5.0: u8); -+ _1 = _8; +- _1 = copy (_5.0: u8); ++ _1 = copy _8; StorageLive(_2); -- _2 = (_5.1: ()); -+ _2 = _9; +- _2 = copy (_5.1: ()); ++ _2 = copy _9; StorageLive(_3); -- _3 = (_5.2: &str); -+ _3 = _10; +- _3 = copy (_5.2: &str); ++ _3 = copy _10; StorageLive(_4); -- _4 = (_5.3: std::option::Option<isize>); +- _4 = copy (_5.3: std::option::Option<isize>); - StorageDead(_5); -+ _4 = _11; ++ _4 = copy _11; + StorageDead(_8); + StorageDead(_9); + StorageDead(_10); diff --git a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff index 304bf2fb1a7..abe7cd78878 100644 --- a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff @@ -27,23 +27,23 @@ bb0: { - StorageLive(_2); -- _2 = (*_1); +- _2 = copy (*_1); + StorageLive(_5); + StorageLive(_6); + StorageLive(_7); + StorageLive(_8); + nop; -+ _5 = ((*_1).0: u8); -+ _6 = ((*_1).1: ()); -+ _7 = ((*_1).2: &str); -+ _8 = ((*_1).3: std::option::Option<isize>); ++ _5 = copy ((*_1).0: u8); ++ _6 = copy ((*_1).1: ()); ++ _7 = copy ((*_1).2: &str); ++ _8 = copy ((*_1).3: std::option::Option<isize>); + nop; StorageLive(_3); -- _3 = (_2.0: u8); -+ _3 = _5; +- _3 = copy (_2.0: u8); ++ _3 = copy _5; StorageLive(_4); -- _4 = (_2.2: &str); -+ _4 = _7; +- _4 = copy (_2.2: &str); ++ _4 = copy _7; _0 = const (); StorageDead(_4); StorageDead(_3); diff --git a/tests/mir-opt/sroa/structs.rs b/tests/mir-opt/sroa/structs.rs index a177dbf71cf..d5f13f8b009 100644 --- a/tests/mir-opt/sroa/structs.rs +++ b/tests/mir-opt/sroa/structs.rs @@ -31,8 +31,8 @@ pub fn enums(a: usize) -> usize { // CHECK: bb0: { // CHECK: [[enum]] = Option::<usize>::Some - // CHECK: _5 = (([[enum]] as Some).0: usize) - // CHECK: _0 = _5 + // CHECK: _5 = copy (([[enum]] as Some).0: usize) + // CHECK: _0 = copy _5 if let Some(a) = Some(a) { a } else { 0 } } @@ -51,13 +51,13 @@ pub fn structs(a: f32) -> f32 { // CHECK: bb0: { // CHECK-NOT: [[struct]] - // CHECK: [[a_tmp]] = _1; + // CHECK: [[a_tmp]] = copy _1; // CHECK-NOT: [[struct]] // CHECK: [[foo]] = const 0_usize; // CHECK-NOT: [[struct]] // CHECK: [[a_ret]] = move [[a_tmp]]; // CHECK-NOT: [[struct]] - // CHECK: _0 = [[a_ret]]; + // CHECK: _0 = copy [[a_ret]]; // CHECK-NOT: [[struct]] U { _foo: 0, a }.a } @@ -73,7 +73,7 @@ pub fn unions(a: f32) -> u32 { // CHECK: bb0: { // CHECK: [[union]] = Repr { - // CHECK: _0 = ([[union]].1: u32) + // CHECK: _0 = copy ([[union]].1: u32) unsafe { Repr { f: a }.u } } @@ -156,10 +156,10 @@ fn copies(x: Foo) { // CHECK: [[opt_isize:_[0-9]+]]: std::option::Option<isize>; // CHECK: bb0: { - // CHECK: [[byte]] = ([[external]].0 - // CHECK: [[unit]] = ([[external]].1 - // CHECK: [[str]] = ([[external]].2 - // CHECK: [[opt_isize]] = ([[external]].3 + // CHECK: [[byte]] = copy ([[external]].0 + // CHECK: [[unit]] = copy ([[external]].1 + // CHECK: [[str]] = copy ([[external]].2 + // CHECK: [[opt_isize]] = copy ([[external]].3 let y = x; let t = y.a; @@ -181,10 +181,10 @@ fn ref_copies(x: &Foo) { // CHECK: [[opt_isize:_[0-9]+]]: std::option::Option<isize>; // CHECK: bb0: { - // CHECK: [[byte]] = ((*[[external]]).0 - // CHECK: [[unit]] = ((*[[external]]).1 - // CHECK: [[str]] = ((*[[external]]).2 - // CHECK: [[opt_isize]] = ((*[[external]]).3 + // CHECK: [[byte]] = copy ((*[[external]]).0 + // CHECK: [[unit]] = copy ((*[[external]]).1 + // CHECK: [[str]] = copy ((*[[external]]).2 + // CHECK: [[opt_isize]] = copy ((*[[external]]).3 let y = *x; let t = y.a; diff --git a/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff index bf5c3e3bd03..fe9deabe940 100644 --- a/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff @@ -15,15 +15,15 @@ + StorageLive(_5); + nop; StorageLive(_3); - _3 = _1; + _3 = copy _1; - _2 = U { _foo: const 0_usize, a: move _3 }; + _4 = const 0_usize; + _5 = move _3; + nop; StorageDead(_3); -- _0 = (_2.1: f32); +- _0 = copy (_2.1: f32); - StorageDead(_2); -+ _0 = _5; ++ _0 = copy _5; + StorageDead(_4); + StorageDead(_5); + nop; diff --git a/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff index 2f8dfcc5d63..115f163cda9 100644 --- a/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff @@ -10,10 +10,10 @@ bb0: { StorageLive(_2); StorageLive(_3); - _3 = _1; + _3 = copy _1; _2 = Repr { f: move _3 }; StorageDead(_3); - _0 = (_2.1: u32); + _0 = copy (_2.1: u32); StorageDead(_2); return; } diff --git a/tests/mir-opt/storage_ranges.main.nll.0.mir b/tests/mir-opt/storage_ranges.main.nll.0.mir index 782efd5acc6..ae8cd0c894d 100644 --- a/tests/mir-opt/storage_ranges.main.nll.0.mir +++ b/tests/mir-opt/storage_ranges.main.nll.0.mir @@ -17,6 +17,9 @@ | '?3 live at {bb0[11]} | '?2: '?3 due to Assignment at Single(bb0[10]) ($DIR/storage_ranges.rs:7:17: 7:25 (#0) | +| Borrows +| bw0: issued at bb0[10] in '?2 +| fn main() -> () { let mut _0: (); let _1: i32; @@ -43,7 +46,7 @@ fn main() -> () { StorageLive(_3); StorageLive(_4); StorageLive(_5); - _5 = _1; + _5 = copy _1; _4 = Option::<i32>::Some(move _5); StorageDead(_5); _3 = &_4; diff --git a/tests/mir-opt/switch_to_self.test.MatchBranchSimplification.diff b/tests/mir-opt/switch_to_self.test.MatchBranchSimplification.diff index c0b599e060b..fef708d9962 100644 --- a/tests/mir-opt/switch_to_self.test.MatchBranchSimplification.diff +++ b/tests/mir-opt/switch_to_self.test.MatchBranchSimplification.diff @@ -9,11 +9,11 @@ } bb1: { - switchInt(_1) -> [0: bb1, otherwise: bb2]; + switchInt(copy _1) -> [0: bb1, otherwise: bb2]; } bb2: { - switchInt(_1) -> [0: bb1, otherwise: bb2]; + switchInt(copy _1) -> [0: bb1, otherwise: bb2]; } } diff --git a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff index 44673ea00a9..17c64d4baf0 100644 --- a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-abort.diff @@ -102,7 +102,7 @@ + } + + bb14 (cleanup): { -+ switchInt(_8) -> [0: bb11, otherwise: bb13]; ++ switchInt(copy _8) -> [0: bb11, otherwise: bb13]; } } diff --git a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff index a6d33a24595..58d8a87986d 100644 --- a/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/tail_call_drops.f.ElaborateDrops.panic-unwind.diff @@ -103,7 +103,7 @@ + } + + bb14 (cleanup): { -+ switchInt(_8) -> [0: bb11, otherwise: bb13]; ++ switchInt(copy _8) -> [0: bb11, otherwise: bb13]; } } diff --git a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff index c7df2bb2207..1a51601bc56 100644 --- a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff +++ b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-abort.diff @@ -178,7 +178,7 @@ + } + + bb31 (cleanup): { -+ switchInt(_12) -> [0: bb26, otherwise: bb30]; ++ switchInt(copy _12) -> [0: bb26, otherwise: bb30]; } } diff --git a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff index c7df2bb2207..1a51601bc56 100644 --- a/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff +++ b/tests/mir-opt/tail_call_drops.f_with_arg.ElaborateDrops.panic-unwind.diff @@ -178,7 +178,7 @@ + } + + bb31 (cleanup): { -+ switchInt(_12) -> [0: bb26, otherwise: bb30]; ++ switchInt(copy _12) -> [0: bb26, otherwise: bb30]; } } diff --git a/tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir b/tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir index f0311422c17..f1904e5d0f4 100644 --- a/tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir @@ -15,7 +15,7 @@ fn bar(_1: Bar) -> () { bb0: { StorageLive(_2); StorageLive(_3); - _3 = (_1.0: u8); + _3 = copy (_1.0: u8); _2 = access::<u8>(move _3) -> [return: bb1, unwind: bb5]; } @@ -24,7 +24,7 @@ fn bar(_1: Bar) -> () { StorageDead(_2); StorageLive(_4); StorageLive(_5); - _5 = ((_1.1: Bar::{anon_adt#0}).0: i8); + _5 = copy ((_1.1: Bar::{anon_adt#0}).0: i8); _4 = access::<i8>(move _5) -> [return: bb2, unwind: bb5]; } @@ -33,7 +33,7 @@ fn bar(_1: Bar) -> () { StorageDead(_4); StorageLive(_6); StorageLive(_7); - _7 = ((_1.1: Bar::{anon_adt#0}).1: bool); + _7 = copy ((_1.1: Bar::{anon_adt#0}).1: bool); _6 = access::<bool>(move _7) -> [return: bb3, unwind: bb5]; } @@ -42,7 +42,7 @@ fn bar(_1: Bar) -> () { StorageDead(_6); StorageLive(_8); StorageLive(_9); - _9 = (((_1.2: Bar::{anon_adt#1}).0: Bar::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]); + _9 = copy (((_1.2: Bar::{anon_adt#1}).0: Bar::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]); _8 = access::<[u8; 1]>(move _9) -> [return: bb4, unwind: bb5]; } diff --git a/tests/mir-opt/unnamed-fields/field_access.foo.SimplifyCfg-initial.after.mir b/tests/mir-opt/unnamed-fields/field_access.foo.SimplifyCfg-initial.after.mir index d48a969f06e..c279f590012 100644 --- a/tests/mir-opt/unnamed-fields/field_access.foo.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/unnamed-fields/field_access.foo.SimplifyCfg-initial.after.mir @@ -15,7 +15,7 @@ fn foo(_1: Foo) -> () { bb0: { StorageLive(_2); StorageLive(_3); - _3 = (_1.0: u8); + _3 = copy (_1.0: u8); _2 = access::<u8>(move _3) -> [return: bb1, unwind: bb5]; } @@ -24,7 +24,7 @@ fn foo(_1: Foo) -> () { StorageDead(_2); StorageLive(_4); StorageLive(_5); - _5 = ((_1.1: Foo::{anon_adt#0}).0: i8); + _5 = copy ((_1.1: Foo::{anon_adt#0}).0: i8); _4 = access::<i8>(move _5) -> [return: bb2, unwind: bb5]; } @@ -33,7 +33,7 @@ fn foo(_1: Foo) -> () { StorageDead(_4); StorageLive(_6); StorageLive(_7); - _7 = ((_1.1: Foo::{anon_adt#0}).1: bool); + _7 = copy ((_1.1: Foo::{anon_adt#0}).1: bool); _6 = access::<bool>(move _7) -> [return: bb3, unwind: bb5]; } @@ -42,7 +42,7 @@ fn foo(_1: Foo) -> () { StorageDead(_6); StorageLive(_8); StorageLive(_9); - _9 = (((_1.2: Foo::{anon_adt#1}).0: Foo::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]); + _9 = copy (((_1.2: Foo::{anon_adt#1}).0: Foo::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]); _8 = access::<[u8; 1]>(move _9) -> [return: bb4, unwind: bb5]; } diff --git a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff index 1e1ddfae0eb..17ddce0cdf8 100644 --- a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff +++ b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff @@ -20,7 +20,7 @@ bb1: { _2 = discriminant(_1); - switchInt(move _2) -> [1: bb3, otherwise: bb2]; -+ _5 = Ne(_2, const 1_isize); ++ _5 = Ne(copy _2, const 1_isize); + assume(move _5); + goto -> bb2; } diff --git a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff index 809d24aa15a..2f78092f5bd 100644 --- a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff +++ b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff @@ -20,7 +20,7 @@ bb1: { _2 = discriminant(_1); - switchInt(move _2) -> [1: bb3, otherwise: bb2]; -+ _5 = Ne(_2, const 1_isize); ++ _5 = Ne(copy _2, const 1_isize); + assume(move _5); + goto -> bb2; } diff --git a/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-abort.diff index 61959732720..2ce37c4422b 100644 --- a/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-abort.diff +++ b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-abort.diff @@ -26,7 +26,7 @@ bb1: { _2 = discriminant(_1); - switchInt(move _2) -> [1: bb2, otherwise: bb6]; -+ _8 = Ne(_2, const 1_isize); ++ _8 = Ne(copy _2, const 1_isize); + assume(move _8); + goto -> bb6; } diff --git a/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-unwind.diff index 476e2f55994..2dfba10c37d 100644 --- a/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-unwind.diff +++ b/tests/mir-opt/unreachable.if_let.UnreachablePropagation.panic-unwind.diff @@ -26,7 +26,7 @@ bb1: { _2 = discriminant(_1); - switchInt(move _2) -> [1: bb2, otherwise: bb6]; -+ _8 = Ne(_2, const 1_isize); ++ _8 = Ne(copy _2, const 1_isize); + assume(move _8); + goto -> bb6; } diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff index 11d7924e736..ba268832ca3 100644 --- a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff +++ b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-abort.diff @@ -35,9 +35,9 @@ _4 = move ((_2 as Some).0: Empty); StorageLive(_5); StorageLive(_6); - _6 = _1; + _6 = copy _1; - switchInt(move _6) -> [0: bb4, otherwise: bb3]; -+ _8 = Ne(_6, const false); ++ _8 = Ne(copy _6, const false); + assume(move _8); + goto -> bb3; } diff --git a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff index df6f5609fbf..f057f776470 100644 --- a/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff +++ b/tests/mir-opt/unreachable_diverging.main.UnreachablePropagation.panic-unwind.diff @@ -35,9 +35,9 @@ _4 = move ((_2 as Some).0: Empty); StorageLive(_5); StorageLive(_6); - _6 = _1; + _6 = copy _1; - switchInt(move _6) -> [0: bb4, otherwise: bb3]; -+ _8 = Ne(_6, const false); ++ _8 = Ne(copy _6, const false); + assume(move _8); + goto -> bb3; } diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff index 4cd6d3f5683..17e01f38f4e 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff @@ -29,7 +29,7 @@ } bb2: { - switchInt(((_2 as A).0: i32)) -> [1: bb6, 2: bb5, otherwise: bb1]; + switchInt(copy ((_2 as A).0: i32)) -> [1: bb6, 2: bb5, otherwise: bb1]; } bb3: { diff --git a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff index 4cd6d3f5683..17e01f38f4e 100644 --- a/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff @@ -29,7 +29,7 @@ } bb2: { - switchInt(((_2 as A).0: i32)) -> [1: bb6, 2: bb5, otherwise: bb1]; + switchInt(copy ((_2 as A).0: i32)) -> [1: bb6, 2: bb5, otherwise: bb1]; } bb3: { diff --git a/tests/pretty/raw-address-of.rs b/tests/pretty/raw-address-of.rs index 6e97ab99407..c00a16e238a 100644 --- a/tests/pretty/raw-address-of.rs +++ b/tests/pretty/raw-address-of.rs @@ -1,5 +1,4 @@ //@ pp-exact -#![feature(raw_ref_op)] const C_PTR: () = { let a = 1; &raw const a; }; static S_PTR: () = { let b = false; &raw const b; }; diff --git a/tests/run-make/rust-lld-compress-debug-sections/main.rs b/tests/run-make/compressed-debuginfo-zstd/main.rs index f328e4d9d04..f328e4d9d04 100644 --- a/tests/run-make/rust-lld-compress-debug-sections/main.rs +++ b/tests/run-make/compressed-debuginfo-zstd/main.rs diff --git a/tests/run-make/compressed-debuginfo-zstd/rmake.rs b/tests/run-make/compressed-debuginfo-zstd/rmake.rs new file mode 100644 index 00000000000..8356373e949 --- /dev/null +++ b/tests/run-make/compressed-debuginfo-zstd/rmake.rs @@ -0,0 +1,42 @@ +// Checks debuginfo compression both for the always-enabled zlib, and when the optional zstd is +// enabled: +// - via rustc's `debuginfo-compression`, +// - and via rust-lld's `compress-debug-sections` + +//@ needs-llvm-zstd: we want LLVM/LLD to be built with zstd support +//@ needs-rust-lld: the system linker will most likely not support zstd +//@ only-linux +//@ ignore-cross-compile + +use run_make_support::{llvm_readobj, run_in_tmpdir, Rustc}; + +fn check_compression(compression: &str, to_find: &str) { + // check compressed debug sections via rustc flag + prepare_and_check(to_find, |rustc| { + rustc.arg(&format!("-Zdebuginfo-compression={compression}")) + }); + + // check compressed debug sections via rust-lld flag + prepare_and_check(to_find, |rustc| { + rustc.link_arg(&format!("-Wl,--compress-debug-sections={compression}")) + }); +} + +fn prepare_and_check<F: FnOnce(&mut Rustc) -> &mut Rustc>(to_find: &str, prepare_rustc: F) { + run_in_tmpdir(|| { + let mut rustc = Rustc::new(); + rustc + .arg("-Zlinker-features=+lld") + .arg("-Clink-self-contained=+linker") + .arg("-Zunstable-options") + .arg("-Cdebuginfo=full") + .input("main.rs"); + prepare_rustc(&mut rustc).run(); + llvm_readobj().arg("-t").arg("main").run().assert_stdout_contains(to_find); + }); +} + +fn main() { + check_compression("zlib", "ZLIB"); + check_compression("zstd", "ZSTD"); +} diff --git a/tests/run-make/crate-loading/multiple-dep-versions-1.rs b/tests/run-make/crate-loading/multiple-dep-versions-1.rs index 2d351633829..d81462504dd 100644 --- a/tests/run-make/crate-loading/multiple-dep-versions-1.rs +++ b/tests/run-make/crate-loading/multiple-dep-versions-1.rs @@ -1,6 +1,12 @@ #![crate_name = "dependency"] #![crate_type = "rlib"] -pub struct Type; -pub trait Trait {} -impl Trait for Type {} +pub struct Type(pub i32); +pub trait Trait { + fn foo(&self); + fn bar(); +} +impl Trait for Type { + fn foo(&self) {} + fn bar() {} +} pub fn do_something<X: Trait>(_: X) {} diff --git a/tests/run-make/crate-loading/multiple-dep-versions-2.rs b/tests/run-make/crate-loading/multiple-dep-versions-2.rs index a5df3dc61ed..0a566fe2c60 100644 --- a/tests/run-make/crate-loading/multiple-dep-versions-2.rs +++ b/tests/run-make/crate-loading/multiple-dep-versions-2.rs @@ -1,6 +1,12 @@ #![crate_name = "dependency"] #![crate_type = "rlib"] -pub struct Type(pub i32); -pub trait Trait {} -impl Trait for Type {} +pub struct Type; +pub trait Trait { + fn foo(&self); + fn bar(); +} +impl Trait for Type { + fn foo(&self) {} + fn bar() {} +} pub fn do_something<X: Trait>(_: X) {} diff --git a/tests/run-make/crate-loading/multiple-dep-versions-3.rs b/tests/run-make/crate-loading/multiple-dep-versions-3.rs new file mode 100644 index 00000000000..07d888e9f10 --- /dev/null +++ b/tests/run-make/crate-loading/multiple-dep-versions-3.rs @@ -0,0 +1,5 @@ +#![crate_name = "foo"] +#![crate_type = "rlib"] + +extern crate dependency; +pub use dependency::Type; diff --git a/tests/run-make/crate-loading/multiple-dep-versions.rs b/tests/run-make/crate-loading/multiple-dep-versions.rs index 5a6cb03aaa4..8ef042bf418 100644 --- a/tests/run-make/crate-loading/multiple-dep-versions.rs +++ b/tests/run-make/crate-loading/multiple-dep-versions.rs @@ -1,8 +1,10 @@ extern crate dep_2_reexport; extern crate dependency; -use dep_2_reexport::do_something; -use dependency::Type; +use dep_2_reexport::Type; +use dependency::{do_something, Trait}; fn main() { do_something(Type); + Type.foo(); + Type::bar(); } diff --git a/tests/run-make/crate-loading/rmake.rs b/tests/run-make/crate-loading/rmake.rs index d7abd5872c9..95a9011669e 100644 --- a/tests/run-make/crate-loading/rmake.rs +++ b/tests/run-make/crate-loading/rmake.rs @@ -1,26 +1,100 @@ //@ only-linux //@ ignore-wasm32 //@ ignore-wasm64 +// ignore-tidy-linelength use run_make_support::{rust_lib_name, rustc}; fn main() { rustc().input("multiple-dep-versions-1.rs").run(); rustc().input("multiple-dep-versions-2.rs").extra_filename("2").metadata("2").run(); + rustc() + .input("multiple-dep-versions-3.rs") + .extern_("dependency", rust_lib_name("dependency2")) + .run(); rustc() .input("multiple-dep-versions.rs") .extern_("dependency", rust_lib_name("dependency")) - .extern_("dep_2_reexport", rust_lib_name("dependency2")) + .extern_("dep_2_reexport", rust_lib_name("foo")) .run_fail() .assert_stderr_contains( - "you have multiple different versions of crate `dependency` in your dependency graph", + r#"error[E0277]: the trait bound `dep_2_reexport::Type: Trait` is not satisfied + --> multiple-dep-versions.rs:7:18 + | +7 | do_something(Type); + | ------------ ^^^^ the trait `Trait` is not implemented for `dep_2_reexport::Type` + | | + | required by a bound introduced by this call + | +help: there are multiple different versions of crate `dependency` in the dependency graph + --> multiple-dep-versions.rs:1:1 + | +1 | extern crate dep_2_reexport; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one version of crate `dependency` is used here, as a dependency of crate `foo` +2 | extern crate dependency; + | ^^^^^^^^^^^^^^^^^^^^^^^^ one version of crate `dependency` is used here, as a direct dependency of the current crate"#, + ) + .assert_stderr_contains( + r#" +3 | pub struct Type(pub i32); + | ^^^^^^^^^^^^^^^ this type implements the required trait +4 | pub trait Trait { + | --------------- this is the required trait"#, + ) + .assert_stderr_contains( + r#" +3 | pub struct Type; + | ^^^^^^^^^^^^^^^ this type doesn't implement the required trait"#, + ) + .assert_stderr_contains( + r#" +error[E0599]: no method named `foo` found for struct `dep_2_reexport::Type` in the current scope + --> multiple-dep-versions.rs:8:10 + | +8 | Type.foo(); + | ^^^ method not found in `Type` + | +note: there are multiple different versions of crate `dependency` in the dependency graph"#, + ) + .assert_stderr_contains( + r#" +4 | pub trait Trait { + | ^^^^^^^^^^^^^^^ this is the trait that is needed +5 | fn foo(&self); + | -------------- the method is available for `dep_2_reexport::Type` here + | + ::: multiple-dep-versions.rs:4:32 + | +4 | use dependency::{do_something, Trait}; + | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency`"#, ) .assert_stderr_contains( - "two types coming from two different versions of the same crate are different types \ - even if they look the same", + r#" +4 | pub trait Trait { + | --------------- this is the trait that was imported"#, ) - .assert_stderr_contains("this type doesn't implement the required trait") - .assert_stderr_contains("this type implements the required trait") - .assert_stderr_contains("this is the required trait"); + .assert_stderr_contains( + r#" +error[E0599]: no function or associated item named `bar` found for struct `dep_2_reexport::Type` in the current scope + --> multiple-dep-versions.rs:9:11 + | +9 | Type::bar(); + | ^^^ function or associated item not found in `Type` + | +note: there are multiple different versions of crate `dependency` in the dependency graph"#, + ) + .assert_stderr_contains( + r#" +4 | pub trait Trait { + | ^^^^^^^^^^^^^^^ this is the trait that is needed +5 | fn foo(&self); +6 | fn bar(); + | --------- the associated function is available for `dep_2_reexport::Type` here + | + ::: multiple-dep-versions.rs:4:32 + | +4 | use dependency::{do_something, Trait}; + | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency`"#, + ); } diff --git a/tests/run-make/debugger-visualizer-dep-info/foo.py b/tests/run-make/debugger-visualizer-dep-info/foo.py deleted file mode 100644 index 1bb8bf6d7fd..00000000000 --- a/tests/run-make/debugger-visualizer-dep-info/foo.py +++ /dev/null @@ -1 +0,0 @@ -# empty diff --git a/tests/run-make/debugger-visualizer-dep-info/main.rs b/tests/run-make/debugger-visualizer-dep-info/main.rs index 3aede2215ea..3539b305be3 100644 --- a/tests/run-make/debugger-visualizer-dep-info/main.rs +++ b/tests/run-make/debugger-visualizer-dep-info/main.rs @@ -1,4 +1,4 @@ -#![debugger_visualizer(gdb_script_file = "foo.py")] +#![debugger_visualizer(gdb_script_file = "my_gdb_script.py")] fn main() { const _UNUSED: u32 = { diff --git a/tests/run-make/debugger-visualizer-dep-info/my_gdb_script.py b/tests/run-make/debugger-visualizer-dep-info/my_gdb_script.py new file mode 100644 index 00000000000..d319792657e --- /dev/null +++ b/tests/run-make/debugger-visualizer-dep-info/my_gdb_script.py @@ -0,0 +1,6 @@ +# This is a Python script, but we don't actually run it. +# So if you're trying to remove Python scripts from the test suite, +# be aware that there's no value in trying to get rid of this one. +# +# It just needs to exist so that the compiler can embed it via +# `#![debugger_visualizer(gdb_script_file = "...")]`. diff --git a/tests/run-make/debugger-visualizer-dep-info/rmake.rs b/tests/run-make/debugger-visualizer-dep-info/rmake.rs index 65ffb2373e7..f5cf39157ac 100644 --- a/tests/run-make/debugger-visualizer-dep-info/rmake.rs +++ b/tests/run-make/debugger-visualizer-dep-info/rmake.rs @@ -6,6 +6,6 @@ use run_make_support::{invalid_utf8_contains, rustc}; fn main() { rustc().emit("dep-info").input("main.rs").run(); - invalid_utf8_contains("main.d", "foo.py"); + invalid_utf8_contains("main.d", "my_gdb_script.py"); invalid_utf8_contains("main.d", "my_visualizers/bar.natvis"); } diff --git a/tests/run-make/dep-info-doesnt-run-much/Makefile b/tests/run-make/dep-info-doesnt-run-much/Makefile deleted file mode 100644 index b4dc44ad2be..00000000000 --- a/tests/run-make/dep-info-doesnt-run-much/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -include ../tools.mk - -all: - $(RUSTC) foo.rs --emit dep-info diff --git a/tests/run-make/dep-info-spaces/Makefile b/tests/run-make/dep-info-spaces/Makefile deleted file mode 100644 index 0cfe513e490..00000000000 --- a/tests/run-make/dep-info-spaces/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -include ../tools.mk - -# ignore-windows -# ignore-freebsd -# FIXME: (windows: see `../dep-info/Makefile`) - -all: - cp lib.rs $(TMPDIR)/ - cp 'foo foo.rs' $(TMPDIR)/ - cp bar.rs $(TMPDIR)/ - $(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs - sleep 1 - touch $(TMPDIR)/'foo foo.rs' - -rm -f $(TMPDIR)/done - $(MAKE) -drf Makefile.foo - rm $(TMPDIR)/done - pwd - $(MAKE) -drf Makefile.foo - rm $(TMPDIR)/done && exit 1 || exit 0 diff --git a/tests/run-make/dep-info-spaces/Makefile.foo b/tests/run-make/dep-info-spaces/Makefile.foo deleted file mode 100644 index 80a5d4333cd..00000000000 --- a/tests/run-make/dep-info-spaces/Makefile.foo +++ /dev/null @@ -1,7 +0,0 @@ -LIB := $(shell $(RUSTC) --print file-names --crate-type=lib $(TMPDIR)/lib.rs) - -$(TMPDIR)/$(LIB): - $(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs - touch $(TMPDIR)/done - --include $(TMPDIR)/lib.d diff --git a/tests/run-make/dep-info-spaces/bar.rs b/tests/run-make/dep-info-spaces/bar.rs deleted file mode 100644 index c5c0bc606cd..00000000000 --- a/tests/run-make/dep-info-spaces/bar.rs +++ /dev/null @@ -1 +0,0 @@ -pub fn bar() {} diff --git a/tests/run-make/dep-info/Makefile b/tests/run-make/dep-info/Makefile deleted file mode 100644 index c76f43a8eed..00000000000 --- a/tests/run-make/dep-info/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -include ../tools.mk - -# ignore-windows -# ignore-freebsd -# FIXME: on windows `rustc --dep-info` produces Makefile dependency with -# windows native paths (e.g. `c:\path\to\libfoo.a`) -# but msys make seems to fail to recognize such paths, so test fails. - -all: - cp *.rs $(TMPDIR) - $(RUSTC) --emit dep-info,link --crate-type=lib $(TMPDIR)/lib.rs - sleep 2 - touch $(TMPDIR)/foo.rs - -rm -f $(TMPDIR)/done - $(MAKE) -drf Makefile.foo - sleep 2 - rm $(TMPDIR)/done - pwd - $(MAKE) -drf Makefile.foo - rm $(TMPDIR)/done && exit 1 || exit 0 - - # When a source file is deleted `make` should still work - rm $(TMPDIR)/bar.rs - cp $(TMPDIR)/lib2.rs $(TMPDIR)/lib.rs - $(MAKE) -drf Makefile.foo diff --git a/tests/run-make/dep-info/Makefile.foo b/tests/run-make/dep-info/Makefile.foo deleted file mode 100644 index e5df31f88c1..00000000000 --- a/tests/run-make/dep-info/Makefile.foo +++ /dev/null @@ -1,7 +0,0 @@ -LIB := $(shell $(RUSTC) --print file-names --crate-type=lib lib.rs) - -$(TMPDIR)/$(LIB): - $(RUSTC) --emit dep-info,link --crate-type=lib lib.rs - touch $(TMPDIR)/done - --include $(TMPDIR)/foo.d diff --git a/tests/run-make/dep-info-doesnt-run-much/foo.rs b/tests/run-make/dep-info/erroneous.rs index 316e681293e..316e681293e 100644 --- a/tests/run-make/dep-info-doesnt-run-much/foo.rs +++ b/tests/run-make/dep-info/erroneous.rs diff --git a/tests/run-make/dep-info-spaces/foo foo.rs b/tests/run-make/dep-info/foo foo.rs index b76b4321d62..b76b4321d62 100644 --- a/tests/run-make/dep-info-spaces/foo foo.rs +++ b/tests/run-make/dep-info/foo foo.rs diff --git a/tests/run-make/dep-info-spaces/lib.rs b/tests/run-make/dep-info/lib_foofoo.rs index 4e061892cf7..4e061892cf7 100644 --- a/tests/run-make/dep-info-spaces/lib.rs +++ b/tests/run-make/dep-info/lib_foofoo.rs diff --git a/tests/run-make/dep-info/rmake.rs b/tests/run-make/dep-info/rmake.rs new file mode 100644 index 00000000000..508569b7671 --- /dev/null +++ b/tests/run-make/dep-info/rmake.rs @@ -0,0 +1,37 @@ +// This is a simple smoke test for rustc's `--emit dep-info` feature. It prints out +// information about dependencies in a Makefile-compatible format, as a `.d` file. +// Note that this test does not check that the `.d` file is Makefile-compatible. + +// This test first checks that emitting dep-info disables static analysis, preventing +// compilation of `erroneous.rs` from causing a compilation failure. +// Then, it checks that compilation using the flag is successful in general, even with +// empty source files or source files that contain a whitespace character. + +// Finally, it removes one dependency and checks that compilation is still successful. +// See https://github.com/rust-lang/rust/pull/10698 + +use run_make_support::{rfs, rustc}; + +fn main() { + // We're only emitting dep info, so we shouldn't be running static analysis to + // figure out that this program is erroneous. + rustc().input("erroneous.rs").emit("dep-info").run(); + + rustc().input("lib.rs").emit("dep-info,link").crate_type("lib").run(); + rfs::remove_file("foo.rs"); + rfs::create_file("foo.rs"); + // Compilation should succeed even if `foo.rs` is empty. + rustc().input("lib.rs").emit("dep-info,link").crate_type("lib").run(); + + // Again, with a space in the filename this time around. + rustc().input("lib_foofoo.rs").emit("dep-info,link").crate_type("lib").run(); + rfs::remove_file("foo foo.rs"); + rfs::create_file("foo foo.rs"); + // Compilation should succeed even if `foo foo.rs` is empty. + rustc().input("lib_foofoo.rs").emit("dep-info,link").crate_type("lib").run(); + + // When a source file is deleted, compilation should still succeed if the library + // also loses this source file dependency. + rfs::remove_file("bar.rs"); + rustc().input("lib2.rs").emit("dep-info,link").crate_type("lib").run(); +} diff --git a/tests/run-make/deref-impl-rustdoc-ice/rmake.rs b/tests/run-make/deref-impl-rustdoc-ice/rmake.rs index 91fc0a9025f..0ad5934f62e 100644 --- a/tests/run-make/deref-impl-rustdoc-ice/rmake.rs +++ b/tests/run-make/deref-impl-rustdoc-ice/rmake.rs @@ -12,5 +12,5 @@ use run_make_support::{cwd, rustc, rustdoc}; fn main() { rustc().input("foo.rs").run(); rustc().input("bar.rs").run(); - rustdoc().input("baz.rs").library_search_path(cwd()).output(cwd()).run(); + rustdoc().input("baz.rs").library_search_path(cwd()).out_dir(cwd()).run(); } diff --git a/tests/run-make/doctests-keep-binaries-2024/rmake.rs b/tests/run-make/doctests-keep-binaries-2024/rmake.rs new file mode 100644 index 00000000000..3e8ffcbf244 --- /dev/null +++ b/tests/run-make/doctests-keep-binaries-2024/rmake.rs @@ -0,0 +1,67 @@ +// Check that valid binaries are persisted by running them, regardless of whether the +// --run or --no-run option is used. + +//@ ignore-cross-compile + +use std::path::Path; + +use run_make_support::{rfs, run, rustc, rustdoc}; + +fn setup_test_env<F: FnOnce(&Path, &Path)>(callback: F) { + let out_dir = Path::new("doctests"); + rfs::create_dir(&out_dir); + rustc().input("t.rs").crate_type("rlib").run(); + callback(&out_dir, Path::new("libt.rlib")); + rfs::remove_dir_all(out_dir); +} + +fn check_generated_binaries() { + run("doctests/merged_doctest_2024/rust_out"); +} + +fn main() { + setup_test_env(|out_dir, extern_path| { + rustdoc() + .input("t.rs") + .arg("-Zunstable-options") + .arg("--test") + .arg("--persist-doctests") + .arg(out_dir) + .extern_("t", extern_path) + .edition("2024") + .run(); + check_generated_binaries(); + }); + setup_test_env(|out_dir, extern_path| { + rustdoc() + .input("t.rs") + .arg("-Zunstable-options") + .arg("--test") + .arg("--persist-doctests") + .arg(out_dir) + .extern_("t", extern_path) + .arg("--no-run") + .edition("2024") + .run(); + check_generated_binaries(); + }); + // Behavior with --test-run-directory with relative paths. + setup_test_env(|_, _| { + let run_dir_path = Path::new("rundir"); + rfs::create_dir(&run_dir_path); + + rustdoc() + .input("t.rs") + .arg("-Zunstable-options") + .arg("--test") + .arg("--persist-doctests") + .arg("doctests") + .arg("--test-run-directory") + .arg(run_dir_path) + .extern_("t", "libt.rlib") + .edition("2024") + .run(); + + rfs::remove_dir_all(run_dir_path); + }); +} diff --git a/tests/run-make/doctests-keep-binaries-2024/t.rs b/tests/run-make/doctests-keep-binaries-2024/t.rs new file mode 100644 index 00000000000..c38cf0a0b25 --- /dev/null +++ b/tests/run-make/doctests-keep-binaries-2024/t.rs @@ -0,0 +1,11 @@ +/// Fungle the foople. +/// ``` +/// t::foople(); +/// ``` +pub fn foople() {} + +/// Flomble the florp +/// ``` +/// t::florp(); +/// ``` +pub fn florp() {} diff --git a/tests/run-make/doctests-merge/doctest-2021.stdout b/tests/run-make/doctests-merge/doctest-2021.stdout new file mode 100644 index 00000000000..7da08d68faa --- /dev/null +++ b/tests/run-make/doctests-merge/doctest-2021.stdout @@ -0,0 +1,7 @@ + +running 2 tests +test doctest.rs - (line 4) ... ok +test doctest.rs - init (line 8) ... ok + +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/run-make/doctests-merge/doctest-2024.stdout b/tests/run-make/doctests-merge/doctest-2024.stdout new file mode 100644 index 00000000000..7da08d68faa --- /dev/null +++ b/tests/run-make/doctests-merge/doctest-2024.stdout @@ -0,0 +1,7 @@ + +running 2 tests +test doctest.rs - (line 4) ... ok +test doctest.rs - init (line 8) ... ok + +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/run-make/doctests-merge/doctest-standalone.rs b/tests/run-make/doctests-merge/doctest-standalone.rs new file mode 100644 index 00000000000..134ffb58285 --- /dev/null +++ b/tests/run-make/doctests-merge/doctest-standalone.rs @@ -0,0 +1,18 @@ +#![crate_name = "foo"] +#![crate_type = "lib"] + +//! ```standalone +//! foo::init(); +//! ``` + +/// ```standalone +/// foo::init(); +/// ``` +pub fn init() { + static mut IS_INIT: bool = false; + + unsafe { + assert!(!IS_INIT); + IS_INIT = true; + } +} diff --git a/tests/run-make/doctests-merge/doctest-standalone.stdout b/tests/run-make/doctests-merge/doctest-standalone.stdout new file mode 100644 index 00000000000..ee9f62326ab --- /dev/null +++ b/tests/run-make/doctests-merge/doctest-standalone.stdout @@ -0,0 +1,7 @@ + +running 2 tests +test doctest-standalone.rs - (line 4) ... ok +test doctest-standalone.rs - init (line 8) ... ok + +test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/run-make/doctests-merge/doctest.rs b/tests/run-make/doctests-merge/doctest.rs new file mode 100644 index 00000000000..66a5d88db67 --- /dev/null +++ b/tests/run-make/doctests-merge/doctest.rs @@ -0,0 +1,18 @@ +#![crate_name = "foo"] +#![crate_type = "lib"] + +//! ``` +//! foo::init(); +//! ``` + +/// ``` +/// foo::init(); +/// ``` +pub fn init() { + static mut IS_INIT: bool = false; + + unsafe { + assert!(!IS_INIT); + IS_INIT = true; + } +} diff --git a/tests/run-make/doctests-merge/rmake.rs b/tests/run-make/doctests-merge/rmake.rs new file mode 100644 index 00000000000..a25da7403e2 --- /dev/null +++ b/tests/run-make/doctests-merge/rmake.rs @@ -0,0 +1,39 @@ +use std::path::Path; + +use run_make_support::{cwd, diff, rustc, rustdoc}; + +fn test_and_compare(input_file: &str, stdout_file: &str, edition: &str, dep: &Path) { + let mut cmd = rustdoc(); + + let output = cmd + .input(input_file) + .arg("--test") + .arg("-Zunstable-options") + .edition(edition) + .arg("--test-args=--test-threads=1") + .extern_("foo", dep.display().to_string()) + .env("RUST_BACKTRACE", "short") + .run(); + + diff() + .expected_file(stdout_file) + .actual_text("output", output.stdout_utf8()) + .normalize(r#"finished in \d+\.\d+s"#, "finished in $$TIME") + .run(); +} + +fn main() { + let out_file = cwd().join("libfoo.rlib"); + + rustc().input("doctest.rs").crate_type("rlib").output(&out_file).run(); + + // First we ensure that running with the 2024 edition will not fail at runtime. + test_and_compare("doctest.rs", "doctest-2024.stdout", "2024", &out_file); + + // Then we ensure that running with an edition < 2024 will not fail at runtime. + test_and_compare("doctest.rs", "doctest-2021.stdout", "2021", &out_file); + + // Now we check with the standalone attribute which should succeed in all cases. + test_and_compare("doctest-standalone.rs", "doctest-standalone.stdout", "2024", &out_file); + test_and_compare("doctest-standalone.rs", "doctest-standalone.stdout", "2021", &out_file); +} diff --git a/tests/run-make/dos-device-input/rmake.rs b/tests/run-make/dos-device-input/rmake.rs index dee3b86f095..f5911d78fd9 100644 --- a/tests/run-make/dos-device-input/rmake.rs +++ b/tests/run-make/dos-device-input/rmake.rs @@ -1,13 +1,11 @@ //@ only-windows // Reason: dos devices are a Windows thing -use std::path::Path; - -use run_make_support::{rustc, static_lib_name}; +use run_make_support::{path, rustc, static_lib_name}; fn main() { rustc().input(r"\\.\NUL").crate_type("staticlib").run(); rustc().input(r"\\?\NUL").crate_type("staticlib").run(); - assert!(Path::new(&static_lib_name("rust_out")).exists()); + assert!(path(&static_lib_name("rust_out")).exists()); } diff --git a/tests/run-make/dump-ice-to-disk/rmake.rs b/tests/run-make/dump-ice-to-disk/rmake.rs index 48b4071e065..15f35eb2d3d 100644 --- a/tests/run-make/dump-ice-to-disk/rmake.rs +++ b/tests/run-make/dump-ice-to-disk/rmake.rs @@ -14,11 +14,17 @@ //! that `RUSTC_ICE_PATH` takes precedence and no ICE dump is emitted under `METRICS_PATH`. //! //! See <https://github.com/rust-lang/rust/pull/108714>. +//! +//! # Test history +//! +//! - The previous rmake.rs iteration of this test was flakey for unknown reason on `i686-mingw` +//! *specifically*, so assertion failures in this test was made extremely verbose to help +//! diagnose why the ICE messages was different *specifically* on `i686-mingw`. +//! - An attempt is made to re-enable this test on `i686-mingw` (by removing `ignore-windows`). If +//! this test is still flakey, please restore the `ignore-windows` directive. //@ ignore-windows -// FIXME(#128911): @jieyouxu: This test is sometimes for whatever forsaken reason flakey in -// `i686-mingw`, and I cannot reproduce it locally. The error messages upon assertion failure in -// this test is intentionally extremely verbose to aid debugging that issue. +//FIXME(#128911): still flakey on i686-mingw. use std::cell::OnceCell; use std::path::{Path, PathBuf}; diff --git a/tests/run-make/embed-source-dwarf/main.rs b/tests/run-make/embed-source-dwarf/main.rs new file mode 100644 index 00000000000..c80af84f414 --- /dev/null +++ b/tests/run-make/embed-source-dwarf/main.rs @@ -0,0 +1,2 @@ +// hello +fn main() {} diff --git a/tests/run-make/embed-source-dwarf/rmake.rs b/tests/run-make/embed-source-dwarf/rmake.rs new file mode 100644 index 00000000000..06d550121b0 --- /dev/null +++ b/tests/run-make/embed-source-dwarf/rmake.rs @@ -0,0 +1,70 @@ +//@ ignore-windows +//@ ignore-apple + +// LLVM 17's embed-source implementation requires that source code is attached +// for all files in the output DWARF debug info. This restriction was lifted in +// LLVM 18 (87e22bdd2bd6d77d782f9d64b3e3ae5bdcd5080d). +//@ min-llvm-version: 18 + +// This test should be replaced with one in tests/debuginfo once we can easily +// tell via GDB or LLDB if debuginfo contains source code. Cheap tricks in LLDB +// like setting an invalid source map path don't appear to work, maybe this'll +// become easier once GDB supports DWARFv6? + +use std::collections::HashMap; +use std::path::PathBuf; +use std::rc::Rc; + +use gimli::{AttributeValue, EndianRcSlice, Reader, RunTimeEndian}; +use object::{Object, ObjectSection}; +use run_make_support::{gimli, object, rfs, rustc}; + +fn main() { + let output = PathBuf::from("embed-source-main"); + rustc() + .input("main.rs") + .output(&output) + .arg("-g") + .arg("-Zembed-source=yes") + .arg("-Zdwarf-version=5") + .run(); + let output = rfs::read(output); + let obj = object::File::parse(output.as_slice()).unwrap(); + let endian = if obj.is_little_endian() { RunTimeEndian::Little } else { RunTimeEndian::Big }; + let dwarf = gimli::Dwarf::load(|section| -> Result<_, ()> { + let data = obj.section_by_name(section.name()).map(|s| s.uncompressed_data().unwrap()); + Ok(EndianRcSlice::new(Rc::from(data.unwrap_or_default().as_ref()), endian)) + }) + .unwrap(); + + let mut sources = HashMap::new(); + + let mut iter = dwarf.units(); + while let Some(header) = iter.next().unwrap() { + let unit = dwarf.unit(header).unwrap(); + let unit = unit.unit_ref(&dwarf); + + if let Some(program) = &unit.line_program { + let header = program.header(); + for file in header.file_names() { + if let Some(source) = file.source() { + let path = unit + .attr_string(file.path_name()) + .unwrap() + .to_string_lossy() + .unwrap() + .to_string(); + let source = + unit.attr_string(source).unwrap().to_string_lossy().unwrap().to_string(); + if !source.is_empty() { + sources.insert(path, source); + } + } + } + } + } + + dbg!(&sources); + assert_eq!(sources.len(), 1); + assert_eq!(sources.get("main.rs").unwrap(), "// hello\nfn main() {}\n"); +} diff --git a/tests/run-make/emit-shared-files/rmake.rs b/tests/run-make/emit-shared-files/rmake.rs index 8ac9073e993..c8c113ce944 100644 --- a/tests/run-make/emit-shared-files/rmake.rs +++ b/tests/run-make/emit-shared-files/rmake.rs @@ -5,36 +5,35 @@ // `all-shared` should only emit files that can be shared between crates. // See https://github.com/rust-lang/rust/pull/83478 -use std::path::Path; - -use run_make_support::{has_extension, has_prefix, rustdoc, shallow_find_files}; +use run_make_support::{has_extension, has_prefix, path, rustdoc, shallow_find_files}; fn main() { rustdoc() .arg("-Zunstable-options") .arg("--emit=invocation-specific") - .output("invocation-only") + .out_dir("invocation-only") .arg("--resource-suffix=-xxx") .args(&["--theme", "y.css"]) .args(&["--extend-css", "z.css"]) .input("x.rs") .run(); - assert!(Path::new("invocation-only/search-index-xxx.js").exists()); - assert!(Path::new("invocation-only/settings.html").exists()); - assert!(Path::new("invocation-only/x/all.html").exists()); - assert!(Path::new("invocation-only/x/index.html").exists()); - assert!(Path::new("invocation-only/theme-xxx.css").exists()); // generated from z.css - assert!(!Path::new("invocation-only/storage-xxx.js").exists()); - assert!(!Path::new("invocation-only/SourceSerif4-It.ttf.woff2").exists()); + assert!(path("invocation-only/search-index-xxx.js").exists()); + assert!(path("invocation-only/crates-xxx.js").exists()); + assert!(path("invocation-only/settings.html").exists()); + assert!(path("invocation-only/x/all.html").exists()); + assert!(path("invocation-only/x/index.html").exists()); + assert!(path("invocation-only/theme-xxx.css").exists()); // generated from z.css + assert!(!path("invocation-only/storage-xxx.js").exists()); + assert!(!path("invocation-only/SourceSerif4-It.ttf.woff2").exists()); // FIXME: this probably shouldn't have a suffix - assert!(Path::new("invocation-only/y-xxx.css").exists()); + assert!(path("invocation-only/y-xxx.css").exists()); // FIXME: this is technically incorrect (see `write_shared`) - assert!(!Path::new("invocation-only/main-xxx.js").exists()); + assert!(!path("invocation-only/main-xxx.js").exists()); rustdoc() .arg("-Zunstable-options") .arg("--emit=toolchain-shared-resources") - .output("toolchain-only") + .out_dir("toolchain-only") .arg("--resource-suffix=-xxx") .args(&["--extend-css", "z.css"]) .input("x.rs") @@ -60,15 +59,15 @@ fn main() { .len(), 1 ); - assert!(!Path::new("toolchain-only/search-index-xxx.js").exists()); - assert!(!Path::new("toolchain-only/x/index.html").exists()); - assert!(!Path::new("toolchain-only/theme.css").exists()); - assert!(!Path::new("toolchain-only/y-xxx.css").exists()); + assert!(!path("toolchain-only/search-index-xxx.js").exists()); + assert!(!path("toolchain-only/x/index.html").exists()); + assert!(!path("toolchain-only/theme.css").exists()); + assert!(!path("toolchain-only/y-xxx.css").exists()); rustdoc() .arg("-Zunstable-options") .arg("--emit=toolchain-shared-resources,unversioned-shared-resources") - .output("all-shared") + .out_dir("all-shared") .arg("--resource-suffix=-xxx") .args(&["--extend-css", "z.css"]) .input("x.rs") @@ -87,11 +86,11 @@ fn main() { .len(), 1 ); - assert!(!Path::new("all-shared/search-index-xxx.js").exists()); - assert!(!Path::new("all-shared/settings.html").exists()); - assert!(!Path::new("all-shared/x").exists()); - assert!(!Path::new("all-shared/src").exists()); - assert!(!Path::new("all-shared/theme.css").exists()); + assert!(!path("all-shared/search-index-xxx.js").exists()); + assert!(!path("all-shared/settings.html").exists()); + assert!(!path("all-shared/x").exists()); + assert!(!path("all-shared/src").exists()); + assert!(!path("all-shared/theme.css").exists()); assert_eq!( shallow_find_files("all-shared/static.files", |path| { has_prefix(path, "main-") && has_extension(path, "js") @@ -99,5 +98,5 @@ fn main() { .len(), 1 ); - assert!(!Path::new("all-shared/y-xxx.css").exists()); + assert!(!path("all-shared/y-xxx.css").exists()); } diff --git a/tests/run-make/exit-code/rmake.rs b/tests/run-make/exit-code/rmake.rs index f290554831d..d3dcc04428c 100644 --- a/tests/run-make/exit-code/rmake.rs +++ b/tests/run-make/exit-code/rmake.rs @@ -16,7 +16,7 @@ fn main() { .run_fail() .assert_exit_code(101); - rustdoc().arg("success.rs").output("exit-code").run(); + rustdoc().arg("success.rs").out_dir("exit-code").run(); rustdoc().arg("--invalid-arg-foo").run_fail().assert_exit_code(1); diff --git a/tests/run-make/libtest-json/Makefile b/tests/run-make/libtest-json/Makefile deleted file mode 100644 index c8bc7b5dd4a..00000000000 --- a/tests/run-make/libtest-json/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# ignore-cross-compile -# needs-unwind -include ../tools.mk - -# Test expected libtest's JSON output - -OUTPUT_FILE_DEFAULT := $(TMPDIR)/libtest-json-output-default.json -OUTPUT_FILE_STDOUT_SUCCESS := $(TMPDIR)/libtest-json-output-stdout-success.json - -all: f.rs validate_json.py output-default.json output-stdout-success.json - $(RUSTC) --test f.rs - RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json > $(OUTPUT_FILE_DEFAULT) || true - RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=json --show-output > $(OUTPUT_FILE_STDOUT_SUCCESS) || true - - cat $(OUTPUT_FILE_DEFAULT) | "$(PYTHON)" validate_json.py - cat $(OUTPUT_FILE_STDOUT_SUCCESS) | "$(PYTHON)" validate_json.py - - # Normalize the actual output and compare to expected output file - cat $(OUTPUT_FILE_DEFAULT) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-default.json - - cat $(OUTPUT_FILE_STDOUT_SUCCESS) | sed 's/"exec_time": [0-9.]*/"exec_time": $$TIME/' | diff output-stdout-success.json - diff --git a/tests/run-make/libtest-json/output-default.json b/tests/run-make/libtest-json/output-default.json index 01710f59e5d..a2293a032d0 100644 --- a/tests/run-make/libtest-json/output-default.json +++ b/tests/run-make/libtest-json/output-default.json @@ -7,4 +7,4 @@ { "type": "test", "name": "c", "event": "ok" } { "type": "test", "event": "started", "name": "d" } { "type": "test", "name": "d", "event": "ignored", "message": "msg" } -{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } +{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": "$EXEC_TIME" } diff --git a/tests/run-make/libtest-json/output-stdout-success.json b/tests/run-make/libtest-json/output-stdout-success.json index 878eb6c7c26..cf92f01f63a 100644 --- a/tests/run-make/libtest-json/output-stdout-success.json +++ b/tests/run-make/libtest-json/output-stdout-success.json @@ -7,4 +7,4 @@ { "type": "test", "name": "c", "event": "ok", "stdout": "thread 'c' panicked at f.rs:15:5:\nassertion failed: false\n" } { "type": "test", "event": "started", "name": "d" } { "type": "test", "name": "d", "event": "ignored", "message": "msg" } -{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": $TIME } +{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": "$EXEC_TIME" } diff --git a/tests/run-make/libtest-json/rmake.rs b/tests/run-make/libtest-json/rmake.rs new file mode 100644 index 00000000000..c31f4a79b64 --- /dev/null +++ b/tests/run-make/libtest-json/rmake.rs @@ -0,0 +1,42 @@ +// Check libtest's JSON output against snapshots. + +//@ ignore-cross-compile +//@ needs-unwind (test file contains #[should_panic] test) + +use run_make_support::{cmd, diff, rustc, serde_json}; + +fn main() { + rustc().arg("--test").input("f.rs").run(); + + run_tests(&[], "output-default.json"); + run_tests(&["--show-output"], "output-stdout-success.json"); +} + +#[track_caller] +fn run_tests(extra_args: &[&str], expected_file: &str) { + let cmd_out = cmd("./f") + .env("RUST_BACKTRACE", "0") + .args(&["-Zunstable-options", "--test-threads=1", "--format=json"]) + .args(extra_args) + .run_fail(); + let test_stdout = &cmd_out.stdout_utf8(); + + // Verify that the test process output is JSON Lines, i.e. each line is valid JSON. + for (line, n) in test_stdout.lines().zip(1..) { + if let Err(e) = serde_json::from_str::<serde_json::Value>(line) { + panic!( + "could not parse JSON on line {n}: {e}\n\ + \n\ + === STDOUT ===\n\ + {test_stdout}\ + ==============" + ); + } + } + + diff() + .expected_file(expected_file) + .actual_text("stdout", test_stdout) + .normalize(r#"(?<prefix>"exec_time": )[0-9.]+"#, r#"${prefix}"$$EXEC_TIME""#) + .run(); +} diff --git a/tests/run-make/libtest-json/validate_json.py b/tests/run-make/libtest-json/validate_json.py deleted file mode 100755 index 657f732f2bf..00000000000 --- a/tests/run-make/libtest-json/validate_json.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python - -import sys -import json - -# Try to decode line in order to ensure it is a valid JSON document -for line in sys.stdin: - json.loads(line) diff --git a/tests/run-make/libtest-junit/Makefile b/tests/run-make/libtest-junit/Makefile deleted file mode 100644 index 26e56242dd2..00000000000 --- a/tests/run-make/libtest-junit/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# ignore-cross-compile -# needs-unwind contains should_panic test -include ../tools.mk - -# Test expected libtest's junit output - -OUTPUT_FILE_DEFAULT := $(TMPDIR)/libtest-junit-output-default.xml -OUTPUT_FILE_STDOUT_SUCCESS := $(TMPDIR)/libtest-junit-output-stdout-success.xml - -all: f.rs validate_junit.py output-default.xml output-stdout-success.xml - $(RUSTC) --test f.rs - RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=junit > $(OUTPUT_FILE_DEFAULT) || true - RUST_BACKTRACE=0 $(call RUN,f) -Z unstable-options --test-threads=1 --format=junit --show-output > $(OUTPUT_FILE_STDOUT_SUCCESS) || true - - cat $(OUTPUT_FILE_DEFAULT) | "$(PYTHON)" validate_junit.py - cat $(OUTPUT_FILE_STDOUT_SUCCESS) | "$(PYTHON)" validate_junit.py - - # Normalize the actual output and compare to expected output file - cat $(OUTPUT_FILE_DEFAULT) | sed 's/time="[0-9.]*"/time="$$TIME"/g' | diff output-default.xml - - cat $(OUTPUT_FILE_STDOUT_SUCCESS) | sed 's/time="[0-9.]*"/time="$$TIME"/g' | diff output-stdout-success.xml - diff --git a/tests/run-make/libtest-junit/rmake.rs b/tests/run-make/libtest-junit/rmake.rs new file mode 100644 index 00000000000..d631313ed92 --- /dev/null +++ b/tests/run-make/libtest-junit/rmake.rs @@ -0,0 +1,31 @@ +// Check libtest's JUnit (XML) output against snapshots. + +//@ ignore-cross-compile +//@ needs-unwind (test file contains #[should_panic] test) + +use run_make_support::{cmd, diff, python_command, rustc}; + +fn main() { + rustc().arg("--test").input("f.rs").run(); + + run_tests(&[], "output-default.xml"); + run_tests(&["--show-output"], "output-stdout-success.xml"); +} + +#[track_caller] +fn run_tests(extra_args: &[&str], expected_file: &str) { + let cmd_out = cmd("./f") + .env("RUST_BACKTRACE", "0") + .args(&["-Zunstable-options", "--test-threads=1", "--format=junit"]) + .args(extra_args) + .run_fail(); + let test_stdout = &cmd_out.stdout_utf8(); + + python_command().arg("validate_junit.py").stdin(test_stdout).run(); + + diff() + .expected_file(expected_file) + .actual_text("stdout", test_stdout) + .normalize(r#"\btime="[0-9.]+""#, r#"time="$$TIME""#) + .run(); +} diff --git a/tests/run-make/libtest-junit/validate_junit.py b/tests/run-make/libtest-junit/validate_junit.py index 0d9b34a3cf7..f92473751b0 100755 --- a/tests/run-make/libtest-junit/validate_junit.py +++ b/tests/run-make/libtest-junit/validate_junit.py @@ -1,5 +1,15 @@ #!/usr/bin/env python +# Trivial Python script that reads lines from stdin, and checks that each line +# is a well-formed XML document. +# +# This takes advantage of the fact that Python has a built-in XML parser, +# whereas doing the same check in Rust would require us to pull in an XML +# crate just for this relatively-minor test. +# +# If you're trying to remove Python scripts from the test suite, think twice +# before removing this one. You could do so, but it's probably not worth it. + import sys import xml.etree.ElementTree as ET diff --git a/tests/run-make/libtest-thread-limit/Makefile b/tests/run-make/libtest-thread-limit/Makefile deleted file mode 100644 index 9496fa30159..00000000000 --- a/tests/run-make/libtest-thread-limit/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -include ../tools.mk - -# only-linux - -all: - $(RUSTC) test.rs --test --target $(TARGET) - $(shell ulimit -p 0 && $(call RUN,test)) diff --git a/tests/run-make/libtest-thread-limit/rmake.rs b/tests/run-make/libtest-thread-limit/rmake.rs new file mode 100644 index 00000000000..5decd802b34 --- /dev/null +++ b/tests/run-make/libtest-thread-limit/rmake.rs @@ -0,0 +1,67 @@ +// libtest used to panic if it hit the thread limit. This often resulted in spurious test failures +// (thread 'main' panicked at 'called Result::unwrap() on an Err value: Os +// { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }' ... +// error: test failed, to rerun pass '--lib'). +// Since the fix in #81546, the test should continue to run synchronously +// if it runs out of threads. Therefore, this test's final execution step +// should succeed without an error. +// See https://github.com/rust-lang/rust/pull/81546 + +//@ only-linux +// Reason: thread limit modification +//@ ignore-cross-compile +// Reason: this test fails armhf-gnu, reasons unknown +//@ needs-unwind +// Reason: this should be ignored in cg_clif (Cranelift) CI and anywhere +// else that uses panic=abort. + +use std::ffi::{self, CStr, CString}; +use std::path::PathBuf; + +use run_make_support::{libc, run, rustc}; + +fn main() { + rustc().input("test.rs").arg("--test").run(); + + // We need to emulate an environment for libtest where threads are exhausted and spawning + // new threads are guaranteed to fail. This was previously achieved by ulimit shell builtin + // that called out to prlimit64 underneath to set resource limits (specifically thread + // number limits). Now that we don't have a shell, we need to implement that ourselves. + // See https://linux.die.net/man/2/setrlimit + + // The fork + exec is required because we cannot first try to limit the number of + // processes/threads to 1 and then try to spawn a new process to run the test. We need to + // setrlimit and run the libtest test program in the same process. + let pid = unsafe { libc::fork() }; + assert!(pid >= 0); + + // If the process ID is 0, this is the child process responsible for running the test + // program. + if pid == 0 { + let test = CString::new("test").unwrap(); + // The argv array should be terminated with a NULL pointer. + let argv = [test.as_ptr(), std::ptr::null()]; + // rlim_cur is soft limit, rlim_max is hard limit. + // By setting the limit very low (max 1), we ensure that libtest is unable to create new + // threads. + let rlimit = libc::rlimit { rlim_cur: 1, rlim_max: 1 }; + // RLIMIT_NPROC: The maximum number of processes (or, more precisely on Linux, + // threads) that can be created for the real user ID of the calling process. Upon + // encountering this limit, fork(2) fails with the error EAGAIN. + // Therefore, set the resource limit to RLIMIT_NPROC. + let ret = unsafe { libc::setrlimit(libc::RLIMIT_NPROC, &rlimit as *const libc::rlimit) }; + assert_eq!(ret, 0); + + // Finally, execute the 2 tests in test.rs. + let ret = unsafe { libc::execv(test.as_ptr(), argv.as_ptr()) }; + assert_eq!(ret, 0); + } else { + // Otherwise, other process IDs indicate that this is the parent process. + + let mut status: libc::c_int = 0; + let ret = unsafe { libc::waitpid(pid, &mut status as *mut libc::c_int, 0) }; + assert_eq!(ret, pid); + assert!(libc::WIFEXITED(status)); + assert_eq!(libc::WEXITSTATUS(status), 0); + } +} diff --git a/tests/run-make/libtest-thread-limit/test.rs b/tests/run-make/libtest-thread-limit/test.rs index 87e1d519171..d4eb1242615 100644 --- a/tests/run-make/libtest-thread-limit/test.rs +++ b/tests/run-make/libtest-thread-limit/test.rs @@ -10,7 +10,12 @@ fn spawn_thread_would_block() { THREAD_ID.set(thread::current().id()).unwrap(); } +// Tests are run in alphabetical order, and the second test is dependent on the +// first to set THREAD_ID. Do not rename the tests in such a way that `test_run_in_same_thread` +// would run before `spawn_thread_would_block`. +// See https://doc.rust-lang.org/rustc/tests/index.html#--shuffle + #[test] -fn run_in_same_thread() { +fn test_run_in_same_thread() { assert_eq!(*THREAD_ID.get().unwrap(), thread::current().id()); } diff --git a/tests/run-make/manual-crate-name/rmake.rs b/tests/run-make/manual-crate-name/rmake.rs index 9085b6c7bc2..9f480ec6b6a 100644 --- a/tests/run-make/manual-crate-name/rmake.rs +++ b/tests/run-make/manual-crate-name/rmake.rs @@ -1,8 +1,6 @@ -use std::path::Path; - -use run_make_support::rustc; +use run_make_support::{path, rustc}; fn main() { rustc().input("bar.rs").crate_name("foo").run(); - assert!(Path::new("libfoo.rlib").is_file()); + assert!(path("libfoo.rlib").is_file()); } diff --git a/tests/run-make/min-global-align/Makefile b/tests/run-make/min-global-align/Makefile deleted file mode 100644 index 82f38749e00..00000000000 --- a/tests/run-make/min-global-align/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -include ../tools.mk - -# only-linux - -# This tests ensure that global variables respect the target minimum alignment. -# The three bools `STATIC_BOOL`, `STATIC_MUT_BOOL`, and `CONST_BOOL` all have -# type-alignment of 1, but some targets require greater global alignment. - -SRC = min_global_align.rs -LL = $(TMPDIR)/min_global_align.ll - -all: -# Most targets are happy with default alignment -- take i686 for example. -ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86) - $(RUSTC) --target=i686-unknown-linux-gnu --emit=llvm-ir $(SRC) - [ "$$(grep -c 'align 1' "$(LL)")" -eq "3" ] -endif -# SystemZ requires even alignment for PC-relative addressing. -ifeq ($(filter systemz,$(LLVM_COMPONENTS)),systemz) - $(RUSTC) --target=s390x-unknown-linux-gnu --emit=llvm-ir $(SRC) - [ "$$(grep -c 'align 2' "$(LL)")" -eq "3" ] -endif diff --git a/tests/run-make/min-global-align/rmake.rs b/tests/run-make/min-global-align/rmake.rs new file mode 100644 index 00000000000..2adaaf172f4 --- /dev/null +++ b/tests/run-make/min-global-align/rmake.rs @@ -0,0 +1,27 @@ +// This test checks that global variables respect the target minimum alignment. +// The three bools `STATIC_BOOL`, `STATIC_MUT_BOOL`, and `CONST_BOOL` all have +// type-alignment of 1, but some targets require greater global alignment. +// See https://github.com/rust-lang/rust/pull/44440 + +//@ only-linux +// Reason: this test is specific to linux, considering compilation is targeted +// towards linux architectures only. + +use run_make_support::{assert_count_is, llvm_components_contain, rfs, rustc}; + +fn main() { + // Most targets are happy with default alignment -- take i686 for example. + if llvm_components_contain("x86") { + rustc().target("i686-unknown-linux-gnu").emit("llvm-ir").input("min_global_align.rs").run(); + assert_count_is(3, rfs::read_to_string("min_global_align.ll"), "align 1"); + } + // SystemZ requires even alignment for PC-relative addressing. + if llvm_components_contain("systemz") { + rustc() + .target("s390x-unknown-linux-gnu") + .emit("llvm-ir") + .input("min_global_align.rs") + .run(); + assert_count_is(3, rfs::read_to_string("min_global_align.ll"), "align 2"); + } +} diff --git a/tests/run-make/msvc-wholearchive/c.c b/tests/run-make/msvc-wholearchive/c.c new file mode 100644 index 00000000000..d6847845c68 --- /dev/null +++ b/tests/run-make/msvc-wholearchive/c.c @@ -0,0 +1 @@ +// This page is intentionally left blank diff --git a/tests/run-make/msvc-wholearchive/dll.def b/tests/run-make/msvc-wholearchive/dll.def new file mode 100644 index 00000000000..d55819e0d5e --- /dev/null +++ b/tests/run-make/msvc-wholearchive/dll.def @@ -0,0 +1,4 @@ +LIBRARY dll +EXPORTS + hello + number diff --git a/tests/run-make/msvc-wholearchive/rmake.rs b/tests/run-make/msvc-wholearchive/rmake.rs new file mode 100644 index 00000000000..98586fd8cc8 --- /dev/null +++ b/tests/run-make/msvc-wholearchive/rmake.rs @@ -0,0 +1,52 @@ +//! This is a regression test for #129020 +//! It ensures we can use `/WHOLEARCHIVE` to link a rust staticlib into DLL +//! using the MSVC linker + +//@ only-msvc +// Reason: this is testing the MSVC linker + +use std::path::PathBuf; + +use run_make_support::{cc, cmd, env_var, extra_c_flags, rustc}; + +fn main() { + // Build the staticlib + rustc().crate_type("staticlib").input("static.rs").output("static.lib").run(); + // Build an empty object to pass to the linker. + cc().input("c.c").output("c.obj").args(["-c"]).run(); + + // Find the C toolchain's linker. + let mut linker = PathBuf::from(env_var("CC")); + let linker_flavour = if linker.file_stem().is_some_and(|s| s == "cl") { + linker.set_file_name("link.exe"); + "msvc" + } else if linker.file_stem().is_some_and(|s| s == "clang-cl") { + linker.set_file_name("lld-link.exe"); + "llvm" + } else { + panic!("unknown C toolchain"); + }; + + // As a sanity check, make sure this works without /WHOLEARCHIVE. + // Otherwise the actual test failure may be caused by something else. + cmd(&linker) + .args(["c.obj", "./static.lib", "-dll", "-def:dll.def", "-out:dll.dll"]) + .args(extra_c_flags()) + .run(); + + // FIXME(@ChrisDenton): this doesn't currently work with llvm's lld-link for other reasons. + // May need LLVM patches. + if linker_flavour == "msvc" { + // Link in the staticlib using `/WHOLEARCHIVE` and produce a DLL. + cmd(&linker) + .args([ + "c.obj", + "-WHOLEARCHIVE:./static.lib", + "-dll", + "-def:dll.def", + "-out:dll_whole_archive.dll", + ]) + .args(extra_c_flags()) + .run(); + } +} diff --git a/tests/run-make/msvc-wholearchive/static.rs b/tests/run-make/msvc-wholearchive/static.rs new file mode 100644 index 00000000000..881c8856573 --- /dev/null +++ b/tests/run-make/msvc-wholearchive/static.rs @@ -0,0 +1,9 @@ +#[no_mangle] +pub extern "C" fn hello() { + println!("Hello world!"); +} + +#[no_mangle] +pub extern "C" fn number() -> u32 { + 42 +} diff --git a/tests/run-make/native-lib-alt-naming/native.rs b/tests/run-make/native-lib-alt-naming/native.rs new file mode 100644 index 00000000000..6c869e74cd2 --- /dev/null +++ b/tests/run-make/native-lib-alt-naming/native.rs @@ -0,0 +1,2 @@ +#[no_mangle] +pub extern "C" fn native_lib_alt_naming() {} diff --git a/tests/run-make/native-lib-alt-naming/rmake.rs b/tests/run-make/native-lib-alt-naming/rmake.rs new file mode 100644 index 00000000000..d1ea0fc8687 --- /dev/null +++ b/tests/run-make/native-lib-alt-naming/rmake.rs @@ -0,0 +1,15 @@ +// On MSVC the alternative naming format for static libraries (`libfoo.a`) is accepted in addition +// to the default format (`foo.lib`). + +//REMOVE@ only-msvc + +use run_make_support::rustc; + +fn main() { + // Prepare the native library. + rustc().input("native.rs").crate_type("staticlib").output("libnative.a").run(); + + // Try to link to it from both a rlib and a bin. + rustc().input("rust.rs").crate_type("rlib").arg("-lstatic=native").run(); + rustc().input("rust.rs").crate_type("bin").arg("-lstatic=native").run(); +} diff --git a/tests/run-make/native-lib-alt-naming/rust.rs b/tests/run-make/native-lib-alt-naming/rust.rs new file mode 100644 index 00000000000..da0f5d925d1 --- /dev/null +++ b/tests/run-make/native-lib-alt-naming/rust.rs @@ -0,0 +1 @@ +pub fn main() {} diff --git a/tests/run-make/native-link-modifier-bundle/Makefile b/tests/run-make/native-link-modifier-bundle/Makefile deleted file mode 100644 index 527720922fe..00000000000 --- a/tests/run-make/native-link-modifier-bundle/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# ignore-cross-compile -# ignore-windows-msvc - -include ../tools.mk - -# We're using the llvm-nm instead of the system nm to ensure it is compatible -# with the LLVM bitcode generated by rustc. -# Except on Windows where piping/IO redirection under MSYS2 is wonky with llvm-nm. -ifndef IS_WINDOWS -NM = "$(LLVM_BIN_DIR)"/llvm-nm -else -NM = nm -endif - -all: $(call NATIVE_STATICLIB,native-staticlib) - # Build a staticlib and a rlib, the `native_func` symbol will be bundled into them - $(RUSTC) bundled.rs --crate-type=staticlib --crate-type=rlib - $(NM) $(TMPDIR)/libbundled.a | $(CGREP) -e "T _*native_func" - $(NM) $(TMPDIR)/libbundled.a | $(CGREP) -e "U _*native_func" - $(NM) $(TMPDIR)/libbundled.rlib | $(CGREP) -e "T _*native_func" - $(NM) $(TMPDIR)/libbundled.rlib | $(CGREP) -e "U _*native_func" - - # Build a staticlib and a rlib, the `native_func` symbol will not be bundled into it - $(RUSTC) non-bundled.rs --crate-type=staticlib --crate-type=rlib - $(NM) $(TMPDIR)/libnon_bundled.a | $(CGREP) -ve "T _*native_func" - $(NM) $(TMPDIR)/libnon_bundled.a | $(CGREP) -e "U _*native_func" - $(NM) $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -ve "T _*native_func" - $(NM) $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -e "U _*native_func" - - # Build a cdylib, `native-staticlib` will not appear on the linker line because it was bundled previously - # The cdylib will contain the `native_func` symbol in the end - $(RUSTC) cdylib-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -ve '-l[" ]*native-staticlib' - $(NM) $(call DYLIB,cdylib_bundled) | $(CGREP) -e "[Tt] _*native_func" - - # Build a cdylib, `native-staticlib` will appear on the linker line because it was not bundled previously - # The cdylib will contain the `native_func` symbol in the end - $(RUSTC) cdylib-non-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -e '-l[" ]*native-staticlib' - $(NM) $(call DYLIB,cdylib_non_bundled) | $(CGREP) -e "[Tt] _*native_func" diff --git a/tests/run-make/native-link-modifier-bundle/rmake.rs b/tests/run-make/native-link-modifier-bundle/rmake.rs new file mode 100644 index 00000000000..058b66b15f1 --- /dev/null +++ b/tests/run-make/native-link-modifier-bundle/rmake.rs @@ -0,0 +1,90 @@ +// This test exercises the `bundle` link argument, which can be turned on or off. + +// When building a rlib or staticlib, +bundle means that all object files from the native static +// library will be added to the rlib or staticlib archive, and then used from it during linking of +// the final binary. + +// When building a rlib -bundle means that the native static library is registered as a dependency +// of that rlib "by name", and object files from it are included only during linking of the final +// binary, the file search by that name is also performed during final linking. +// When building a staticlib -bundle means that the native static library is simply not included +// into the archive and some higher level build system will need to add it later during linking of +// the final binary. + +// This modifier has no effect when building other targets like executables or dynamic libraries. + +// The default for this modifier is +bundle. +// See https://github.com/rust-lang/rust/pull/95818 + +//@ ignore-cross-compile +// Reason: cross-compilation fails to export native symbols + +use run_make_support::{ + build_native_static_lib, dynamic_lib_name, is_msvc, llvm_nm, rust_lib_name, rustc, + static_lib_name, +}; + +fn main() { + build_native_static_lib("native-staticlib"); + // Build a staticlib and a rlib, the `native_func` symbol will be bundled into them + rustc().input("bundled.rs").crate_type("staticlib").crate_type("rlib").run(); + llvm_nm() + .input(static_lib_name("bundled")) + .run() + .assert_stdout_contains_regex("T _*native_func"); + llvm_nm() + .input(static_lib_name("bundled")) + .run() + .assert_stdout_contains_regex("U _*native_func"); + llvm_nm().input(rust_lib_name("bundled")).run().assert_stdout_contains_regex("T _*native_func"); + llvm_nm().input(rust_lib_name("bundled")).run().assert_stdout_contains_regex("U _*native_func"); + + // Build a staticlib and a rlib, the `native_func` symbol will not be bundled into it + build_native_static_lib("native-staticlib"); + rustc().input("non-bundled.rs").crate_type("staticlib").crate_type("rlib").run(); + llvm_nm() + .input(static_lib_name("non_bundled")) + .run() + .assert_stdout_not_contains_regex("T _*native_func"); + llvm_nm() + .input(static_lib_name("non_bundled")) + .run() + .assert_stdout_contains_regex("U _*native_func"); + llvm_nm() + .input(rust_lib_name("non_bundled")) + .run() + .assert_stdout_not_contains_regex("T _*native_func"); + llvm_nm() + .input(rust_lib_name("non_bundled")) + .run() + .assert_stdout_contains_regex("U _*native_func"); + + // This part of the test does not function on Windows MSVC - no symbols are printed. + if !is_msvc() { + // Build a cdylib, `native-staticlib` will not appear on the linker line because it was + // bundled previously. The cdylib will contain the `native_func` symbol in the end. + rustc() + .input("cdylib-bundled.rs") + .crate_type("cdylib") + .print("link-args") + .run() + .assert_stdout_not_contains(r#"-l[" ]*native-staticlib"#); + llvm_nm() + .input(dynamic_lib_name("cdylib_bundled")) + .run() + .assert_stdout_contains_regex("[Tt] _*native_func"); + + // Build a cdylib, `native-staticlib` will appear on the linker line because it was not + // bundled previously. The cdylib will contain the `native_func` symbol in the end + rustc() + .input("cdylib-non-bundled.rs") + .crate_type("cdylib") + .print("link-args") + .run() + .assert_stdout_contains_regex(r#"-l[" ]*native-staticlib"#); + llvm_nm() + .input(dynamic_lib_name("cdylib_non_bundled")) + .run() + .assert_stdout_contains_regex("[Tt] _*native_func"); + } +} diff --git a/tests/run-make/no-alloc-shim/Makefile b/tests/run-make/no-alloc-shim/Makefile deleted file mode 100644 index 568e3f9ba1d..00000000000 --- a/tests/run-make/no-alloc-shim/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -include ../tools.mk - -# ignore-cross-compile -# ignore-msvc FIXME(bjorn3) can't figure out how to link with the MSVC toolchain - -TARGET_LIBDIR = $$($(RUSTC) --print target-libdir) - -all: - $(RUSTC) foo.rs --crate-type bin --emit obj -Cpanic=abort -ifdef IS_MSVC - $(CC) $(CFLAGS) $(TMPDIR)/foo.o $(call OUT_EXE,foo) /link $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib - $(call OUT_EXE,foo) -else - $(CC) $(CFLAGS) $(TMPDIR)/foo.o $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib -o $(call RUN_BINFILE,foo) - $(call RUN_BINFILE,foo) -endif - - # Check that linking without __rust_no_alloc_shim_is_unstable defined fails - $(RUSTC) foo.rs --crate-type bin --emit obj -Cpanic=abort --cfg check_feature_gate -ifdef IS_MSVC - $(CC) $(CFLAGS) $(TMPDIR)/foo.o $(call OUT_EXE,foo) /link $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib || exit 0 && exit 1 -else - $(CC) $(CFLAGS) $(TMPDIR)/foo.o $(TARGET_LIBDIR)/liballoc-*.rlib $(TARGET_LIBDIR)/libcore-*.rlib $(TARGET_LIBDIR)/libcompiler_builtins-*.rlib -o $(call RUN_BINFILE,foo) || exit 0 && exit 1 -endif diff --git a/tests/run-make/no-alloc-shim/rmake.rs b/tests/run-make/no-alloc-shim/rmake.rs new file mode 100644 index 00000000000..c398a3177df --- /dev/null +++ b/tests/run-make/no-alloc-shim/rmake.rs @@ -0,0 +1,55 @@ +// This test checks the compatibility of the interaction between `--emit obj` and +// `#[global_allocator]`, as it is now possible to invoke the latter without the +// allocator shim since #86844. As this feature is unstable, it should fail if +// --cfg check_feature_gate is passed. +// See https://github.com/rust-lang/rust/pull/86844 + +//@ ignore-cross-compile +// Reason: the compiled binary is executed + +//@ ignore-msvc +//FIXME(Oneirical): Getting this to work on MSVC requires passing libcmt.lib to CC, +// which is not trivial to do. +// Tracking issue: https://github.com/rust-lang/rust/issues/128602 +// Discussion: https://github.com/rust-lang/rust/pull/128407#discussion_r1702439172 + +use run_make_support::{cc, cwd, has_extension, has_prefix, run, rustc, shallow_find_files}; + +fn main() { + rustc().input("foo.rs").crate_type("bin").emit("obj").panic("abort").run(); + let libdir = rustc().print("target-libdir").run().stdout_utf8(); + let libdir = libdir.trim(); + + let alloc_libs = shallow_find_files(&libdir, |path| { + has_prefix(path, "liballoc-") && has_extension(path, "rlib") + }); + let core_libs = shallow_find_files(&libdir, |path| { + has_prefix(path, "libcore-") && has_extension(path, "rlib") + }); + let compiler_builtins_libs = shallow_find_files(libdir, |path| { + has_prefix(path, "libcompiler_builtins") && has_extension(path, "rlib") + }); + + cc().input("foo.o") + .out_exe("foo") + .args(&alloc_libs) + .args(&core_libs) + .args(&compiler_builtins_libs) + .run(); + run("foo"); + + // Check that linking without __rust_no_alloc_shim_is_unstable defined fails + rustc() + .input("foo.rs") + .crate_type("bin") + .emit("obj") + .panic("abort") + .cfg("check_feature_gate") + .run(); + cc().input("foo.o") + .out_exe("foo") + .args(&alloc_libs) + .args(&core_libs) + .args(&compiler_builtins_libs) + .run_fail(); +} diff --git a/tests/run-make/pretty-print-with-dep-file/rmake.rs b/tests/run-make/pretty-print-with-dep-file/rmake.rs index 5d422085834..24ae6bc2456 100644 --- a/tests/run-make/pretty-print-with-dep-file/rmake.rs +++ b/tests/run-make/pretty-print-with-dep-file/rmake.rs @@ -5,14 +5,12 @@ // does not get an unexpected dep-info file. // See https://github.com/rust-lang/rust/issues/112898 -use std::path::Path; - -use run_make_support::{invalid_utf8_contains, rfs, rustc}; +use run_make_support::{invalid_utf8_contains, path, rfs, rustc}; fn main() { rustc().emit("dep-info").arg("-Zunpretty=expanded").input("with-dep.rs").run(); invalid_utf8_contains("with-dep.d", "with-dep.rs"); rfs::remove_file("with-dep.d"); rustc().emit("dep-info").arg("-Zunpretty=normal").input("with-dep.rs").run(); - assert!(!Path::new("with-dep.d").exists()); + assert!(!path("with-dep.d").exists()); } diff --git a/tests/run-make/print-cfg/rmake.rs b/tests/run-make/print-cfg/rmake.rs index 471a99b90d9..7b8b760ea33 100644 --- a/tests/run-make/print-cfg/rmake.rs +++ b/tests/run-make/print-cfg/rmake.rs @@ -5,6 +5,11 @@ //! //! It also checks that some targets have the correct set cfgs. +// ignore-tidy-linelength +//@ needs-llvm-components: arm x86 +// Note: without the needs-llvm-components it will fail on LLVM built without the required +// components listed above. + use std::collections::HashSet; use std::iter::FromIterator; use std::path::PathBuf; diff --git a/tests/run-make/print-target-list/rmake.rs b/tests/run-make/print-target-list/rmake.rs index 743ed52069d..04ef8440104 100644 --- a/tests/run-make/print-target-list/rmake.rs +++ b/tests/run-make/print-target-list/rmake.rs @@ -1,10 +1,15 @@ -// Checks that all the targets returned by `rustc --print target-list` are valid -// target specifications +// Checks that all the targets returned by `rustc --print target-list` are valid target +// specifications. + +// ignore-tidy-linelength +//@ needs-llvm-components: aarch64 arm avr bpf csky hexagon loongarch m68k mips msp430 nvptx powerpc riscv sparc systemz webassembly x86 +// FIXME(jieyouxu): there has to be a better way to do this, without the needs-llvm-components it +// will fail on LLVM built without all of the components listed above. use run_make_support::bare_rustc; -// FIXME(127877): certain experimental targets fail with creating a 'LLVM TargetMachine' -// in CI, so we skip them +// FIXME(#127877): certain experimental targets fail with creating a 'LLVM TargetMachine' in CI, so +// we skip them. const EXPERIMENTAL_TARGETS: &[&str] = &["avr", "m68k", "csky", "xtensa"]; fn main() { diff --git a/tests/run-make/print-to-output/rmake.rs b/tests/run-make/print-to-output/rmake.rs index db2a291f8e7..a85ab5e23b0 100644 --- a/tests/run-make/print-to-output/rmake.rs +++ b/tests/run-make/print-to-output/rmake.rs @@ -1,5 +1,11 @@ -//! This checks the output of some `--print` options when -//! output to a file (instead of stdout) +//! This checks the output of some `--print` options when output to a file (instead of stdout) + +// ignore-tidy-linelength +//@ needs-llvm-components: aarch64 arm avr bpf csky hexagon loongarch m68k mips msp430 nvptx powerpc riscv sparc systemz webassembly x86 +// FIXME(jieyouxu): there has to be a better way to do this, without the needs-llvm-components it +// will fail on LLVM built without all of the components listed above. If adding a new target that +// relies on a llvm component not listed above, it will need to be added to the required llvm +// components above. use std::path::PathBuf; diff --git a/tests/run-make/profile/rmake.rs b/tests/run-make/profile/rmake.rs index 4c6f9c19091..4287ab0a931 100644 --- a/tests/run-make/profile/rmake.rs +++ b/tests/run-make/profile/rmake.rs @@ -8,16 +8,14 @@ //@ ignore-cross-compile //@ needs-profiler-support -use std::path::Path; - -use run_make_support::{run, rustc}; +use run_make_support::{path, run, rustc}; fn main() { rustc().arg("-g").arg("-Zprofile").input("test.rs").run(); run("test"); - assert!(Path::new("test.gcno").exists(), "no .gcno file"); - assert!(Path::new("test.gcda").exists(), "no .gcda file"); + assert!(path("test.gcno").exists(), "no .gcno file"); + assert!(path("test.gcda").exists(), "no .gcda file"); rustc().arg("-g").arg("-Zprofile").arg("-Zprofile-emit=abc/abc.gcda").input("test.rs").run(); run("test"); - assert!(Path::new("abc/abc.gcda").exists(), "gcda file not emitted to defined path"); + assert!(path("abc/abc.gcda").exists(), "gcda file not emitted to defined path"); } diff --git a/tests/run-make/remap-path-prefix-dwarf/Makefile b/tests/run-make/remap-path-prefix-dwarf/Makefile deleted file mode 100644 index 8905a00ea28..00000000000 --- a/tests/run-make/remap-path-prefix-dwarf/Makefile +++ /dev/null @@ -1,112 +0,0 @@ -# This test makes sure that --remap-path-prefix has the expected effects on paths in debuginfo. -# It tests several cases, each of them has a detailed description attached to it. - -# ignore-windows - -include ../tools.mk - -SRC_DIR := $(abspath .) -SRC_DIR_PARENT := $(abspath ..) - -ifeq ($(UNAME),Darwin) - DEBUGINFOOPTS := -Csplit-debuginfo=off -else - DEBUGINFOOPTS := -endif - -all: \ - abs_input_outside_working_dir \ - rel_input_remap_working_dir \ - rel_input_remap_working_dir_scope \ - rel_input_remap_working_dir_parent \ - rel_input_remap_working_dir_child \ - rel_input_remap_working_dir_diagnostics \ - abs_input_inside_working_dir \ - abs_input_inside_working_dir_scope \ - abs_input_outside_working_dir - -# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path *is* within -# the working directory of the compiler. We are remapping the path that contains `src`. -abs_input_inside_working_dir: - # We explicitly switch to a directory that *is* a prefix of the directory our - # source code is contained in. - cd $(SRC_DIR) && $(RUSTC) $(SRC_DIR)/src/quux.rs -o "$(TMPDIR)/abs_input_inside_working_dir.rlib" -Cdebuginfo=2 --remap-path-prefix $(SRC_DIR)=REMAPPED - # We expect the path to the main source file to be remapped. - "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir.rlib | $(CGREP) "REMAPPED/src/quux.rs" - # No weird duplication of remapped components (see #78479) - "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir.rlib | $(CGREP) -v "REMAPPED/REMAPPED" - -# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path *is* within -# the working directory of the compiler. We are remapping the path that contains `src`. -abs_input_inside_working_dir_scope: - # We explicitly switch to a directory that *is* a prefix of the directory our - # source code is contained in. - cd $(SRC_DIR) && $(RUSTC) $(SRC_DIR)/src/quux.rs -o "$(TMPDIR)/abs_input_inside_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix $(SRC_DIR)=REMAPPED -Zremap-path-scope=object $(DEBUGINFOOPTS) - # We expect the path to the main source file to be remapped. - "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir_scope.rlib | $(CGREP) "REMAPPED/src/quux.rs" - # No weird duplication of remapped components (see #78479) - "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir_scope.rlib | $(CGREP) -v "REMAPPED/REMAPPED" - -# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path is *not* within -# the working directory of the compiler. We are remapping both the path that contains `src` and -# the working directory to the same thing. This setup corresponds to a workaround that is needed -# when trying to remap everything to something that looks like a local path. -# Relative paths are interpreted as relative to the compiler's working directory (e.g. in -# debuginfo). If we also remap the working directory, the compiler strip it from other paths so -# that the final outcome is the desired one again. -abs_input_outside_working_dir: - # We explicitly switch to a directory that is *not* a prefix of the directory our - # source code is contained in. - cd $(TMPDIR) && $(RUSTC) $(SRC_DIR)/src/quux.rs -o "$(TMPDIR)/abs_input_outside_working_dir.rlib" -Cdebuginfo=2 --remap-path-prefix $(SRC_DIR)=REMAPPED --remap-path-prefix $(TMPDIR)=REMAPPED - "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_outside_working_dir.rlib | $(CGREP) "REMAPPED/src/quux.rs" - # No weird duplication of remapped components (see #78479) - "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_outside_working_dir.rlib | $(CGREP) -v "REMAPPED/REMAPPED" - -# The compiler is called with a *RELATIVE PATH* as input. We are remapping the working directory of -# the compiler, which naturally is an implicit prefix of our relative input path. Debuginfo will -# expand the relative path to an absolute path and we expect the working directory to be remapped -# in that expansion. -rel_input_remap_working_dir: - cd $(SRC_DIR) && $(RUSTC) src/quux.rs -o "$(TMPDIR)/rel_input_remap_working_dir.rlib" -Cdebuginfo=2 --remap-path-prefix "$(SRC_DIR)=REMAPPED" - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir.rlib" | $(CGREP) "REMAPPED/src/quux.rs" - # No weird duplication of remapped components (see #78479) - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir.rlib" | $(CGREP) -v "REMAPPED/REMAPPED" - -# The compiler is called with a *RELATIVE PATH* as input. We are remapping the working directory of -# the compiler, which naturally is an implicit prefix of our relative input path. Debuginfo will -# expand the relative path to an absolute path and we expect the working directory to be remapped -# in that expansion. -rel_input_remap_working_dir_scope: - cd $(SRC_DIR) && $(RUSTC) src/quux.rs -o "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix "$(SRC_DIR)=REMAPPED" -Zremap-path-scope=object $(DEBUGINFOOPTS) - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) "REMAPPED/src/quux.rs" - # No weird duplication of remapped components (see #78479) - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/REMAPPED" - -rel_input_remap_working_dir_diagnostics: - cd $(SRC_DIR) && $(RUSTC) src/quux.rs -o "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix "$(SRC_DIR)=REMAPPED" -Zremap-path-scope=diagnostics $(DEBUGINFOOPTS) - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/src/quux.rs" - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/REMAPPED" - -# The compiler is called with a *RELATIVE PATH* as input. We are remapping a *SUB-DIRECTORY* of the -# compiler's working directory. This test makes sure that that directory is remapped even though it -# won't actually show up in this form in the compiler's SourceMap and instead is only constructed -# on demand during debuginfo generation. -rel_input_remap_working_dir_child: - cd $(SRC_DIR) && $(RUSTC) src/quux.rs -o "$(TMPDIR)/rel_input_remap_working_dir_child.rlib" -Cdebuginfo=2 --remap-path-prefix "$(SRC_DIR)/src=REMAPPED" - # We expect `src/quux.rs` to have been remapped to `REMAPPED/quux.rs`. - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_child.rlib" | $(CGREP) "REMAPPED/quux.rs" - # We don't want to find the path that we just remapped anywhere in the DWARF - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_child.rlib" | $(CGREP) -v "$(SRC_DIR)/src" - # No weird duplication of remapped components (see #78479) - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_child.rlib" | $(CGREP) -v "REMAPPED/REMAPPED" - -# The compiler is called with a *RELATIVE PATH* as input. We are remapping a *PARENT DIRECTORY* of -# the compiler's working directory. -rel_input_remap_working_dir_parent: - cd $(SRC_DIR) && $(RUSTC) src/quux.rs -o "$(TMPDIR)/rel_input_remap_working_dir_parent.rlib" -Cdebuginfo=2 --remap-path-prefix "$(SRC_DIR_PARENT)=REMAPPED" - # We expect `src/quux.rs` to have been remapped to `REMAPPED/remap-path-prefix-dwarf/src/quux.rs`. - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_parent.rlib" | $(CGREP) "REMAPPED/remap-path-prefix-dwarf/src/quux.rs" - # We don't want to find the path that we just remapped anywhere in the DWARF - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_parent.rlib" | $(CGREP) -v "$(SRC_DIR_PARENT)" - # No weird duplication of remapped components (see #78479) - "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_parent.rlib" | $(CGREP) -v "REMAPPED/REMAPPED" diff --git a/tests/run-make/remap-path-prefix-dwarf/rmake.rs b/tests/run-make/remap-path-prefix-dwarf/rmake.rs new file mode 100644 index 00000000000..ede1d615742 --- /dev/null +++ b/tests/run-make/remap-path-prefix-dwarf/rmake.rs @@ -0,0 +1,202 @@ +// This test makes sure that --remap-path-prefix has the expected effects on paths in debuginfo. +// We explicitly switch to a directory that *is* a prefix of the directory our +// source code is contained in. +// It tests several cases, each of them has a detailed description attached to it. +// See https://github.com/rust-lang/rust/pull/96867 + +//@ ignore-windows +// Reason: the remap path prefix is not printed in the dwarf dump. + +use run_make_support::{cwd, is_darwin, llvm_dwarfdump, rust_lib_name, rustc}; + +fn main() { + // The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path *is* within + // the working directory of the compiler. We are remapping the path that contains `src`. + check_dwarf(DwarfTest { + lib_name: "abs_input_inside_working_dir", + input_path: PathType::Absolute, + scope: None, + remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().display())), + dwarf_test: DwarfDump::ContainsSrcPath, + }); + check_dwarf(DwarfTest { + lib_name: "abs_input_inside_working_dir_scope", + input_path: PathType::Absolute, + scope: Some(ScopeType::Object), + remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().display())), + dwarf_test: DwarfDump::ContainsSrcPath, + }); + // The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path is *not* + // within the working directory of the compiler. We are remapping both the path that contains + // `src` and the working directory to the same thing. This setup corresponds to a workaround + // that is needed when trying to remap everything to something that looks like a local + // path. Relative paths are interpreted as relative to the compiler's working directory (e.g. + // in debuginfo). If we also remap the working directory, the compiler strip it from other + // paths so that the final outcome is the desired one again. + check_dwarf(DwarfTest { + lib_name: "abs_input_outside_working_dir", + input_path: PathType::Absolute, + scope: None, + remap_path_prefix: PrefixType::Dual(( + format!("{}=REMAPPED", cwd().display()), + "rmake_out=REMAPPED".to_owned(), + )), + dwarf_test: DwarfDump::ContainsSrcPath, + }); + // The compiler is called with a *RELATIVE PATH* as input. We are remapping the working + // directory of the compiler, which naturally is an implicit prefix of our relative input path. + // Debuginfo will expand the relative path to an absolute path and we expect the working + // directory to be remapped in that expansion. + check_dwarf(DwarfTest { + lib_name: "rel_input_remap_working_dir", + input_path: PathType::Relative, + scope: None, + remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().display())), + dwarf_test: DwarfDump::ContainsSrcPath, + }); + check_dwarf(DwarfTest { + lib_name: "rel_input_remap_working_dir_scope", + input_path: PathType::Relative, + scope: Some(ScopeType::Object), + remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().display())), + dwarf_test: DwarfDump::ContainsSrcPath, + }); + check_dwarf(DwarfTest { + lib_name: "rel_input_remap_working_dir_scope", + input_path: PathType::Relative, + scope: Some(ScopeType::Diagnostics), + remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().display())), + dwarf_test: DwarfDump::AvoidSrcPath, + }); + // The compiler is called with a *RELATIVE PATH* as input. We are remapping a *SUB-DIRECTORY* + // of the compiler's working directory. This test makes sure that that directory is remapped + // even though it won't actually show up in this form in the compiler's SourceMap and instead + // is only constructed on demand during debuginfo generation. + check_dwarf(DwarfTest { + lib_name: "rel_input_remap_working_dir_child", + input_path: PathType::Relative, + scope: None, + remap_path_prefix: PrefixType::Regular(format!("{}=REMAPPED", cwd().join("src").display())), + dwarf_test: DwarfDump::ChildTest, + }); + // The compiler is called with a *RELATIVE PATH* as input. We are remapping a + // *PARENT DIRECTORY* of the compiler's working directory. + check_dwarf(DwarfTest { + lib_name: "rel_input_remap_working_dir_parent", + input_path: PathType::Relative, + scope: None, + remap_path_prefix: PrefixType::Regular(format!( + "{}=REMAPPED", + cwd().parent().unwrap().display() + )), + dwarf_test: DwarfDump::ParentTest, + }); +} + +#[track_caller] +fn check_dwarf(test: DwarfTest) { + let mut rustc = rustc(); + match test.input_path { + PathType::Absolute => rustc.input(cwd().join("src/quux.rs")), + PathType::Relative => rustc.input("src/quux.rs"), + }; + rustc.output(rust_lib_name(test.lib_name)); + rustc.arg("-Cdebuginfo=2"); + if let Some(scope) = test.scope { + match scope { + ScopeType::Object => rustc.arg("-Zremap-path-scope=object"), + ScopeType::Diagnostics => rustc.arg("-Zremap-path-scope=diagnostics"), + }; + if is_darwin() { + rustc.arg("-Csplit-debuginfo=off"); + } + } + match test.remap_path_prefix { + PrefixType::Regular(prefix) => { + // We explicitly switch to a directory that *is* a prefix of the directory our + // source code is contained in. + rustc.arg("--remap-path-prefix"); + rustc.arg(prefix); + } + PrefixType::Dual((prefix1, prefix2)) => { + // We explicitly switch to a directory that is *not* a prefix of the directory our + // source code is contained in. + rustc.arg("--remap-path-prefix"); + rustc.arg(prefix1); + rustc.arg("--remap-path-prefix"); + rustc.arg(prefix2); + } + } + rustc.run(); + match test.dwarf_test { + DwarfDump::ContainsSrcPath => { + llvm_dwarfdump() + .input(rust_lib_name(test.lib_name)) + .run() + // We expect the path to the main source file to be remapped. + .assert_stdout_contains("REMAPPED/src/quux.rs") + // No weird duplication of remapped components (see #78479) + .assert_stdout_not_contains("REMAPPED/REMAPPED"); + } + DwarfDump::AvoidSrcPath => { + llvm_dwarfdump() + .input(rust_lib_name(test.lib_name)) + .run() + .assert_stdout_not_contains("REMAPPED/src/quux.rs") + .assert_stdout_not_contains("REMAPPED/REMAPPED"); + } + DwarfDump::ChildTest => { + llvm_dwarfdump() + .input(rust_lib_name(test.lib_name)) + .run() + // We expect `src/quux.rs` to have been remapped to `REMAPPED/quux.rs`. + .assert_stdout_contains("REMAPPED/quux.rs") + // We don't want to find the path that we just remapped anywhere in the DWARF + .assert_stdout_not_contains(cwd().join("src").to_str().unwrap()) + // No weird duplication of remapped components (see #78479) + .assert_stdout_not_contains("REMAPPED/REMAPPED"); + } + DwarfDump::ParentTest => { + llvm_dwarfdump() + .input(rust_lib_name(test.lib_name)) + .run() + // We expect `src/quux.rs` to have been remapped to + // `REMAPPED/remap-path-prefix-dwarf/src/quux.rs`. + .assert_stdout_contains("REMAPPED/rmake_out/src/quux.rs") + // We don't want to find the path that we just remapped anywhere in the DWARF + .assert_stdout_not_contains(cwd().parent().unwrap().to_str().unwrap()) + // No weird duplication of remapped components (see #78479) + .assert_stdout_not_contains("REMAPPED/REMAPPED"); + } + }; +} + +struct DwarfTest { + lib_name: &'static str, + input_path: PathType, + scope: Option<ScopeType>, + remap_path_prefix: PrefixType, + dwarf_test: DwarfDump, +} + +enum PathType { + Absolute, + Relative, +} + +enum ScopeType { + Object, + Diagnostics, +} + +enum DwarfDump { + ContainsSrcPath, + AvoidSrcPath, + ChildTest, + ParentTest, +} + +enum PrefixType { + Regular(String), + Dual((String, String)), +} diff --git a/tests/run-make/remove-dir-all-race/rmake.rs b/tests/run-make/remove-dir-all-race/rmake.rs new file mode 100644 index 00000000000..03c94b76127 --- /dev/null +++ b/tests/run-make/remove-dir-all-race/rmake.rs @@ -0,0 +1,62 @@ +//@ ignore-windows + +// This test attempts to make sure that running `remove_dir_all` +// doesn't result in a NotFound error one of the files it +// is deleting is deleted concurrently. +// +// The windows implementation for `remove_dir_all` is significantly +// more complicated, and has not yet been brought up to par with +// the implementation on other platforms, so this test is marked as +// `ignore-windows` until someone more expirenced with windows can +// sort that out. + +use std::fs::remove_dir_all; +use std::path::Path; +use std::thread; +use std::time::Duration; + +use run_make_support::rfs::{create_dir, write}; +use run_make_support::run_in_tmpdir; + +fn main() { + let mut race_happened = false; + run_in_tmpdir(|| { + for i in 0..150 { + create_dir("outer"); + create_dir("outer/inner"); + write("outer/inner.txt", b"sometext"); + + thread::scope(|scope| { + let t1 = scope.spawn(|| { + thread::sleep(Duration::from_nanos(i)); + remove_dir_all("outer").unwrap(); + }); + + let race_happened_ref = &race_happened; + let t2 = scope.spawn(|| { + let r1 = remove_dir_all("outer/inner"); + let r2 = remove_dir_all("outer/inner.txt"); + if r1.is_ok() && r2.is_err() { + race_happened = true; + } + }); + }); + + assert!(!Path::new("outer").exists()); + + // trying to remove a nonexistant top-level directory should + // still result in an error. + let Err(err) = remove_dir_all("outer") else { + panic!("removing nonexistant dir did not result in an error"); + }; + assert_eq!(err.kind(), std::io::ErrorKind::NotFound); + } + }); + if !race_happened { + eprintln!( + "WARNING: multithreaded deletion never raced, \ + try increasing the number of attempts or \ + adjusting the sleep timing" + ); + } +} diff --git a/tests/run-make/reproducible-build/Makefile b/tests/run-make/reproducible-build/Makefile deleted file mode 100644 index f5d17a234c0..00000000000 --- a/tests/run-make/reproducible-build/Makefile +++ /dev/null @@ -1,140 +0,0 @@ -# ignore-cross-compile -include ../tools.mk - -# ignore-musl -# Objects are reproducible but their path is not. - -all: \ - smoke \ - debug \ - opt \ - link_paths \ - remap_paths \ - different_source_dirs_rlib \ - remap_cwd_rlib \ - remap_cwd_to_empty \ - extern_flags - -# TODO: Builds of `bin` crate types are not deterministic with debuginfo=2 on -# Windows. -# See: https://github.com/rust-lang/rust/pull/87320#issuecomment-920105533 -# Issue: https://github.com/rust-lang/rust/issues/88982 -# -# different_source_dirs_bin \ -# remap_cwd_bin \ - -smoke: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) linker.rs -O - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) - diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" - -debug: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) linker.rs -O - $(RUSTC) reproducible-build-aux.rs -g - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -g - diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" - -opt: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) linker.rs -O - $(RUSTC) reproducible-build-aux.rs -O - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O - $(RUSTC) reproducible-build.rs -C linker=$(call RUN_BINFILE,linker) -O - diff -u "$(TMPDIR)/linker-arguments1" "$(TMPDIR)/linker-arguments2" - -link_paths: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs --crate-type rlib -L /b - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - $(RUSTC) reproducible-build.rs --crate-type rlib -L /a - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 - -remap_paths: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/a=/c - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=/b=/c - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 - -different_source_dirs_bin: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type bin --remap-path-prefix=$$PWD=/b - cp $(TMPDIR)/reproducible-build $(TMPDIR)/foo - (cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \ - --remap-path-prefix=$(TMPDIR)/test=/b \ - --crate-type bin) - cmp "$(TMPDIR)/reproducible-build" "$(TMPDIR)/foo" || exit 1 - -different_source_dirs_rlib: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type rlib --remap-path-prefix=$$PWD=/b - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - (cd $(TMPDIR)/test && $(RUSTC) reproducible-build.rs \ - --remap-path-prefix=$(TMPDIR)/test=/b \ - --crate-type rlib) - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 - -remap_cwd_bin: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \ - -Z remap-cwd-prefix=. - cp $(TMPDIR)/reproducible-build $(TMPDIR)/first - (cd $(TMPDIR)/test && \ - $(RUSTC) reproducible-build.rs --crate-type bin -C debuginfo=2 \ - -Z remap-cwd-prefix=.) - cmp "$(TMPDIR)/first" "$(TMPDIR)/reproducible-build" || exit 1 - -remap_cwd_rlib: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix=. - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib - (cd $(TMPDIR)/test && \ - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix=.) - cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1 - -remap_cwd_to_empty: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - mkdir $(TMPDIR)/test - cp reproducible-build.rs $(TMPDIR)/test - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix= - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfirst.rlib - (cd $(TMPDIR)/test && \ - $(RUSTC) reproducible-build.rs --crate-type rlib -C debuginfo=2 \ - -Z remap-cwd-prefix=) - cmp "$(TMPDIR)/libfirst.rlib" "$(TMPDIR)/libreproducible_build.rlib" || exit 1 - -extern_flags: - rm -rf $(TMPDIR) && mkdir $(TMPDIR) - $(RUSTC) reproducible-build-aux.rs - $(RUSTC) reproducible-build.rs \ - --extern reproducible_build_aux=$(TMPDIR)/libreproducible_build_aux.rlib \ - --crate-type rlib - cp $(TMPDIR)/libreproducible_build_aux.rlib $(TMPDIR)/libbar.rlib - cp $(TMPDIR)/libreproducible_build.rlib $(TMPDIR)/libfoo.rlib - $(RUSTC) reproducible-build.rs \ - --extern reproducible_build_aux=$(TMPDIR)/libbar.rlib \ - --crate-type rlib - cmp "$(TMPDIR)/libreproducible_build.rlib" "$(TMPDIR)/libfoo.rlib" || exit 1 diff --git a/tests/run-make/reproducible-build/rmake.rs b/tests/run-make/reproducible-build/rmake.rs new file mode 100644 index 00000000000..34410d224fb --- /dev/null +++ b/tests/run-make/reproducible-build/rmake.rs @@ -0,0 +1,240 @@ +// This test case makes sure that two identical invocations of the compiler +// (i.e. same code base, same compile-flags, same compiler-versions, etc.) +// produce the same output. In the past, symbol names of monomorphized functions +// were not deterministic (which we want to avoid). +// +// The test tries to exercise as many different paths into symbol name +// generation as possible: +// +// - regular functions +// - generic functions +// - methods +// - statics +// - closures +// - enum variant constructors +// - tuple struct constructors +// - drop glue +// - FnOnce adapters +// - Trait object shims +// - Fn Pointer shims +// See https://github.com/rust-lang/rust/pull/32293 +// Tracking Issue: https://github.com/rust-lang/rust/issues/129080 + +use run_make_support::{ + bin_name, cwd, diff, is_darwin, is_windows, rfs, run_in_tmpdir, rust_lib_name, rustc, +}; + +fn main() { + // Smoke tests. Simple flags, build should be reproducible. + eprintln!("smoke_test => None"); + smoke_test(None); + eprintln!("smoke_test => SmokeFlag::Debug"); + smoke_test(Some(SmokeFlag::Debug)); + eprintln!("smoke_test => SmokeFlag::Opt"); + smoke_test(Some(SmokeFlag::Opt)); + + // Builds should be reproducible even through custom library search paths + // or remap path prefixes. + eprintln!("paths_test => PathsFlag::Link"); + paths_test(PathsFlag::Link); + eprintln!("paths_test => PathsFlag::Remap"); + paths_test(PathsFlag::Remap); + + // Builds should be reproducible even if each build is done in a different directory, + // with both --remap-path-prefix and -Z remap-cwd-prefix. + + // FIXME(Oneirical): Building with crate type set to `bin` AND having -Cdebuginfo=2 + // (or `-g`, the shorthand form) enabled will cause reproducibility failures. + // See https://github.com/rust-lang/rust/issues/89911 + + if !is_darwin() && !is_windows() { + // FIXME(Oneirical): Bin builds are not reproducible on non-Linux targets. + eprintln!("diff_dir_test => Bin, Path"); + diff_dir_test(CrateType::Bin, RemapType::Path); + } + + eprintln!("diff_dir_test => Rlib, Path"); + diff_dir_test(CrateType::Rlib, RemapType::Path); + + // FIXME(Oneirical): This specific case would fail on Linux, should -Cdebuginfo=2 + // be added. + // FIXME(Oneirical): Bin builds are not reproducible on non-Linux targets. + // See https://github.com/rust-lang/rust/issues/89911 + if !is_darwin() && !is_windows() { + eprintln!("diff_dir_test => Bin, Cwd false"); + diff_dir_test(CrateType::Bin, RemapType::Cwd { is_empty: false }); + } + + eprintln!("diff_dir_test => Rlib, Cwd false"); + diff_dir_test(CrateType::Rlib, RemapType::Cwd { is_empty: false }); + eprintln!("diff_dir_test => Rlib, Cwd true"); + diff_dir_test(CrateType::Rlib, RemapType::Cwd { is_empty: true }); + + eprintln!("final extern test"); + // Builds should be reproducible when using the --extern flag. + run_in_tmpdir(|| { + rustc().input("reproducible-build-aux.rs").run(); + rustc() + .input("reproducible-build.rs") + .crate_type("rlib") + .extern_("reproducible_build_aux", rust_lib_name("reproducible_build_aux")) + .run(); + rfs::copy(rust_lib_name("reproducible_build"), rust_lib_name("foo")); + rfs::copy(rust_lib_name("reproducible_build_aux"), rust_lib_name("bar")); + rustc() + .input("reproducible-build.rs") + .crate_type("rlib") + .extern_("reproducible_build_aux", rust_lib_name("bar")) + .run(); + assert!(rfs::read(rust_lib_name("foo")) == rfs::read(rust_lib_name("reproducible_build"))) + }); +} + +#[track_caller] +fn smoke_test(flag: Option<SmokeFlag>) { + run_in_tmpdir(|| { + rustc().input("linker.rs").opt().run(); + rustc().input("reproducible-build-aux.rs").run(); + let mut compiler1 = rustc(); + let mut compiler2 = rustc(); + if let Some(flag) = flag { + match flag { + SmokeFlag::Debug => { + compiler1.arg("-g"); + compiler2.arg("-g"); + } + SmokeFlag::Opt => { + compiler1.opt(); + compiler2.opt(); + } + }; + }; + compiler1 + .input("reproducible-build.rs") + .linker(&cwd().join(bin_name("linker")).display().to_string()) + .run(); + compiler2 + .input("reproducible-build.rs") + .linker(&cwd().join(bin_name("linker")).display().to_string()) + .run(); + diff().actual_file("linker-arguments1").expected_file("linker-arguments2").run(); + }); +} + +#[track_caller] +fn paths_test(flag: PathsFlag) { + run_in_tmpdir(|| { + rustc().input("reproducible-build-aux.rs").run(); + let mut compiler1 = rustc(); + let mut compiler2 = rustc(); + match flag { + PathsFlag::Link => { + compiler1.library_search_path("a"); + compiler2.library_search_path("b"); + } + PathsFlag::Remap => { + compiler1.arg("--remap-path-prefix=/a=/c"); + compiler2.arg("--remap-path-prefix=/b=/c"); + } + } + compiler1.input("reproducible-build.rs").crate_type("rlib").run(); + rfs::rename(rust_lib_name("reproducible_build"), rust_lib_name("foo")); + compiler2.input("reproducible-build.rs").crate_type("rlib").run(); + assert!(rfs::read(rust_lib_name("foo")) == rfs::read(rust_lib_name("reproducible_build"))) + }); +} + +#[track_caller] +fn diff_dir_test(crate_type: CrateType, remap_type: RemapType) { + run_in_tmpdir(|| { + let base_dir = cwd(); + rustc().input("reproducible-build-aux.rs").run(); + rfs::create_dir("test"); + rfs::copy("reproducible-build.rs", "test/reproducible-build.rs"); + let mut compiler1 = rustc(); + let mut compiler2 = rustc(); + match crate_type { + CrateType::Bin => { + compiler1.crate_type("bin"); + compiler2.crate_type("bin"); + } + CrateType::Rlib => { + compiler1.crate_type("rlib"); + compiler2.crate_type("rlib"); + } + } + match remap_type { + RemapType::Path => { + compiler1.arg(&format!("--remap-path-prefix={}=/b", cwd().display())); + compiler2 + .arg(format!("--remap-path-prefix={}=/b", base_dir.join("test").display())); + } + RemapType::Cwd { is_empty } => { + // FIXME(Oneirical): Building with crate type set to `bin` AND having -Cdebuginfo=2 + // (or `-g`, the shorthand form) enabled will cause reproducibility failures + // for multiple platforms. + // See https://github.com/rust-lang/rust/issues/89911 + // FIXME(#129117): Windows rlib + `-Cdebuginfo=2` + `-Z remap-cwd-prefix=.` seems + // to be unreproducible. + if !matches!(crate_type, CrateType::Bin) && !is_windows() { + compiler1.arg("-Cdebuginfo=2"); + compiler2.arg("-Cdebuginfo=2"); + } + if is_empty { + compiler1.arg("-Zremap-cwd-prefix="); + compiler2.arg("-Zremap-cwd-prefix="); + } else { + compiler1.arg("-Zremap-cwd-prefix=."); + compiler2.arg("-Zremap-cwd-prefix=."); + } + } + } + compiler1.input("reproducible-build.rs").run(); + match crate_type { + CrateType::Bin => { + rfs::rename(bin_name("reproducible-build"), bin_name("foo")); + } + CrateType::Rlib => { + rfs::rename(rust_lib_name("reproducible_build"), rust_lib_name("foo")); + } + } + std::env::set_current_dir("test").unwrap(); + compiler2 + .input("reproducible-build.rs") + .library_search_path(&base_dir) + .out_dir(&base_dir) + .run(); + std::env::set_current_dir(&base_dir).unwrap(); + match crate_type { + CrateType::Bin => { + assert!(rfs::read(bin_name("reproducible-build")) == rfs::read(bin_name("foo"))); + } + CrateType::Rlib => { + assert!( + rfs::read(rust_lib_name("foo")) + == rfs::read(rust_lib_name("reproducible_build")) + ); + } + } + }); +} + +enum SmokeFlag { + Debug, + Opt, +} + +enum PathsFlag { + Link, + Remap, +} + +enum CrateType { + Bin, + Rlib, +} + +enum RemapType { + Path, + Cwd { is_empty: bool }, +} diff --git a/tests/run-make/reset-codegen-1/rmake.rs b/tests/run-make/reset-codegen-1/rmake.rs index 118b3a666ad..bdc90e39f9e 100644 --- a/tests/run-make/reset-codegen-1/rmake.rs +++ b/tests/run-make/reset-codegen-1/rmake.rs @@ -7,9 +7,7 @@ //@ ignore-cross-compile -use std::path::Path; - -use run_make_support::{bin_name, rustc}; +use run_make_support::{bin_name, path, rustc}; fn compile(output_file: &str, emit: Option<&str>) { let mut rustc = rustc(); @@ -34,10 +32,10 @@ fn main() { // In the None case, bin_name is required for successful Windows compilation. let output_file = &bin_name(output_file); compile(output_file, emit); - assert!(Path::new(output_file).is_file()); + assert!(path(output_file).is_file()); } compile("multi-output", Some("asm,obj")); - assert!(Path::new("multi-output.s").is_file()); - assert!(Path::new("multi-output.o").is_file()); + assert!(path("multi-output.s").is_file()); + assert!(path("multi-output.o").is_file()); } diff --git a/tests/run-make/rlib-format-packed-bundled-libs/Makefile b/tests/run-make/rlib-format-packed-bundled-libs/Makefile deleted file mode 100644 index f454da67893..00000000000 --- a/tests/run-make/rlib-format-packed-bundled-libs/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -include ../tools.mk - -# ignore-cross-compile - -# Make sure rlib format with -Zpacked_bundled_libs is correct. - -# We're using the llvm-nm instead of the system nm to ensure it is compatible -# with the LLVM bitcode generated by rustc. -# Except on Windows where piping/IO redirection under MSYS2 is wonky with llvm-nm. -ifndef IS_WINDOWS -NM = "$(LLVM_BIN_DIR)"/llvm-nm -else -NM = nm -endif - -all: $(call NATIVE_STATICLIB,native_dep_1) $(call NATIVE_STATICLIB,native_dep_2) $(call NATIVE_STATICLIB,native_dep_3) - $(RUSTC) rust_dep_up.rs --crate-type=rlib -Zpacked_bundled_libs - $(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) -e "U.*native_f2" - $(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) -e "U.*native_f3" - $(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) -e "T.*rust_dep_up" - $(AR) t $(TMPDIR)/librust_dep_up.rlib | $(CGREP) "native_dep_2" - $(AR) t $(TMPDIR)/librust_dep_up.rlib | $(CGREP) "native_dep_3" - $(RUSTC) rust_dep_local.rs --extern rlib=$(TMPDIR)/librust_dep_up.rlib -Zpacked_bundled_libs --crate-type=rlib - $(NM) $(TMPDIR)/librust_dep_local.rlib | $(CGREP) -e "U.*native_f1" - $(NM) $(TMPDIR)/librust_dep_local.rlib | $(CGREP) -e "T.*rust_dep_local" - $(AR) t $(TMPDIR)/librust_dep_local.rlib | $(CGREP) "native_dep_1" - - # Make sure compiler doesn't use files, that it shouldn't know about. - rm $(TMPDIR)/*native_dep_* - - $(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep_local.rlib -o $(TMPDIR)/main.exe -Zpacked_bundled_libs --print link-args | $(CGREP) -e "native_dep_1.*native_dep_2.*native_dep_3" - -ifndef IS_MSVC - $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*native_f1" - $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*native_f2" - $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*native_f3" - $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*rust_dep_local" - $(NM) $(TMPDIR)/main.exe | $(CGREP) -e "T.*rust_dep_up" -endif diff --git a/tests/run-make/rlib-format-packed-bundled-libs/rmake.rs b/tests/run-make/rlib-format-packed-bundled-libs/rmake.rs new file mode 100644 index 00000000000..ff0438a6b72 --- /dev/null +++ b/tests/run-make/rlib-format-packed-bundled-libs/rmake.rs @@ -0,0 +1,84 @@ +// `-Z packed_bundled_libs` is an unstable rustc flag that makes the compiler +// only require a native library and no supplementary object files to compile. +// Output files compiled with this flag should still contain all expected symbols - +// that is what this test checks. +// See https://github.com/rust-lang/rust/pull/100101 + +//@ ignore-cross-compile +// Reason: cross-compilation fails to export native symbols + +use run_make_support::{ + bin_name, build_native_static_lib, cwd, filename_contains, is_msvc, llvm_ar, llvm_nm, rfs, + rust_lib_name, rustc, shallow_find_files, +}; + +fn main() { + build_native_static_lib("native_dep_1"); + build_native_static_lib("native_dep_2"); + build_native_static_lib("native_dep_3"); + rustc().input("rust_dep_up.rs").crate_type("rlib").arg("-Zpacked_bundled_libs").run(); + llvm_nm() + .input(rust_lib_name("rust_dep_up")) + .run() + .assert_stdout_contains_regex("U.*native_f2"); + llvm_nm() + .input(rust_lib_name("rust_dep_up")) + .run() + .assert_stdout_contains_regex("U.*native_f3"); + llvm_nm() + .input(rust_lib_name("rust_dep_up")) + .run() + .assert_stdout_contains_regex("T.*rust_dep_up"); + llvm_ar() + .table_of_contents() + .arg(rust_lib_name("rust_dep_up")) + .run() + .assert_stdout_contains("native_dep_2"); + llvm_ar() + .table_of_contents() + .arg(rust_lib_name("rust_dep_up")) + .run() + .assert_stdout_contains("native_dep_3"); + rustc() + .input("rust_dep_local.rs") + .extern_("rlib", rust_lib_name("rust_dep_up")) + .arg("-Zpacked_bundled_libs") + .crate_type("rlib") + .run(); + llvm_nm() + .input(rust_lib_name("rust_dep_local")) + .run() + .assert_stdout_contains_regex("U.*native_f1"); + llvm_nm() + .input(rust_lib_name("rust_dep_local")) + .run() + .assert_stdout_contains_regex("T.*rust_dep_local"); + llvm_ar() + .table_of_contents() + .arg(rust_lib_name("rust_dep_local")) + .run() + .assert_stdout_contains("native_dep_1"); + + // Ensure the compiler will not use files it should not know about. + for file in shallow_find_files(cwd(), |path| filename_contains(path, "native_dep_")) { + rfs::remove_file(file); + } + + rustc() + .input("main.rs") + .extern_("lib", rust_lib_name("rust_dep_local")) + .output(bin_name("main")) + .arg("-Zpacked_bundled_libs") + .print("link-args") + .run() + .assert_stdout_contains_regex("native_dep_1.*native_dep_2.*native_dep_3"); + + // The binary "main" will not contain any symbols on MSVC. + if !is_msvc() { + llvm_nm().input(bin_name("main")).run().assert_stdout_contains_regex("T.*native_f1"); + llvm_nm().input(bin_name("main")).run().assert_stdout_contains_regex("T.*native_f2"); + llvm_nm().input(bin_name("main")).run().assert_stdout_contains_regex("T.*native_f3"); + llvm_nm().input(bin_name("main")).run().assert_stdout_contains_regex("T.*rust_dep_local"); + llvm_nm().input(bin_name("main")).run().assert_stdout_contains_regex("T.*rust_dep_up"); + } +} diff --git a/tests/run-make/rust-lld-compress-debug-sections/rmake.rs b/tests/run-make/rust-lld-compress-debug-sections/rmake.rs deleted file mode 100644 index ea4997fab80..00000000000 --- a/tests/run-make/rust-lld-compress-debug-sections/rmake.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Checks the `compress-debug-sections` option on rust-lld. - -//@ needs-rust-lld -//@ only-linux -//@ ignore-cross-compile - -// FIXME: This test isn't comprehensive and isn't covering all possible combinations. - -use run_make_support::{assert_contains, llvm_readobj, run_in_tmpdir, rustc}; - -fn check_compression(compression: &str, to_find: &str) { - run_in_tmpdir(|| { - let out = rustc() - .arg("-Zlinker-features=+lld") - .arg("-Clink-self-contained=+linker") - .arg("-Zunstable-options") - .arg("-Cdebuginfo=full") - .link_arg(&format!("-Wl,--compress-debug-sections={compression}")) - .input("main.rs") - .run_unchecked(); - let stderr = out.stderr_utf8(); - if stderr.is_empty() { - llvm_readobj().arg("-t").arg("main").run().assert_stdout_contains(to_find); - } else { - assert_contains( - stderr, - format!( - "LLVM was not built with LLVM_ENABLE_{to_find} \ - or did not find {compression} at build time" - ), - ); - } - }); -} - -fn main() { - check_compression("zlib", "ZLIB"); - check_compression("zstd", "ZSTD"); -} diff --git a/tests/run-make/rustdoc-determinism/rmake.rs b/tests/run-make/rustdoc-determinism/rmake.rs index aa8090174d9..5a030c6f496 100644 --- a/tests/run-make/rustdoc-determinism/rmake.rs +++ b/tests/run-make/rustdoc-determinism/rmake.rs @@ -1,18 +1,16 @@ // Assert that the search index is generated deterministically, regardless of the // order that crates are documented in. -use std::path::Path; - -use run_make_support::{diff, rustdoc}; +use run_make_support::{diff, path, rustdoc}; fn main() { - let foo_first = Path::new("foo_first"); - rustdoc().input("foo.rs").output(&foo_first).run(); - rustdoc().input("bar.rs").output(&foo_first).run(); + let foo_first = path("foo_first"); + rustdoc().input("foo.rs").out_dir(&foo_first).run(); + rustdoc().input("bar.rs").out_dir(&foo_first).run(); - let bar_first = Path::new("bar_first"); - rustdoc().input("bar.rs").output(&bar_first).run(); - rustdoc().input("foo.rs").output(&bar_first).run(); + let bar_first = path("bar_first"); + rustdoc().input("bar.rs").out_dir(&bar_first).run(); + rustdoc().input("foo.rs").out_dir(&bar_first).run(); diff() .expected_file(foo_first.join("search-index.js")) diff --git a/tests/run-make/rustdoc-io-error/rmake.rs b/tests/run-make/rustdoc-io-error/rmake.rs index a5fae36e733..31441d7ebc5 100644 --- a/tests/run-make/rustdoc-io-error/rmake.rs +++ b/tests/run-make/rustdoc-io-error/rmake.rs @@ -25,7 +25,7 @@ fn main() { permissions.set_readonly(true); rfs::set_permissions(&out_dir, permissions); - let output = rustdoc().input("foo.rs").output(&out_dir).env("RUST_BACKTRACE", "1").run_fail(); + let output = rustdoc().input("foo.rs").out_dir(&out_dir).env("RUST_BACKTRACE", "1").run_fail(); rfs::set_permissions(&out_dir, original_permissions); diff --git a/tests/run-make/rustdoc-map-file/rmake.rs b/tests/run-make/rustdoc-map-file/rmake.rs index 08f9595ef9f..d7e3510fe31 100644 --- a/tests/run-make/rustdoc-map-file/rmake.rs +++ b/tests/run-make/rustdoc-map-file/rmake.rs @@ -1,13 +1,54 @@ -use run_make_support::{python_command, rustdoc}; +// This test ensures that all items from `foo` are correctly generated into the `redirect-map.json` +// file with `--generate-redirect-map` rustdoc option. + +use std::path::Path; + +use run_make_support::rfs::read_to_string; +use run_make_support::{path, rustdoc, serde_json}; fn main() { let out_dir = "out"; + let crate_name = "foo"; rustdoc() .input("foo.rs") + .crate_name(crate_name) .arg("-Zunstable-options") .arg("--generate-redirect-map") - .output(&out_dir) + .out_dir(&out_dir) .run(); - // FIXME (GuillaumeGomez): Port the python script to Rust as well. - python_command().arg("validate_json.py").arg(&out_dir).run(); + + let generated = read_to_string(path(out_dir).join(crate_name).join("redirect-map.json")); + let expected = read_to_string("expected.json"); + let generated: serde_json::Value = + serde_json::from_str(&generated).expect("failed to parse JSON"); + let expected: serde_json::Value = + serde_json::from_str(&expected).expect("failed to parse JSON"); + let expected = expected.as_object().unwrap(); + + let mut differences = Vec::new(); + for (key, expected_value) in expected.iter() { + match generated.get(key) { + Some(value) => { + if expected_value != value { + differences.push(format!( + "values for key `{key}` don't match: `{expected_value:?}` != `{value:?}`" + )); + } + } + None => differences.push(format!("missing key `{key}`")), + } + } + for (key, data) in generated.as_object().unwrap().iter() { + if !expected.contains_key(key) { + differences.push(format!("Extra data not expected: key: `{key}`, data: `{data}`")); + } + } + + if !differences.is_empty() { + eprintln!("Found differences in JSON files:"); + for diff in differences { + eprintln!("=> {diff}"); + } + panic!("Found differences in JSON files"); + } } diff --git a/tests/run-make/rustdoc-map-file/validate_json.py b/tests/run-make/rustdoc-map-file/validate_json.py deleted file mode 100755 index 912dea3791b..00000000000 --- a/tests/run-make/rustdoc-map-file/validate_json.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python - -import os -import sys -import json - - -def find_redirect_map_file(folder, errors): - for root, _dirs, files in os.walk(folder): - for name in files: - if not name.endswith("redirect-map.json"): - continue - with open(os.path.join(root, name)) as f: - data = json.load(f) - with open("expected.json") as f: - expected = json.load(f) - for key in expected: - if expected[key] != data.get(key): - errors.append("Expected `{}` for key `{}`, found: `{}`".format( - expected[key], key, data.get(key))) - else: - del data[key] - for key in data: - errors.append("Extra data not expected: key: `{}`, data: `{}`".format( - key, data[key])) - return True - return False - - -if len(sys.argv) != 2: - print("Expected doc directory to check!") - sys.exit(1) - -errors = [] -if not find_redirect_map_file(sys.argv[1], errors): - print("Didn't find the map file in `{}`...".format(sys.argv[1])) - sys.exit(1) -for err in errors: - print("=> {}".format(err)) -if len(errors) != 0: - sys.exit(1) diff --git a/tests/run-make/rustdoc-output-path/rmake.rs b/tests/run-make/rustdoc-output-path/rmake.rs index 3c1ccd3a069..7f6accf26c2 100644 --- a/tests/run-make/rustdoc-output-path/rmake.rs +++ b/tests/run-make/rustdoc-output-path/rmake.rs @@ -1,11 +1,9 @@ // Checks that if the output folder doesn't exist, rustdoc will create it. -use std::path::Path; - -use run_make_support::rustdoc; +use run_make_support::{path, rustdoc}; fn main() { - let out_dir = Path::new("foo/bar/doc"); - rustdoc().input("foo.rs").output(&out_dir).run(); + let out_dir = path("foo/bar/doc"); + rustdoc().input("foo.rs").out_dir(&out_dir).run(); assert!(out_dir.exists()); } diff --git a/tests/run-make/rustdoc-output-stdout/foo.rs b/tests/run-make/rustdoc-output-stdout/foo.rs new file mode 100644 index 00000000000..4a835673a59 --- /dev/null +++ b/tests/run-make/rustdoc-output-stdout/foo.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/tests/run-make/rustdoc-output-stdout/rmake.rs b/tests/run-make/rustdoc-output-stdout/rmake.rs new file mode 100644 index 00000000000..dbc9892f3f5 --- /dev/null +++ b/tests/run-make/rustdoc-output-stdout/rmake.rs @@ -0,0 +1,25 @@ +// This test verifies that rustdoc `-o -` prints JSON on stdout and doesn't generate +// a JSON file. + +use std::path::PathBuf; + +use run_make_support::path_helpers::{cwd, has_extension, read_dir_entries_recursive}; +use run_make_support::rustdoc; + +fn main() { + // First we check that we generate the JSON in the stdout. + rustdoc() + .input("foo.rs") + .out_dir("-") + .arg("-Zunstable-options") + .output_format("json") + .run() + .assert_stdout_contains("{\""); + + // Then we check it didn't generate any JSON file. + read_dir_entries_recursive(cwd(), |path| { + if path.is_file() && has_extension(path, "json") { + panic!("Found a JSON file {path:?}"); + } + }); +} diff --git a/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs b/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs index b77df7adc8d..546a0685b4e 100644 --- a/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs +++ b/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs @@ -35,7 +35,7 @@ fn main() { .input("examples/ex.rs") .crate_name("ex") .crate_type("bin") - .output(&out_dir) + .out_dir(&out_dir) .extern_(crate_name, rust_lib_name(crate_name)) .extern_(proc_crate_name, dylib_name.trim()) .arg("-Zunstable-options") @@ -49,7 +49,7 @@ fn main() { .input("src/lib.rs") .crate_name(crate_name) .crate_type("lib") - .output(&out_dir) + .out_dir(&out_dir) .arg("-Zunstable-options") .arg("--with-examples") .arg(&ex_dir) diff --git a/tests/run-make/rustdoc-scrape-examples-remap/scrape.rs b/tests/run-make/rustdoc-scrape-examples-remap/scrape.rs index eca07043b55..c4d7814c3c8 100644 --- a/tests/run-make/rustdoc-scrape-examples-remap/scrape.rs +++ b/tests/run-make/rustdoc-scrape-examples-remap/scrape.rs @@ -20,7 +20,7 @@ pub fn scrape(extra_args: &[&str]) { .input(&dep) .crate_name(&dep_stem) .crate_type("bin") - .output(&out_dir) + .out_dir(&out_dir) .extern_(crate_name, format!("lib{crate_name}.rmeta")) .arg("-Zunstable-options") .arg("--scrape-examples-output-path") @@ -35,7 +35,7 @@ pub fn scrape(extra_args: &[&str]) { let mut rustdoc = rustdoc(); rustdoc .input("src/lib.rs") - .output(&out_dir) + .out_dir(&out_dir) .crate_name(crate_name) .crate_type("lib") .arg("-Zunstable-options"); diff --git a/tests/run-make/rustdoc-target-spec-json-path/rmake.rs b/tests/run-make/rustdoc-target-spec-json-path/rmake.rs index 3246fc56506..fe9587f5022 100644 --- a/tests/run-make/rustdoc-target-spec-json-path/rmake.rs +++ b/tests/run-make/rustdoc-target-spec-json-path/rmake.rs @@ -7,7 +7,7 @@ fn main() { rustc().crate_type("lib").input("dummy_core.rs").target("target.json").run(); rustdoc() .input("my_crate.rs") - .output(out_dir) + .out_dir(out_dir) .library_search_path(cwd()) .target("target.json") .run(); diff --git a/tests/run-make/rustdoc-themes/rmake.rs b/tests/run-make/rustdoc-themes/rmake.rs index 8a961beb9f7..4577e47d47e 100644 --- a/tests/run-make/rustdoc-themes/rmake.rs +++ b/tests/run-make/rustdoc-themes/rmake.rs @@ -27,6 +27,6 @@ fn main() { rfs::create_dir_all(&out_dir); rfs::write(&test_css, test_content); - rustdoc().output(&out_dir).input("foo.rs").arg("--theme").arg(&test_css).run(); + rustdoc().out_dir(&out_dir).input("foo.rs").arg("--theme").arg(&test_css).run(); htmldocck().arg(out_dir).arg("foo.rs").run(); } diff --git a/tests/run-make/rustdoc-with-out-dir-option/rmake.rs b/tests/run-make/rustdoc-with-out-dir-option/rmake.rs index ded89c9ae79..a82a1965a9c 100644 --- a/tests/run-make/rustdoc-with-out-dir-option/rmake.rs +++ b/tests/run-make/rustdoc-with-out-dir-option/rmake.rs @@ -2,6 +2,6 @@ use run_make_support::{htmldocck, rustdoc}; fn main() { let out_dir = "rustdoc"; - rustdoc().input("src/lib.rs").crate_name("foobar").crate_type("lib").output(&out_dir).run(); + rustdoc().input("src/lib.rs").crate_name("foobar").crate_type("lib").out_dir(&out_dir).run(); htmldocck().arg(out_dir).arg("src/lib.rs").run(); } diff --git a/tests/run-make/staticlib-thin-archive/bin.rs b/tests/run-make/staticlib-thin-archive/bin.rs new file mode 100644 index 00000000000..97a2751f20b --- /dev/null +++ b/tests/run-make/staticlib-thin-archive/bin.rs @@ -0,0 +1,5 @@ +fn main() { + unsafe { + rust_lib::simple_fn(); + } +} diff --git a/tests/run-make/staticlib-thin-archive/rmake.rs b/tests/run-make/staticlib-thin-archive/rmake.rs new file mode 100644 index 00000000000..955c50da201 --- /dev/null +++ b/tests/run-make/staticlib-thin-archive/rmake.rs @@ -0,0 +1,23 @@ +// Regression test for https://github.com/rust-lang/rust/issues/107407 which +// checks that rustc can read thin archive. Before the object crate added thin +// archive support rustc would add emit object files to the staticlib and after +// the object crate added thin archive support it would previously crash the +// compiler due to a missing special case for thin archive members. +use run_make_support::{llvm_ar, path, rfs, rust_lib_name, rustc, static_lib_name}; + +fn main() { + rfs::create_dir("archive"); + + // Build a thin archive + rustc().input("simple_obj.rs").emit("obj").output("archive/simple_obj.o").run(); + llvm_ar() + .obj_to_thin_ar() + .output_input(path("archive").join(static_lib_name("thin_archive")), "archive/simple_obj.o") + .run(); + + // Build an rlib which includes the members of this thin archive + rustc().input("rust_lib.rs").library_search_path("archive").run(); + + // Build a binary which requires a symbol from the thin archive + rustc().input("bin.rs").extern_("rust_lib", rust_lib_name("rust_lib")).run(); +} diff --git a/tests/run-make/staticlib-thin-archive/rust_lib.rs b/tests/run-make/staticlib-thin-archive/rust_lib.rs new file mode 100644 index 00000000000..c76b0f25433 --- /dev/null +++ b/tests/run-make/staticlib-thin-archive/rust_lib.rs @@ -0,0 +1,6 @@ +#![crate_type = "rlib"] + +#[link(name = "thin_archive", kind = "static")] +extern "C" { + pub fn simple_fn(); +} diff --git a/tests/run-make/staticlib-thin-archive/simple_obj.rs b/tests/run-make/staticlib-thin-archive/simple_obj.rs new file mode 100644 index 00000000000..a120c9b3e67 --- /dev/null +++ b/tests/run-make/staticlib-thin-archive/simple_obj.rs @@ -0,0 +1,4 @@ +#![crate_type = "staticlib"] + +#[no_mangle] +extern "C" fn simple_fn() {} diff --git a/tests/run-make/sysroot-crates-are-unstable/Makefile b/tests/run-make/sysroot-crates-are-unstable/Makefile deleted file mode 100644 index 1e267fb9576..00000000000 --- a/tests/run-make/sysroot-crates-are-unstable/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - '$(PYTHON)' test.py diff --git a/tests/run-make/sysroot-crates-are-unstable/rmake.rs b/tests/run-make/sysroot-crates-are-unstable/rmake.rs new file mode 100644 index 00000000000..2240d87237b --- /dev/null +++ b/tests/run-make/sysroot-crates-are-unstable/rmake.rs @@ -0,0 +1,102 @@ +// Check that crates in the sysroot are treated as unstable, unless they are +// on a list of known-stable sysroot crates. + +use std::path::{Path, PathBuf}; +use std::str; + +use run_make_support::{rfs, rustc, target}; + +fn is_stable_crate(name: &str) -> bool { + matches!(name, "std" | "alloc" | "core" | "proc_macro") +} + +fn main() { + for cr in get_unstable_sysroot_crates() { + check_crate_is_unstable(&cr); + } + println!("Done"); +} + +#[derive(Debug)] +struct Crate { + name: String, + path: PathBuf, +} + +fn check_crate_is_unstable(cr: &Crate) { + let Crate { name, path } = cr; + + print!("- Verifying that sysroot crate '{name}' is an unstable crate ..."); + + // Trying to use this crate from a user program should fail. + let output = rustc() + .crate_type("rlib") + .target(target()) + .extern_(name, path) + .input("-") + .stdin(format!("extern crate {name};")) + .run_fail(); + + // Make sure it failed for the intended reason, not some other reason. + // (The actual feature required varies between crates.) + output.assert_stderr_contains("use of unstable library feature"); + + println!(" OK"); +} + +fn get_unstable_sysroot_crates() -> Vec<Crate> { + let sysroot = PathBuf::from(rustc().print("sysroot").run().stdout_utf8().trim()); + let sysroot_libs_dir = sysroot.join("lib").join("rustlib").join(target()).join("lib"); + println!("Sysroot libs dir: {sysroot_libs_dir:?}"); + + // Generate a list of all library crates in the sysroot. + let sysroot_crates = get_all_crates_in_dir(&sysroot_libs_dir); + println!( + "Found {} sysroot crates: {:?}", + sysroot_crates.len(), + sysroot_crates.iter().map(|cr| &cr.name).collect::<Vec<_>>() + ); + + // Self-check: If we didn't find `core`, we probably checked the wrong directory. + assert!( + sysroot_crates.iter().any(|cr| cr.name == "core"), + "Couldn't find `core` in {sysroot_libs_dir:?}" + ); + + let unstable_sysroot_crates = + sysroot_crates.into_iter().filter(|cr| !is_stable_crate(&cr.name)).collect::<Vec<_>>(); + // Self-check: There should be at least one unstable crate in the directory. + assert!( + !unstable_sysroot_crates.is_empty(), + "Couldn't find any unstable crates in {sysroot_libs_dir:?}" + ); + unstable_sysroot_crates +} + +fn get_all_crates_in_dir(libs_dir: &Path) -> Vec<Crate> { + let mut libs = vec![]; + rfs::read_dir_entries(libs_dir, |path| { + if !path.is_file() { + return; + } + if let Some(name) = crate_name_from_path(path) { + libs.push(Crate { name, path: path.to_owned() }); + } + }); + libs.sort_by(|a, b| a.name.cmp(&b.name)); + libs +} + +/// Treat a file as a crate if its name begins with `lib` and ends with `.rlib`. +/// The crate name is the part before the first hyphen (if any). +fn crate_name_from_path(path: &Path) -> Option<String> { + let name = path + .file_name()? + .to_str()? + .strip_prefix("lib")? + .strip_suffix(".rlib")? + .split('-') + .next() + .expect("split always yields at least one string"); + Some(name.to_owned()) +} diff --git a/tests/run-make/sysroot-crates-are-unstable/test.py b/tests/run-make/sysroot-crates-are-unstable/test.py deleted file mode 100644 index 45cfdd195b4..00000000000 --- a/tests/run-make/sysroot-crates-are-unstable/test.py +++ /dev/null @@ -1,75 +0,0 @@ -import sys -import os -from os import listdir -from os.path import isfile, join -from subprocess import PIPE, Popen - - -# This is n list of files which are stable crates or simply are not crates, -# we don't check for the instability of these crates as they're all stable! -STABLE_CRATES = ['std', 'alloc', 'core', 'proc_macro', - 'rsbegin.o', 'rsend.o', 'dllcrt2.o', 'crt2.o', 'clang_rt'] - - -def convert_to_string(s): - if s.__class__.__name__ == 'bytes': - return s.decode('utf-8') - return s - - -def set_ld_lib_path(): - var = os.environ.get("LD_LIB_PATH_ENVVAR") - rpath = os.environ.get("HOST_RPATH_DIR") - if var and rpath: - path = os.environ.get(var) - if path: - os.environ[var] = rpath + os.pathsep + path - else: - os.environ[var] = rpath - - -def exec_command(command, to_input=None): - child = None - if to_input is None: - child = Popen(command, stdout=PIPE, stderr=PIPE) - else: - child = Popen(command, stdout=PIPE, stderr=PIPE, stdin=PIPE) - stdout, stderr = child.communicate(input=to_input) - return (convert_to_string(stdout), convert_to_string(stderr)) - - -def check_lib(lib): - if lib['name'] in STABLE_CRATES: - return True - print('verifying if {} is an unstable crate'.format(lib['name'])) - stdout, stderr = exec_command([os.environ['RUSTC'], '-', '--crate-type', 'rlib', - '--target', os.environ['TARGET'], - '--extern', '{}={}'.format(lib['name'], lib['path'])], - to_input=('extern crate {};'.format(lib['name'])).encode('utf-8')) - if 'use of unstable library feature' not in '{}{}'.format(stdout, stderr): - print('crate {} "{}" is not unstable'.format(lib['name'], lib['path'])) - print('{}{}'.format(stdout, stderr)) - print('') - return False - return True - -# Generate a list of all crates in the sysroot. To do this we list all files in -# rustc's sysroot, look at the filename, strip everything after the `-`, and -# strip the leading `lib` (if present) -def get_all_libs(dir_path): - return [{ 'path': join(dir_path, f), 'name': f[3:].split('-')[0] } - for f in listdir(dir_path) - if isfile(join(dir_path, f)) and f.endswith('.rlib') and f not in STABLE_CRATES] - - -set_ld_lib_path() -sysroot = exec_command([os.environ['RUSTC'], '--print', 'sysroot'])[0].replace('\n', '') -assert sysroot, "Could not read the rustc sysroot!" -libs = get_all_libs(join(sysroot, 'lib/rustlib/{}/lib'.format(os.environ['TARGET']))) - -ret = 0 -for lib in libs: - if not check_lib(lib): - # We continue so users can see all the not unstable crates. - ret = 1 -sys.exit(ret) diff --git a/tests/run-make/target-without-atomic-cas/rmake.rs b/tests/run-make/target-without-atomic-cas/rmake.rs index c8782b6d1a5..e6c86c0c21d 100644 --- a/tests/run-make/target-without-atomic-cas/rmake.rs +++ b/tests/run-make/target-without-atomic-cas/rmake.rs @@ -1,8 +1,13 @@ -// ARM Cortex-M are a class of processors supported by the rust compiler. However, -// they cannot support any atomic features, such as Arc. This test simply prints -// the configuration details of one Cortex target, and checks that the compiler -// does not falsely list atomic support. -// See https://github.com/rust-lang/rust/pull/36874 +// ARM Cortex-M are a class of processors supported by the rust compiler. However, they cannot +// support any atomic features, such as Arc. This test simply prints the configuration details of +// one Cortex target, and checks that the compiler does not falsely list atomic support. +// See <https://github.com/rust-lang/rust/pull/36874>. + +// ignore-tidy-linelength +//@ needs-llvm-components: arm +// Note: without the needs-llvm-components it will fail on LLVM built without all of the components +// listed above. If any new targets are added, please double-check their respective llvm components +// are specified above. use run_make_support::rustc; diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile deleted file mode 100644 index 3c88ec34f43..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -include ../tools.mk - -#only-x86_64-fortanix-unknown-sgx - -# For cargo setting -export RUSTC := $(RUSTC_ORIGINAL) -export LD_LIBRARY_PATH := $(HOST_RPATH_DIR) -# We need to be outside of 'src' dir in order to run cargo -export WORK_DIR := $(TMPDIR) -export TEST_DIR := $(shell pwd) - -## clean up unused env variables which might cause harm. -unexport RUSTC_LINKER -unexport RUSTC_BOOTSTRAP -unexport RUST_BUILD_STAGE -unexport RUST_TEST_THREADS -unexport RUST_TEST_TMPDIR -unexport AR -unexport CC -unexport CXX - -all: - bash script.sh diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs new file mode 100644 index 00000000000..130781a4293 --- /dev/null +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs @@ -0,0 +1,96 @@ +// ignore-tidy-linelength +// Reason: intel.com link + +// This security test checks that the disassembled form of certain symbols +// is "hardened" - that means, the assembly instructions match a pattern that +// mitigate potential Load Value Injection vulnerabilities. +// To do so, a test crate is compiled, and certain symbols are found, disassembled +// and checked one by one. +// See https://github.com/rust-lang/rust/pull/77008 + +// On load value injection: +// https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/technical-documentation/load-value-injection.html + +//@ only-x86_64-fortanix-unknown-sgx + +use run_make_support::{cmd, cwd, llvm_filecheck, llvm_objdump, regex, set_current_dir, target}; + +fn main() { + let main_dir = cwd(); + set_current_dir("enclave"); + // HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features. + // These come from the top-level Rust workspace, that this crate is not a + // member of, but Cargo tries to load the workspace `Cargo.toml` anyway. + cmd("cargo") + .env("RUSTC_BOOTSTRAP", "1") + .arg("-v") + .arg("run") + .arg("--target") + .arg(target()) + .run(); + set_current_dir(&main_dir); + // Rust has various ways of adding code to a binary: + // - Rust code + // - Inline assembly + // - Global assembly + // - C/C++ code compiled as part of Rust crates + // For those different kinds, we do have very small code examples that should be + // mitigated in some way. Mostly we check that ret instructions should no longer be present. + check("unw_getcontext", "unw_getcontext.checks"); + check("__libunwind_Registers_x86_64_jumpto", "jumpto.checks"); + + check("std::io::stdio::_print::[[:alnum:]]+", "print.with_frame_pointers.checks"); + + check("rust_plus_one_global_asm", "rust_plus_one_global_asm.checks"); + + check("cc_plus_one_c", "cc_plus_one_c.checks"); + check("cc_plus_one_c_asm", "cc_plus_one_c_asm.checks"); + check("cc_plus_one_cxx", "cc_plus_one_cxx.checks"); + check("cc_plus_one_cxx_asm", "cc_plus_one_cxx_asm.checks"); + check("cc_plus_one_asm", "cc_plus_one_asm.checks"); + + check("cmake_plus_one_c", "cmake_plus_one_c.checks"); + check("cmake_plus_one_c_asm", "cmake_plus_one_c_asm.checks"); + check("cmake_plus_one_c_global_asm", "cmake_plus_one_c_global_asm.checks"); + check("cmake_plus_one_cxx", "cmake_plus_one_cxx.checks"); + check("cmake_plus_one_cxx_asm", "cmake_plus_one_cxx_asm.checks"); + check("cmake_plus_one_cxx_global_asm", "cmake_plus_one_cxx_global_asm.checks"); + check("cmake_plus_one_asm", "cmake_plus_one_asm.checks"); +} + +fn check(func_re: &str, mut checks: &str) { + let dump = llvm_objdump() + .input("enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave") + .args(&["--syms", "--demangle"]) + .run() + .stdout_utf8(); + let re = regex::Regex::new(&format!("[[:blank:]]+{func_re}")).unwrap(); + let func = re.find_iter(&dump).map(|m| m.as_str().trim()).collect::<Vec<&str>>().join(","); + assert!(!func.is_empty()); + let dump = llvm_objdump() + .input("enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave") + .args(&["--demangle", &format!("--disassemble-symbols={func}")]) + .run() + .stdout_utf8(); + let dump = dump.as_bytes(); + + // Unique case, must succeed at one of two possible tests. + // This is because frame pointers are optional, and them being enabled requires + // an additional `popq` in the pattern checking file. + if func_re == "std::io::stdio::_print::[[:alnum:]]+" { + let output = llvm_filecheck().stdin(&dump).patterns(checks).run_unchecked(); + if !output.status().success() { + checks = "print.without_frame_pointers.checks"; + llvm_filecheck().stdin(&dump).patterns(checks).run(); + } + } else { + llvm_filecheck().stdin(&dump).patterns(checks).run(); + } + if !["rust_plus_one_global_asm", "cmake_plus_one_c_global_asm", "cmake_plus_one_cxx_global_asm"] + .contains(&func_re) + { + // The assembler cannot avoid explicit `ret` instructions. Sequences + // of `shlq $0x0, (%rsp); lfence; retq` are used instead. + llvm_filecheck().args(&["--implicit-check-not", "ret"]).stdin(dump).patterns(checks).run(); + } +} diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh deleted file mode 100644 index a7c4ae13ecb..00000000000 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -set -exuo pipefail - -function build { - CRATE=enclave - - mkdir -p "${WORK_DIR}" - pushd "${WORK_DIR}" - rm -rf "${CRATE}" - cp -a "${TEST_DIR}"/enclave . - pushd $CRATE - echo "${WORK_DIR}" - # HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features. - # These come from the top-level Rust workspace, that this crate is not a - # member of, but Cargo tries to load the workspace `Cargo.toml` anyway. - env RUSTC_BOOTSTRAP=1 - cargo -v run --target "${TARGET}" - popd - popd -} - -function check { - local func_re="$1" - local checks="${TEST_DIR}/$2" - local asm="" - local objdump="${LLVM_BIN_DIR}/llvm-objdump" - local filecheck="${LLVM_BIN_DIR}/FileCheck" - local enclave=${WORK_DIR}/enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave - - asm=$(mktemp) - func="$(${objdump} --syms --demangle "${enclave}" | \ - grep --only-matching -E "[[:blank:]]+${func_re}\$" | \ - sed -e 's/^[[:space:]]*//' )" - ${objdump} --disassemble-symbols="${func}" --demangle \ - "${enclave}" > "${asm}" - ${filecheck} --input-file "${asm}" "${checks}" - - if [ "${func_re}" != "rust_plus_one_global_asm" ] && - [ "${func_re}" != "cmake_plus_one_c_global_asm" ] && - [ "${func_re}" != "cmake_plus_one_cxx_global_asm" ]; then - # The assembler cannot avoid explicit `ret` instructions. Sequences - # of `shlq $0x0, (%rsp); lfence; retq` are used instead. - # https://www.intel.com/content/www/us/en/developer/articles/technical/ - # software-security-guidance/technical-documentation/load-value-injection.html - ${filecheck} --implicit-check-not ret --input-file "${asm}" "${checks}" - fi -} - -build - -check "unw_getcontext" unw_getcontext.checks -check "__libunwind_Registers_x86_64_jumpto" jumpto.checks -check 'std::io::stdio::_print::[[:alnum:]]+' print.with_frame_pointers.checks || - check 'std::io::stdio::_print::[[:alnum:]]+' print.without_frame_pointers.checks -check rust_plus_one_global_asm rust_plus_one_global_asm.checks - -check cc_plus_one_c cc_plus_one_c.checks -check cc_plus_one_c_asm cc_plus_one_c_asm.checks -check cc_plus_one_cxx cc_plus_one_cxx.checks -check cc_plus_one_cxx_asm cc_plus_one_cxx_asm.checks -check cc_plus_one_asm cc_plus_one_asm.checks - -check cmake_plus_one_c cmake_plus_one_c.checks -check cmake_plus_one_c_asm cmake_plus_one_c_asm.checks -check cmake_plus_one_c_global_asm cmake_plus_one_c_global_asm.checks -check cmake_plus_one_cxx cmake_plus_one_cxx.checks -check cmake_plus_one_cxx_asm cmake_plus_one_cxx_asm.checks -check cmake_plus_one_cxx_global_asm cmake_plus_one_cxx_global_asm.checks -check cmake_plus_one_asm cmake_plus_one_asm.checks diff --git a/tests/rustdoc-gui/target.goml b/tests/rustdoc-gui/target.goml index 82bd34ed274..92846f8e01d 100644 --- a/tests/rustdoc-gui/target.goml +++ b/tests/rustdoc-gui/target.goml @@ -11,7 +11,7 @@ define-function: ( [theme, background, border], block { call-function: ("switch-theme", {"theme": |theme|}) - assert-css: ("#method\.a_method:target", { + wait-for-css: ("#method\.a_method:target", { "background-color": |background|, "border-right": "3px solid " + |border|, }) diff --git a/tests/rustdoc-js-std/exact-case.js b/tests/rustdoc-js-std/exact-case.js new file mode 100644 index 00000000000..d9faff22fff --- /dev/null +++ b/tests/rustdoc-js-std/exact-case.js @@ -0,0 +1,7 @@ +const EXPECTED = { + 'query': 'Copy', + 'others': [ + { 'path': 'std::marker', 'name': 'Copy' }, + { 'path': 'std::fs', 'name': 'copy' }, + ], +} diff --git a/tests/rustdoc-json/impl-trait-precise-capturing.rs b/tests/rustdoc-json/impl-trait-precise-capturing.rs index f9fee788ffe..0c116a10290 100644 --- a/tests/rustdoc-json/impl-trait-precise-capturing.rs +++ b/tests/rustdoc-json/impl-trait-precise-capturing.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - //@ is "$.index[*][?(@.name=='hello')].inner.function.decl.output.impl_trait[1].use[0]" \"\'a\" //@ is "$.index[*][?(@.name=='hello')].inner.function.decl.output.impl_trait[1].use[1]" \"T\" //@ is "$.index[*][?(@.name=='hello')].inner.function.decl.output.impl_trait[1].use[2]" \"N\" diff --git a/tests/rustdoc-json/traits/self.rs b/tests/rustdoc-json/traits/self.rs new file mode 100644 index 00000000000..c7d952ae567 --- /dev/null +++ b/tests/rustdoc-json/traits/self.rs @@ -0,0 +1,58 @@ +// ignore-tidy-linelength + +pub struct Foo; + +// Check that Self is represented uniformly between inherent impls, trait impls, +// and trait definitions, even though it uses both SelfTyParam and SelfTyAlias +// internally. +// +// Each assertion matches 3 times, and should be the same each time. + +impl Foo { + //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.decl.inputs[0][0]' '"self"' '"self"' '"self"' + //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.decl.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"' + //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.decl.inputs[0][1].borrowed_ref.lifetime' null null null + //@ ismany '$.index[*][?(@.name=="by_ref")].inner.function.decl.inputs[0][1].borrowed_ref.mutable' false false false + pub fn by_ref(&self) {} + + //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.decl.inputs[0][0]' '"self"' '"self"' '"self"' + //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.decl.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"' + //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.decl.inputs[0][1].borrowed_ref.lifetime' null null null + //@ ismany '$.index[*][?(@.name=="by_exclusive_ref")].inner.function.decl.inputs[0][1].borrowed_ref.mutable' true true true + pub fn by_exclusive_ref(&mut self) {} + + //@ ismany '$.index[*][?(@.name=="by_value")].inner.function.decl.inputs[0][0]' '"self"' '"self"' '"self"' + //@ ismany '$.index[*][?(@.name=="by_value")].inner.function.decl.inputs[0][1].generic' '"Self"' '"Self"' '"Self"' + pub fn by_value(self) {} + + //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.decl.inputs[0][0]' '"self"' '"self"' '"self"' + //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.decl.inputs[0][1].borrowed_ref.type.generic' '"Self"' '"Self"' '"Self"' + //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.decl.inputs[0][1].borrowed_ref.lifetime' \"\'a\" \"\'a\" \"\'a\" + //@ ismany '$.index[*][?(@.name=="with_lifetime")].inner.function.decl.inputs[0][1].borrowed_ref.mutable' false false false + pub fn with_lifetime<'a>(&'a self) {} + + //@ ismany '$.index[*][?(@.name=="build")].inner.function.decl.output.generic' '"Self"' '"Self"' '"Self"' + pub fn build() -> Self { + Self + } +} + +pub struct Bar; + +pub trait SelfParams { + fn by_ref(&self); + fn by_exclusive_ref(&mut self); + fn by_value(self); + fn with_lifetime<'a>(&'a self); + fn build() -> Self; +} + +impl SelfParams for Bar { + fn by_ref(&self) {} + fn by_exclusive_ref(&mut self) {} + fn by_value(self) {} + fn with_lifetime<'a>(&'a self) {} + fn build() -> Self { + Self + } +} diff --git a/tests/rustdoc-ui/2024-doctests-checks.rs b/tests/rustdoc-ui/2024-doctests-checks.rs new file mode 100644 index 00000000000..464cf5b200d --- /dev/null +++ b/tests/rustdoc-ui/2024-doctests-checks.rs @@ -0,0 +1,27 @@ +//@ check-pass +//@ compile-flags: --test --test-args=--test-threads=1 -Zunstable-options --edition 2024 +//@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" + +/// ``` +/// let x = 12; +/// ``` +/// +/// This one should not be a merged doctest (because of `$crate`). The output +/// will confirm it by displaying both merged and standalone doctest passes. +/// +/// ``` +/// macro_rules! bla { +/// () => {{ +/// $crate::foo(); +/// }} +/// } +/// +/// fn foo() {} +/// +/// fn main() { +/// bla!(); +/// } +/// ``` +pub struct Foo; diff --git a/tests/rustdoc-ui/2024-doctests-checks.stdout b/tests/rustdoc-ui/2024-doctests-checks.stdout new file mode 100644 index 00000000000..d1064084a85 --- /dev/null +++ b/tests/rustdoc-ui/2024-doctests-checks.stdout @@ -0,0 +1,12 @@ + +running 1 test +test $DIR/2024-doctests-checks.rs - Foo (line 7) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + + +running 1 test +test $DIR/2024-doctests-checks.rs - Foo (line 14) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/2024-doctests-crate-attribute.rs b/tests/rustdoc-ui/2024-doctests-crate-attribute.rs new file mode 100644 index 00000000000..4984fdfe194 --- /dev/null +++ b/tests/rustdoc-ui/2024-doctests-crate-attribute.rs @@ -0,0 +1,22 @@ +//@ check-pass +//@ compile-flags: --test --test-args=--test-threads=1 -Zunstable-options --edition 2024 +//@ normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" + +/// This doctest is used to ensure that if a crate attribute is present, +/// it will not be part of the merged doctests. +/// +/// ``` +/// #![doc(html_playground_url = "foo")] +/// +/// pub struct Bar; +/// ``` +/// +/// This one will allow us to confirm that the doctest above will be a +/// standalone one (there will be two separate doctests passes). +/// +/// ``` +/// let x = 12; +/// ``` +pub struct Foo; diff --git a/tests/rustdoc-ui/2024-doctests-crate-attribute.stdout b/tests/rustdoc-ui/2024-doctests-crate-attribute.stdout new file mode 100644 index 00000000000..29702ce8929 --- /dev/null +++ b/tests/rustdoc-ui/2024-doctests-crate-attribute.stdout @@ -0,0 +1,12 @@ + +running 1 test +test $DIR/2024-doctests-crate-attribute.rs - Foo (line 19) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + + +running 1 test +test $DIR/2024-doctests-crate-attribute.rs - Foo (line 10) ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.rs b/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.rs new file mode 100644 index 00000000000..4fe513b4066 --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.rs @@ -0,0 +1,12 @@ +// FIXME: if/when the output of the test harness can be tested on its own, this test should be +// adapted to use that, and that normalize line can go away + +//@ compile-flags:--test --edition 2021 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 + +/// ```should_panic +/// println!("Hello, world!"); +/// ``` +pub struct Foo; diff --git a/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.stdout b/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.stdout new file mode 100644 index 00000000000..63d987de8a9 --- /dev/null +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic-2021.stdout @@ -0,0 +1,14 @@ + +running 1 test +test $DIR/failed-doctest-should-panic-2021.rs - Foo (line 9) ... FAILED + +failures: + +---- $DIR/failed-doctest-should-panic-2021.rs - Foo (line 9) stdout ---- +Test executable succeeded, but it's marked `should_panic`. + +failures: + $DIR/failed-doctest-should-panic-2021.rs - Foo (line 9) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs index b24687993e5..4018e37105f 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs @@ -1,7 +1,7 @@ // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away -//@ compile-flags:--test +//@ compile-flags:--test -Z unstable-options --edition 2024 //@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" //@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" //@ failure-status: 101 diff --git a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout index 57a20092a5d..cb3456e087e 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout @@ -1,11 +1,11 @@ running 1 test -test $DIR/failed-doctest-should-panic.rs - Foo (line 9) ... FAILED +test $DIR/failed-doctest-should-panic.rs - Foo (line 9) - should panic ... FAILED failures: ---- $DIR/failed-doctest-should-panic.rs - Foo (line 9) stdout ---- -Test executable succeeded, but it's marked `should_panic`. +note: test did not panic as expected failures: $DIR/failed-doctest-should-panic.rs - Foo (line 9) diff --git a/tests/rustdoc-ui/doctest/merged-ignore-no_run.rs b/tests/rustdoc-ui/doctest/merged-ignore-no_run.rs new file mode 100644 index 00000000000..4c21d542951 --- /dev/null +++ b/tests/rustdoc-ui/doctest/merged-ignore-no_run.rs @@ -0,0 +1,14 @@ +//@ compile-flags:--test --test-args=--test-threads=1 -Zunstable-options --edition 2024 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ check-pass + +/// ```ignore (test) +/// let x = 12; +/// ``` +pub fn ignored() {} + +/// ```no_run +/// panic!("blob"); +/// ``` +pub fn no_run() {} diff --git a/tests/rustdoc-ui/doctest/merged-ignore-no_run.stdout b/tests/rustdoc-ui/doctest/merged-ignore-no_run.stdout new file mode 100644 index 00000000000..f2cb1e7e72f --- /dev/null +++ b/tests/rustdoc-ui/doctest/merged-ignore-no_run.stdout @@ -0,0 +1,7 @@ + +running 2 tests +test $DIR/merged-ignore-no_run.rs - ignored (line 6) ... ignored +test $DIR/merged-ignore-no_run.rs - no_run (line 11) - compile ... ok + +test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/wrong-ast-2024.rs b/tests/rustdoc-ui/doctest/wrong-ast-2024.rs new file mode 100644 index 00000000000..7b4fa8fd2c9 --- /dev/null +++ b/tests/rustdoc-ui/doctest/wrong-ast-2024.rs @@ -0,0 +1,20 @@ +//@ compile-flags:--test --test-args=--test-threads=1 -Zunstable-options --edition 2024 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" +//@ failure-status: 101 + +/// ``` +/// /* plop +/// ``` +pub fn one() {} + +/// ``` +/// } mod __doctest_1 { fn main() { +/// ``` +pub fn two() {} + +/// ```should_panic +/// panic!() +/// ``` +pub fn three() {} diff --git a/tests/rustdoc-ui/doctest/wrong-ast-2024.stdout b/tests/rustdoc-ui/doctest/wrong-ast-2024.stdout new file mode 100644 index 00000000000..22c8ce468fd --- /dev/null +++ b/tests/rustdoc-ui/doctest/wrong-ast-2024.stdout @@ -0,0 +1,41 @@ + +running 1 test +test $DIR/wrong-ast-2024.rs - three (line 17) - should panic ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + + +running 2 tests +test $DIR/wrong-ast-2024.rs - one (line 7) ... FAILED +test $DIR/wrong-ast-2024.rs - two (line 12) ... FAILED + +failures: + +---- $DIR/wrong-ast-2024.rs - one (line 7) stdout ---- +error[E0758]: unterminated block comment + --> $DIR/wrong-ast-2024.rs:$LINE:$COL + | +LL | /* plop + | ^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0758`. +Couldn't compile the test. +---- $DIR/wrong-ast-2024.rs - two (line 12) stdout ---- +error: unexpected closing delimiter: `}` + --> $DIR/wrong-ast-2024.rs:$LINE:$COL + | +LL | } mod __doctest_1 { fn main() { + | ^ unexpected closing delimiter + +error: aborting due to 1 previous error + +Couldn't compile the test. + +failures: + $DIR/wrong-ast-2024.rs - one (line 7) + $DIR/wrong-ast-2024.rs - two (line 12) + +test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/wrong-ast.rs b/tests/rustdoc-ui/doctest/wrong-ast.rs new file mode 100644 index 00000000000..92286b33dcf --- /dev/null +++ b/tests/rustdoc-ui/doctest/wrong-ast.rs @@ -0,0 +1,19 @@ +//@ compile-flags:--test --test-args=--test-threads=1 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ failure-status: 101 + +/// ``` +/// /* plop +/// ``` +pub fn one() {} + +/// ``` +/// } mod __doctest_1 { fn main() { +/// ``` +pub fn two() {} + +/// ```should_panic +/// panic!() +/// ``` +pub fn three() {} diff --git a/tests/rustdoc-ui/doctest/wrong-ast.stdout b/tests/rustdoc-ui/doctest/wrong-ast.stdout new file mode 100644 index 00000000000..15494706c16 --- /dev/null +++ b/tests/rustdoc-ui/doctest/wrong-ast.stdout @@ -0,0 +1,36 @@ + +running 3 tests +test $DIR/wrong-ast.rs - one (line 6) ... FAILED +test $DIR/wrong-ast.rs - three (line 16) ... ok +test $DIR/wrong-ast.rs - two (line 11) ... FAILED + +failures: + +---- $DIR/wrong-ast.rs - one (line 6) stdout ---- +error[E0758]: unterminated block comment + --> $DIR/wrong-ast.rs:7:1 + | +LL | /* plop + | ^^^^^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0758`. +Couldn't compile the test. +---- $DIR/wrong-ast.rs - two (line 11) stdout ---- +error: unexpected closing delimiter: `}` + --> $DIR/wrong-ast.rs:12:1 + | +LL | } mod __doctest_1 { fn main() { + | ^ unexpected closing delimiter + +error: aborting due to 1 previous error + +Couldn't compile the test. + +failures: + $DIR/wrong-ast.rs - one (line 6) + $DIR/wrong-ast.rs - two (line 11) + +test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs index f11b94bb036..babdbd0a692 100644 --- a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs +++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs @@ -2,5 +2,6 @@ // option can only be used with HTML generation. //@ compile-flags: -Zunstable-options --generate-link-to-definition --output-format json +//@ check-pass pub fn f() {} diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.stderr b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.stderr index 4c8c607e7da..62b0e3ce408 100644 --- a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.stderr +++ b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.stderr @@ -1,2 +1,4 @@ -error: --generate-link-to-definition option can only be used with HTML output format +warning: `--generate-link-to-definition` option can only be used with HTML output format + | + = note: `--generate-link-to-definition` option will be ignored diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs deleted file mode 100644 index 71852205979..00000000000 --- a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs +++ /dev/null @@ -1,6 +0,0 @@ -// This test purpose is to check that the "--generate-link-to-definition" -// option can only be used with HTML generation. - -//@ compile-flags: -Zunstable-options --generate-link-to-definition --show-coverage - -pub fn f() {} diff --git a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.stderr b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.stderr deleted file mode 100644 index 4c8c607e7da..00000000000 --- a/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.stderr +++ /dev/null @@ -1,2 +0,0 @@ -error: --generate-link-to-definition option can only be used with HTML output format - diff --git a/tests/rustdoc-ui/unportable-markdown.rs b/tests/rustdoc-ui/unportable-markdown.rs index 8035e680f3c..105fc1e59d5 100644 --- a/tests/rustdoc-ui/unportable-markdown.rs +++ b/tests/rustdoc-ui/unportable-markdown.rs @@ -19,7 +19,6 @@ pub struct GfmFootnotes; /// <https://github.com/pulldown-cmark/pulldown-cmark/pull/773> /// /// test [^foo][^bar] -//~^ ERROR unportable markdown /// /// [^foo]: test /// [^bar]: test2 diff --git a/tests/rustdoc-ui/unportable-markdown.stderr b/tests/rustdoc-ui/unportable-markdown.stderr index b524aca25ae..952ae4bb6ee 100644 --- a/tests/rustdoc-ui/unportable-markdown.stderr +++ b/tests/rustdoc-ui/unportable-markdown.stderr @@ -1,31 +1,15 @@ error: unportable markdown - --> $DIR/unportable-markdown.rs:21:10 + --> $DIR/unportable-markdown.rs:48:5 | -LL | /// test [^foo][^bar] - | ^^^^^^ +LL | /// >bar + | ^ | - = help: confusing footnote reference and link + = help: confusing block quote with no space after the `>` marker note: the lint level is defined here --> $DIR/unportable-markdown.rs:8:9 | LL | #![deny(rustdoc::unportable_markdown)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: if it should not be a footnote, escape it - | -LL | /// test \[^foo][^bar] - | + -help: if the footnote is intended, add a space - | -LL | /// test [^foo] [^bar] - | + - -error: unportable markdown - --> $DIR/unportable-markdown.rs:49:5 - | -LL | /// >bar - | ^ - | - = help: confusing block quote with no space after the `>` marker help: if the quote is intended, add a space | LL | /// > bar @@ -35,5 +19,5 @@ help: if it should not be a quote, escape it LL | /// \>bar | + -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/tests/rustdoc/anchors.no_type_anchor2.html b/tests/rustdoc/anchors.no_type_anchor2.html index 71e93990e29..9127104ded4 100644 --- a/tests/rustdoc/anchors.no_type_anchor2.html +++ b/tests/rustdoc/anchors.no_type_anchor2.html @@ -1 +1 @@ -<section id="associatedtype.Y" class="associatedtype"><h4 class="code-header">pub type <a href="#associatedtype.Y" class="associatedtype">Y</a> = <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></section> \ No newline at end of file +<section id="associatedtype.Y" class="associatedtype"><a class="src rightside" href="../src/foo/anchors.rs.html#45">source</a><h4 class="code-header">pub type <a href="#associatedtype.Y" class="associatedtype">Y</a> = <a class="primitive" href="{{channel}}/std/primitive.u32.html">u32</a></h4></section> \ No newline at end of file diff --git a/tests/rustdoc/assoc-type-source-link.rs b/tests/rustdoc/assoc-type-source-link.rs new file mode 100644 index 00000000000..34b156b9649 --- /dev/null +++ b/tests/rustdoc/assoc-type-source-link.rs @@ -0,0 +1,26 @@ +// This test ensures that the source links are generated for impl associated types. + +#![crate_name = "foo"] +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +//@ has 'foo/struct.Bar.html' +pub struct Bar; + +impl Bar { + //@ has - '//*[@id="implementations-list"]//*[@id="associatedtype.Y"]/a' 'source' + //@ has - '//*[@id="implementations-list"]//*[@id="associatedtype.Y"]/a/@href' \ + // '../src/foo/assoc-type-source-link.rs.html#14' + pub type Y = u8; +} + +pub trait Foo { + type Z; +} + +impl Foo for Bar { + //@ has - '//*[@id="trait-implementations-list"]//*[@id="associatedtype.Z"]/a' 'source' + //@ has - '//*[@id="trait-implementations-list"]//*[@id="associatedtype.Z"]/a/@href' \ + // '../src/foo/assoc-type-source-link.rs.html#25' + type Z = u8; +} diff --git a/tests/rustdoc/doc-hidden-crate.rs b/tests/rustdoc/doc-hidden-crate.rs new file mode 100644 index 00000000000..dac557107a9 --- /dev/null +++ b/tests/rustdoc/doc-hidden-crate.rs @@ -0,0 +1,27 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/126796>. +// `doc(hidden)` should still be able to hide extern crates, only the local crates +// cannot be hidden because we still need to generate its `index.html` file. + +#![crate_name = "foo"] +#![doc(hidden)] + +//@ has 'foo/index.html' +// First we check that the page contains the crate name (`foo`). +//@ has - '//*' 'foo' +// But doesn't contain any of the other items. +//@ !has - '//*' 'other' +//@ !has - '//*' 'marker' +//@ !has - '//*' 'PhantomData' + +#[doc(inline)] +pub use std as other; + +#[doc(inline)] +pub use std::marker; + +#[doc(inline)] +pub use std::marker::PhantomData; + +//@ !has - '//*' 'myself' +#[doc(inline)] +pub use crate as myself; diff --git a/tests/rustdoc/impl-trait-precise-capturing.rs b/tests/rustdoc/impl-trait-precise-capturing.rs index a964a1f8518..3ec8c578013 100644 --- a/tests/rustdoc/impl-trait-precise-capturing.rs +++ b/tests/rustdoc/impl-trait-precise-capturing.rs @@ -1,7 +1,6 @@ //@ aux-build:precise-capturing.rs #![crate_name = "foo"] -#![feature(precise_capturing)] extern crate precise_capturing; diff --git a/tests/rustdoc/primitive-tuple-variadic.rs b/tests/rustdoc/primitive-tuple-variadic.rs index 4b2fb786a89..b15e996f929 100644 --- a/tests/rustdoc/primitive-tuple-variadic.rs +++ b/tests/rustdoc/primitive-tuple-variadic.rs @@ -16,3 +16,20 @@ pub trait Bar {} //@ has - '//section[@id="impl-Bar-for-(U,)"]/h3' 'impl<U: Foo> Bar for (U₁, U₂, …, Uₙ)' #[doc(fake_variadic)] impl<U: Foo> Bar for (U,) {} + +pub trait Baz<T> { fn baz(&self) -> T { todo!() } } + +//@ has foo/trait.Baz.html +//@ has - '//section[@id="impl-Baz%3C(T,)%3E-for-%5BT;+1%5D"]/h3' 'impl<T> Baz<(T₁, T₂, …, Tₙ)> for [T; N]' +#[doc(fake_variadic)] +impl<T> Baz<(T,)> for [T; 1] {} + +//@ has foo/trait.Baz.html +//@ has - '//section[@id="impl-Baz%3C%5BT;+1%5D%3E-for-(T,)"]/h3' 'impl<T> Baz<[T; N]> for (T₁, T₂, …, Tₙ)' +#[doc(fake_variadic)] +impl<T> Baz<[T; 1]> for (T,) {} + +//@ has foo/trait.Baz.html +//@ has - '//section[@id="impl-Baz%3CT%3E-for-(T,)"]/h3' 'impl<T> Baz<T> for (T₁, T₂, …, Tₙ)' +#[doc(fake_variadic)] +impl<T> Baz<T> for (T,) {} diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.rs b/tests/ui-fulldeps/internal-lints/diagnostics.rs index 5fcff74064a..442f9d72c3f 100644 --- a/tests/ui-fulldeps/internal-lints/diagnostics.rs +++ b/tests/ui-fulldeps/internal-lints/diagnostics.rs @@ -117,4 +117,11 @@ pub fn skipped_because_of_annotation<'a>(dcx: DiagCtxtHandle<'a>) { fn f(_x: impl Into<DiagMessage>, _y: impl Into<SubdiagMessage>) {} fn g() { f(crate::fluent_generated::no_crate_example, crate::fluent_generated::no_crate_example); + f("untranslatable diagnostic", crate::fluent_generated::no_crate_example); + //~^ ERROR diagnostics should be created using translatable messages + f(crate::fluent_generated::no_crate_example, "untranslatable diagnostic"); + //~^ ERROR diagnostics should be created using translatable messages + f("untranslatable diagnostic", "untranslatable diagnostic"); + //~^ ERROR diagnostics should be created using translatable messages + //~^^ ERROR diagnostics should be created using translatable messages } diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.stderr b/tests/ui-fulldeps/internal-lints/diagnostics.stderr index 669324ce5d4..36dd3cf4be7 100644 --- a/tests/ui-fulldeps/internal-lints/diagnostics.stderr +++ b/tests/ui-fulldeps/internal-lints/diagnostics.stderr @@ -1,8 +1,8 @@ error: diagnostics should be created using translatable messages - --> $DIR/diagnostics.rs:43:9 + --> $DIR/diagnostics.rs:43:31 | LL | Diag::new(dcx, level, "untranslatable diagnostic") - | ^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here --> $DIR/diagnostics.rs:7:9 @@ -11,16 +11,16 @@ LL | #![deny(rustc::untranslatable_diagnostic)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostics should be created using translatable messages - --> $DIR/diagnostics.rs:64:14 + --> $DIR/diagnostics.rs:64:19 | LL | diag.note("untranslatable diagnostic"); - | ^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostics should be created using translatable messages - --> $DIR/diagnostics.rs:85:14 + --> $DIR/diagnostics.rs:85:19 | LL | diag.note("untranslatable diagnostic"); - | ^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: diagnostics should only be created in `Diagnostic`/`Subdiagnostic`/`LintDiagnostic` impls --> $DIR/diagnostics.rs:99:21 @@ -41,10 +41,34 @@ LL | let _diag = dcx.struct_err("untranslatable diagnostic"); | ^^^^^^^^^^ error: diagnostics should be created using translatable messages - --> $DIR/diagnostics.rs:102:21 + --> $DIR/diagnostics.rs:102:32 | LL | let _diag = dcx.struct_err("untranslatable diagnostic"); - | ^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: diagnostics should be created using translatable messages + --> $DIR/diagnostics.rs:120:7 + | +LL | f("untranslatable diagnostic", crate::fluent_generated::no_crate_example); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: diagnostics should be created using translatable messages + --> $DIR/diagnostics.rs:122:50 + | +LL | f(crate::fluent_generated::no_crate_example, "untranslatable diagnostic"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: diagnostics should be created using translatable messages + --> $DIR/diagnostics.rs:124:7 + | +LL | f("untranslatable diagnostic", "untranslatable diagnostic"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: diagnostics should be created using translatable messages + --> $DIR/diagnostics.rs:124:36 + | +LL | f("untranslatable diagnostic", "untranslatable diagnostic"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 6 previous errors +error: aborting due to 10 previous errors diff --git a/tests/ui-fulldeps/stable-mir/check_instance.rs b/tests/ui-fulldeps/stable-mir/check_instance.rs index 5e3f2557566..5449c09d35a 100644 --- a/tests/ui-fulldeps/stable-mir/check_instance.rs +++ b/tests/ui-fulldeps/stable-mir/check_instance.rs @@ -17,12 +17,14 @@ extern crate rustc_driver; extern crate rustc_interface; extern crate stable_mir; -use mir::{mono::Instance, TerminatorKind::*}; +use std::io::Write; +use std::ops::ControlFlow; + +use mir::mono::Instance; +use mir::TerminatorKind::*; use rustc_smir::rustc_internal; use stable_mir::ty::{RigidTy, TyKind}; use stable_mir::*; -use std::io::Write; -use std::ops::ControlFlow; const CRATE_NAME: &str = "input"; @@ -33,7 +35,7 @@ fn test_stable_mir() -> ControlFlow<()> { // Get all items and split generic vs monomorphic items. let (generic, mono): (Vec<_>, Vec<_>) = items.into_iter().partition(|item| item.requires_monomorphization()); - assert_eq!(mono.len(), 3, "Expected 3 mono functions"); + assert_eq!(mono.len(), 4, "Expected 3 mono functions"); assert_eq!(generic.len(), 2, "Expected 2 generic functions"); // For all monomorphic items, get the correspondent instances. diff --git a/tests/ui/abi/c-zst.other-linux.stderr b/tests/ui/abi/c-zst.other-linux.stderr new file mode 100644 index 00000000000..5a656e6ea66 --- /dev/null +++ b/tests/ui/abi/c-zst.other-linux.stderr @@ -0,0 +1,67 @@ +error: fn_abi_of(pass_zst) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: C, + can_unwind: false, + } + --> $DIR/c-zst.rs:27:1 + | +LL | extern "C" fn pass_zst(_: ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/c-zst.other.stderr b/tests/ui/abi/c-zst.other.stderr new file mode 100644 index 00000000000..5a656e6ea66 --- /dev/null +++ b/tests/ui/abi/c-zst.other.stderr @@ -0,0 +1,67 @@ +error: fn_abi_of(pass_zst) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: C, + can_unwind: false, + } + --> $DIR/c-zst.rs:27:1 + | +LL | extern "C" fn pass_zst(_: ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/c-zst.powerpc-linux.stderr b/tests/ui/abi/c-zst.powerpc-linux.stderr new file mode 100644 index 00000000000..ba9738050d8 --- /dev/null +++ b/tests/ui/abi/c-zst.powerpc-linux.stderr @@ -0,0 +1,78 @@ +error: fn_abi_of(pass_zst) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Indirect { + attrs: ArgAttributes { + regular: NoAlias | NoCapture | NonNull | NoUndef, + arg_ext: None, + pointee_size: Size(0 bytes), + pointee_align: Some( + Align(1 bytes), + ), + }, + meta_attrs: None, + on_stack: false, + }, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: C, + can_unwind: false, + } + --> $DIR/c-zst.rs:27:1 + | +LL | extern "C" fn pass_zst(_: ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/c-zst.rs b/tests/ui/abi/c-zst.rs new file mode 100644 index 00000000000..0cfd653b37e --- /dev/null +++ b/tests/ui/abi/c-zst.rs @@ -0,0 +1,27 @@ +//@ revisions: other other-linux x86_64-pc-windows-gnu s390x-linux sparc64-linux powerpc-linux +//@ normalize-stderr-test: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" +// ZSTs are only not ignored when the target_env is "gnu", "musl" or "uclibc". However, Rust does +// not currently support any other target_env on these architectures. + +// Ignore the ZST revisions +//@[other] ignore-x86_64-pc-windows-gnu +//@[other] ignore-linux +//@[other-linux] only-linux +//@[other-linux] ignore-s390x +//@[other-linux] ignore-sparc64 +//@[other-linux] ignore-powerpc + +// Pass the ZST indirectly revisions +//@[x86_64-pc-windows-gnu] only-x86_64-pc-windows-gnu +//@[s390x-linux] only-s390x +//@[s390x-linux] only-linux +//@[sparc64-linux] only-sparc64 +//@[sparc64-linux] only-linux +//@[powerpc-linux] only-powerpc +//@[powerpc-linux] only-linux + +#![feature(rustc_attrs)] +#![crate_type = "lib"] + +#[rustc_abi(debug)] +extern "C" fn pass_zst(_: ()) {} //~ ERROR: fn_abi diff --git a/tests/ui/abi/c-zst.s390x-linux.stderr b/tests/ui/abi/c-zst.s390x-linux.stderr new file mode 100644 index 00000000000..ba9738050d8 --- /dev/null +++ b/tests/ui/abi/c-zst.s390x-linux.stderr @@ -0,0 +1,78 @@ +error: fn_abi_of(pass_zst) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Indirect { + attrs: ArgAttributes { + regular: NoAlias | NoCapture | NonNull | NoUndef, + arg_ext: None, + pointee_size: Size(0 bytes), + pointee_align: Some( + Align(1 bytes), + ), + }, + meta_attrs: None, + on_stack: false, + }, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: C, + can_unwind: false, + } + --> $DIR/c-zst.rs:27:1 + | +LL | extern "C" fn pass_zst(_: ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/c-zst.sparc64-linux.stderr b/tests/ui/abi/c-zst.sparc64-linux.stderr new file mode 100644 index 00000000000..ba9738050d8 --- /dev/null +++ b/tests/ui/abi/c-zst.sparc64-linux.stderr @@ -0,0 +1,78 @@ +error: fn_abi_of(pass_zst) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Indirect { + attrs: ArgAttributes { + regular: NoAlias | NoCapture | NonNull | NoUndef, + arg_ext: None, + pointee_size: Size(0 bytes), + pointee_align: Some( + Align(1 bytes), + ), + }, + meta_attrs: None, + on_stack: false, + }, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: C, + can_unwind: false, + } + --> $DIR/c-zst.rs:27:1 + | +LL | extern "C" fn pass_zst(_: ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr new file mode 100644 index 00000000000..ba9738050d8 --- /dev/null +++ b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr @@ -0,0 +1,78 @@ +error: fn_abi_of(pass_zst) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Indirect { + attrs: ArgAttributes { + regular: NoAlias | NoCapture | NonNull | NoUndef, + arg_ext: None, + pointee_size: Size(0 bytes), + pointee_align: Some( + Align(1 bytes), + ), + }, + meta_attrs: None, + on_stack: false, + }, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: C, + can_unwind: false, + } + --> $DIR/c-zst.rs:27:1 + | +LL | extern "C" fn pass_zst(_: ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs index ca78604edd8..d37e793d989 100644 --- a/tests/ui/abi/compatibility.rs +++ b/tests/ui/abi/compatibility.rs @@ -40,9 +40,10 @@ //@[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu //@[loongarch64] needs-llvm-components: loongarch //@[loongarch64] min-llvm-version: 18 -//@ revisions: wasm -//@[wasm] compile-flags: --target wasm32-unknown-unknown -//@[wasm] needs-llvm-components: webassembly +//FIXME: wasm is disabled due to <https://github.com/rust-lang/rust/issues/115666>. +//FIXME @ revisions: wasm +//FIXME @[wasm] compile-flags: --target wasm32-unknown-unknown +//FIXME @[wasm] needs-llvm-components: webassembly //@ revisions: wasip1 //@[wasip1] compile-flags: --target wasm32-wasip1 //@[wasip1] needs-llvm-components: webassembly diff --git a/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs b/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs new file mode 100644 index 00000000000..d758c903087 --- /dev/null +++ b/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs @@ -0,0 +1,15 @@ +//@ compile-flags: --target aarch64-unknown-none -Zsanitizer=shadow-call-stack +//@ error-pattern: shadow-call-stack sanitizer is not supported for this target +//@ dont-check-compiler-stderr +//@ needs-llvm-components: aarch64 + +#![allow(internal_features)] +#![crate_type = "rlib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +#[no_mangle] +pub fn foo() {} diff --git a/tests/ui/abi/sysv64-zst.rs b/tests/ui/abi/sysv64-zst.rs new file mode 100644 index 00000000000..6f4497e77a1 --- /dev/null +++ b/tests/ui/abi/sysv64-zst.rs @@ -0,0 +1,8 @@ +//@ only-x86_64 +//@ normalize-stderr-test: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" + +#![feature(rustc_attrs)] +#![crate_type = "lib"] + +#[rustc_abi(debug)] +extern "sysv64" fn pass_zst(_: ()) {} //~ ERROR: fn_abi diff --git a/tests/ui/abi/sysv64-zst.stderr b/tests/ui/abi/sysv64-zst.stderr new file mode 100644 index 00000000000..8b0b84dfa06 --- /dev/null +++ b/tests/ui/abi/sysv64-zst.stderr @@ -0,0 +1,67 @@ +error: fn_abi_of(pass_zst) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: X86_64SysV, + can_unwind: false, + } + --> $DIR/sysv64-zst.rs:8:1 + | +LL | extern "sysv64" fn pass_zst(_: ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/win64-zst.other.stderr b/tests/ui/abi/win64-zst.other.stderr new file mode 100644 index 00000000000..15db141cb57 --- /dev/null +++ b/tests/ui/abi/win64-zst.other.stderr @@ -0,0 +1,67 @@ +error: fn_abi_of(pass_zst) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: X86_64Win64, + can_unwind: false, + } + --> $DIR/win64-zst.rs:11:1 + | +LL | extern "win64" fn pass_zst(_: ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/abi/win64-zst.rs b/tests/ui/abi/win64-zst.rs new file mode 100644 index 00000000000..cae32795e16 --- /dev/null +++ b/tests/ui/abi/win64-zst.rs @@ -0,0 +1,11 @@ +//@ only-x86_64 +//@ revisions: other windows-gnu +//@ normalize-stderr-test: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" +//@[other] ignore-windows-gnu +//@[windows-gnu] only-windows-gnu + +#![feature(rustc_attrs)] +#![crate_type = "lib"] + +#[rustc_abi(debug)] +extern "win64" fn pass_zst(_: ()) {} //~ ERROR: fn_abi diff --git a/tests/ui/abi/win64-zst.windows-gnu.stderr b/tests/ui/abi/win64-zst.windows-gnu.stderr new file mode 100644 index 00000000000..7773e0aa2b5 --- /dev/null +++ b/tests/ui/abi/win64-zst.windows-gnu.stderr @@ -0,0 +1,78 @@ +error: fn_abi_of(pass_zst) = FnAbi { + args: [ + ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Indirect { + attrs: ArgAttributes { + regular: NoAlias | NoCapture | NonNull | NoUndef, + arg_ext: None, + pointee_size: Size(0 bytes), + pointee_align: Some( + Align(1 bytes), + ), + }, + meta_attrs: None, + on_stack: false, + }, + }, + ], + ret: ArgAbi { + layout: TyAndLayout { + ty: (), + layout: Layout { + size: Size(0 bytes), + align: AbiAndPrefAlign { + abi: $SOME_ALIGN, + pref: $SOME_ALIGN, + }, + abi: Aggregate { + sized: true, + }, + fields: Arbitrary { + offsets: [], + memory_index: [], + }, + largest_niche: None, + variants: Single { + index: 0, + }, + max_repr_align: None, + unadjusted_abi_align: $SOME_ALIGN, + }, + }, + mode: Ignore, + }, + c_variadic: false, + fixed_count: 1, + conv: X86_64Win64, + can_unwind: false, + } + --> $DIR/win64-zst.rs:11:1 + | +LL | extern "win64" fn pass_zst(_: ()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/asm/aarch64/bad-reg.rs b/tests/ui/asm/aarch64/bad-reg.rs index 1e54b6505db..b99e5fe4b9e 100644 --- a/tests/ui/asm/aarch64/bad-reg.rs +++ b/tests/ui/asm/aarch64/bad-reg.rs @@ -1,8 +1,6 @@ //@ only-aarch64 //@ compile-flags: -C target-feature=+neon -#![feature(asm_const)] - use std::arch::asm; fn main() { diff --git a/tests/ui/asm/aarch64/bad-reg.stderr b/tests/ui/asm/aarch64/bad-reg.stderr index 717a788caf6..370752ad0f1 100644 --- a/tests/ui/asm/aarch64/bad-reg.stderr +++ b/tests/ui/asm/aarch64/bad-reg.stderr @@ -1,17 +1,17 @@ error: invalid register class `foo`: unknown register class - --> $DIR/bad-reg.rs:14:20 + --> $DIR/bad-reg.rs:12:20 | LL | asm!("{}", in(foo) foo); | ^^^^^^^^^^^ error: invalid register `foo`: unknown register - --> $DIR/bad-reg.rs:16:18 + --> $DIR/bad-reg.rs:14:18 | LL | asm!("", in("foo") foo); | ^^^^^^^^^^^^^ error: invalid asm template modifier for this register class - --> $DIR/bad-reg.rs:18:15 + --> $DIR/bad-reg.rs:16:15 | LL | asm!("{:z}", in(reg) foo); | ^^^^ ----------- argument @@ -21,7 +21,7 @@ LL | asm!("{:z}", in(reg) foo); = note: the `reg` register class supports the following template modifiers: `w`, `x` error: invalid asm template modifier for this register class - --> $DIR/bad-reg.rs:20:15 + --> $DIR/bad-reg.rs:18:15 | LL | asm!("{:r}", in(vreg) foo); | ^^^^ ------------ argument @@ -31,7 +31,7 @@ LL | asm!("{:r}", in(vreg) foo); = note: the `vreg` register class supports the following template modifiers: `b`, `h`, `s`, `d`, `q`, `v` error: invalid asm template modifier for this register class - --> $DIR/bad-reg.rs:22:15 + --> $DIR/bad-reg.rs:20:15 | LL | asm!("{:r}", in(vreg_low16) foo); | ^^^^ ------------------ argument @@ -41,7 +41,7 @@ LL | asm!("{:r}", in(vreg_low16) foo); = note: the `vreg_low16` register class supports the following template modifiers: `b`, `h`, `s`, `d`, `q`, `v` error: asm template modifiers are not allowed for `const` arguments - --> $DIR/bad-reg.rs:24:15 + --> $DIR/bad-reg.rs:22:15 | LL | asm!("{:a}", const 0); | ^^^^ ------- argument @@ -49,7 +49,7 @@ LL | asm!("{:a}", const 0); | template modifier error: asm template modifiers are not allowed for `sym` arguments - --> $DIR/bad-reg.rs:26:15 + --> $DIR/bad-reg.rs:24:15 | LL | asm!("{:a}", sym main); | ^^^^ -------- argument @@ -57,49 +57,49 @@ LL | asm!("{:a}", sym main); | template modifier error: invalid register `x29`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:28:18 + --> $DIR/bad-reg.rs:26:18 | LL | asm!("", in("x29") foo); | ^^^^^^^^^^^^^ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:30:18 + --> $DIR/bad-reg.rs:28:18 | LL | asm!("", in("sp") foo); | ^^^^^^^^^^^^ error: invalid register `xzr`: the zero register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:32:18 + --> $DIR/bad-reg.rs:30:18 | LL | asm!("", in("xzr") foo); | ^^^^^^^^^^^^^ error: invalid register `x19`: x19 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:34:18 + --> $DIR/bad-reg.rs:32:18 | LL | asm!("", in("x19") foo); | ^^^^^^^^^^^^^ error: register class `preg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:37:18 + --> $DIR/bad-reg.rs:35:18 | LL | asm!("", in("p0") foo); | ^^^^^^^^^^^^ error: register class `preg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:41:20 + --> $DIR/bad-reg.rs:39:20 | LL | asm!("{}", in(preg) foo); | ^^^^^^^^^^^^ error: register class `preg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:44:20 + --> $DIR/bad-reg.rs:42:20 | LL | asm!("{}", out(preg) _); | ^^^^^^^^^^^ error: register `w0` conflicts with register `x0` - --> $DIR/bad-reg.rs:50:32 + --> $DIR/bad-reg.rs:48:32 | LL | asm!("", in("x0") foo, in("w0") bar); | ------------ ^^^^^^^^^^^^ register `w0` @@ -107,7 +107,7 @@ LL | asm!("", in("x0") foo, in("w0") bar); | register `x0` error: register `x0` conflicts with register `x0` - --> $DIR/bad-reg.rs:52:32 + --> $DIR/bad-reg.rs:50:32 | LL | asm!("", in("x0") foo, out("x0") bar); | ------------ ^^^^^^^^^^^^^ register `x0` @@ -115,13 +115,13 @@ LL | asm!("", in("x0") foo, out("x0") bar); | register `x0` | help: use `lateout` instead of `out` to avoid conflict - --> $DIR/bad-reg.rs:52:18 + --> $DIR/bad-reg.rs:50:18 | LL | asm!("", in("x0") foo, out("x0") bar); | ^^^^^^^^^^^^ error: register `q0` conflicts with register `v0` - --> $DIR/bad-reg.rs:55:32 + --> $DIR/bad-reg.rs:53:32 | LL | asm!("", in("v0") foo, in("q0") bar); | ------------ ^^^^^^^^^^^^ register `q0` @@ -129,7 +129,7 @@ LL | asm!("", in("v0") foo, in("q0") bar); | register `v0` error: register `q0` conflicts with register `v0` - --> $DIR/bad-reg.rs:57:32 + --> $DIR/bad-reg.rs:55:32 | LL | asm!("", in("v0") foo, out("q0") bar); | ------------ ^^^^^^^^^^^^^ register `q0` @@ -137,13 +137,13 @@ LL | asm!("", in("v0") foo, out("q0") bar); | register `v0` | help: use `lateout` instead of `out` to avoid conflict - --> $DIR/bad-reg.rs:57:18 + --> $DIR/bad-reg.rs:55:18 | LL | asm!("", in("v0") foo, out("q0") bar); | ^^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:37:27 + --> $DIR/bad-reg.rs:35:27 | LL | asm!("", in("p0") foo); | ^^^ @@ -151,7 +151,7 @@ LL | asm!("", in("p0") foo); = note: register class `preg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:41:29 + --> $DIR/bad-reg.rs:39:29 | LL | asm!("{}", in(preg) foo); | ^^^ diff --git a/tests/ui/asm/aarch64/const.rs b/tests/ui/asm/aarch64/const.rs index a1fadb2115b..3eab5138d7d 100644 --- a/tests/ui/asm/aarch64/const.rs +++ b/tests/ui/asm/aarch64/const.rs @@ -2,8 +2,6 @@ //@ run-pass //@ needs-asm-support -#![feature(asm_const)] - use std::arch::{asm, global_asm}; fn const_generic<const X: usize>() -> usize { diff --git a/tests/ui/asm/aarch64/parse-error.rs b/tests/ui/asm/aarch64/parse-error.rs index ac73bbf99c9..aa731c35dda 100644 --- a/tests/ui/asm/aarch64/parse-error.rs +++ b/tests/ui/asm/aarch64/parse-error.rs @@ -1,7 +1,5 @@ //@ only-aarch64 -#![feature(asm_const)] - use std::arch::{asm, global_asm}; fn main() { diff --git a/tests/ui/asm/aarch64/parse-error.stderr b/tests/ui/asm/aarch64/parse-error.stderr index e2c798c798e..7b273282ee6 100644 --- a/tests/ui/asm/aarch64/parse-error.stderr +++ b/tests/ui/asm/aarch64/parse-error.stderr @@ -1,107 +1,107 @@ error: requires at least a template string argument - --> $DIR/parse-error.rs:11:9 + --> $DIR/parse-error.rs:9:9 | LL | asm!(); | ^^^^^^ error: asm template must be a string literal - --> $DIR/parse-error.rs:13:14 + --> $DIR/parse-error.rs:11:14 | LL | asm!(foo); | ^^^ error: expected token: `,` - --> $DIR/parse-error.rs:15:19 + --> $DIR/parse-error.rs:13:19 | LL | asm!("{}" foo); | ^^^ expected `,` error: expected operand, clobber_abi, options, or additional template string - --> $DIR/parse-error.rs:17:20 + --> $DIR/parse-error.rs:15:20 | LL | asm!("{}", foo); | ^^^ expected operand, clobber_abi, options, or additional template string error: expected `(`, found `foo` - --> $DIR/parse-error.rs:19:23 + --> $DIR/parse-error.rs:17:23 | LL | asm!("{}", in foo); | ^^^ expected `(` error: expected `)`, found `foo` - --> $DIR/parse-error.rs:21:27 + --> $DIR/parse-error.rs:19:27 | LL | asm!("{}", in(reg foo)); | ^^^ expected `)` error: expected expression, found end of macro arguments - --> $DIR/parse-error.rs:23:27 + --> $DIR/parse-error.rs:21:27 | LL | asm!("{}", in(reg)); | ^ expected expression error: expected register class or explicit register - --> $DIR/parse-error.rs:25:26 + --> $DIR/parse-error.rs:23:26 | LL | asm!("{}", inout(=) foo => bar); | ^ error: expected expression, found end of macro arguments - --> $DIR/parse-error.rs:27:37 + --> $DIR/parse-error.rs:25:37 | LL | asm!("{}", inout(reg) foo =>); | ^ expected expression error: expected one of `!`, `,`, `.`, `::`, `?`, `{`, or an operator, found `=>` - --> $DIR/parse-error.rs:29:32 + --> $DIR/parse-error.rs:27:32 | LL | asm!("{}", in(reg) foo => bar); | ^^ expected one of 7 possible tokens error: expected a path for argument to `sym` - --> $DIR/parse-error.rs:31:24 + --> $DIR/parse-error.rs:29:24 | LL | asm!("{}", sym foo + bar); | ^^^^^^^^^ error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` - --> $DIR/parse-error.rs:33:26 + --> $DIR/parse-error.rs:31:26 | LL | asm!("", options(foo)); | ^^^ expected one of 10 possible tokens error: expected one of `)` or `,`, found `foo` - --> $DIR/parse-error.rs:35:32 + --> $DIR/parse-error.rs:33:32 | LL | asm!("", options(nomem foo)); | ^^^ expected one of `)` or `,` error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` - --> $DIR/parse-error.rs:37:33 + --> $DIR/parse-error.rs:35:33 | LL | asm!("", options(nomem, foo)); | ^^^ expected one of 10 possible tokens error: expected string literal - --> $DIR/parse-error.rs:41:30 + --> $DIR/parse-error.rs:39:30 | LL | asm!("", clobber_abi(foo)); | ^^^ not a string literal error: expected one of `)` or `,`, found `foo` - --> $DIR/parse-error.rs:43:34 + --> $DIR/parse-error.rs:41:34 | LL | asm!("", clobber_abi("C" foo)); | ^^^ expected one of `)` or `,` error: expected string literal - --> $DIR/parse-error.rs:45:35 + --> $DIR/parse-error.rs:43:35 | LL | asm!("", clobber_abi("C", foo)); | ^^^ not a string literal error: duplicate argument named `a` - --> $DIR/parse-error.rs:52:36 + --> $DIR/parse-error.rs:50:36 | LL | asm!("{a}", a = const foo, a = const bar); | ------------- ^^^^^^^^^^^^^ duplicate argument @@ -109,7 +109,7 @@ LL | asm!("{a}", a = const foo, a = const bar); | previously here error: argument never used - --> $DIR/parse-error.rs:52:36 + --> $DIR/parse-error.rs:50:36 | LL | asm!("{a}", a = const foo, a = const bar); | ^^^^^^^^^^^^^ argument never used @@ -117,13 +117,13 @@ LL | asm!("{a}", a = const foo, a = const bar); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {1} */"` error: explicit register arguments cannot have names - --> $DIR/parse-error.rs:57:18 + --> $DIR/parse-error.rs:55:18 | LL | asm!("", a = in("x0") foo); | ^^^^^^^^^^^^^^^^ error: positional arguments cannot follow named arguments or explicit register arguments - --> $DIR/parse-error.rs:63:35 + --> $DIR/parse-error.rs:61:35 | LL | asm!("{1}", in("x0") foo, const bar); | ------------ ^^^^^^^^^ positional argument @@ -131,19 +131,19 @@ LL | asm!("{1}", in("x0") foo, const bar); | explicit register argument error: expected one of `clobber_abi`, `const`, `in`, `inlateout`, `inout`, `label`, `lateout`, `options`, `out`, or `sym`, found `""` - --> $DIR/parse-error.rs:66:29 + --> $DIR/parse-error.rs:64:29 | LL | asm!("", options(), ""); | ^^ expected one of 10 possible tokens error: expected one of `clobber_abi`, `const`, `in`, `inlateout`, `inout`, `label`, `lateout`, `options`, `out`, or `sym`, found `"{}"` - --> $DIR/parse-error.rs:68:33 + --> $DIR/parse-error.rs:66:33 | LL | asm!("{}", in(reg) foo, "{}", out(reg) foo); | ^^^^ expected one of 10 possible tokens error: asm template must be a string literal - --> $DIR/parse-error.rs:70:14 + --> $DIR/parse-error.rs:68:14 | LL | asm!(format!("{{{}}}", 0), in(reg) foo); | ^^^^^^^^^^^^^^^^^^^^ @@ -151,7 +151,7 @@ LL | asm!(format!("{{{}}}", 0), in(reg) foo); = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error: asm template must be a string literal - --> $DIR/parse-error.rs:72:21 + --> $DIR/parse-error.rs:70:21 | LL | asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar); | ^^^^^^^^^^^^^^^^^^^^ @@ -159,127 +159,127 @@ LL | asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar); = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error: _ cannot be used for input operands - --> $DIR/parse-error.rs:74:28 + --> $DIR/parse-error.rs:72:28 | LL | asm!("{}", in(reg) _); | ^ error: _ cannot be used for input operands - --> $DIR/parse-error.rs:76:31 + --> $DIR/parse-error.rs:74:31 | LL | asm!("{}", inout(reg) _); | ^ error: _ cannot be used for input operands - --> $DIR/parse-error.rs:78:35 + --> $DIR/parse-error.rs:76:35 | LL | asm!("{}", inlateout(reg) _); | ^ error: requires at least a template string argument - --> $DIR/parse-error.rs:85:1 + --> $DIR/parse-error.rs:83:1 | LL | global_asm!(); | ^^^^^^^^^^^^^ error: asm template must be a string literal - --> $DIR/parse-error.rs:87:13 + --> $DIR/parse-error.rs:85:13 | LL | global_asm!(FOO); | ^^^ error: expected token: `,` - --> $DIR/parse-error.rs:89:18 + --> $DIR/parse-error.rs:87:18 | LL | global_asm!("{}" FOO); | ^^^ expected `,` error: expected operand, options, or additional template string - --> $DIR/parse-error.rs:91:19 + --> $DIR/parse-error.rs:89:19 | LL | global_asm!("{}", FOO); | ^^^ expected operand, options, or additional template string error: expected expression, found end of macro arguments - --> $DIR/parse-error.rs:93:24 + --> $DIR/parse-error.rs:91:24 | LL | global_asm!("{}", const); | ^ expected expression error: expected one of `,`, `.`, `?`, or an operator, found `FOO` - --> $DIR/parse-error.rs:95:30 + --> $DIR/parse-error.rs:93:30 | LL | global_asm!("{}", const(reg) FOO); | ^^^ expected one of `,`, `.`, `?`, or an operator error: expected one of `)`, `att_syntax`, or `raw`, found `FOO` - --> $DIR/parse-error.rs:97:25 + --> $DIR/parse-error.rs:95:25 | LL | global_asm!("", options(FOO)); | ^^^ expected one of `)`, `att_syntax`, or `raw` error: the `nomem` option cannot be used with `global_asm!` - --> $DIR/parse-error.rs:99:25 + --> $DIR/parse-error.rs:97:25 | LL | global_asm!("", options(nomem FOO)); | ^^^^^ the `nomem` option is not meaningful for global-scoped inline assembly error: expected one of `)` or `,`, found `FOO` - --> $DIR/parse-error.rs:99:31 + --> $DIR/parse-error.rs:97:31 | LL | global_asm!("", options(nomem FOO)); | ^^^ expected one of `)` or `,` error: the `nomem` option cannot be used with `global_asm!` - --> $DIR/parse-error.rs:102:25 + --> $DIR/parse-error.rs:100:25 | LL | global_asm!("", options(nomem, FOO)); | ^^^^^ the `nomem` option is not meaningful for global-scoped inline assembly error: expected one of `)`, `att_syntax`, or `raw`, found `FOO` - --> $DIR/parse-error.rs:102:32 + --> $DIR/parse-error.rs:100:32 | LL | global_asm!("", options(nomem, FOO)); | ^^^ expected one of `)`, `att_syntax`, or `raw` error: expected string literal - --> $DIR/parse-error.rs:106:29 + --> $DIR/parse-error.rs:104:29 | LL | global_asm!("", clobber_abi(FOO)); | ^^^ not a string literal error: expected one of `)` or `,`, found `FOO` - --> $DIR/parse-error.rs:108:33 + --> $DIR/parse-error.rs:106:33 | LL | global_asm!("", clobber_abi("C" FOO)); | ^^^ expected one of `)` or `,` error: expected string literal - --> $DIR/parse-error.rs:110:34 + --> $DIR/parse-error.rs:108:34 | LL | global_asm!("", clobber_abi("C", FOO)); | ^^^ not a string literal error: `clobber_abi` cannot be used with `global_asm!` - --> $DIR/parse-error.rs:112:19 + --> $DIR/parse-error.rs:110:19 | LL | global_asm!("{}", clobber_abi("C"), const FOO); | ^^^^^^^^^^^^^^^^ error: `clobber_abi` cannot be used with `global_asm!` - --> $DIR/parse-error.rs:114:28 + --> $DIR/parse-error.rs:112:28 | LL | global_asm!("", options(), clobber_abi("C")); | ^^^^^^^^^^^^^^^^ error: `clobber_abi` cannot be used with `global_asm!` - --> $DIR/parse-error.rs:116:30 + --> $DIR/parse-error.rs:114:30 | LL | global_asm!("{}", options(), clobber_abi("C"), const FOO); | ^^^^^^^^^^^^^^^^ error: duplicate argument named `a` - --> $DIR/parse-error.rs:118:35 + --> $DIR/parse-error.rs:116:35 | LL | global_asm!("{a}", a = const FOO, a = const BAR); | ------------- ^^^^^^^^^^^^^ duplicate argument @@ -287,7 +287,7 @@ LL | global_asm!("{a}", a = const FOO, a = const BAR); | previously here error: argument never used - --> $DIR/parse-error.rs:118:35 + --> $DIR/parse-error.rs:116:35 | LL | global_asm!("{a}", a = const FOO, a = const BAR); | ^^^^^^^^^^^^^ argument never used @@ -295,19 +295,19 @@ LL | global_asm!("{a}", a = const FOO, a = const BAR); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {1} */"` error: expected one of `clobber_abi`, `const`, `options`, or `sym`, found `""` - --> $DIR/parse-error.rs:121:28 + --> $DIR/parse-error.rs:119:28 | LL | global_asm!("", options(), ""); | ^^ expected one of `clobber_abi`, `const`, `options`, or `sym` error: expected one of `clobber_abi`, `const`, `options`, or `sym`, found `"{}"` - --> $DIR/parse-error.rs:123:30 + --> $DIR/parse-error.rs:121:30 | LL | global_asm!("{}", const FOO, "{}", const FOO); | ^^^^ expected one of `clobber_abi`, `const`, `options`, or `sym` error: asm template must be a string literal - --> $DIR/parse-error.rs:125:13 + --> $DIR/parse-error.rs:123:13 | LL | global_asm!(format!("{{{}}}", 0), const FOO); | ^^^^^^^^^^^^^^^^^^^^ @@ -315,7 +315,7 @@ LL | global_asm!(format!("{{{}}}", 0), const FOO); = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error: asm template must be a string literal - --> $DIR/parse-error.rs:127:20 + --> $DIR/parse-error.rs:125:20 | LL | global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR); | ^^^^^^^^^^^^^^^^^^^^ @@ -323,7 +323,7 @@ LL | global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR); = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:39:37 + --> $DIR/parse-error.rs:37:37 | LL | asm!("{}", options(), const foo); | ^^^ non-constant value @@ -334,7 +334,7 @@ LL | const foo: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:47:44 + --> $DIR/parse-error.rs:45:44 | LL | asm!("{}", clobber_abi("C"), const foo); | ^^^ non-constant value @@ -345,7 +345,7 @@ LL | const foo: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:50:55 + --> $DIR/parse-error.rs:48:55 | LL | asm!("{}", options(), clobber_abi("C"), const foo); | ^^^ non-constant value @@ -356,7 +356,7 @@ LL | const foo: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:52:31 + --> $DIR/parse-error.rs:50:31 | LL | asm!("{a}", a = const foo, a = const bar); | ^^^ non-constant value @@ -367,7 +367,7 @@ LL | const foo: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:52:46 + --> $DIR/parse-error.rs:50:46 | LL | asm!("{a}", a = const foo, a = const bar); | ^^^ non-constant value @@ -378,7 +378,7 @@ LL | const bar: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:59:45 + --> $DIR/parse-error.rs:57:45 | LL | asm!("{a}", in("x0") foo, a = const bar); | ^^^ non-constant value @@ -389,7 +389,7 @@ LL | const bar: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:61:45 + --> $DIR/parse-error.rs:59:45 | LL | asm!("{a}", in("x0") foo, a = const bar); | ^^^ non-constant value @@ -400,7 +400,7 @@ LL | const bar: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:63:41 + --> $DIR/parse-error.rs:61:41 | LL | asm!("{1}", in("x0") foo, const bar); | ^^^ non-constant value diff --git a/tests/ui/asm/aarch64/type-check-3.rs b/tests/ui/asm/aarch64/type-check-3.rs index 3fc8e506069..b64473f98c0 100644 --- a/tests/ui/asm/aarch64/type-check-3.rs +++ b/tests/ui/asm/aarch64/type-check-3.rs @@ -1,7 +1,7 @@ //@ only-aarch64 //@ compile-flags: -C target-feature=+neon -#![feature(repr_simd, asm_const)] +#![feature(repr_simd)] use std::arch::aarch64::float64x2_t; use std::arch::{asm, global_asm}; diff --git a/tests/ui/asm/aarch64/type-check-3.stderr b/tests/ui/asm/aarch64/type-check-3.stderr index 9e37bb4c203..9d84d2666b3 100644 --- a/tests/ui/asm/aarch64/type-check-3.stderr +++ b/tests/ui/asm/aarch64/type-check-3.stderr @@ -95,7 +95,7 @@ error: type `i128` cannot be used with this register class LL | asm!("{}", in(reg) 0i128); | ^^^^^ | - = note: register class `reg` supports these types: i8, i16, i32, i64, f32, f64 + = note: register class `reg` supports these types: i8, i16, i32, i64, f16, f32, f64 error: type `float64x2_t` cannot be used with this register class --> $DIR/type-check-3.rs:75:28 @@ -103,7 +103,7 @@ error: type `float64x2_t` cannot be used with this register class LL | asm!("{}", in(reg) f64x2); | ^^^^^ | - = note: register class `reg` supports these types: i8, i16, i32, i64, f32, f64 + = note: register class `reg` supports these types: i8, i16, i32, i64, f16, f32, f64 error: type `Simd256bit` cannot be used with this register class --> $DIR/type-check-3.rs:77:29 @@ -111,7 +111,7 @@ error: type `Simd256bit` cannot be used with this register class LL | asm!("{}", in(vreg) f64x4); | ^^^^^ | - = note: register class `vreg` supports these types: i8, i16, i32, i64, f32, f64, i8x8, i16x4, i32x2, i64x1, f32x2, f64x1, i8x16, i16x8, i32x4, i64x2, f32x4, f64x2 + = note: register class `vreg` supports these types: i8, i16, i32, i64, f16, f32, f64, f128, i8x8, i16x4, i32x2, i64x1, f16x4, f32x2, f64x1, i8x16, i16x8, i32x4, i64x2, f16x8, f32x4, f64x2 error: incompatible types for asm inout argument --> $DIR/type-check-3.rs:88:33 diff --git a/tests/ui/asm/aarch64/type-check-4.rs b/tests/ui/asm/aarch64/type-check-4.rs index f00b4d4c46f..41eb9de5669 100644 --- a/tests/ui/asm/aarch64/type-check-4.rs +++ b/tests/ui/asm/aarch64/type-check-4.rs @@ -1,7 +1,7 @@ //@ only-aarch64 //@ compile-flags: -C target-feature=+neon -#![feature(repr_simd, asm_const)] +#![feature(repr_simd)] use std::arch::aarch64::float64x2_t; use std::arch::{asm, global_asm}; @@ -10,8 +10,7 @@ use std::arch::{asm, global_asm}; #[derive(Copy, Clone)] struct Simd256bit(f64, f64, f64, f64); -fn main() { -} +fn main() {} // Constants must be... constant diff --git a/tests/ui/asm/aarch64/type-check-4.stderr b/tests/ui/asm/aarch64/type-check-4.stderr index 3e675f69e84..89eb8467cde 100644 --- a/tests/ui/asm/aarch64/type-check-4.stderr +++ b/tests/ui/asm/aarch64/type-check-4.stderr @@ -1,5 +1,5 @@ error[E0658]: referencing statics in constants is unstable - --> $DIR/type-check-4.rs:25:25 + --> $DIR/type-check-4.rs:24:25 | LL | global_asm!("{}", const S); | ^ @@ -11,7 +11,7 @@ LL | global_asm!("{}", const S); = help: to fix this, the value can be extracted to a `const` and then used. error[E0658]: referencing statics in constants is unstable - --> $DIR/type-check-4.rs:28:35 + --> $DIR/type-check-4.rs:27:35 | LL | global_asm!("{}", const const_foo(S)); | ^ @@ -23,7 +23,7 @@ LL | global_asm!("{}", const const_foo(S)); = help: to fix this, the value can be extracted to a `const` and then used. error[E0658]: referencing statics in constants is unstable - --> $DIR/type-check-4.rs:31:35 + --> $DIR/type-check-4.rs:30:35 | LL | global_asm!("{}", const const_bar(S)); | ^ diff --git a/tests/ui/asm/aarch64/type-f16.rs b/tests/ui/asm/aarch64/type-f16.rs new file mode 100644 index 00000000000..e62d8130c93 --- /dev/null +++ b/tests/ui/asm/aarch64/type-f16.rs @@ -0,0 +1,25 @@ +//@ only-aarch64 +//@ run-pass +//@ needs-asm-support + +#![feature(f16)] + +use std::arch::asm; + +#[inline(never)] +pub fn f32_to_f16_asm(a: f32) -> f16 { + let ret: f16; + unsafe { + asm!( + "fcvt {ret:h}, {a:s}", + a = in(vreg) a, + ret = lateout(vreg) ret, + options(nomem, nostack), + ); + } + ret +} + +fn main() { + assert_eq!(f32_to_f16_asm(1.0 as f32), 1.0); +} diff --git a/tests/ui/asm/bad-template.rs b/tests/ui/asm/bad-template.rs index 41a906e32a4..6b00905a393 100644 --- a/tests/ui/asm/bad-template.rs +++ b/tests/ui/asm/bad-template.rs @@ -6,7 +6,7 @@ //@ [x86_64] needs-llvm-components: x86 //@ [aarch64] needs-llvm-components: aarch64 -#![feature(no_core, lang_items, rustc_attrs, asm_const)] +#![feature(no_core, lang_items, rustc_attrs)] #![no_core] #[rustc_builtin_macro] diff --git a/tests/ui/asm/const-error.rs b/tests/ui/asm/const-error.rs index f2cead399b6..40d0590c33e 100644 --- a/tests/ui/asm/const-error.rs +++ b/tests/ui/asm/const-error.rs @@ -1,15 +1,15 @@ //@ only-x86_64 //@ needs-asm-support -#![feature(asm_const)] - // Test to make sure that we emit const errors eagerly for inline asm use std::arch::asm; fn test<T>() { - unsafe { asm!("/* {} */", const 1 / 0); } - //~^ ERROR evaluation of + unsafe { + asm!("/* {} */", const 1 / 0); + //~^ ERROR evaluation of + } } fn main() {} diff --git a/tests/ui/asm/const-error.stderr b/tests/ui/asm/const-error.stderr index fe311832177..02e54457e89 100644 --- a/tests/ui/asm/const-error.stderr +++ b/tests/ui/asm/const-error.stderr @@ -1,8 +1,8 @@ error[E0080]: evaluation of `test::<T>::{constant#0}` failed - --> $DIR/const-error.rs:11:37 + --> $DIR/const-error.rs:10:32 | -LL | unsafe { asm!("/* {} */", const 1 / 0); } - | ^^^^^ attempt to divide `1_i32` by zero +LL | asm!("/* {} */", const 1 / 0); + | ^^^^^ attempt to divide `1_i32` by zero error: aborting due to 1 previous error diff --git a/tests/ui/asm/fail-const-eval-issue-121099.rs b/tests/ui/asm/fail-const-eval-issue-121099.rs index bed6fc9b39f..36d00b1e5d2 100644 --- a/tests/ui/asm/fail-const-eval-issue-121099.rs +++ b/tests/ui/asm/fail-const-eval-issue-121099.rs @@ -1,6 +1,5 @@ //@ build-fail //@ needs-asm-support -#![feature(asm_const)] use std::arch::global_asm; diff --git a/tests/ui/asm/fail-const-eval-issue-121099.stderr b/tests/ui/asm/fail-const-eval-issue-121099.stderr index 51d283218d2..5d86c3a5f7b 100644 --- a/tests/ui/asm/fail-const-eval-issue-121099.stderr +++ b/tests/ui/asm/fail-const-eval-issue-121099.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $DIR/fail-const-eval-issue-121099.rs:9:31 + --> $DIR/fail-const-eval-issue-121099.rs:8:31 | LL | global_asm!("/* {} */", const 1 << 500); | ^^^^^^^^ attempt to shift left by `500_i32`, which would overflow error[E0080]: evaluation of constant value failed - --> $DIR/fail-const-eval-issue-121099.rs:11:31 + --> $DIR/fail-const-eval-issue-121099.rs:10:31 | LL | global_asm!("/* {} */", const 1 / 0); | ^^^^^ attempt to divide `1_i32` by zero diff --git a/tests/ui/asm/generic-const.rs b/tests/ui/asm/generic-const.rs index 133d093d200..3b69a4e86e3 100644 --- a/tests/ui/asm/generic-const.rs +++ b/tests/ui/asm/generic-const.rs @@ -1,8 +1,6 @@ //@ needs-asm-support //@ build-pass -#![feature(asm_const)] - use std::arch::asm; fn foofoo<const N: usize>() {} diff --git a/tests/ui/asm/invalid-const-operand.rs b/tests/ui/asm/invalid-const-operand.rs index eff335ff6aa..a688f5042db 100644 --- a/tests/ui/asm/invalid-const-operand.rs +++ b/tests/ui/asm/invalid-const-operand.rs @@ -2,8 +2,6 @@ //@ ignore-nvptx64 //@ ignore-spirv -#![feature(asm_const)] - use std::arch::{asm, global_asm}; // Const operands must be integers and must be constants. diff --git a/tests/ui/asm/invalid-const-operand.stderr b/tests/ui/asm/invalid-const-operand.stderr index a6d742b53c2..bda4b0355b7 100644 --- a/tests/ui/asm/invalid-const-operand.stderr +++ b/tests/ui/asm/invalid-const-operand.stderr @@ -1,5 +1,5 @@ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/invalid-const-operand.rs:42:26 + --> $DIR/invalid-const-operand.rs:40:26 | LL | asm!("{}", const x); | ^ non-constant value @@ -10,7 +10,7 @@ LL | const x: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/invalid-const-operand.rs:45:36 + --> $DIR/invalid-const-operand.rs:43:36 | LL | asm!("{}", const const_foo(x)); | ^ non-constant value @@ -21,7 +21,7 @@ LL | const x: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/invalid-const-operand.rs:48:36 + --> $DIR/invalid-const-operand.rs:46:36 | LL | asm!("{}", const const_bar(x)); | ^ non-constant value @@ -32,7 +32,7 @@ LL | const x: /* Type */ = 0; | ~~~~~ ++++++++++++ error: invalid type for `const` operand - --> $DIR/invalid-const-operand.rs:14:19 + --> $DIR/invalid-const-operand.rs:12:19 | LL | global_asm!("{}", const 0f32); | ^^^^^^---- @@ -42,7 +42,7 @@ LL | global_asm!("{}", const 0f32); = help: `const` operands must be of an integer type error: invalid type for `const` operand - --> $DIR/invalid-const-operand.rs:16:19 + --> $DIR/invalid-const-operand.rs:14:19 | LL | global_asm!("{}", const 0 as *mut u8); | ^^^^^^------------ @@ -52,7 +52,7 @@ LL | global_asm!("{}", const 0 as *mut u8); = help: `const` operands must be of an integer type error: invalid type for `const` operand - --> $DIR/invalid-const-operand.rs:26:20 + --> $DIR/invalid-const-operand.rs:24:20 | LL | asm!("{}", const 0f32); | ^^^^^^---- @@ -62,7 +62,7 @@ LL | asm!("{}", const 0f32); = help: `const` operands must be of an integer type error: invalid type for `const` operand - --> $DIR/invalid-const-operand.rs:28:20 + --> $DIR/invalid-const-operand.rs:26:20 | LL | asm!("{}", const 0 as *mut u8); | ^^^^^^------------ @@ -72,7 +72,7 @@ LL | asm!("{}", const 0 as *mut u8); = help: `const` operands must be of an integer type error: invalid type for `const` operand - --> $DIR/invalid-const-operand.rs:30:20 + --> $DIR/invalid-const-operand.rs:28:20 | LL | asm!("{}", const &0); | ^^^^^^-- diff --git a/tests/ui/asm/naked-functions.rs b/tests/ui/asm/naked-functions.rs index cb1e5c325c2..116a84506c5 100644 --- a/tests/ui/asm/naked-functions.rs +++ b/tests/ui/asm/naked-functions.rs @@ -3,7 +3,7 @@ //@ ignore-spirv #![feature(naked_functions)] -#![feature(asm_const, asm_unwind, linkage)] +#![feature(asm_unwind, linkage)] #![crate_type = "lib"] use std::arch::asm; diff --git a/tests/ui/asm/naked-with-invalid-repr-attr.rs b/tests/ui/asm/naked-with-invalid-repr-attr.rs new file mode 100644 index 00000000000..687fe1ad73d --- /dev/null +++ b/tests/ui/asm/naked-with-invalid-repr-attr.rs @@ -0,0 +1,48 @@ +//@ needs-asm-support +#![feature(naked_functions)] +#![feature(fn_align)] +#![crate_type = "lib"] +use std::arch::asm; + +#[repr(C)] +//~^ ERROR attribute should be applied to a struct, enum, or union [E0517] +#[naked] +extern "C" fn example1() { + //~^ NOTE not a struct, enum, or union + unsafe { asm!("", options(noreturn)) } +} + +#[repr(transparent)] +//~^ ERROR attribute should be applied to a struct, enum, or union [E0517] +#[naked] +extern "C" fn example2() { + //~^ NOTE not a struct, enum, or union + unsafe { asm!("", options(noreturn)) } +} + +#[repr(align(16), C)] +//~^ ERROR attribute should be applied to a struct, enum, or union [E0517] +#[naked] +extern "C" fn example3() { + //~^ NOTE not a struct, enum, or union + unsafe { asm!("", options(noreturn)) } +} + +// note: two errors because of packed and C +#[repr(C, packed)] +//~^ ERROR attribute should be applied to a struct or union [E0517] +//~| ERROR attribute should be applied to a struct, enum, or union [E0517] +#[naked] +extern "C" fn example4() { + //~^ NOTE not a struct, enum, or union + //~| NOTE not a struct or union + unsafe { asm!("", options(noreturn)) } +} + +#[repr(u8)] +//~^ ERROR attribute should be applied to an enum [E0517] +#[naked] +extern "C" fn example5() { + //~^ NOTE not an enum + unsafe { asm!("", options(noreturn)) } +} diff --git a/tests/ui/asm/naked-with-invalid-repr-attr.stderr b/tests/ui/asm/naked-with-invalid-repr-attr.stderr new file mode 100644 index 00000000000..3740f17a9dc --- /dev/null +++ b/tests/ui/asm/naked-with-invalid-repr-attr.stderr @@ -0,0 +1,77 @@ +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/naked-with-invalid-repr-attr.rs:7:8 + | +LL | #[repr(C)] + | ^ +... +LL | / extern "C" fn example1() { +LL | | +LL | | unsafe { asm!("", options(noreturn)) } +LL | | } + | |_- not a struct, enum, or union + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/naked-with-invalid-repr-attr.rs:15:8 + | +LL | #[repr(transparent)] + | ^^^^^^^^^^^ +... +LL | / extern "C" fn example2() { +LL | | +LL | | unsafe { asm!("", options(noreturn)) } +LL | | } + | |_- not a struct, enum, or union + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/naked-with-invalid-repr-attr.rs:23:19 + | +LL | #[repr(align(16), C)] + | ^ +... +LL | / extern "C" fn example3() { +LL | | +LL | | unsafe { asm!("", options(noreturn)) } +LL | | } + | |_- not a struct, enum, or union + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/naked-with-invalid-repr-attr.rs:32:8 + | +LL | #[repr(C, packed)] + | ^ +... +LL | / extern "C" fn example4() { +LL | | +LL | | +LL | | unsafe { asm!("", options(noreturn)) } +LL | | } + | |_- not a struct, enum, or union + +error[E0517]: attribute should be applied to a struct or union + --> $DIR/naked-with-invalid-repr-attr.rs:32:11 + | +LL | #[repr(C, packed)] + | ^^^^^^ +... +LL | / extern "C" fn example4() { +LL | | +LL | | +LL | | unsafe { asm!("", options(noreturn)) } +LL | | } + | |_- not a struct or union + +error[E0517]: attribute should be applied to an enum + --> $DIR/naked-with-invalid-repr-attr.rs:42:8 + | +LL | #[repr(u8)] + | ^^ +... +LL | / extern "C" fn example5() { +LL | | +LL | | unsafe { asm!("", options(noreturn)) } +LL | | } + | |_- not an enum + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0517`. diff --git a/tests/ui/asm/named-asm-labels.rs b/tests/ui/asm/named-asm-labels.rs index d2ca6fe8808..043aab9029d 100644 --- a/tests/ui/asm/named-asm-labels.rs +++ b/tests/ui/asm/named-asm-labels.rs @@ -10,7 +10,7 @@ // which causes less readable LLVM errors and in the worst cases causes ICEs // or segfaults based on system dependent behavior and codegen flags. -#![feature(naked_functions, asm_const)] +#![feature(naked_functions)] use std::arch::{asm, global_asm}; @@ -128,6 +128,7 @@ fn main() { // Tests usage of colons in non-label positions asm!(":lo12:FOO"); // this is apparently valid aarch64 + // is there an example that is valid x86 for this test? asm!(":bbb nop"); @@ -176,7 +177,8 @@ fn main() { // label or LTO can cause labels to break #[naked] pub extern "C" fn foo() -> i32 { - unsafe { asm!(".Lfoo: mov rax, {}; ret;", "nop", const 1, options(noreturn)) } //~ ERROR avoid using named labels + unsafe { asm!(".Lfoo: mov rax, {}; ret;", "nop", const 1, options(noreturn)) } + //~^ ERROR avoid using named labels } // Make sure that non-naked attributes *do* still let the lint happen diff --git a/tests/ui/asm/named-asm-labels.stderr b/tests/ui/asm/named-asm-labels.stderr index 20b7d64f9e7..e5e177fb8b8 100644 --- a/tests/ui/asm/named-asm-labels.stderr +++ b/tests/ui/asm/named-asm-labels.stderr @@ -328,7 +328,7 @@ LL | ab: nop // ab: does foo = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:143:19 + --> $DIR/named-asm-labels.rs:144:19 | LL | asm!("test_{}: nop", in(reg) 10); | ^^^^^^^ @@ -338,7 +338,7 @@ LL | asm!("test_{}: nop", in(reg) 10); = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:145:15 + --> $DIR/named-asm-labels.rs:146:15 | LL | asm!("test_{}: nop", const 10); | ^^^^^^^ @@ -348,7 +348,7 @@ LL | asm!("test_{}: nop", const 10); = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:146:15 + --> $DIR/named-asm-labels.rs:147:15 | LL | asm!("test_{}: nop", sym main); | ^^^^^^^ @@ -358,7 +358,7 @@ LL | asm!("test_{}: nop", sym main); = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:147:15 + --> $DIR/named-asm-labels.rs:148:15 | LL | asm!("{}_test: nop", const 10); | ^^^^^^^ @@ -368,7 +368,7 @@ LL | asm!("{}_test: nop", const 10); = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:148:15 + --> $DIR/named-asm-labels.rs:149:15 | LL | asm!("test_{}_test: nop", const 10); | ^^^^^^^^^^^^ @@ -378,7 +378,7 @@ LL | asm!("test_{}_test: nop", const 10); = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:149:15 + --> $DIR/named-asm-labels.rs:150:15 | LL | asm!("{}: nop", const 10); | ^^ @@ -388,7 +388,7 @@ LL | asm!("{}: nop", const 10); = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:151:15 + --> $DIR/named-asm-labels.rs:152:15 | LL | asm!("{uwu}: nop", uwu = const 10); | ^^^^^ @@ -398,7 +398,7 @@ LL | asm!("{uwu}: nop", uwu = const 10); = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:152:15 + --> $DIR/named-asm-labels.rs:153:15 | LL | asm!("{0}: nop", const 10); | ^^^ @@ -408,7 +408,7 @@ LL | asm!("{0}: nop", const 10); = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:153:15 + --> $DIR/named-asm-labels.rs:154:15 | LL | asm!("{1}: nop", "/* {0} */", const 10, const 20); | ^^^ @@ -418,7 +418,7 @@ LL | asm!("{1}: nop", "/* {0} */", const 10, const 20); = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:156:14 + --> $DIR/named-asm-labels.rs:157:14 | LL | asm!(include_str!("named-asm-labels.s")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -428,7 +428,7 @@ LL | asm!(include_str!("named-asm-labels.s")); = note: the label may be declared in the expansion of a macro error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:156:14 + --> $DIR/named-asm-labels.rs:157:14 | LL | asm!(include_str!("named-asm-labels.s")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -439,7 +439,7 @@ LL | asm!(include_str!("named-asm-labels.s")); = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:156:14 + --> $DIR/named-asm-labels.rs:157:14 | LL | asm!(include_str!("named-asm-labels.s")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -450,7 +450,7 @@ LL | asm!(include_str!("named-asm-labels.s")); = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:156:14 + --> $DIR/named-asm-labels.rs:157:14 | LL | asm!(include_str!("named-asm-labels.s")); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -461,7 +461,7 @@ LL | asm!(include_str!("named-asm-labels.s")); = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` warning: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:170:19 + --> $DIR/named-asm-labels.rs:171:19 | LL | asm!("warned: nop"); | ^^^^^^ @@ -469,13 +469,13 @@ LL | asm!("warned: nop"); = help: only local labels of the form `<number>:` should be used in inline asm = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information note: the lint level is defined here - --> $DIR/named-asm-labels.rs:168:16 + --> $DIR/named-asm-labels.rs:169:16 | LL | #[warn(named_asm_labels)] | ^^^^^^^^^^^^^^^^ error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:179:20 + --> $DIR/named-asm-labels.rs:180:20 | LL | unsafe { asm!(".Lfoo: mov rax, {}; ret;", "nop", const 1, options(noreturn)) } | ^^^^^ @@ -484,7 +484,7 @@ LL | unsafe { asm!(".Lfoo: mov rax, {}; ret;", "nop", const 1, options(noret = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:185:20 + --> $DIR/named-asm-labels.rs:187:20 | LL | unsafe { asm!(".Lbar: mov rax, {}; ret;", "nop", const 1, options(noreturn)) } | ^^^^^ @@ -493,7 +493,7 @@ LL | unsafe { asm!(".Lbar: mov rax, {}; ret;", "nop", const 1, options(noret = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:193:20 + --> $DIR/named-asm-labels.rs:195:20 | LL | unsafe { asm!(".Laaa: nop; ret;", options(noreturn)) } | ^^^^^ @@ -502,7 +502,7 @@ LL | unsafe { asm!(".Laaa: nop; ret;", options(noreturn)) } = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:203:24 + --> $DIR/named-asm-labels.rs:205:24 | LL | unsafe { asm!(".Lbbb: nop; ret;", options(noreturn)) } | ^^^^^ @@ -511,7 +511,7 @@ LL | unsafe { asm!(".Lbbb: nop; ret;", options(noreturn)) } = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:212:15 + --> $DIR/named-asm-labels.rs:214:15 | LL | asm!("closure1: nop"); | ^^^^^^^^ @@ -520,7 +520,7 @@ LL | asm!("closure1: nop"); = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:216:15 + --> $DIR/named-asm-labels.rs:218:15 | LL | asm!("closure2: nop"); | ^^^^^^^^ @@ -529,7 +529,7 @@ LL | asm!("closure2: nop"); = note: see the asm section of Rust By Example <https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#labels> for more information error: avoid using named labels in inline assembly - --> $DIR/named-asm-labels.rs:226:19 + --> $DIR/named-asm-labels.rs:228:19 | LL | asm!("closure3: nop"); | ^^^^^^^^ diff --git a/tests/ui/asm/parse-error.rs b/tests/ui/asm/parse-error.rs index 16ae0282864..4d7b522f5fc 100644 --- a/tests/ui/asm/parse-error.rs +++ b/tests/ui/asm/parse-error.rs @@ -1,7 +1,5 @@ //@ needs-asm-support -#![feature(asm_const)] - use std::arch::{asm, global_asm}; fn main() { diff --git a/tests/ui/asm/parse-error.stderr b/tests/ui/asm/parse-error.stderr index f5f8d537d86..6d0e629b937 100644 --- a/tests/ui/asm/parse-error.stderr +++ b/tests/ui/asm/parse-error.stderr @@ -1,167 +1,167 @@ error: requires at least a template string argument - --> $DIR/parse-error.rs:11:9 + --> $DIR/parse-error.rs:9:9 | LL | asm!(); | ^^^^^^ error: asm template must be a string literal - --> $DIR/parse-error.rs:13:14 + --> $DIR/parse-error.rs:11:14 | LL | asm!(foo); | ^^^ error: expected token: `,` - --> $DIR/parse-error.rs:15:19 + --> $DIR/parse-error.rs:13:19 | LL | asm!("{}" foo); | ^^^ expected `,` error: expected operand, clobber_abi, options, or additional template string - --> $DIR/parse-error.rs:17:20 + --> $DIR/parse-error.rs:15:20 | LL | asm!("{}", foo); | ^^^ expected operand, clobber_abi, options, or additional template string error: expected `(`, found `foo` - --> $DIR/parse-error.rs:19:23 + --> $DIR/parse-error.rs:17:23 | LL | asm!("{}", in foo); | ^^^ expected `(` error: expected `)`, found `foo` - --> $DIR/parse-error.rs:21:27 + --> $DIR/parse-error.rs:19:27 | LL | asm!("{}", in(reg foo)); | ^^^ expected `)` error: expected expression, found end of macro arguments - --> $DIR/parse-error.rs:23:27 + --> $DIR/parse-error.rs:21:27 | LL | asm!("{}", in(reg)); | ^ expected expression error: expected register class or explicit register - --> $DIR/parse-error.rs:25:26 + --> $DIR/parse-error.rs:23:26 | LL | asm!("{}", inout(=) foo => bar); | ^ error: expected expression, found end of macro arguments - --> $DIR/parse-error.rs:27:37 + --> $DIR/parse-error.rs:25:37 | LL | asm!("{}", inout(reg) foo =>); | ^ expected expression error: expected one of `!`, `,`, `.`, `::`, `?`, `{`, or an operator, found `=>` - --> $DIR/parse-error.rs:29:32 + --> $DIR/parse-error.rs:27:32 | LL | asm!("{}", in(reg) foo => bar); | ^^ expected one of 7 possible tokens error: expected a path for argument to `sym` - --> $DIR/parse-error.rs:31:24 + --> $DIR/parse-error.rs:29:24 | LL | asm!("{}", sym foo + bar); | ^^^^^^^^^ error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` - --> $DIR/parse-error.rs:33:26 + --> $DIR/parse-error.rs:31:26 | LL | asm!("", options(foo)); | ^^^ expected one of 10 possible tokens error: expected one of `)` or `,`, found `foo` - --> $DIR/parse-error.rs:35:32 + --> $DIR/parse-error.rs:33:32 | LL | asm!("", options(nomem foo)); | ^^^ expected one of `)` or `,` error: expected one of `)`, `att_syntax`, `may_unwind`, `nomem`, `noreturn`, `nostack`, `preserves_flags`, `pure`, `raw`, or `readonly`, found `foo` - --> $DIR/parse-error.rs:37:33 + --> $DIR/parse-error.rs:35:33 | LL | asm!("", options(nomem, foo)); | ^^^ expected one of 10 possible tokens error: at least one abi must be provided as an argument to `clobber_abi` - --> $DIR/parse-error.rs:44:30 + --> $DIR/parse-error.rs:42:30 | LL | asm!("", clobber_abi()); | ^ error: expected string literal - --> $DIR/parse-error.rs:46:30 + --> $DIR/parse-error.rs:44:30 | LL | asm!("", clobber_abi(foo)); | ^^^ not a string literal error: expected one of `)` or `,`, found `foo` - --> $DIR/parse-error.rs:48:34 + --> $DIR/parse-error.rs:46:34 | LL | asm!("", clobber_abi("C" foo)); | ^^^ expected one of `)` or `,` error: expected string literal - --> $DIR/parse-error.rs:50:35 + --> $DIR/parse-error.rs:48:35 | LL | asm!("", clobber_abi("C", foo)); | ^^^ not a string literal error: expected string literal - --> $DIR/parse-error.rs:52:30 + --> $DIR/parse-error.rs:50:30 | LL | asm!("", clobber_abi(1)); | ^ not a string literal error: expected string literal - --> $DIR/parse-error.rs:54:30 + --> $DIR/parse-error.rs:52:30 | LL | asm!("", clobber_abi(())); | ^ not a string literal error: expected string literal - --> $DIR/parse-error.rs:56:30 + --> $DIR/parse-error.rs:54:30 | LL | asm!("", clobber_abi(uwu)); | ^^^ not a string literal error: expected string literal - --> $DIR/parse-error.rs:58:30 + --> $DIR/parse-error.rs:56:30 | LL | asm!("", clobber_abi({})); | ^ not a string literal error: expected string literal - --> $DIR/parse-error.rs:60:30 + --> $DIR/parse-error.rs:58:30 | LL | asm!("", clobber_abi(loop {})); | ^^^^ not a string literal error: expected string literal - --> $DIR/parse-error.rs:62:30 + --> $DIR/parse-error.rs:60:30 | LL | asm!("", clobber_abi(if)); | ^^ not a string literal error: expected string literal - --> $DIR/parse-error.rs:64:30 + --> $DIR/parse-error.rs:62:30 | LL | asm!("", clobber_abi(do)); | ^^ not a string literal error: expected string literal - --> $DIR/parse-error.rs:66:30 + --> $DIR/parse-error.rs:64:30 | LL | asm!("", clobber_abi(<)); | ^ not a string literal error: expected string literal - --> $DIR/parse-error.rs:68:30 + --> $DIR/parse-error.rs:66:30 | LL | asm!("", clobber_abi(.)); | ^ not a string literal error: duplicate argument named `a` - --> $DIR/parse-error.rs:76:36 + --> $DIR/parse-error.rs:74:36 | LL | asm!("{a}", a = const foo, a = const bar); | ------------- ^^^^^^^^^^^^^ duplicate argument @@ -169,7 +169,7 @@ LL | asm!("{a}", a = const foo, a = const bar); | previously here error: argument never used - --> $DIR/parse-error.rs:76:36 + --> $DIR/parse-error.rs:74:36 | LL | asm!("{a}", a = const foo, a = const bar); | ^^^^^^^^^^^^^ argument never used @@ -177,19 +177,19 @@ LL | asm!("{a}", a = const foo, a = const bar); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {1} */"` error: expected one of `clobber_abi`, `const`, `in`, `inlateout`, `inout`, `label`, `lateout`, `options`, `out`, or `sym`, found `""` - --> $DIR/parse-error.rs:82:29 + --> $DIR/parse-error.rs:80:29 | LL | asm!("", options(), ""); | ^^ expected one of 10 possible tokens error: expected one of `clobber_abi`, `const`, `in`, `inlateout`, `inout`, `label`, `lateout`, `options`, `out`, or `sym`, found `"{}"` - --> $DIR/parse-error.rs:84:33 + --> $DIR/parse-error.rs:82:33 | LL | asm!("{}", in(reg) foo, "{}", out(reg) foo); | ^^^^ expected one of 10 possible tokens error: asm template must be a string literal - --> $DIR/parse-error.rs:86:14 + --> $DIR/parse-error.rs:84:14 | LL | asm!(format!("{{{}}}", 0), in(reg) foo); | ^^^^^^^^^^^^^^^^^^^^ @@ -197,7 +197,7 @@ LL | asm!(format!("{{{}}}", 0), in(reg) foo); = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error: asm template must be a string literal - --> $DIR/parse-error.rs:88:21 + --> $DIR/parse-error.rs:86:21 | LL | asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar); | ^^^^^^^^^^^^^^^^^^^^ @@ -205,139 +205,139 @@ LL | asm!("{1}", format!("{{{}}}", 0), in(reg) foo, out(reg) bar); = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error: _ cannot be used for input operands - --> $DIR/parse-error.rs:90:28 + --> $DIR/parse-error.rs:88:28 | LL | asm!("{}", in(reg) _); | ^ error: _ cannot be used for input operands - --> $DIR/parse-error.rs:92:31 + --> $DIR/parse-error.rs:90:31 | LL | asm!("{}", inout(reg) _); | ^ error: _ cannot be used for input operands - --> $DIR/parse-error.rs:94:35 + --> $DIR/parse-error.rs:92:35 | LL | asm!("{}", inlateout(reg) _); | ^ error: requires at least a template string argument - --> $DIR/parse-error.rs:101:1 + --> $DIR/parse-error.rs:99:1 | LL | global_asm!(); | ^^^^^^^^^^^^^ error: asm template must be a string literal - --> $DIR/parse-error.rs:103:13 + --> $DIR/parse-error.rs:101:13 | LL | global_asm!(FOO); | ^^^ error: expected token: `,` - --> $DIR/parse-error.rs:105:18 + --> $DIR/parse-error.rs:103:18 | LL | global_asm!("{}" FOO); | ^^^ expected `,` error: expected operand, options, or additional template string - --> $DIR/parse-error.rs:107:19 + --> $DIR/parse-error.rs:105:19 | LL | global_asm!("{}", FOO); | ^^^ expected operand, options, or additional template string error: expected expression, found end of macro arguments - --> $DIR/parse-error.rs:109:24 + --> $DIR/parse-error.rs:107:24 | LL | global_asm!("{}", const); | ^ expected expression error: expected one of `,`, `.`, `?`, or an operator, found `FOO` - --> $DIR/parse-error.rs:111:30 + --> $DIR/parse-error.rs:109:30 | LL | global_asm!("{}", const(reg) FOO); | ^^^ expected one of `,`, `.`, `?`, or an operator error: expected one of `)`, `att_syntax`, or `raw`, found `FOO` - --> $DIR/parse-error.rs:113:25 + --> $DIR/parse-error.rs:111:25 | LL | global_asm!("", options(FOO)); | ^^^ expected one of `)`, `att_syntax`, or `raw` error: expected one of `)`, `att_syntax`, or `raw`, found `FOO` - --> $DIR/parse-error.rs:115:25 + --> $DIR/parse-error.rs:113:25 | LL | global_asm!("", options(FOO,)); | ^^^ expected one of `)`, `att_syntax`, or `raw` error: the `nomem` option cannot be used with `global_asm!` - --> $DIR/parse-error.rs:117:25 + --> $DIR/parse-error.rs:115:25 | LL | global_asm!("", options(nomem FOO)); | ^^^^^ the `nomem` option is not meaningful for global-scoped inline assembly error: expected one of `)` or `,`, found `FOO` - --> $DIR/parse-error.rs:117:31 + --> $DIR/parse-error.rs:115:31 | LL | global_asm!("", options(nomem FOO)); | ^^^ expected one of `)` or `,` error: the `nomem` option cannot be used with `global_asm!` - --> $DIR/parse-error.rs:120:25 + --> $DIR/parse-error.rs:118:25 | LL | global_asm!("", options(nomem, FOO)); | ^^^^^ the `nomem` option is not meaningful for global-scoped inline assembly error: expected one of `)`, `att_syntax`, or `raw`, found `FOO` - --> $DIR/parse-error.rs:120:32 + --> $DIR/parse-error.rs:118:32 | LL | global_asm!("", options(nomem, FOO)); | ^^^ expected one of `)`, `att_syntax`, or `raw` error: expected string literal - --> $DIR/parse-error.rs:124:29 + --> $DIR/parse-error.rs:122:29 | LL | global_asm!("", clobber_abi(FOO)); | ^^^ not a string literal error: expected one of `)` or `,`, found `FOO` - --> $DIR/parse-error.rs:126:33 + --> $DIR/parse-error.rs:124:33 | LL | global_asm!("", clobber_abi("C" FOO)); | ^^^ expected one of `)` or `,` error: expected string literal - --> $DIR/parse-error.rs:128:34 + --> $DIR/parse-error.rs:126:34 | LL | global_asm!("", clobber_abi("C", FOO)); | ^^^ not a string literal error: `clobber_abi` cannot be used with `global_asm!` - --> $DIR/parse-error.rs:130:19 + --> $DIR/parse-error.rs:128:19 | LL | global_asm!("{}", clobber_abi("C"), const FOO); | ^^^^^^^^^^^^^^^^ error: `clobber_abi` cannot be used with `global_asm!` - --> $DIR/parse-error.rs:132:28 + --> $DIR/parse-error.rs:130:28 | LL | global_asm!("", options(), clobber_abi("C")); | ^^^^^^^^^^^^^^^^ error: `clobber_abi` cannot be used with `global_asm!` - --> $DIR/parse-error.rs:134:30 + --> $DIR/parse-error.rs:132:30 | LL | global_asm!("{}", options(), clobber_abi("C"), const FOO); | ^^^^^^^^^^^^^^^^ error: `clobber_abi` cannot be used with `global_asm!` - --> $DIR/parse-error.rs:136:17 + --> $DIR/parse-error.rs:134:17 | LL | global_asm!("", clobber_abi("C"), clobber_abi("C")); | ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ error: duplicate argument named `a` - --> $DIR/parse-error.rs:138:35 + --> $DIR/parse-error.rs:136:35 | LL | global_asm!("{a}", a = const FOO, a = const BAR); | ------------- ^^^^^^^^^^^^^ duplicate argument @@ -345,7 +345,7 @@ LL | global_asm!("{a}", a = const FOO, a = const BAR); | previously here error: argument never used - --> $DIR/parse-error.rs:138:35 + --> $DIR/parse-error.rs:136:35 | LL | global_asm!("{a}", a = const FOO, a = const BAR); | ^^^^^^^^^^^^^ argument never used @@ -353,19 +353,19 @@ LL | global_asm!("{a}", a = const FOO, a = const BAR); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {1} */"` error: expected one of `clobber_abi`, `const`, `options`, or `sym`, found `""` - --> $DIR/parse-error.rs:141:28 + --> $DIR/parse-error.rs:139:28 | LL | global_asm!("", options(), ""); | ^^ expected one of `clobber_abi`, `const`, `options`, or `sym` error: expected one of `clobber_abi`, `const`, `options`, or `sym`, found `"{}"` - --> $DIR/parse-error.rs:143:30 + --> $DIR/parse-error.rs:141:30 | LL | global_asm!("{}", const FOO, "{}", const FOO); | ^^^^ expected one of `clobber_abi`, `const`, `options`, or `sym` error: asm template must be a string literal - --> $DIR/parse-error.rs:145:13 + --> $DIR/parse-error.rs:143:13 | LL | global_asm!(format!("{{{}}}", 0), const FOO); | ^^^^^^^^^^^^^^^^^^^^ @@ -373,7 +373,7 @@ LL | global_asm!(format!("{{{}}}", 0), const FOO); = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error: asm template must be a string literal - --> $DIR/parse-error.rs:147:20 + --> $DIR/parse-error.rs:145:20 | LL | global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR); | ^^^^^^^^^^^^^^^^^^^^ @@ -381,43 +381,43 @@ LL | global_asm!("{1}", format!("{{{}}}", 0), const FOO, const BAR); = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) error: the `in` operand cannot be used with `global_asm!` - --> $DIR/parse-error.rs:150:19 + --> $DIR/parse-error.rs:148:19 | LL | global_asm!("{}", in(reg)); | ^^ the `in` operand is not meaningful for global-scoped inline assembly, remove it error: the `out` operand cannot be used with `global_asm!` - --> $DIR/parse-error.rs:152:19 + --> $DIR/parse-error.rs:150:19 | LL | global_asm!("{}", out(reg)); | ^^^ the `out` operand is not meaningful for global-scoped inline assembly, remove it error: the `lateout` operand cannot be used with `global_asm!` - --> $DIR/parse-error.rs:154:19 + --> $DIR/parse-error.rs:152:19 | LL | global_asm!("{}", lateout(reg)); | ^^^^^^^ the `lateout` operand is not meaningful for global-scoped inline assembly, remove it error: the `inout` operand cannot be used with `global_asm!` - --> $DIR/parse-error.rs:156:19 + --> $DIR/parse-error.rs:154:19 | LL | global_asm!("{}", inout(reg)); | ^^^^^ the `inout` operand is not meaningful for global-scoped inline assembly, remove it error: the `inlateout` operand cannot be used with `global_asm!` - --> $DIR/parse-error.rs:158:19 + --> $DIR/parse-error.rs:156:19 | LL | global_asm!("{}", inlateout(reg)); | ^^^^^^^^^ the `inlateout` operand is not meaningful for global-scoped inline assembly, remove it error: the `label` operand cannot be used with `global_asm!` - --> $DIR/parse-error.rs:160:19 + --> $DIR/parse-error.rs:158:19 | LL | global_asm!("{}", label(reg)); | ^^^^^ the `label` operand is not meaningful for global-scoped inline assembly, remove it error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:39:37 + --> $DIR/parse-error.rs:37:37 | LL | asm!("{}", options(), const foo); | ^^^ non-constant value @@ -428,7 +428,7 @@ LL | const foo: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:71:44 + --> $DIR/parse-error.rs:69:44 | LL | asm!("{}", clobber_abi("C"), const foo); | ^^^ non-constant value @@ -439,7 +439,7 @@ LL | const foo: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:74:55 + --> $DIR/parse-error.rs:72:55 | LL | asm!("{}", options(), clobber_abi("C"), const foo); | ^^^ non-constant value @@ -450,7 +450,7 @@ LL | const foo: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:76:31 + --> $DIR/parse-error.rs:74:31 | LL | asm!("{a}", a = const foo, a = const bar); | ^^^ non-constant value @@ -461,7 +461,7 @@ LL | const foo: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/parse-error.rs:76:46 + --> $DIR/parse-error.rs:74:46 | LL | asm!("{a}", a = const foo, a = const bar); | ^^^ non-constant value diff --git a/tests/ui/asm/type-check-1.rs b/tests/ui/asm/type-check-1.rs index 22669dce280..4dc30fb5838 100644 --- a/tests/ui/asm/type-check-1.rs +++ b/tests/ui/asm/type-check-1.rs @@ -2,8 +2,6 @@ //@ ignore-nvptx64 //@ ignore-spirv -#![feature(asm_const)] - use std::arch::{asm, global_asm}; fn main() { diff --git a/tests/ui/asm/type-check-1.stderr b/tests/ui/asm/type-check-1.stderr index d47e6ae1d2a..aa9eed2fce6 100644 --- a/tests/ui/asm/type-check-1.stderr +++ b/tests/ui/asm/type-check-1.stderr @@ -1,17 +1,17 @@ error: invalid asm output - --> $DIR/type-check-1.rs:14:29 + --> $DIR/type-check-1.rs:12:29 | LL | asm!("{}", out(reg) 1 + 2); | ^^^^^ cannot assign to this expression error: invalid asm output - --> $DIR/type-check-1.rs:16:31 + --> $DIR/type-check-1.rs:14:31 | LL | asm!("{}", inout(reg) 1 + 2); | ^^^^^ cannot assign to this expression error[E0277]: the size for values of type `[u64]` cannot be known at compilation time - --> $DIR/type-check-1.rs:22:28 + --> $DIR/type-check-1.rs:20:28 | LL | asm!("{}", in(reg) v[..]); | ^^^^^ doesn't have a size known at compile-time @@ -20,7 +20,7 @@ LL | asm!("{}", in(reg) v[..]); = note: all inline asm arguments must have a statically known size error[E0277]: the size for values of type `[u64]` cannot be known at compilation time - --> $DIR/type-check-1.rs:25:29 + --> $DIR/type-check-1.rs:23:29 | LL | asm!("{}", out(reg) v[..]); | ^^^^^ doesn't have a size known at compile-time @@ -29,7 +29,7 @@ LL | asm!("{}", out(reg) v[..]); = note: all inline asm arguments must have a statically known size error[E0277]: the size for values of type `[u64]` cannot be known at compilation time - --> $DIR/type-check-1.rs:28:31 + --> $DIR/type-check-1.rs:26:31 | LL | asm!("{}", inout(reg) v[..]); | ^^^^^ doesn't have a size known at compile-time @@ -38,7 +38,7 @@ LL | asm!("{}", inout(reg) v[..]); = note: all inline asm arguments must have a statically known size error: cannot use value of type `[u64]` for inline assembly - --> $DIR/type-check-1.rs:22:28 + --> $DIR/type-check-1.rs:20:28 | LL | asm!("{}", in(reg) v[..]); | ^^^^^ @@ -46,7 +46,7 @@ LL | asm!("{}", in(reg) v[..]); = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly error: cannot use value of type `[u64]` for inline assembly - --> $DIR/type-check-1.rs:25:29 + --> $DIR/type-check-1.rs:23:29 | LL | asm!("{}", out(reg) v[..]); | ^^^^^ @@ -54,7 +54,7 @@ LL | asm!("{}", out(reg) v[..]); = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly error: cannot use value of type `[u64]` for inline assembly - --> $DIR/type-check-1.rs:28:31 + --> $DIR/type-check-1.rs:26:31 | LL | asm!("{}", inout(reg) v[..]); | ^^^^^ diff --git a/tests/ui/asm/x86_64/bad-reg.rs b/tests/ui/asm/x86_64/bad-reg.rs index d41c46d57bb..2a189a91c5a 100644 --- a/tests/ui/asm/x86_64/bad-reg.rs +++ b/tests/ui/asm/x86_64/bad-reg.rs @@ -1,8 +1,6 @@ //@ only-x86_64 //@ compile-flags: -C target-feature=+avx2 -#![feature(asm_const)] - use std::arch::asm; fn main() { diff --git a/tests/ui/asm/x86_64/bad-reg.stderr b/tests/ui/asm/x86_64/bad-reg.stderr index 8017008e97d..3df1f7b2208 100644 --- a/tests/ui/asm/x86_64/bad-reg.stderr +++ b/tests/ui/asm/x86_64/bad-reg.stderr @@ -1,17 +1,17 @@ error: invalid register class `foo`: unknown register class - --> $DIR/bad-reg.rs:14:20 + --> $DIR/bad-reg.rs:12:20 | LL | asm!("{}", in(foo) foo); | ^^^^^^^^^^^ error: invalid register `foo`: unknown register - --> $DIR/bad-reg.rs:16:18 + --> $DIR/bad-reg.rs:14:18 | LL | asm!("", in("foo") foo); | ^^^^^^^^^^^^^ error: invalid asm template modifier for this register class - --> $DIR/bad-reg.rs:18:15 + --> $DIR/bad-reg.rs:16:15 | LL | asm!("{:z}", in(reg) foo); | ^^^^ ----------- argument @@ -21,7 +21,7 @@ LL | asm!("{:z}", in(reg) foo); = note: the `reg` register class supports the following template modifiers: `l`, `x`, `e`, `r` error: invalid asm template modifier for this register class - --> $DIR/bad-reg.rs:20:15 + --> $DIR/bad-reg.rs:18:15 | LL | asm!("{:r}", in(xmm_reg) foo); | ^^^^ --------------- argument @@ -31,7 +31,7 @@ LL | asm!("{:r}", in(xmm_reg) foo); = note: the `xmm_reg` register class supports the following template modifiers: `x`, `y`, `z` error: asm template modifiers are not allowed for `const` arguments - --> $DIR/bad-reg.rs:22:15 + --> $DIR/bad-reg.rs:20:15 | LL | asm!("{:a}", const 0); | ^^^^ ------- argument @@ -39,7 +39,7 @@ LL | asm!("{:a}", const 0); | template modifier error: asm template modifiers are not allowed for `sym` arguments - --> $DIR/bad-reg.rs:24:15 + --> $DIR/bad-reg.rs:22:15 | LL | asm!("{:a}", sym main); | ^^^^ -------- argument @@ -47,67 +47,67 @@ LL | asm!("{:a}", sym main); | template modifier error: invalid register `ebp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:26:18 + --> $DIR/bad-reg.rs:24:18 | LL | asm!("", in("ebp") foo); | ^^^^^^^^^^^^^ error: invalid register `rsp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:28:18 + --> $DIR/bad-reg.rs:26:18 | LL | asm!("", in("rsp") foo); | ^^^^^^^^^^^^^ error: invalid register `ip`: the instruction pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:30:18 + --> $DIR/bad-reg.rs:28:18 | LL | asm!("", in("ip") foo); | ^^^^^^^^^^^^ error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:33:18 + --> $DIR/bad-reg.rs:31:18 | LL | asm!("", in("st(2)") foo); | ^^^^^^^^^^^^^^^ error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:36:18 + --> $DIR/bad-reg.rs:34:18 | LL | asm!("", in("mm0") foo); | ^^^^^^^^^^^^^ error: register class `kreg0` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:39:18 + --> $DIR/bad-reg.rs:37:18 | LL | asm!("", in("k0") foo); | ^^^^^^^^^^^^ error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:44:20 + --> $DIR/bad-reg.rs:42:20 | LL | asm!("{}", in(x87_reg) foo); | ^^^^^^^^^^^^^^^ error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:47:20 + --> $DIR/bad-reg.rs:45:20 | LL | asm!("{}", in(mmx_reg) foo); | ^^^^^^^^^^^^^^^ error: register class `x87_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:50:20 + --> $DIR/bad-reg.rs:48:20 | LL | asm!("{}", out(x87_reg) _); | ^^^^^^^^^^^^^^ error: register class `mmx_reg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:52:20 + --> $DIR/bad-reg.rs:50:20 | LL | asm!("{}", out(mmx_reg) _); | ^^^^^^^^^^^^^^ error: register `al` conflicts with register `eax` - --> $DIR/bad-reg.rs:58:33 + --> $DIR/bad-reg.rs:56:33 | LL | asm!("", in("eax") foo, in("al") bar); | ------------- ^^^^^^^^^^^^ register `al` @@ -115,7 +115,7 @@ LL | asm!("", in("eax") foo, in("al") bar); | register `eax` error: register `rax` conflicts with register `rax` - --> $DIR/bad-reg.rs:61:33 + --> $DIR/bad-reg.rs:59:33 | LL | asm!("", in("rax") foo, out("rax") bar); | ------------- ^^^^^^^^^^^^^^ register `rax` @@ -123,13 +123,13 @@ LL | asm!("", in("rax") foo, out("rax") bar); | register `rax` | help: use `lateout` instead of `out` to avoid conflict - --> $DIR/bad-reg.rs:61:18 + --> $DIR/bad-reg.rs:59:18 | LL | asm!("", in("rax") foo, out("rax") bar); | ^^^^^^^^^^^^^ error: register `ymm0` conflicts with register `xmm0` - --> $DIR/bad-reg.rs:66:34 + --> $DIR/bad-reg.rs:64:34 | LL | asm!("", in("xmm0") foo, in("ymm0") bar); | -------------- ^^^^^^^^^^^^^^ register `ymm0` @@ -137,7 +137,7 @@ LL | asm!("", in("xmm0") foo, in("ymm0") bar); | register `xmm0` error: register `ymm0` conflicts with register `xmm0` - --> $DIR/bad-reg.rs:68:34 + --> $DIR/bad-reg.rs:66:34 | LL | asm!("", in("xmm0") foo, out("ymm0") bar); | -------------- ^^^^^^^^^^^^^^^ register `ymm0` @@ -145,13 +145,13 @@ LL | asm!("", in("xmm0") foo, out("ymm0") bar); | register `xmm0` | help: use `lateout` instead of `out` to avoid conflict - --> $DIR/bad-reg.rs:68:18 + --> $DIR/bad-reg.rs:66:18 | LL | asm!("", in("xmm0") foo, out("ymm0") bar); | ^^^^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:33:30 + --> $DIR/bad-reg.rs:31:30 | LL | asm!("", in("st(2)") foo); | ^^^ @@ -159,7 +159,7 @@ LL | asm!("", in("st(2)") foo); = note: register class `x87_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:36:28 + --> $DIR/bad-reg.rs:34:28 | LL | asm!("", in("mm0") foo); | ^^^ @@ -167,7 +167,7 @@ LL | asm!("", in("mm0") foo); = note: register class `mmx_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:39:27 + --> $DIR/bad-reg.rs:37:27 | LL | asm!("", in("k0") foo); | ^^^ @@ -175,7 +175,7 @@ LL | asm!("", in("k0") foo); = note: register class `kreg0` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:44:32 + --> $DIR/bad-reg.rs:42:32 | LL | asm!("{}", in(x87_reg) foo); | ^^^ @@ -183,7 +183,7 @@ LL | asm!("{}", in(x87_reg) foo); = note: register class `x87_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:47:32 + --> $DIR/bad-reg.rs:45:32 | LL | asm!("{}", in(mmx_reg) foo); | ^^^ @@ -191,7 +191,7 @@ LL | asm!("{}", in(mmx_reg) foo); = note: register class `mmx_reg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:58:42 + --> $DIR/bad-reg.rs:56:42 | LL | asm!("", in("eax") foo, in("al") bar); | ^^^ @@ -199,7 +199,7 @@ LL | asm!("", in("eax") foo, in("al") bar); = note: register class `reg_byte` supports these types: i8 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:63:27 + --> $DIR/bad-reg.rs:61:27 | LL | asm!("", in("al") foo, lateout("al") bar); | ^^^ @@ -207,7 +207,7 @@ LL | asm!("", in("al") foo, lateout("al") bar); = note: register class `reg_byte` supports these types: i8 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:63:46 + --> $DIR/bad-reg.rs:61:46 | LL | asm!("", in("al") foo, lateout("al") bar); | ^^^ diff --git a/tests/ui/asm/x86_64/const.rs b/tests/ui/asm/x86_64/const.rs index 817a338a5b9..eaaaf92e823 100644 --- a/tests/ui/asm/x86_64/const.rs +++ b/tests/ui/asm/x86_64/const.rs @@ -2,8 +2,6 @@ //@ run-pass //@ needs-asm-support -#![feature(asm_const)] - use std::arch::{asm, global_asm}; fn const_generic<const X: usize>() -> usize { diff --git a/tests/ui/asm/x86_64/type-check-3.rs b/tests/ui/asm/x86_64/type-check-3.rs index bd242af3dbc..bfb795d2624 100644 --- a/tests/ui/asm/x86_64/type-check-3.rs +++ b/tests/ui/asm/x86_64/type-check-3.rs @@ -1,8 +1,6 @@ //@ only-x86_64 //@ compile-flags: -C target-feature=+avx512f -#![feature(asm_const)] - use std::arch::{asm, global_asm}; use std::arch::x86_64::{_mm256_setzero_ps, _mm_setzero_ps}; diff --git a/tests/ui/asm/x86_64/type-check-3.stderr b/tests/ui/asm/x86_64/type-check-3.stderr index 202b97ca5c0..5a7b349413e 100644 --- a/tests/ui/asm/x86_64/type-check-3.stderr +++ b/tests/ui/asm/x86_64/type-check-3.stderr @@ -1,5 +1,5 @@ error: type `i128` cannot be used with this register class - --> $DIR/type-check-3.rs:14:28 + --> $DIR/type-check-3.rs:12:28 | LL | asm!("{}", in(reg) 0i128); | ^^^^^ @@ -7,7 +7,7 @@ LL | asm!("{}", in(reg) 0i128); = note: register class `reg` supports these types: i16, i32, i64, f16, f32, f64 error: type `__m128` cannot be used with this register class - --> $DIR/type-check-3.rs:16:28 + --> $DIR/type-check-3.rs:14:28 | LL | asm!("{}", in(reg) _mm_setzero_ps()); | ^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | asm!("{}", in(reg) _mm_setzero_ps()); = note: register class `reg` supports these types: i16, i32, i64, f16, f32, f64 error: type `__m256` cannot be used with this register class - --> $DIR/type-check-3.rs:18:28 + --> $DIR/type-check-3.rs:16:28 | LL | asm!("{}", in(reg) _mm256_setzero_ps()); | ^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | asm!("{}", in(reg) _mm256_setzero_ps()); = note: register class `reg` supports these types: i16, i32, i64, f16, f32, f64 error: type `u8` cannot be used with this register class - --> $DIR/type-check-3.rs:20:32 + --> $DIR/type-check-3.rs:18:32 | LL | asm!("{}", in(xmm_reg) 0u8); | ^^^ @@ -31,7 +31,7 @@ LL | asm!("{}", in(xmm_reg) 0u8); = note: register class `xmm_reg` supports these types: i32, i64, f16, f32, f64, f128, i8x16, i16x8, i32x4, i64x2, f16x8, f32x4, f64x2 error: `avx512bw` target feature is not enabled - --> $DIR/type-check-3.rs:29:29 + --> $DIR/type-check-3.rs:27:29 | LL | asm!("{}", in(kreg) 0u64); | ^^^^ @@ -39,7 +39,7 @@ LL | asm!("{}", in(kreg) 0u64); = note: this is required to use type `u64` with register class `kreg` warning: formatting may not be suitable for sub-register argument - --> $DIR/type-check-3.rs:34:15 + --> $DIR/type-check-3.rs:32:15 | LL | asm!("{0} {0}", in(reg) 0i16); | ^^^ ^^^ ---- for this argument @@ -49,7 +49,7 @@ LL | asm!("{0} {0}", in(reg) 0i16); = note: `#[warn(asm_sub_register)]` on by default warning: formatting may not be suitable for sub-register argument - --> $DIR/type-check-3.rs:36:15 + --> $DIR/type-check-3.rs:34:15 | LL | asm!("{0} {0:x}", in(reg) 0i16); | ^^^ ---- for this argument @@ -58,7 +58,7 @@ LL | asm!("{0} {0:x}", in(reg) 0i16); = help: or use `{0:r}` to keep the default formatting of `rax` (for 64-bit values) warning: formatting may not be suitable for sub-register argument - --> $DIR/type-check-3.rs:38:15 + --> $DIR/type-check-3.rs:36:15 | LL | asm!("{}", in(reg) 0i32); | ^^ ---- for this argument @@ -67,7 +67,7 @@ LL | asm!("{}", in(reg) 0i32); = help: or use `{0:r}` to keep the default formatting of `rax` (for 64-bit values) warning: formatting may not be suitable for sub-register argument - --> $DIR/type-check-3.rs:41:15 + --> $DIR/type-check-3.rs:39:15 | LL | asm!("{}", in(ymm_reg) 0i64); | ^^ ---- for this argument @@ -76,7 +76,7 @@ LL | asm!("{}", in(ymm_reg) 0i64); = help: or use `{0:y}` to keep the default formatting of `ymm0` (for 256-bit values) error: type `i8` cannot be used with this register class - --> $DIR/type-check-3.rs:52:28 + --> $DIR/type-check-3.rs:50:28 | LL | asm!("{}", in(reg) 0i8); | ^^^ @@ -85,7 +85,7 @@ LL | asm!("{}", in(reg) 0i8); = help: consider using the `reg_byte` register class instead error: incompatible types for asm inout argument - --> $DIR/type-check-3.rs:64:33 + --> $DIR/type-check-3.rs:62:33 | LL | asm!("{:r}", inout(reg) 0u32 => val_f32); | ^^^^ ^^^^^^^ type `f32` @@ -95,7 +95,7 @@ LL | asm!("{:r}", inout(reg) 0u32 => val_f32); = note: asm inout arguments must have the same type, unless they are both pointers or integers of the same size error: incompatible types for asm inout argument - --> $DIR/type-check-3.rs:66:33 + --> $DIR/type-check-3.rs:64:33 | LL | asm!("{:r}", inout(reg) 0u32 => val_ptr); | ^^^^ ^^^^^^^ type `*mut u8` @@ -105,7 +105,7 @@ LL | asm!("{:r}", inout(reg) 0u32 => val_ptr); = note: asm inout arguments must have the same type, unless they are both pointers or integers of the same size error: incompatible types for asm inout argument - --> $DIR/type-check-3.rs:68:33 + --> $DIR/type-check-3.rs:66:33 | LL | asm!("{:r}", inout(reg) main => val_u32); | ^^^^ ^^^^^^^ type `u32` diff --git a/tests/ui/asm/x86_64/type-check-4.rs b/tests/ui/asm/x86_64/type-check-4.rs index f7bf60d04df..9503cd6d8ab 100644 --- a/tests/ui/asm/x86_64/type-check-4.rs +++ b/tests/ui/asm/x86_64/type-check-4.rs @@ -1,8 +1,6 @@ //@ only-x86_64 //@ compile-flags: -C target-feature=+avx512f -#![feature(asm_const)] - use std::arch::{asm, global_asm}; use std::arch::x86_64::{_mm256_setzero_ps, _mm_setzero_ps}; diff --git a/tests/ui/asm/x86_64/type-check-4.stderr b/tests/ui/asm/x86_64/type-check-4.stderr index cbdc051b343..f1bbc9e7d33 100644 --- a/tests/ui/asm/x86_64/type-check-4.stderr +++ b/tests/ui/asm/x86_64/type-check-4.stderr @@ -1,5 +1,5 @@ error[E0658]: referencing statics in constants is unstable - --> $DIR/type-check-4.rs:21:25 + --> $DIR/type-check-4.rs:19:25 | LL | global_asm!("{}", const S); | ^ @@ -11,7 +11,7 @@ LL | global_asm!("{}", const S); = help: to fix this, the value can be extracted to a `const` and then used. error[E0658]: referencing statics in constants is unstable - --> $DIR/type-check-4.rs:24:35 + --> $DIR/type-check-4.rs:22:35 | LL | global_asm!("{}", const const_foo(S)); | ^ @@ -23,7 +23,7 @@ LL | global_asm!("{}", const const_foo(S)); = help: to fix this, the value can be extracted to a `const` and then used. error[E0658]: referencing statics in constants is unstable - --> $DIR/type-check-4.rs:27:35 + --> $DIR/type-check-4.rs:25:35 | LL | global_asm!("{}", const const_bar(S)); | ^ diff --git a/tests/ui/asm/x86_64/x86_64_parse_error.rs b/tests/ui/asm/x86_64/x86_64_parse_error.rs index 850033d4ce0..3df0febf6b0 100644 --- a/tests/ui/asm/x86_64/x86_64_parse_error.rs +++ b/tests/ui/asm/x86_64/x86_64_parse_error.rs @@ -1,7 +1,5 @@ //@ only-x86_64 -#![feature(asm_const)] - use std::arch::asm; fn main() { diff --git a/tests/ui/asm/x86_64/x86_64_parse_error.stderr b/tests/ui/asm/x86_64/x86_64_parse_error.stderr index 9751f7b09d0..b64f6c1127e 100644 --- a/tests/ui/asm/x86_64/x86_64_parse_error.stderr +++ b/tests/ui/asm/x86_64/x86_64_parse_error.stderr @@ -1,11 +1,11 @@ error: explicit register arguments cannot have names - --> $DIR/x86_64_parse_error.rs:11:18 + --> $DIR/x86_64_parse_error.rs:9:18 | LL | asm!("", a = in("eax") foo); | ^^^^^^^^^^^^^^^^^ error: positional arguments cannot follow named arguments or explicit register arguments - --> $DIR/x86_64_parse_error.rs:17:36 + --> $DIR/x86_64_parse_error.rs:15:36 | LL | asm!("{1}", in("eax") foo, const bar); | ------------- ^^^^^^^^^ positional argument @@ -13,7 +13,7 @@ LL | asm!("{1}", in("eax") foo, const bar); | explicit register argument error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/x86_64_parse_error.rs:13:46 + --> $DIR/x86_64_parse_error.rs:11:46 | LL | asm!("{a}", in("eax") foo, a = const bar); | ^^^ non-constant value @@ -24,7 +24,7 @@ LL | const bar: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/x86_64_parse_error.rs:15:46 + --> $DIR/x86_64_parse_error.rs:13:46 | LL | asm!("{a}", in("eax") foo, a = const bar); | ^^^ non-constant value @@ -35,7 +35,7 @@ LL | const bar: /* Type */ = 0; | ~~~~~ ++++++++++++ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/x86_64_parse_error.rs:17:42 + --> $DIR/x86_64_parse_error.rs:15:42 | LL | asm!("{1}", in("eax") foo, const bar); | ^^^ non-constant value diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr index a495e94bd9a..cf5d8f614dd 100644 --- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr +++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr @@ -4,11 +4,6 @@ error[E0391]: cycle detected when computing predicates of `Foo` LL | struct Foo { | ^^^^^^^^^^ | -note: ...which requires computing predicates of `Foo`... - --> $DIR/cycle-iat-inside-of-adt.rs:7:1 - | -LL | struct Foo { - | ^^^^^^^^^^ note: ...which requires computing inferred outlives predicates of `Foo`... --> $DIR/cycle-iat-inside-of-adt.rs:7:1 | diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr index e7292c08ebd..e97a5df9d49 100644 --- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr +++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr @@ -4,11 +4,6 @@ error[E0391]: cycle detected when computing predicates of `user` LL | fn user<T>() where S<T>::P: std::fmt::Debug {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: ...which requires computing predicates of `user`... - --> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1 - | -LL | fn user<T>() where S<T>::P: std::fmt::Debug {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires computing explicit predicates of `user`... --> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1 | diff --git a/tests/ui/async-await/async-closures/move-out-of-ref.rs b/tests/ui/async-await/async-closures/move-out-of-ref.rs new file mode 100644 index 00000000000..a05447232f6 --- /dev/null +++ b/tests/ui/async-await/async-closures/move-out-of-ref.rs @@ -0,0 +1,16 @@ +//@ compile-flags: -Zvalidate-mir +//@ edition: 2021 + +#![feature(async_closure)] + +// NOT copy. +struct Ty; + +fn hello(x: &Ty) { + let c = async || { + *x; + //~^ ERROR cannot move out of `*x` which is behind a shared reference + }; +} + +fn main() {} diff --git a/tests/ui/async-await/async-closures/move-out-of-ref.stderr b/tests/ui/async-await/async-closures/move-out-of-ref.stderr new file mode 100644 index 00000000000..294905a481d --- /dev/null +++ b/tests/ui/async-await/async-closures/move-out-of-ref.stderr @@ -0,0 +1,18 @@ +error[E0507]: cannot move out of `*x` which is behind a shared reference + --> $DIR/move-out-of-ref.rs:11:9 + | +LL | *x; + | ^^ move occurs because `*x` has type `Ty`, which does not implement the `Copy` trait + | +note: if `Ty` implemented `Clone`, you could clone the value + --> $DIR/move-out-of-ref.rs:7:1 + | +LL | struct Ty; + | ^^^^^^^^^ consider implementing `Clone` for this type +... +LL | *x; + | -- you could clone this value + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0507`. diff --git a/tests/ui/async-await/async-closures/sig-from-bare-fn.rs b/tests/ui/async-await/async-closures/sig-from-bare-fn.rs new file mode 100644 index 00000000000..a679471a3b3 --- /dev/null +++ b/tests/ui/async-await/async-closures/sig-from-bare-fn.rs @@ -0,0 +1,49 @@ +//@ check-pass +//@ edition: 2021 + +// Make sure that we infer the args of an async closure even if it's passed to +// a function that requires the async closure implement `Fn*` but does *not* have +// a `Future` bound on the return type. + +#![feature(async_closure)] + +use std::future::Future; + +trait TryStream { + type Ok; + type Err; +} + +trait TryFuture { + type Ok; + type Err; +} + +impl<F, T, E> TryFuture for F where F: Future<Output = Result<T, E>> { + type Ok = T; + type Err = E; +} + +trait TryStreamExt: TryStream { + fn try_for_each<F, Fut>(&self, f: F) + where + F: FnMut(Self::Ok) -> Fut, + Fut: TryFuture<Ok = (), Err = Self::Err>; +} + +impl<S> TryStreamExt for S where S: TryStream { + fn try_for_each<F, Fut>(&self, f: F) + where + F: FnMut(Self::Ok) -> Fut, + Fut: TryFuture<Ok = (), Err = Self::Err>, + { } +} + +fn test(stream: impl TryStream<Ok = &'static str, Err = ()>) { + stream.try_for_each(async |s| { + s.trim(); // Make sure we know the type of `s` at this point. + Ok(()) + }); +} + +fn main() {} diff --git a/tests/ui/async-await/async-fn/recurse-ice-129215.rs b/tests/ui/async-await/async-fn/recurse-ice-129215.rs new file mode 100644 index 00000000000..06a2d7be9ef --- /dev/null +++ b/tests/ui/async-await/async-fn/recurse-ice-129215.rs @@ -0,0 +1,9 @@ +//@ edition: 2021 + +async fn a() { + //~^ ERROR `()` is not a future + //~| ERROR mismatched types + a() //~ ERROR `()` is not a future +} + +fn main() {} diff --git a/tests/ui/async-await/async-fn/recurse-ice-129215.stderr b/tests/ui/async-await/async-fn/recurse-ice-129215.stderr new file mode 100644 index 00000000000..98c7be2a5a3 --- /dev/null +++ b/tests/ui/async-await/async-fn/recurse-ice-129215.stderr @@ -0,0 +1,34 @@ +error[E0277]: `()` is not a future + --> $DIR/recurse-ice-129215.rs:6:5 + | +LL | a() + | ^^^ `()` is not a future + | + = help: the trait `Future` is not implemented for `()` + +error[E0277]: `()` is not a future + --> $DIR/recurse-ice-129215.rs:3:1 + | +LL | async fn a() { + | ^^^^^^^^^^^^ `()` is not a future + | + = help: the trait `Future` is not implemented for `()` + +error[E0308]: mismatched types + --> $DIR/recurse-ice-129215.rs:3:14 + | +LL | async fn a() { + | ______________^ +LL | | +LL | | +LL | | a() +LL | | } + | |_^ expected `()`, found `async` fn body + | + = note: expected unit type `()` + found `async` fn body `{async fn body of a()}` + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/async-await/issues/issue-63388-1.rs b/tests/ui/async-await/issues/issue-63388-1.rs index 32026a22a16..a6f499ba94e 100644 --- a/tests/ui/async-await/issues/issue-63388-1.rs +++ b/tests/ui/async-await/issues/issue-63388-1.rs @@ -9,7 +9,7 @@ trait Foo {} impl Xyz { async fn do_sth<'a>( &'a self, foo: &dyn Foo - ) -> &dyn Foo + ) -> &dyn Foo //~ WARNING elided lifetime has a name { //~^ ERROR explicit lifetime required in the type of `foo` [E0621] foo diff --git a/tests/ui/async-await/issues/issue-63388-1.stderr b/tests/ui/async-await/issues/issue-63388-1.stderr index f7f285ad0cc..ef74bfe3237 100644 --- a/tests/ui/async-await/issues/issue-63388-1.stderr +++ b/tests/ui/async-await/issues/issue-63388-1.stderr @@ -1,3 +1,14 @@ +warning: elided lifetime has a name + --> $DIR/issue-63388-1.rs:12:10 + | +LL | async fn do_sth<'a>( + | -- lifetime `'a` declared here +LL | &'a self, foo: &dyn Foo +LL | ) -> &dyn Foo + | ^ this elided lifetime gets resolved as `'a` + | + = note: `#[warn(elided_named_lifetimes)]` on by default + error[E0621]: explicit lifetime required in the type of `foo` --> $DIR/issue-63388-1.rs:13:5 | @@ -10,6 +21,6 @@ LL | | foo LL | | } | |_____^ lifetime `'a` required -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted For more information about this error, try `rustc --explain E0621`. diff --git a/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr b/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr index 5ae1d78a92b..167b5ee4425 100644 --- a/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr +++ b/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr @@ -26,10 +26,10 @@ LL | | (a, b) LL | | } | |_^ | -help: to declare that `impl Trait<'a>` captures `'b`, you can add an explicit `'b` lifetime bound +help: add a `use<...>` bound to explicitly capture `'b` | -LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b { - | ++++ +LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + use<'a, 'b> { + | +++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/attributes/assoc-expr.rs b/tests/ui/attributes/assoc-expr.rs new file mode 100644 index 00000000000..f39557d2ef0 --- /dev/null +++ b/tests/ui/attributes/assoc-expr.rs @@ -0,0 +1,42 @@ +//@ check-pass +// This test triggered an assertion failure in token collection due to +// mishandling of attributes on associative expressions. + +#![feature(cfg_eval)] +#![feature(rustc_attrs)] +#![feature(stmt_expr_attributes)] +#![allow(internal_features)] + +fn main() {} + +#[cfg_eval] +struct Foo1( + [ bool; { + let _x = 30; + #[cfg_attr(unix, rustc_dummy(aa))] 1 + } ] +); + +#[cfg_eval] +struct Foo12( + [ bool; { + let _x = 30; + #[cfg_attr(unix, rustc_dummy(bb))] 1 + 2 + } ] +); + +#[cfg_eval] +struct Foox( + [ bool; { + let _x = 30; + #[cfg_attr(unix, rustc_dummy(cc))] _x + } ] +); + +#[cfg_eval] +struct Foox2( + [ bool; { + let _x = 30; + #[cfg_attr(unix, rustc_dummy(dd))] _x + 2 + } ] +); diff --git a/tests/ui/attributes/linkage.rs b/tests/ui/attributes/linkage.rs new file mode 100644 index 00000000000..0d5ce699fa8 --- /dev/null +++ b/tests/ui/attributes/linkage.rs @@ -0,0 +1,42 @@ +#![feature(linkage)] +#![feature(stmt_expr_attributes)] +#![deny(unused_attributes)] +#![allow(dead_code)] + +#[linkage = "weak"] //~ ERROR attribute should be applied to a function or static +type InvalidTy = (); + +#[linkage = "weak"] //~ ERROR attribute should be applied to a function or static +mod invalid_module {} + +#[linkage = "weak"] //~ ERROR attribute should be applied to a function or static +struct F; + +#[linkage = "weak"] //~ ERROR attribute should be applied to a function or static +impl F { + #[linkage = "weak"] + fn valid(&self) {} +} + +#[linkage = "weak"] +fn f() { + #[linkage = "weak"] + { + 1 + }; + //~^^^^ ERROR attribute should be applied to a function or static +} + +extern "C" { + #[linkage = "weak"] + static A: *const (); + + #[linkage = "weak"] + fn bar(); +} + +fn main() { + let _ = #[linkage = "weak"] + (|| 1); + //~^^ ERROR attribute should be applied to a function or static +} diff --git a/tests/ui/attributes/linkage.stderr b/tests/ui/attributes/linkage.stderr new file mode 100644 index 00000000000..d5595529f40 --- /dev/null +++ b/tests/ui/attributes/linkage.stderr @@ -0,0 +1,55 @@ +error: attribute should be applied to a function or static + --> $DIR/linkage.rs:6:1 + | +LL | #[linkage = "weak"] + | ^^^^^^^^^^^^^^^^^^^ +LL | type InvalidTy = (); + | -------------------- not a function definition or static + +error: attribute should be applied to a function or static + --> $DIR/linkage.rs:9:1 + | +LL | #[linkage = "weak"] + | ^^^^^^^^^^^^^^^^^^^ +LL | mod invalid_module {} + | --------------------- not a function definition or static + +error: attribute should be applied to a function or static + --> $DIR/linkage.rs:12:1 + | +LL | #[linkage = "weak"] + | ^^^^^^^^^^^^^^^^^^^ +LL | struct F; + | --------- not a function definition or static + +error: attribute should be applied to a function or static + --> $DIR/linkage.rs:15:1 + | +LL | #[linkage = "weak"] + | ^^^^^^^^^^^^^^^^^^^ +LL | / impl F { +LL | | #[linkage = "weak"] +LL | | fn valid(&self) {} +LL | | } + | |_- not a function definition or static + +error: attribute should be applied to a function or static + --> $DIR/linkage.rs:23:5 + | +LL | #[linkage = "weak"] + | ^^^^^^^^^^^^^^^^^^^ +LL | / { +LL | | 1 +LL | | }; + | |_____- not a function definition or static + +error: attribute should be applied to a function or static + --> $DIR/linkage.rs:39:13 + | +LL | let _ = #[linkage = "weak"] + | ^^^^^^^^^^^^^^^^^^^ +LL | (|| 1); + | ------ not a function definition or static + +error: aborting due to 6 previous errors + diff --git a/tests/ui/attributes/may_dangle.rs b/tests/ui/attributes/may_dangle.rs new file mode 100644 index 00000000000..209ba0e88ad --- /dev/null +++ b/tests/ui/attributes/may_dangle.rs @@ -0,0 +1,53 @@ +#![feature(dropck_eyepatch)] + +struct Implee1<'a, T, const N: usize>(&'a T); +struct Implee2<'a, T, const N: usize>(&'a T); +struct Implee3<'a, T, const N: usize>(&'a T); +trait NotDrop {} + +unsafe impl<#[may_dangle] 'a, T, const N: usize> NotDrop for Implee1<'a, T, N> {} +//~^ ERROR must be applied to a lifetime or type generic parameter in `Drop` impl + +unsafe impl<'a, #[may_dangle] T, const N: usize> NotDrop for Implee2<'a, T, N> {} +//~^ ERROR must be applied to a lifetime or type generic parameter in `Drop` impl + +unsafe impl<'a, T, #[may_dangle] const N: usize> Drop for Implee1<'a, T, N> { + //~^ ERROR must be applied to a lifetime or type generic parameter in `Drop` impl + fn drop(&mut self) {} +} + +// Ok, lifetime param in a `Drop` impl. +unsafe impl<#[may_dangle] 'a, T, const N: usize> Drop for Implee2<'a, T, N> { + fn drop(&mut self) {} +} + +// Ok, type param in a `Drop` impl. +unsafe impl<'a, #[may_dangle] T, const N: usize> Drop for Implee3<'a, T, N> { + fn drop(&mut self) {} +} + +// Check that this check is not textual. +mod fake { + trait Drop { + fn drop(&mut self); + } + struct Implee<T>(T); + + unsafe impl<#[may_dangle] T> Drop for Implee<T> { + //~^ ERROR must be applied to a lifetime or type generic parameter in `Drop` impl + fn drop(&mut self) {} + } +} + +#[may_dangle] //~ ERROR must be applied to a lifetime or type generic parameter in `Drop` impl +struct Dangling; + +#[may_dangle] //~ ERROR must be applied to a lifetime or type generic parameter in `Drop` impl +impl NotDrop for () { +} + +#[may_dangle] //~ ERROR must be applied to a lifetime or type generic parameter in `Drop` impl +fn main() { + #[may_dangle] //~ ERROR must be applied to a lifetime or type generic parameter in `Drop` impl + let () = (); +} diff --git a/tests/ui/attributes/may_dangle.stderr b/tests/ui/attributes/may_dangle.stderr new file mode 100644 index 00000000000..dc24f847f71 --- /dev/null +++ b/tests/ui/attributes/may_dangle.stderr @@ -0,0 +1,50 @@ +error: `#[may_dangle]` must be applied to a lifetime or type generic parameter in `Drop` impl + --> $DIR/may_dangle.rs:8:13 + | +LL | unsafe impl<#[may_dangle] 'a, T, const N: usize> NotDrop for Implee1<'a, T, N> {} + | ^^^^^^^^^^^^^ + +error: `#[may_dangle]` must be applied to a lifetime or type generic parameter in `Drop` impl + --> $DIR/may_dangle.rs:11:17 + | +LL | unsafe impl<'a, #[may_dangle] T, const N: usize> NotDrop for Implee2<'a, T, N> {} + | ^^^^^^^^^^^^^ + +error: `#[may_dangle]` must be applied to a lifetime or type generic parameter in `Drop` impl + --> $DIR/may_dangle.rs:14:20 + | +LL | unsafe impl<'a, T, #[may_dangle] const N: usize> Drop for Implee1<'a, T, N> { + | ^^^^^^^^^^^^^ + +error: `#[may_dangle]` must be applied to a lifetime or type generic parameter in `Drop` impl + --> $DIR/may_dangle.rs:42:1 + | +LL | #[may_dangle] + | ^^^^^^^^^^^^^ + +error: `#[may_dangle]` must be applied to a lifetime or type generic parameter in `Drop` impl + --> $DIR/may_dangle.rs:45:1 + | +LL | #[may_dangle] + | ^^^^^^^^^^^^^ + +error: `#[may_dangle]` must be applied to a lifetime or type generic parameter in `Drop` impl + --> $DIR/may_dangle.rs:49:1 + | +LL | #[may_dangle] + | ^^^^^^^^^^^^^ + +error: `#[may_dangle]` must be applied to a lifetime or type generic parameter in `Drop` impl + --> $DIR/may_dangle.rs:51:5 + | +LL | #[may_dangle] + | ^^^^^^^^^^^^^ + +error: `#[may_dangle]` must be applied to a lifetime or type generic parameter in `Drop` impl + --> $DIR/may_dangle.rs:36:17 + | +LL | unsafe impl<#[may_dangle] T> Drop for Implee<T> { + | ^^^^^^^^^^^^^ + +error: aborting due to 8 previous errors + diff --git a/tests/ui/attributes/rustc_pub_transparent.rs b/tests/ui/attributes/rustc_pub_transparent.rs new file mode 100644 index 00000000000..4508fa39baf --- /dev/null +++ b/tests/ui/attributes/rustc_pub_transparent.rs @@ -0,0 +1,25 @@ +#![feature(rustc_attrs, transparent_unions)] + +#[rustc_pub_transparent] +#[repr(transparent)] +union E<T: Copy> { + value: T, + uninit: (), +} + +#[repr(transparent)] +#[rustc_pub_transparent] +struct S<T>(T); + +#[rustc_pub_transparent] //~ ERROR attribute should be applied to `#[repr(transparent)]` types +#[repr(C)] +struct S1 { + A: u8, +} + +#[rustc_pub_transparent] //~ ERROR attribute should be applied to `#[repr(transparent)]` types +struct S2<T> { + value: T, +} + +fn main() {} diff --git a/tests/ui/attributes/rustc_pub_transparent.stderr b/tests/ui/attributes/rustc_pub_transparent.stderr new file mode 100644 index 00000000000..1d1f9437cb2 --- /dev/null +++ b/tests/ui/attributes/rustc_pub_transparent.stderr @@ -0,0 +1,23 @@ +error: attribute should be applied to `#[repr(transparent)]` types + --> $DIR/rustc_pub_transparent.rs:14:1 + | +LL | #[rustc_pub_transparent] + | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[repr(C)] +LL | / struct S1 { +LL | | A: u8, +LL | | } + | |_- not a `#[repr(transparent)]` type + +error: attribute should be applied to `#[repr(transparent)]` types + --> $DIR/rustc_pub_transparent.rs:20:1 + | +LL | #[rustc_pub_transparent] + | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / struct S2<T> { +LL | | value: T, +LL | | } + | |_- not a `#[repr(transparent)]` type + +error: aborting due to 2 previous errors + diff --git a/tests/ui/attributes/unsafe/cfg-unsafe-attributes.rs b/tests/ui/attributes/unsafe/cfg-unsafe-attributes.rs index ce365d1a8b1..6a9853b2f6f 100644 --- a/tests/ui/attributes/unsafe/cfg-unsafe-attributes.rs +++ b/tests/ui/attributes/unsafe/cfg-unsafe-attributes.rs @@ -1,5 +1,4 @@ //@ build-pass -#![feature(unsafe_attributes)] #[cfg_attr(all(), unsafe(no_mangle))] fn a() {} diff --git a/tests/ui/attributes/unsafe/derive-unsafe-attributes.rs b/tests/ui/attributes/unsafe/derive-unsafe-attributes.rs index b8edb4aab90..95fc19f506b 100644 --- a/tests/ui/attributes/unsafe/derive-unsafe-attributes.rs +++ b/tests/ui/attributes/unsafe/derive-unsafe-attributes.rs @@ -1,5 +1,3 @@ -#![feature(unsafe_attributes)] - #[derive(unsafe(Debug))] //~^ ERROR: expected identifier, found keyword `unsafe` //~| ERROR: traits in `#[derive(...)]` don't accept arguments diff --git a/tests/ui/attributes/unsafe/derive-unsafe-attributes.stderr b/tests/ui/attributes/unsafe/derive-unsafe-attributes.stderr index c40a5512fd5..4002c930b63 100644 --- a/tests/ui/attributes/unsafe/derive-unsafe-attributes.stderr +++ b/tests/ui/attributes/unsafe/derive-unsafe-attributes.stderr @@ -1,5 +1,5 @@ error: expected identifier, found keyword `unsafe` - --> $DIR/derive-unsafe-attributes.rs:3:10 + --> $DIR/derive-unsafe-attributes.rs:1:10 | LL | #[derive(unsafe(Debug))] | ^^^^^^ expected identifier, found keyword @@ -10,13 +10,13 @@ LL | #[derive(r#unsafe(Debug))] | ++ error: traits in `#[derive(...)]` don't accept arguments - --> $DIR/derive-unsafe-attributes.rs:3:16 + --> $DIR/derive-unsafe-attributes.rs:1:16 | LL | #[derive(unsafe(Debug))] | ^^^^^^^ help: remove the arguments error: `derive` is not an unsafe attribute - --> $DIR/derive-unsafe-attributes.rs:12:3 + --> $DIR/derive-unsafe-attributes.rs:10:3 | LL | #[unsafe(derive(Debug))] | ^^^^^^ this is not an unsafe attribute @@ -24,7 +24,7 @@ LL | #[unsafe(derive(Debug))] = note: extraneous unsafe is not allowed in attributes error: expected identifier, found keyword `unsafe` - --> $DIR/derive-unsafe-attributes.rs:3:10 + --> $DIR/derive-unsafe-attributes.rs:1:10 | LL | #[derive(unsafe(Debug))] | ^^^^^^ expected identifier, found keyword @@ -36,7 +36,7 @@ LL | #[derive(r#unsafe(Debug))] | ++ error: expected identifier, found keyword `unsafe` - --> $DIR/derive-unsafe-attributes.rs:3:10 + --> $DIR/derive-unsafe-attributes.rs:1:10 | LL | #[derive(unsafe(Debug))] | ^^^^^^ expected identifier, found keyword @@ -48,13 +48,13 @@ LL | #[derive(r#unsafe(Debug))] | ++ error: cannot find derive macro `r#unsafe` in this scope - --> $DIR/derive-unsafe-attributes.rs:3:10 + --> $DIR/derive-unsafe-attributes.rs:1:10 | LL | #[derive(unsafe(Debug))] | ^^^^^^ error: cannot find derive macro `r#unsafe` in this scope - --> $DIR/derive-unsafe-attributes.rs:3:10 + --> $DIR/derive-unsafe-attributes.rs:1:10 | LL | #[derive(unsafe(Debug))] | ^^^^^^ diff --git a/tests/ui/attributes/unsafe/double-unsafe-attributes.rs b/tests/ui/attributes/unsafe/double-unsafe-attributes.rs index a6c0ea578f2..894d1327da7 100644 --- a/tests/ui/attributes/unsafe/double-unsafe-attributes.rs +++ b/tests/ui/attributes/unsafe/double-unsafe-attributes.rs @@ -1,5 +1,3 @@ -#![feature(unsafe_attributes)] - #[unsafe(unsafe(no_mangle))] //~^ ERROR expected identifier, found keyword `unsafe` //~| ERROR cannot find attribute `r#unsafe` in this scope diff --git a/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr b/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr index 950b2636993..0825cf79408 100644 --- a/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr +++ b/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr @@ -1,5 +1,5 @@ error: expected identifier, found keyword `unsafe` - --> $DIR/double-unsafe-attributes.rs:3:10 + --> $DIR/double-unsafe-attributes.rs:1:10 | LL | #[unsafe(unsafe(no_mangle))] | ^^^^^^ expected identifier, found keyword @@ -10,7 +10,7 @@ LL | #[unsafe(r#unsafe(no_mangle))] | ++ error: `r#unsafe` is not an unsafe attribute - --> $DIR/double-unsafe-attributes.rs:3:3 + --> $DIR/double-unsafe-attributes.rs:1:3 | LL | #[unsafe(unsafe(no_mangle))] | ^^^^^^ this is not an unsafe attribute @@ -18,7 +18,7 @@ LL | #[unsafe(unsafe(no_mangle))] = note: extraneous unsafe is not allowed in attributes error: cannot find attribute `r#unsafe` in this scope - --> $DIR/double-unsafe-attributes.rs:3:10 + --> $DIR/double-unsafe-attributes.rs:1:10 | LL | #[unsafe(unsafe(no_mangle))] | ^^^^^^ diff --git a/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.rs b/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.rs index 0181add843b..b561550c198 100644 --- a/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.rs +++ b/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.rs @@ -1,6 +1,5 @@ //@ edition: 2024 //@ compile-flags: -Zunstable-options -#![feature(unsafe_attributes)] #[unsafe(cfg(any()))] //~ ERROR: is not an unsafe attribute fn a() {} diff --git a/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.stderr b/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.stderr index f39074b613d..9fb7f062b91 100644 --- a/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.stderr +++ b/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.stderr @@ -1,5 +1,5 @@ error: `cfg` is not an unsafe attribute - --> $DIR/extraneous-unsafe-attributes.rs:5:3 + --> $DIR/extraneous-unsafe-attributes.rs:4:3 | LL | #[unsafe(cfg(any()))] | ^^^^^^ this is not an unsafe attribute @@ -7,7 +7,7 @@ LL | #[unsafe(cfg(any()))] = note: extraneous unsafe is not allowed in attributes error: `cfg_attr` is not an unsafe attribute - --> $DIR/extraneous-unsafe-attributes.rs:8:3 + --> $DIR/extraneous-unsafe-attributes.rs:7:3 | LL | #[unsafe(cfg_attr(any(), allow(dead_code)))] | ^^^^^^ this is not an unsafe attribute @@ -15,7 +15,7 @@ LL | #[unsafe(cfg_attr(any(), allow(dead_code)))] = note: extraneous unsafe is not allowed in attributes error: `test` is not an unsafe attribute - --> $DIR/extraneous-unsafe-attributes.rs:11:3 + --> $DIR/extraneous-unsafe-attributes.rs:10:3 | LL | #[unsafe(test)] | ^^^^^^ this is not an unsafe attribute @@ -23,7 +23,7 @@ LL | #[unsafe(test)] = note: extraneous unsafe is not allowed in attributes error: `ignore` is not an unsafe attribute - --> $DIR/extraneous-unsafe-attributes.rs:14:3 + --> $DIR/extraneous-unsafe-attributes.rs:13:3 | LL | #[unsafe(ignore = "test")] | ^^^^^^ this is not an unsafe attribute @@ -31,7 +31,7 @@ LL | #[unsafe(ignore = "test")] = note: extraneous unsafe is not allowed in attributes error: `should_panic` is not an unsafe attribute - --> $DIR/extraneous-unsafe-attributes.rs:17:3 + --> $DIR/extraneous-unsafe-attributes.rs:16:3 | LL | #[unsafe(should_panic(expected = "test"))] | ^^^^^^ this is not an unsafe attribute @@ -39,7 +39,7 @@ LL | #[unsafe(should_panic(expected = "test"))] = note: extraneous unsafe is not allowed in attributes error: `macro_use` is not an unsafe attribute - --> $DIR/extraneous-unsafe-attributes.rs:20:3 + --> $DIR/extraneous-unsafe-attributes.rs:19:3 | LL | #[unsafe(macro_use)] | ^^^^^^ this is not an unsafe attribute @@ -47,7 +47,7 @@ LL | #[unsafe(macro_use)] = note: extraneous unsafe is not allowed in attributes error: `macro_export` is not an unsafe attribute - --> $DIR/extraneous-unsafe-attributes.rs:22:7 + --> $DIR/extraneous-unsafe-attributes.rs:21:7 | LL | #[unsafe(macro_export)] | ^^^^^^ this is not an unsafe attribute @@ -55,7 +55,7 @@ LL | #[unsafe(macro_export)] = note: extraneous unsafe is not allowed in attributes error: `used` is not an unsafe attribute - --> $DIR/extraneous-unsafe-attributes.rs:28:3 + --> $DIR/extraneous-unsafe-attributes.rs:27:3 | LL | #[unsafe(used)] | ^^^^^^ this is not an unsafe attribute diff --git a/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs b/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs index f29a5b3252b..eaf8706369a 100644 --- a/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs +++ b/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs @@ -1,5 +1,3 @@ -#![feature(unsafe_attributes)] - #[unsafe(proc_macro)] //~^ ERROR: is not an unsafe attribute //~| ERROR attribute is only usable with crates of the `proc-macro` crate type diff --git a/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr b/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr index 79d34d458bd..9c5751c82e4 100644 --- a/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr +++ b/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr @@ -1,11 +1,11 @@ error[E0452]: malformed lint attribute input - --> $DIR/proc-unsafe-attributes.rs:28:16 + --> $DIR/proc-unsafe-attributes.rs:26:16 | LL | #[unsafe(allow(unsafe(dead_code)))] | ^^^^^^^^^^^^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input - --> $DIR/proc-unsafe-attributes.rs:28:16 + --> $DIR/proc-unsafe-attributes.rs:26:16 | LL | #[unsafe(allow(unsafe(dead_code)))] | ^^^^^^^^^^^^^^^^^ bad attribute argument @@ -13,7 +13,7 @@ LL | #[unsafe(allow(unsafe(dead_code)))] = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: `proc_macro` is not an unsafe attribute - --> $DIR/proc-unsafe-attributes.rs:3:3 + --> $DIR/proc-unsafe-attributes.rs:1:3 | LL | #[unsafe(proc_macro)] | ^^^^^^ this is not an unsafe attribute @@ -21,7 +21,7 @@ LL | #[unsafe(proc_macro)] = note: extraneous unsafe is not allowed in attributes error: `proc_macro_derive` is not an unsafe attribute - --> $DIR/proc-unsafe-attributes.rs:9:3 + --> $DIR/proc-unsafe-attributes.rs:7:3 | LL | #[unsafe(proc_macro_derive(Foo))] | ^^^^^^ this is not an unsafe attribute @@ -29,7 +29,7 @@ LL | #[unsafe(proc_macro_derive(Foo))] = note: extraneous unsafe is not allowed in attributes error: expected identifier, found keyword `unsafe` - --> $DIR/proc-unsafe-attributes.rs:14:21 + --> $DIR/proc-unsafe-attributes.rs:12:21 | LL | #[proc_macro_derive(unsafe(Foo))] | ^^^^^^ expected identifier, found keyword @@ -40,7 +40,7 @@ LL | #[proc_macro_derive(r#unsafe(Foo))] | ++ error: `proc_macro_attribute` is not an unsafe attribute - --> $DIR/proc-unsafe-attributes.rs:19:3 + --> $DIR/proc-unsafe-attributes.rs:17:3 | LL | #[unsafe(proc_macro_attribute)] | ^^^^^^ this is not an unsafe attribute @@ -48,7 +48,7 @@ LL | #[unsafe(proc_macro_attribute)] = note: extraneous unsafe is not allowed in attributes error: `allow` is not an unsafe attribute - --> $DIR/proc-unsafe-attributes.rs:24:3 + --> $DIR/proc-unsafe-attributes.rs:22:3 | LL | #[unsafe(allow(dead_code))] | ^^^^^^ this is not an unsafe attribute @@ -56,7 +56,7 @@ LL | #[unsafe(allow(dead_code))] = note: extraneous unsafe is not allowed in attributes error: `allow` is not an unsafe attribute - --> $DIR/proc-unsafe-attributes.rs:28:3 + --> $DIR/proc-unsafe-attributes.rs:26:3 | LL | #[unsafe(allow(unsafe(dead_code)))] | ^^^^^^ this is not an unsafe attribute @@ -64,7 +64,7 @@ LL | #[unsafe(allow(unsafe(dead_code)))] = note: extraneous unsafe is not allowed in attributes error: expected identifier, found keyword `unsafe` - --> $DIR/proc-unsafe-attributes.rs:28:16 + --> $DIR/proc-unsafe-attributes.rs:26:16 | LL | #[unsafe(allow(unsafe(dead_code)))] | ^^^^^^ expected identifier, found keyword @@ -75,31 +75,31 @@ LL | #[unsafe(allow(r#unsafe(dead_code)))] | ++ error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/proc-unsafe-attributes.rs:3:1 + --> $DIR/proc-unsafe-attributes.rs:1:1 | LL | #[unsafe(proc_macro)] | ^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/proc-unsafe-attributes.rs:9:1 + --> $DIR/proc-unsafe-attributes.rs:7:1 | LL | #[unsafe(proc_macro_derive(Foo))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/proc-unsafe-attributes.rs:14:1 + --> $DIR/proc-unsafe-attributes.rs:12:1 | LL | #[proc_macro_derive(unsafe(Foo))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/proc-unsafe-attributes.rs:19:1 + --> $DIR/proc-unsafe-attributes.rs:17:1 | LL | #[unsafe(proc_macro_attribute)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0452]: malformed lint attribute input - --> $DIR/proc-unsafe-attributes.rs:28:16 + --> $DIR/proc-unsafe-attributes.rs:26:16 | LL | #[unsafe(allow(unsafe(dead_code)))] | ^^^^^^^^^^^^^^^^^ bad attribute argument @@ -107,7 +107,7 @@ LL | #[unsafe(allow(unsafe(dead_code)))] = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0452]: malformed lint attribute input - --> $DIR/proc-unsafe-attributes.rs:28:16 + --> $DIR/proc-unsafe-attributes.rs:26:16 | LL | #[unsafe(allow(unsafe(dead_code)))] | ^^^^^^^^^^^^^^^^^ bad attribute argument diff --git a/tests/ui/attributes/unsafe/unsafe-attributes.rs b/tests/ui/attributes/unsafe/unsafe-attributes.rs index 33a412add50..5c57767b3b9 100644 --- a/tests/ui/attributes/unsafe/unsafe-attributes.rs +++ b/tests/ui/attributes/unsafe/unsafe-attributes.rs @@ -1,5 +1,4 @@ //@ build-pass -#![feature(unsafe_attributes)] #[unsafe(no_mangle)] fn a() {} diff --git a/tests/ui/attributes/unsafe/unsafe-safe-attribute.rs b/tests/ui/attributes/unsafe/unsafe-safe-attribute.rs index 67db36afd2e..5af03a2b8d1 100644 --- a/tests/ui/attributes/unsafe/unsafe-safe-attribute.rs +++ b/tests/ui/attributes/unsafe/unsafe-safe-attribute.rs @@ -1,5 +1,3 @@ -#![feature(unsafe_attributes)] - #[unsafe(repr(C))] //~ ERROR: is not an unsafe attribute struct Foo {} diff --git a/tests/ui/attributes/unsafe/unsafe-safe-attribute.stderr b/tests/ui/attributes/unsafe/unsafe-safe-attribute.stderr index 584b0ea797d..55172c91aae 100644 --- a/tests/ui/attributes/unsafe/unsafe-safe-attribute.stderr +++ b/tests/ui/attributes/unsafe/unsafe-safe-attribute.stderr @@ -1,5 +1,5 @@ error: `repr` is not an unsafe attribute - --> $DIR/unsafe-safe-attribute.rs:3:3 + --> $DIR/unsafe-safe-attribute.rs:1:3 | LL | #[unsafe(repr(C))] | ^^^^^^ this is not an unsafe attribute diff --git a/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.rs b/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.rs index ff2eb61b405..0f241cc439f 100644 --- a/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.rs +++ b/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.rs @@ -1,5 +1,3 @@ -#![feature(unsafe_attributes)] - #[unsafe(diagnostic::on_unimplemented( //~ ERROR: is not an unsafe attribute message = "testing", ))] diff --git a/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.stderr b/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.stderr index 26b5e4e37b9..3bc291db5ac 100644 --- a/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.stderr +++ b/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.stderr @@ -1,5 +1,5 @@ error: `diagnostic::on_unimplemented` is not an unsafe attribute - --> $DIR/unsafe-safe-attribute_diagnostic.rs:3:3 + --> $DIR/unsafe-safe-attribute_diagnostic.rs:1:3 | LL | #[unsafe(diagnostic::on_unimplemented( | ^^^^^^ this is not an unsafe attribute diff --git a/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr b/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr index 73de5864953..1a32d120057 100644 --- a/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr +++ b/tests/ui/borrowck/alias-liveness/opaque-type-param.stderr @@ -7,6 +7,11 @@ LL | fn foo<'a>(s: &'a str) -> impl Trait + 'static { | hidden type `impl Trait + 'static` captures the lifetime `'a` as defined here LL | bar(s) | ^^^^^^ + | +help: add a `use<...>` bound to explicitly capture `'a` + | +LL | fn foo<'a>(s: &'a str) -> impl Trait + 'static + use<'a> { + | +++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/borrow-raw-address-of-borrowed.rs b/tests/ui/borrowck/borrow-raw-address-of-borrowed.rs index f25fd7f66b3..3ed42d07289 100644 --- a/tests/ui/borrowck/borrow-raw-address-of-borrowed.rs +++ b/tests/ui/borrowck/borrow-raw-address-of-borrowed.rs @@ -1,5 +1,3 @@ -#![feature(raw_ref_op)] - fn address_of_shared() { let mut x = 0; let y = &x; diff --git a/tests/ui/borrowck/borrow-raw-address-of-borrowed.stderr b/tests/ui/borrowck/borrow-raw-address-of-borrowed.stderr index 6f7b7e08070..1a38f8c780e 100644 --- a/tests/ui/borrowck/borrow-raw-address-of-borrowed.stderr +++ b/tests/ui/borrowck/borrow-raw-address-of-borrowed.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/borrow-raw-address-of-borrowed.rs:7:13 + --> $DIR/borrow-raw-address-of-borrowed.rs:5:13 | LL | let y = &x; | -- immutable borrow occurs here @@ -11,7 +11,7 @@ LL | drop(y); | - immutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrow-raw-address-of-borrowed.rs:16:13 + --> $DIR/borrow-raw-address-of-borrowed.rs:14:13 | LL | let y = &mut x; | ------ mutable borrow occurs here @@ -23,7 +23,7 @@ LL | drop(y); | - mutable borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrow-raw-address-of-borrowed.rs:17:13 + --> $DIR/borrow-raw-address-of-borrowed.rs:15:13 | LL | let y = &mut x; | ------ first mutable borrow occurs here diff --git a/tests/ui/borrowck/borrow-raw-address-of-deref-mutability-ok.rs b/tests/ui/borrowck/borrow-raw-address-of-deref-mutability-ok.rs index 0dfced34c7e..23409795227 100644 --- a/tests/ui/borrowck/borrow-raw-address-of-deref-mutability-ok.rs +++ b/tests/ui/borrowck/borrow-raw-address-of-deref-mutability-ok.rs @@ -1,7 +1,5 @@ //@ check-pass -#![feature(raw_ref_op)] - fn raw_reborrow() { let x = &0; let y = &mut 0; diff --git a/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.rs b/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.rs index 712873528b5..5b3936ef5a3 100644 --- a/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.rs +++ b/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.rs @@ -1,7 +1,5 @@ // Check that `&raw mut` cannot be used to turn a `&T` into a `*mut T`. -#![feature(raw_ref_op)] - fn raw_reborrow() { let x = &0; diff --git a/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr b/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr index cfc86ff0dc1..ac0241cf9a7 100644 --- a/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr +++ b/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrow-raw-address-of-deref-mutability.rs:8:13 + --> $DIR/borrow-raw-address-of-deref-mutability.rs:6:13 | LL | let q = &raw mut *x; | ^^^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable @@ -10,7 +10,7 @@ LL | let x = &mut 0; | +++ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer - --> $DIR/borrow-raw-address-of-deref-mutability.rs:14:13 + --> $DIR/borrow-raw-address-of-deref-mutability.rs:12:13 | LL | let q = &raw mut *x; | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable diff --git a/tests/ui/borrowck/borrow-raw-address-of-mutability-ok.rs b/tests/ui/borrowck/borrow-raw-address-of-mutability-ok.rs index 7b0232a9d45..ed8c5502a75 100644 --- a/tests/ui/borrowck/borrow-raw-address-of-mutability-ok.rs +++ b/tests/ui/borrowck/borrow-raw-address-of-mutability-ok.rs @@ -1,7 +1,5 @@ //@ check-pass -#![feature(raw_ref_op)] - fn mutable_address_of() { let mut x = 0; let y = &raw mut x; diff --git a/tests/ui/borrowck/borrow-raw-address-of-mutability.rs b/tests/ui/borrowck/borrow-raw-address-of-mutability.rs index 320c54b806a..2c5d636d096 100644 --- a/tests/ui/borrowck/borrow-raw-address-of-mutability.rs +++ b/tests/ui/borrowck/borrow-raw-address-of-mutability.rs @@ -1,5 +1,3 @@ -#![feature(raw_ref_op)] - fn mutable_address_of() { let x = 0; let y = &raw mut x; //~ ERROR cannot borrow diff --git a/tests/ui/borrowck/borrow-raw-address-of-mutability.stderr b/tests/ui/borrowck/borrow-raw-address-of-mutability.stderr index 4b5b368287e..f81a8c99376 100644 --- a/tests/ui/borrowck/borrow-raw-address-of-mutability.stderr +++ b/tests/ui/borrowck/borrow-raw-address-of-mutability.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrow-raw-address-of-mutability.rs:5:13 + --> $DIR/borrow-raw-address-of-mutability.rs:3:13 | LL | let y = &raw mut x; | ^^^^^^^^^^ cannot borrow as mutable @@ -10,7 +10,7 @@ LL | let mut x = 0; | +++ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrow-raw-address-of-mutability.rs:11:17 + --> $DIR/borrow-raw-address-of-mutability.rs:9:17 | LL | let y = &raw mut x; | ^^^^^^^^^^ cannot borrow as mutable @@ -21,7 +21,7 @@ LL | let mut x = 0; | +++ error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable - --> $DIR/borrow-raw-address-of-mutability.rs:21:5 + --> $DIR/borrow-raw-address-of-mutability.rs:19:5 | LL | let y = &raw mut x; | - calling `f` requires mutable binding due to mutable borrow of `x` @@ -35,7 +35,7 @@ LL | let mut f = || { | +++ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/borrow-raw-address-of-mutability.rs:29:17 + --> $DIR/borrow-raw-address-of-mutability.rs:27:17 | LL | fn make_fn<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` @@ -48,7 +48,7 @@ LL | let y = &raw mut x; | ^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/borrow-raw-address-of-mutability.rs:37:17 + --> $DIR/borrow-raw-address-of-mutability.rs:35:17 | LL | fn make_fn<F: Fn()>(f: F) -> F { f } | - change this to accept `FnMut` instead of `Fn` diff --git a/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr b/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr index 54d8f26f4ea..5f0347bdb4d 100644 --- a/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr +++ b/tests/ui/borrowck/regions-bound-missing-bound-in-impl.stderr @@ -30,9 +30,9 @@ note: the lifetime `'c` as defined here... LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^ note: ...does not necessarily outlive the lifetime `'c` as defined here - --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 + --> $DIR/regions-bound-missing-bound-in-impl.rs:12:24 | -LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { +LL | fn wrong_bound1<'b,'c,'d:'a+'b>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>); | ^^ error[E0308]: method not compatible with trait @@ -44,16 +44,15 @@ LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d = note: expected signature `fn(&'a _, Inv<'c>, Inv<'c>, Inv<'_>)` found signature `fn(&'a _, Inv<'_>, Inv<'c>, Inv<'_>)` note: the lifetime `'c` as defined here... - --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 + --> $DIR/regions-bound-missing-bound-in-impl.rs:12:24 | -LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { +LL | fn wrong_bound1<'b,'c,'d:'a+'b>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>); | ^^ note: ...does not necessarily outlive the lifetime `'c` as defined here --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^ - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0195]: lifetime parameters or bounds on method `wrong_bound2` do not match the trait declaration --> $DIR/regions-bound-missing-bound-in-impl.rs:42:20 diff --git a/tests/ui/cast/ptr-to-trait-obj-different-args.stderr b/tests/ui/cast/ptr-to-trait-obj-different-args.stderr index b04289ae747..8e60ca42f0a 100644 --- a/tests/ui/cast/ptr-to-trait-obj-different-args.stderr +++ b/tests/ui/cast/ptr-to-trait-obj-different-args.stderr @@ -14,6 +14,7 @@ LL | let y: *const dyn Trait<Y> = x as _; | = note: expected trait object `dyn Trait<X>` found trait object `dyn Trait<Y>` + = help: `dyn Trait<Y>` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well error[E0308]: mismatched types --> $DIR/ptr-to-trait-obj-different-args.rs:27:34 @@ -25,6 +26,7 @@ LL | let _: *const dyn Trait<T> = x as _; | = note: expected trait object `dyn Trait<X>` found trait object `dyn Trait<T>` + = help: `dyn Trait<T>` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well error[E0308]: mismatched types --> $DIR/ptr-to-trait-obj-different-args.rs:28:34 @@ -37,6 +39,7 @@ LL | let _: *const dyn Trait<X> = t as _; | = note: expected trait object `dyn Trait<T>` found trait object `dyn Trait<X>` + = help: `dyn Trait<X>` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well error[E0308]: mismatched types --> $DIR/ptr-to-trait-obj-different-args.rs:36:5 diff --git a/tests/ui/cfg/disallowed-cli-cfgs.fmt_debug_.stderr b/tests/ui/cfg/disallowed-cli-cfgs.fmt_debug_.stderr new file mode 100644 index 00000000000..a0d7fa5c3c9 --- /dev/null +++ b/tests/ui/cfg/disallowed-cli-cfgs.fmt_debug_.stderr @@ -0,0 +1,8 @@ +error: unexpected `--cfg fmt_debug="shallow"` flag + | + = note: config `fmt_debug` is only supposed to be controlled by `-Z fmt-debug` + = note: manually setting a built-in cfg can and does create incoherent behaviors + = note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default + +error: aborting due to 1 previous error + diff --git a/tests/ui/cfg/disallowed-cli-cfgs.rs b/tests/ui/cfg/disallowed-cli-cfgs.rs index 714c01f4bc6..3c9ee87f28a 100644 --- a/tests/ui/cfg/disallowed-cli-cfgs.rs +++ b/tests/ui/cfg/disallowed-cli-cfgs.rs @@ -6,6 +6,7 @@ //@ revisions: target_pointer_width_ target_vendor_ target_has_atomic_ //@ revisions: target_has_atomic_equal_alignment_ target_has_atomic_load_store_ //@ revisions: target_thread_local_ relocation_model_ +//@ revisions: fmt_debug_ //@ [overflow_checks_]compile-flags: --cfg overflow_checks //@ [debug_assertions_]compile-flags: --cfg debug_assertions @@ -31,5 +32,6 @@ //@ [target_has_atomic_load_store_]compile-flags: --cfg target_has_atomic_load_store="32" //@ [target_thread_local_]compile-flags: --cfg target_thread_local //@ [relocation_model_]compile-flags: --cfg relocation_model="a" +//@ [fmt_debug_]compile-flags: --cfg fmt_debug="shallow" fn main() {} diff --git a/tests/ui/check-cfg/allow-same-level.stderr b/tests/ui/check-cfg/allow-same-level.stderr index b311a80c8fd..b1a9c5810d8 100644 --- a/tests/ui/check-cfg/allow-same-level.stderr +++ b/tests/ui/check-cfg/allow-same-level.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `FALSE` LL | #[cfg(FALSE)] | ^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(FALSE)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cargo-build-script.stderr b/tests/ui/check-cfg/cargo-build-script.stderr index 9ab3290ef22..0b01b1da5a7 100644 --- a/tests/ui/check-cfg/cargo-build-script.stderr +++ b/tests/ui/check-cfg/cargo-build-script.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `has_foo` LL | #[cfg(has_foo)] | ^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `has_bar`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `has_bar`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cargo-feature.none.stderr b/tests/ui/check-cfg/cargo-feature.none.stderr index 9d3117ed54d..6de6e9a6851 100644 --- a/tests/ui/check-cfg/cargo-feature.none.stderr +++ b/tests/ui/check-cfg/cargo-feature.none.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cargo-feature.some.stderr b/tests/ui/check-cfg/cargo-feature.some.stderr index 14e24cb1429..d4a7f6defb2 100644 --- a/tests/ui/check-cfg/cargo-feature.some.stderr +++ b/tests/ui/check-cfg/cargo-feature.some.stderr @@ -25,7 +25,7 @@ warning: unexpected `cfg` condition name: `tokio_unstable` LL | #[cfg(tokio_unstable)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `CONFIG_NVME`, `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: consider using a Cargo feature instead = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint: [lints.rust] diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr index 08bd43832ea..831722a12e2 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-duplicate.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `value` LL | #[cfg(value)] | ^^^^^ | - = help: expected names are: `bar`, `bee`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bar`, `bee`, `clippy`, `cow`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(value)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr index 6db1144eada..a35a8d68def 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `my_value` LL | #[cfg(my_value)] | ^^^^^^^^ | - = help: expected names are: `bar`, `clippy`, `debug_assertions`, `doc`, `doctest`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `bar`, `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `foo`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(my_value)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr index a5f8176343a..65a73ffcd1d 100644 --- a/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr +++ b/tests/ui/check-cfg/cfg-value-for-cfg-name.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `linux` LL | #[cfg(linux)] | ^^^^^ help: found config with similar value: `target_os = "linux"` | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(linux)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/compact-names.stderr b/tests/ui/check-cfg/compact-names.stderr index 6fecdb52362..536c992ee92 100644 --- a/tests/ui/check-cfg/compact-names.stderr +++ b/tests/ui/check-cfg/compact-names.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `target_architecture` LL | #[cfg(target(os = "linux", architecture = "arm"))] | ^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(target_architecture, values("arm"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr index 2497864e87e..6c26a8b11d9 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr index a7d4c6d4df6..b7ccf5e5f83 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.feature.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.feature.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names-values.full.stderr b/tests/ui/check-cfg/exhaustive-names-values.full.stderr index a7d4c6d4df6..b7ccf5e5f83 100644 --- a/tests/ui/check-cfg/exhaustive-names-values.full.stderr +++ b/tests/ui/check-cfg/exhaustive-names-values.full.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/exhaustive-names.stderr b/tests/ui/check-cfg/exhaustive-names.stderr index 7ac3241db5f..5350534f3e8 100644 --- a/tests/ui/check-cfg/exhaustive-names.stderr +++ b/tests/ui/check-cfg/exhaustive-names.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `unknown_key` LL | #[cfg(unknown_key = "value")] | ^^^^^^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(unknown_key, values("value"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/mix.stderr b/tests/ui/check-cfg/mix.stderr index 520cffc4b02..a163728b51d 100644 --- a/tests/ui/check-cfg/mix.stderr +++ b/tests/ui/check-cfg/mix.stderr @@ -44,7 +44,7 @@ warning: unexpected `cfg` condition name: `uu` LL | #[cfg_attr(uu, test)] | ^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(uu)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration @@ -251,7 +251,7 @@ warning: unexpected `cfg` condition value: `zebra` LL | cfg!(target_feature = "zebra"); | ^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, and `avx512vpopcntdq` and 201 more + = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, and `avx512vpopcntdq` and 239 more = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: 27 warnings emitted diff --git a/tests/ui/check-cfg/stmt-no-ice.stderr b/tests/ui/check-cfg/stmt-no-ice.stderr index e8b61d808fe..98f09a648bc 100644 --- a/tests/ui/check-cfg/stmt-no-ice.stderr +++ b/tests/ui/check-cfg/stmt-no-ice.stderr @@ -4,7 +4,7 @@ warning: unexpected `cfg` condition name: `crossbeam_loom` LL | #[cfg(crossbeam_loom)] | ^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(crossbeam_loom)` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr index 41130210df1..abcf53cfe30 100644 --- a/tests/ui/check-cfg/well-known-names.stderr +++ b/tests/ui/check-cfg/well-known-names.stderr @@ -18,7 +18,7 @@ warning: unexpected `cfg` condition name: `features` LL | #[cfg(features = "foo")] | ^^^^^^^^^^^^^^^^ | - = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` + = help: expected names are: `clippy`, `debug_assertions`, `doc`, `doctest`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows` = help: to expect this configuration use `--check-cfg=cfg(features, values("foo"))` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration diff --git a/tests/ui/check-cfg/well-known-values.rs b/tests/ui/check-cfg/well-known-values.rs index d5fe7464792..1fda4b2089e 100644 --- a/tests/ui/check-cfg/well-known-values.rs +++ b/tests/ui/check-cfg/well-known-values.rs @@ -16,6 +16,7 @@ #![feature(cfg_target_has_atomic_equal_alignment)] #![feature(cfg_target_thread_local)] #![feature(cfg_ub_checks)] +#![feature(fmt_debug)] // This part makes sure that none of the well known names are // unexpected. @@ -33,6 +34,8 @@ //~^ WARN unexpected `cfg` condition value doctest = "_UNEXPECTED_VALUE", //~^ WARN unexpected `cfg` condition value + fmt_debug = "_UNEXPECTED_VALUE", + //~^ WARN unexpected `cfg` condition value miri = "_UNEXPECTED_VALUE", //~^ WARN unexpected `cfg` condition value overflow_checks = "_UNEXPECTED_VALUE", diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr index d780e04e729..0530e1c34c9 100644 --- a/tests/ui/check-cfg/well-known-values.stderr +++ b/tests/ui/check-cfg/well-known-values.stderr @@ -1,5 +1,5 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:28:5 + --> $DIR/well-known-values.rs:29:5 | LL | clippy = "_UNEXPECTED_VALUE", | ^^^^^^---------------------- @@ -11,7 +11,7 @@ LL | clippy = "_UNEXPECTED_VALUE", = note: `#[warn(unexpected_cfgs)]` on by default warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:30:5 + --> $DIR/well-known-values.rs:31:5 | LL | debug_assertions = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^---------------------- @@ -22,7 +22,7 @@ LL | debug_assertions = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:32:5 + --> $DIR/well-known-values.rs:33:5 | LL | doc = "_UNEXPECTED_VALUE", | ^^^---------------------- @@ -33,7 +33,7 @@ LL | doc = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:34:5 + --> $DIR/well-known-values.rs:35:5 | LL | doctest = "_UNEXPECTED_VALUE", | ^^^^^^^---------------------- @@ -44,7 +44,16 @@ LL | doctest = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:36:5 + --> $DIR/well-known-values.rs:37:5 + | +LL | fmt_debug = "_UNEXPECTED_VALUE", + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: expected values for `fmt_debug` are: `full`, `none`, and `shallow` + = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration + +warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` + --> $DIR/well-known-values.rs:39:5 | LL | miri = "_UNEXPECTED_VALUE", | ^^^^---------------------- @@ -55,7 +64,7 @@ LL | miri = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:38:5 + --> $DIR/well-known-values.rs:41:5 | LL | overflow_checks = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^---------------------- @@ -66,7 +75,7 @@ LL | overflow_checks = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:40:5 + --> $DIR/well-known-values.rs:43:5 | LL | panic = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -75,7 +84,7 @@ LL | panic = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:42:5 + --> $DIR/well-known-values.rs:45:5 | LL | proc_macro = "_UNEXPECTED_VALUE", | ^^^^^^^^^^---------------------- @@ -86,7 +95,7 @@ LL | proc_macro = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:44:5 + --> $DIR/well-known-values.rs:47:5 | LL | relocation_model = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,7 +104,7 @@ LL | relocation_model = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:46:5 + --> $DIR/well-known-values.rs:49:5 | LL | rustfmt = "_UNEXPECTED_VALUE", | ^^^^^^^---------------------- @@ -106,7 +115,7 @@ LL | rustfmt = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:48:5 + --> $DIR/well-known-values.rs:51:5 | LL | sanitize = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -115,7 +124,7 @@ LL | sanitize = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:50:5 + --> $DIR/well-known-values.rs:53:5 | LL | target_abi = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -124,7 +133,7 @@ LL | target_abi = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:52:5 + --> $DIR/well-known-values.rs:55:5 | LL | target_arch = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +142,7 @@ LL | target_arch = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:54:5 + --> $DIR/well-known-values.rs:57:5 | LL | target_endian = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -142,7 +151,7 @@ LL | target_endian = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:56:5 + --> $DIR/well-known-values.rs:59:5 | LL | target_env = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -151,7 +160,7 @@ LL | target_env = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:58:5 + --> $DIR/well-known-values.rs:61:5 | LL | target_family = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -160,16 +169,16 @@ LL | target_family = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:60:5 + --> $DIR/well-known-values.rs:63:5 | LL | target_feature = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, `avxvnniint8`, `backchain`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `extended-const`, `f`, `f16c`, `f32mm`, `f64mm`, `fcma`, `fdivdu`, `fhm`, `flagm`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frecipe`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lahfsahf`, `lasx`, `lbt`, `lor`, `lse`, `lsx`, `lvz`, `lzcnt`, `m`, `mclass`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `prfchw`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sha512`, `sign-ext`, `simd128`, `sm3`, `sm4`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `sve`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `unaligned-scalar-mem`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vector`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `xop`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, and `zkt` + = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, `avx512vpopcntdq`, `avxifma`, `avxneconvert`, `avxvnni`, `avxvnniint16`, `avxvnniint8`, `backchain`, `bf16`, `bmi1`, `bmi2`, `bti`, `bulk-memory`, `c`, `cache`, `cmpxchg16b`, `crc`, `crt-static`, `cssc`, `d`, `d32`, `dit`, `doloop`, `dotprod`, `dpb`, `dpb2`, `dsp`, `dsp1e2`, `dspe60`, `e`, `e1`, `e2`, `ecv`, `edsp`, `elrw`, `ermsb`, `exception-handling`, `extended-const`, `f`, `f16c`, `f32mm`, `f64mm`, `faminmax`, `fcma`, `fdivdu`, `fhm`, `flagm`, `flagm2`, `float1e2`, `float1e3`, `float3e4`, `float7e60`, `floate1`, `fma`, `fp-armv8`, `fp16`, `fp64`, `fp8`, `fp8dot2`, `fp8dot4`, `fp8fma`, `fpuv2_df`, `fpuv2_sf`, `fpuv3_df`, `fpuv3_hf`, `fpuv3_hi`, `fpuv3_sf`, `frecipe`, `frintts`, `fxsr`, `gfni`, `hard-float`, `hard-float-abi`, `hard-tp`, `hbc`, `high-registers`, `hvx`, `hvx-length128b`, `hwdiv`, `i8mm`, `jsconv`, `lahfsahf`, `lasx`, `lbt`, `lor`, `lse`, `lse128`, `lse2`, `lsx`, `lut`, `lvz`, `lzcnt`, `m`, `mclass`, `mops`, `movbe`, `mp`, `mp1e2`, `msa`, `mte`, `multivalue`, `mutable-globals`, `neon`, `nontrapping-fptoint`, `nvic`, `paca`, `pacg`, `pan`, `pclmulqdq`, `pmuv3`, `popcnt`, `power10-vector`, `power8-altivec`, `power8-vector`, `power9-altivec`, `power9-vector`, `prfchw`, `rand`, `ras`, `rclass`, `rcpc`, `rcpc2`, `rcpc3`, `rdm`, `rdrand`, `rdseed`, `reference-types`, `relax`, `relaxed-simd`, `rtm`, `sb`, `sha`, `sha2`, `sha3`, `sha512`, `sign-ext`, `simd128`, `sm3`, `sm4`, `sme`, `sme-f16f16`, `sme-f64f64`, `sme-f8f16`, `sme-f8f32`, `sme-fa64`, `sme-i16i64`, `sme-lutv2`, `sme2`, `sme2p1`, `spe`, `ssbs`, `sse`, `sse2`, `sse3`, `sse4.1`, `sse4.2`, `sse4a`, `ssse3`, `ssve-fp8dot2`, `ssve-fp8dot4`, `ssve-fp8fma`, `sve`, `sve-b16b16`, `sve2`, `sve2-aes`, `sve2-bitperm`, `sve2-sha3`, `sve2-sm4`, `sve2p1`, `tbm`, `thumb-mode`, `thumb2`, `tme`, `trust`, `trustzone`, `ual`, `unaligned-scalar-mem`, `v`, `v5te`, `v6`, `v6k`, `v6t2`, `v7`, `v8`, `v8.1a`, `v8.2a`, `v8.3a`, `v8.4a`, `v8.5a`, `v8.6a`, `v8.7a`, `v8.8a`, `v8.9a`, `v9.1a`, `v9.2a`, `v9.3a`, `v9.4a`, `v9.5a`, `v9a`, `vaes`, `vdsp2e60f`, `vdspv1`, `vdspv2`, `vector`, `vfp2`, `vfp3`, `vfp4`, `vh`, `virt`, `virtualization`, `vpclmulqdq`, `vsx`, `wfxt`, `xop`, `xsave`, `xsavec`, `xsaveopt`, `xsaves`, `zba`, `zbb`, `zbc`, `zbkb`, `zbkc`, `zbkx`, `zbs`, `zdinx`, `zfh`, `zfhmin`, `zfinx`, `zhinx`, `zhinxmin`, `zk`, `zkn`, `zknd`, `zkne`, `zknh`, `zkr`, `zks`, `zksed`, `zksh`, and `zkt` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:62:5 + --> $DIR/well-known-values.rs:65:5 | LL | target_has_atomic = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -178,7 +187,7 @@ LL | target_has_atomic = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:64:5 + --> $DIR/well-known-values.rs:67:5 | LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -187,7 +196,7 @@ LL | target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:66:5 + --> $DIR/well-known-values.rs:69:5 | LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -196,16 +205,16 @@ LL | target_has_atomic_load_store = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:68:5 + --> $DIR/well-known-values.rs:71:5 | LL | target_os = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` + = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:70:5 + --> $DIR/well-known-values.rs:73:5 | LL | target_pointer_width = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -214,7 +223,7 @@ LL | target_pointer_width = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:72:5 + --> $DIR/well-known-values.rs:75:5 | LL | target_thread_local = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^---------------------- @@ -225,7 +234,7 @@ LL | target_thread_local = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:74:5 + --> $DIR/well-known-values.rs:77:5 | LL | target_vendor = "_UNEXPECTED_VALUE", | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -234,7 +243,7 @@ LL | target_vendor = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:76:5 + --> $DIR/well-known-values.rs:79:5 | LL | test = "_UNEXPECTED_VALUE", | ^^^^---------------------- @@ -245,7 +254,7 @@ LL | test = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:78:5 + --> $DIR/well-known-values.rs:81:5 | LL | ub_checks = "_UNEXPECTED_VALUE", | ^^^^^^^^^---------------------- @@ -256,7 +265,7 @@ LL | ub_checks = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:80:5 + --> $DIR/well-known-values.rs:83:5 | LL | unix = "_UNEXPECTED_VALUE", | ^^^^---------------------- @@ -267,7 +276,7 @@ LL | unix = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE` - --> $DIR/well-known-values.rs:82:5 + --> $DIR/well-known-values.rs:85:5 | LL | windows = "_UNEXPECTED_VALUE", | ^^^^^^^---------------------- @@ -278,15 +287,15 @@ LL | windows = "_UNEXPECTED_VALUE", = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration warning: unexpected `cfg` condition value: `linuz` - --> $DIR/well-known-values.rs:88:7 + --> $DIR/well-known-values.rs:91:7 | LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux` | ^^^^^^^^^^^^------- | | | help: there is a expected value with a similar name: `"linux"` | - = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` + = note: expected values for `target_os` are: `aix`, `android`, `cuda`, `dragonfly`, `emscripten`, `espidf`, `freebsd`, `fuchsia`, `haiku`, `hermit`, `horizon`, `hurd`, `illumos`, `ios`, `l4re`, `linux`, `macos`, `netbsd`, `none`, `nto`, `nuttx`, `openbsd`, `psp`, `redox`, `solaris`, `solid_asp3`, `teeos`, `trusty`, `tvos`, `uefi`, `unknown`, `visionos`, `vita`, `vxworks`, `wasi`, `watchos`, `windows`, `xous`, and `zkvm` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration -warning: 29 warnings emitted +warning: 30 warnings emitted diff --git a/tests/ui/closures/add_semicolon_non_block_closure.rs b/tests/ui/closures/add_semicolon_non_block_closure.rs index 3ae91be60c5..62c5e343cd3 100644 --- a/tests/ui/closures/add_semicolon_non_block_closure.rs +++ b/tests/ui/closures/add_semicolon_non_block_closure.rs @@ -8,4 +8,5 @@ fn main() { foo(|| bar()) //~^ ERROR mismatched types [E0308] //~| HELP consider using a semicolon here + //~| HELP try adding a return type } diff --git a/tests/ui/closures/add_semicolon_non_block_closure.stderr b/tests/ui/closures/add_semicolon_non_block_closure.stderr index d095e59c7eb..7883db8f98e 100644 --- a/tests/ui/closures/add_semicolon_non_block_closure.stderr +++ b/tests/ui/closures/add_semicolon_non_block_closure.stderr @@ -1,8 +1,6 @@ error[E0308]: mismatched types --> $DIR/add_semicolon_non_block_closure.rs:8:12 | -LL | fn main() { - | - expected `()` because of default return type LL | foo(|| bar()) | ^^^^^ expected `()`, found `i32` | @@ -10,6 +8,10 @@ help: consider using a semicolon here | LL | foo(|| { bar(); }) | + +++ +help: try adding a return type + | +LL | foo(|| -> i32 bar()) + | ++++++ error: aborting due to 1 previous error diff --git a/tests/ui/closures/coerce-unsafe-to-closure.stderr b/tests/ui/closures/coerce-unsafe-to-closure.stderr index cb718ca160f..2538fc0361c 100644 --- a/tests/ui/closures/coerce-unsafe-to-closure.stderr +++ b/tests/ui/closures/coerce-unsafe-to-closure.stderr @@ -1,4 +1,4 @@ -error[E0277]: expected a `FnOnce(&str)` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` +error[E0277]: expected a `FnOnce(&str)` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}` --> $DIR/coerce-unsafe-to-closure.rs:2:44 | LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); @@ -6,7 +6,7 @@ LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); | | | required by a bound introduced by this call | - = help: the trait `FnOnce(&str)` is not implemented for fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` + = help: the trait `FnOnce(&str)` is not implemented for fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}` = note: unsafe function cannot be called generically without an unsafe block note: required by a bound in `Option::<T>::map` --> $SRC_DIR/core/src/option.rs:LL:COL diff --git a/tests/ui/coercion/cast-higher-ranked-unsafe-fn-ptr.rs b/tests/ui/coercion/cast-higher-ranked-unsafe-fn-ptr.rs new file mode 100644 index 00000000000..19723bee4d4 --- /dev/null +++ b/tests/ui/coercion/cast-higher-ranked-unsafe-fn-ptr.rs @@ -0,0 +1,14 @@ +//@ check-pass + +fn higher_ranked_fndef(ctx: &mut ()) {} + +fn test(higher_ranked_fnptr: fn(&mut ())) { + fn as_unsafe<T>(_: unsafe fn(T)) {} + + // Make sure that we can cast higher-ranked fn items and pointers to + // a non-higher-ranked target. + as_unsafe(higher_ranked_fndef); + as_unsafe(higher_ranked_fnptr); +} + +fn main() {} diff --git a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr index 646044ae41a..0c220a13876 100644 --- a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -42,6 +42,7 @@ LL | let _ = type_ascribe!(Box::new( if true { false } else { true }), Box<d | = note: expected struct `Box<dyn Debug>` found struct `Box<bool>` + = help: `bool` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:16:27 @@ -51,6 +52,7 @@ LL | let _ = type_ascribe!(Box::new( match true { true => 'a', false => 'b' | = note: expected struct `Box<dyn Debug>` found struct `Box<char>` + = help: `char` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:18:27 @@ -96,6 +98,7 @@ LL | let _ = type_ascribe!(&if true { false } else { true }, &dyn Debug); | = note: expected reference `&dyn Debug` found reference `&bool` + = help: `bool` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:24:27 @@ -105,6 +108,7 @@ LL | let _ = type_ascribe!(&match true { true => 'a', false => 'b' }, &dyn D | = note: expected reference `&dyn Debug` found reference `&char` + = help: `char` implements `Debug` so you could box the found value and coerce it to the trait object `Box<dyn Debug>`, you will have to change the expected type as well error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:26:27 diff --git a/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.rs b/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.rs index e07fa78463c..cdfeb9c434e 100644 --- a/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.rs +++ b/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.rs @@ -5,7 +5,9 @@ #![feature(with_negative_coherence)] trait Trait {} impl<const N: u8> Trait for [(); N] {} +//~^ ERROR: mismatched types impl<const N: i8> Trait for [(); N] {} //~^ ERROR: conflicting implementations of trait `Trait` +//~| ERROR: mismatched types fn main() {} diff --git a/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.stderr b/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.stderr index 2087be8e711..d65450845bc 100644 --- a/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.stderr +++ b/tests/ui/coherence/negative-coherence/generic_const_type_mismatch.stderr @@ -1,11 +1,25 @@ error[E0119]: conflicting implementations of trait `Trait` for type `[(); _]` - --> $DIR/generic_const_type_mismatch.rs:8:1 + --> $DIR/generic_const_type_mismatch.rs:9:1 | LL | impl<const N: u8> Trait for [(); N] {} | ----------------------------------- first implementation here +LL | LL | impl<const N: i8> Trait for [(); N] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[(); _]` -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/generic_const_type_mismatch.rs:7:34 + | +LL | impl<const N: u8> Trait for [(); N] {} + | ^ expected `usize`, found `u8` + +error[E0308]: mismatched types + --> $DIR/generic_const_type_mismatch.rs:9:34 + | +LL | impl<const N: i8> Trait for [(); N] {} + | ^ expected `usize`, found `i8` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0119`. +Some errors have detailed explanations: E0119, E0308. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/crashes/116308.rs b/tests/ui/const-generics/adt_const_params/116308.rs index cb96c80d79b..9ea7022e29c 100644 --- a/tests/crashes/116308.rs +++ b/tests/ui/const-generics/adt_const_params/116308.rs @@ -1,6 +1,8 @@ -//@ known-bug: #116308 +//@ check-pass #![feature(adt_const_params)] +// Regression test for #116308 + pub trait Identity { type Identity; } diff --git a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.rs b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.rs index 569e57fa326..401267a0f16 100644 --- a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.rs +++ b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.rs @@ -4,11 +4,11 @@ #![allow(incomplete_features, unstable_features)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable<Src, Dst, Context, const ASSUME: std::mem::Assume>() where - Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>, + Dst: TransmuteFrom<Src, Context, ASSUME>, //~^ ERROR trait takes at most 2 generic arguments but 3 generic arguments were supplied { } diff --git a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr index 5c04c4c9d5b..96716685614 100644 --- a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr +++ b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr @@ -1,8 +1,8 @@ error[E0107]: trait takes at most 2 generic arguments but 3 generic arguments were supplied --> $DIR/transmutable-ice-110969.rs:11:14 | -LL | Dst: BikeshedIntrinsicFrom<Src, Context, ASSUME>, - | ^^^^^^^^^^^^^^^^^^^^^ -------- help: remove the unnecessary generic argument +LL | Dst: TransmuteFrom<Src, Context, ASSUME>, + | ^^^^^^^^^^^^^ -------- help: remove the unnecessary generic argument | | | expected at most 2 generic arguments diff --git a/tests/ui/const-generics/bad-subst-const-kind.rs b/tests/ui/const-generics/bad-subst-const-kind.rs index cc2ff9b8dea..c4e74596e9f 100644 --- a/tests/ui/const-generics/bad-subst-const-kind.rs +++ b/tests/ui/const-generics/bad-subst-const-kind.rs @@ -7,6 +7,7 @@ trait Q { impl<const N: u64> Q for [u8; N] { //~^ ERROR: the constant `N` is not of type `usize` + //~| ERROR: mismatched types const ASSOC: usize = 1; } diff --git a/tests/ui/const-generics/bad-subst-const-kind.stderr b/tests/ui/const-generics/bad-subst-const-kind.stderr index 5c8d9c90363..21ec8f0768c 100644 --- a/tests/ui/const-generics/bad-subst-const-kind.stderr +++ b/tests/ui/const-generics/bad-subst-const-kind.stderr @@ -5,7 +5,7 @@ LL | impl<const N: u64> Q for [u8; N] { | ^^^^^^^ expected `usize`, found `u64` error: the constant `13` is not of type `u64` - --> $DIR/bad-subst-const-kind.rs:13:24 + --> $DIR/bad-subst-const-kind.rs:14:24 | LL | pub fn test() -> [u8; <[u8; 13] as Q>::ASSOC] { | ^^^^^^^^ expected `u64`, found `usize` @@ -18,5 +18,12 @@ LL | impl<const N: u64> Q for [u8; N] { | | | unsatisfied trait bound introduced here -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/bad-subst-const-kind.rs:8:31 + | +LL | impl<const N: u64> Q for [u8; N] { + | ^ expected `usize`, found `u64` + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/const-ty-is-normalized.rs b/tests/ui/const-generics/const-ty-is-normalized.rs new file mode 100644 index 00000000000..784145f735e --- /dev/null +++ b/tests/ui/const-generics/const-ty-is-normalized.rs @@ -0,0 +1,25 @@ +//@ compile-flags: -Cdebuginfo=2 --crate-type=lib +//@ build-pass +#![feature(adt_const_params)] + +const N_ISLANDS: usize = 4; + +pub type Matrix = [[usize; N_ISLANDS]; N_ISLANDS]; + +const EMPTY_MATRIX: Matrix = [[0; N_ISLANDS]; N_ISLANDS]; + +const fn to_matrix() -> Matrix { + EMPTY_MATRIX +} + +const BRIDGE_MATRIX: [[usize; N_ISLANDS]; N_ISLANDS] = to_matrix(); + +pub struct Walk<const CURRENT: usize, const REMAINING: Matrix> { + _p: (), +} + +impl Walk<0, BRIDGE_MATRIX> { + pub const fn new() -> Self { + Self { _p: () } + } +} diff --git a/tests/ui/const-generics/early/trivial-const-arg-macro-nested.rs b/tests/ui/const-generics/early/trivial-const-arg-macro-nested.rs new file mode 100644 index 00000000000..f9730cf8566 --- /dev/null +++ b/tests/ui/const-generics/early/trivial-const-arg-macro-nested.rs @@ -0,0 +1,21 @@ +//@ check-pass + +// This is a regression test for #128016. + +macro_rules! len_inner { + () => { + BAR + }; +} + +macro_rules! len { + () => { + len_inner!() + }; +} + +const BAR: usize = 0; + +fn main() { + let val: [bool; len!()] = []; +} diff --git a/tests/ui/const-generics/early/trivial-const-arg-macro-param.rs b/tests/ui/const-generics/early/trivial-const-arg-macro-param.rs new file mode 100644 index 00000000000..f123e55c028 --- /dev/null +++ b/tests/ui/const-generics/early/trivial-const-arg-macro-param.rs @@ -0,0 +1,13 @@ +//@ check-pass + +macro_rules! len { + ($x:ident) => { + $x + }; +} + +fn bar<const N: usize>() { + let val: [bool; len!(N)] = [true; N]; +} + +fn main() {} diff --git a/tests/ui/const-generics/early/trivial-const-arg-macro-res-error.rs b/tests/ui/const-generics/early/trivial-const-arg-macro-res-error.rs new file mode 100644 index 00000000000..f218caac0cf --- /dev/null +++ b/tests/ui/const-generics/early/trivial-const-arg-macro-res-error.rs @@ -0,0 +1,13 @@ +// This is a regression test for #128016. + +macro_rules! len { + () => { + target + //~^ ERROR cannot find value `target` + }; +} + +fn main() { + let val: [str; len!()] = []; + //~^ ERROR the size for values +} diff --git a/tests/ui/const-generics/early/trivial-const-arg-macro-res-error.stderr b/tests/ui/const-generics/early/trivial-const-arg-macro-res-error.stderr new file mode 100644 index 00000000000..ab289e5a6b7 --- /dev/null +++ b/tests/ui/const-generics/early/trivial-const-arg-macro-res-error.stderr @@ -0,0 +1,24 @@ +error[E0425]: cannot find value `target` in this scope + --> $DIR/trivial-const-arg-macro-res-error.rs:5:9 + | +LL | target + | ^^^^^^ not found in this scope +... +LL | let val: [str; len!()] = []; + | ------ in this macro invocation + | + = note: this error originates in the macro `len` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/trivial-const-arg-macro-res-error.rs:11:14 + | +LL | let val: [str; len!()] = []; + | ^^^^^^^^^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = note: slice and array elements must have `Sized` type + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0277, E0425. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/early/trivial-const-arg-macro.rs b/tests/ui/const-generics/early/trivial-const-arg-macro.rs new file mode 100644 index 00000000000..a19d9abfdcb --- /dev/null +++ b/tests/ui/const-generics/early/trivial-const-arg-macro.rs @@ -0,0 +1,15 @@ +//@ check-pass + +// This is a regression test for #128016. + +macro_rules! len { + () => { + BAR + }; +} + +const BAR: usize = 0; + +fn main() { + let val: [bool; len!()] = []; +} diff --git a/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr b/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr index 7a9572d000d..24f3ed7cdf1 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-109141.stderr @@ -30,10 +30,10 @@ LL | fn a(&self) -> impl Iterator { LL | self.0.iter_mut() | ^^^^^^^^^^^^^^^^^ | -help: to declare that `impl Iterator` captures `'_`, you can add an explicit `'_` lifetime bound +help: add a `use<...>` bound to explicitly capture `'_` | -LL | fn a(&self) -> impl Iterator + '_ { - | ++++ +LL | fn a(&self) -> impl Iterator + use<'_> { + | +++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs index 8e5e23b2337..a45deabbb0f 100644 --- a/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs +++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs @@ -8,6 +8,7 @@ trait Q { impl<const N: u64> Q for [u8; N] {} //~^ ERROR not all trait items implemented //~| ERROR the constant `N` is not of type `usize` +//~| ERROR mismatched types pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {} //~^ ERROR the constant `13` is not of type `u64` diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr index e03580ec007..68870a8d38d 100644 --- a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr +++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr @@ -14,7 +14,7 @@ LL | impl<const N: u64> Q for [u8; N] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `ASSOC` in implementation error: the constant `13` is not of type `u64` - --> $DIR/type_mismatch.rs:12:26 + --> $DIR/type_mismatch.rs:13:26 | LL | pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {} | ^^^^^^^^ expected `u64`, found `usize` @@ -28,14 +28,20 @@ LL | impl<const N: u64> Q for [u8; N] {} | unsatisfied trait bound introduced here error[E0308]: mismatched types - --> $DIR/type_mismatch.rs:12:20 + --> $DIR/type_mismatch.rs:13:20 | LL | pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {} | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[u8; <[u8; 13] as Q>::ASSOC]`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -error: aborting due to 4 previous errors +error[E0308]: mismatched types + --> $DIR/type_mismatch.rs:8:31 + | +LL | impl<const N: u64> Q for [u8; N] {} + | ^ expected `usize`, found `u64` + +error: aborting due to 5 previous errors Some errors have detailed explanations: E0046, E0308. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs index 8b7ee577569..05a3487ffca 100644 --- a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs +++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs @@ -14,8 +14,8 @@ mod v20 { //~^ ERROR cannot find value `v8` in this scope //~| ERROR cannot find function `v6` in this scope pub struct v17<const v10: usize, const v7: v11> { - //~^ WARN type `v17` should have an upper camel case name - //~| ERROR `[[usize; v4]; v4]` is forbidden as the type of a const generic parameter + //~^ WARN type `v17` should have an upper camel case name + //~| ERROR `[[usize; v4]; v4]` is forbidden as the type of a const generic parameter _p: (), } @@ -25,10 +25,10 @@ mod v20 { } impl<const v10: usize> v17<v10, v2> { - //~^ ERROR maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0} - //~| ERROR maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0} + //~^ ERROR maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1} + //~| ERROR maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1} pub const fn v21() -> v18 { - //~^ ERROR cannot find type `v18` in this scope + //~^ ERROR cannot find type `v18` in this scope v18 { _p: () } //~^ ERROR cannot find struct, variant or union type `v18` in this scope } diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr index 15d3c472585..39f022fbee9 100644 --- a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr +++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr @@ -72,13 +72,13 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more LL + #![feature(adt_const_params)] | -error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0} +error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1} --> $DIR/unevaluated-const-ice-119731.rs:27:37 | LL | impl<const v10: usize> v17<v10, v2> { | ^^ -error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0} +error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1} --> $DIR/unevaluated-const-ice-119731.rs:27:37 | LL | impl<const v10: usize> v17<v10, v2> { diff --git a/tests/ui/const-generics/transmute-fail.rs b/tests/ui/const-generics/transmute-fail.rs index 59b77c678e8..a9b297ffb62 100644 --- a/tests/ui/const-generics/transmute-fail.rs +++ b/tests/ui/const-generics/transmute-fail.rs @@ -2,108 +2,108 @@ #![feature(generic_const_exprs)] #![allow(incomplete_features)] -fn foo<const W: usize, const H: usize>(v: [[u32;H+1]; W]) -> [[u32; W+1]; H] { - unsafe { - std::mem::transmute(v) - //~^ ERROR cannot transmute - } +fn foo<const W: usize, const H: usize>(v: [[u32; H + 1]; W]) -> [[u32; W + 1]; H] { + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } } fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] { - //~^ ERROR the constant `W` is not of type `usize` - unsafe { - std::mem::transmute(v) - //~^ ERROR the constant `W` is not of type `usize` - } + //~^ ERROR: the constant `W` is not of type `usize` + //~| ERROR: mismatched types + //~| ERROR: mismatched types + unsafe { + std::mem::transmute(v) + //~^ ERROR: the constant `W` is not of type `usize` + } } fn baz<const W: usize, const H: usize>(v: [[u32; H]; W]) -> [u32; W * H * H] { - unsafe { - std::mem::transmute(v) - //~^ ERROR cannot transmute - } + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } } fn overflow(v: [[[u32; 8888888]; 9999999]; 777777777]) -> [[[u32; 9999999]; 777777777]; 8888888] { - unsafe { - std::mem::transmute(v) - //~^ ERROR cannot transmute - } + unsafe { + std::mem::transmute(v) + //~^ ERROR cannot transmute + } } -fn transpose<const W: usize, const H: usize>(v: [[u32;H]; W]) -> [[u32; W]; H] { - unsafe { - std::mem::transmute(v) - //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types - } +fn transpose<const W: usize, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] { + unsafe { + std::mem::transmute(v) + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types + } } fn ident<const W: usize, const H: usize>(v: [[u32; H]; W]) -> [[u32; H]; W] { - unsafe { - std::mem::transmute(v) - } + unsafe { std::mem::transmute(v) } } fn flatten<const W: usize, const H: usize>(v: [[u32; H]; W]) -> [u32; W * H] { - unsafe { - std::mem::transmute(v) - //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types - } + unsafe { + std::mem::transmute(v) + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types + } } -fn coagulate<const W: usize, const H: usize>(v: [u32; H*W]) -> [[u32; W];H] { - unsafe { - std::mem::transmute(v) - //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types - } +fn coagulate<const W: usize, const H: usize>(v: [u32; H * W]) -> [[u32; W]; H] { + unsafe { + std::mem::transmute(v) + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types + } } fn flatten_3d<const W: usize, const H: usize, const D: usize>( - v: [[[u32; D]; H]; W] + v: [[[u32; D]; H]; W], ) -> [u32; D * W * H] { - unsafe { - std::mem::transmute(v) - //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types - } + unsafe { + std::mem::transmute(v) + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types + } } fn flatten_somewhat<const W: usize, const H: usize, const D: usize>( - v: [[[u32; D]; H]; W] + v: [[[u32; D]; H]; W], ) -> [[u32; D * W]; H] { - unsafe { - std::mem::transmute(v) - //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types - } + unsafe { + std::mem::transmute(v) + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types + } } fn known_size<const L: usize>(v: [u16; L]) -> [u8; L * 2] { - unsafe { - std::mem::transmute(v) - //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types - } + unsafe { + std::mem::transmute(v) + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types + } } fn condense_bytes<const L: usize>(v: [u8; L * 2]) -> [u16; L] { - unsafe { - std::mem::transmute(v) - //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types - } + unsafe { + std::mem::transmute(v) + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types + } } -fn singleton_each<const L: usize>(v: [u8; L]) -> [[u8;1]; L] { - unsafe { - std::mem::transmute(v) - //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types - } +fn singleton_each<const L: usize>(v: [u8; L]) -> [[u8; 1]; L] { + unsafe { + std::mem::transmute(v) + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types + } } fn transpose_with_const<const W: usize, const H: usize>( - v: [[u32; 2 * H]; W + W] + v: [[u32; 2 * H]; W + W], ) -> [[u32; W + W]; 2 * H] { - unsafe { - std::mem::transmute(v) - //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types - } + unsafe { + std::mem::transmute(v) + //~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types + } } fn main() {} diff --git a/tests/ui/const-generics/transmute-fail.stderr b/tests/ui/const-generics/transmute-fail.stderr index b40fb23c331..124fbee8850 100644 --- a/tests/ui/const-generics/transmute-fail.stderr +++ b/tests/ui/const-generics/transmute-fail.stderr @@ -5,119 +5,132 @@ LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] { | ^^^^^^^^^^^^^ expected `usize`, found `bool` error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:7:5 + --> $DIR/transmute-fail.rs:7:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | - = note: source type: `[[u32; H+1]; W]` (size can vary because of [u32; H+1]) - = note: target type: `[[u32; W+1]; H]` (size can vary because of [u32; W+1]) + = note: source type: `[[u32; H + 1]; W]` (size can vary because of [u32; H + 1]) + = note: target type: `[[u32; W + 1]; H]` (size can vary because of [u32; W + 1]) error: the constant `W` is not of type `usize` - --> $DIR/transmute-fail.rs:15:5 + --> $DIR/transmute-fail.rs:17:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool` error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:22:5 + --> $DIR/transmute-fail.rs:24:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `[[u32; H]; W]` (size can vary because of [u32; H]) = note: target type: `[u32; W * H * H]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:29:5 + --> $DIR/transmute-fail.rs:31:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[u32; 8888888]; 9999999]` are too big for the current architecture) = note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type `[[u32; 9999999]; 777777777]` are too big for the current architecture) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:36:5 + --> $DIR/transmute-fail.rs:38:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `[[u32; H]; W]` (size can vary because of [u32; H]) = note: target type: `[[u32; W]; H]` (size can vary because of [u32; W]) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:49:5 + --> $DIR/transmute-fail.rs:49:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `[[u32; H]; W]` (size can vary because of [u32; H]) = note: target type: `[u32; W * H]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:56:5 + --> $DIR/transmute-fail.rs:56:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | - = note: source type: `[u32; H*W]` (this type does not have a fixed size) + = note: source type: `[u32; H * W]` (this type does not have a fixed size) = note: target type: `[[u32; W]; H]` (size can vary because of [u32; W]) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:65:5 + --> $DIR/transmute-fail.rs:65:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `[[[u32; D]; H]; W]` (size can vary because of [u32; D]) = note: target type: `[u32; D * W * H]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:74:5 + --> $DIR/transmute-fail.rs:74:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `[[[u32; D]; H]; W]` (size can vary because of [u32; D]) = note: target type: `[[u32; D * W]; H]` (size can vary because of [u32; D * W]) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:81:5 + --> $DIR/transmute-fail.rs:81:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `[u16; L]` (this type does not have a fixed size) = note: target type: `[u8; L * 2]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:88:5 + --> $DIR/transmute-fail.rs:88:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `[u8; L * 2]` (this type does not have a fixed size) = note: target type: `[u16; L]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:95:5 + --> $DIR/transmute-fail.rs:95:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `[u8; L]` (this type does not have a fixed size) = note: target type: `[[u8; 1]; L]` (this type does not have a fixed size) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types - --> $DIR/transmute-fail.rs:104:5 + --> $DIR/transmute-fail.rs:104:9 | -LL | std::mem::transmute(v) - | ^^^^^^^^^^^^^^^^^^^ +LL | std::mem::transmute(v) + | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `[[u32; 2 * H]; W + W]` (size can vary because of [u32; 2 * H]) = note: target type: `[[u32; W + W]; 2 * H]` (size can vary because of [u32; W + W]) -error: aborting due to 14 previous errors +error[E0308]: mismatched types + --> $DIR/transmute-fail.rs:12:53 + | +LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] { + | ^ expected `usize`, found `bool` + +error[E0308]: mismatched types + --> $DIR/transmute-fail.rs:12:67 + | +LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] { + | ^ expected `usize`, found `bool` + +error: aborting due to 16 previous errors -For more information about this error, try `rustc --explain E0512`. +Some errors have detailed explanations: E0308, E0512. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/type-dependent/issue-71348.full.stderr b/tests/ui/const-generics/type-dependent/issue-71348.full.stderr new file mode 100644 index 00000000000..177ff20fbf9 --- /dev/null +++ b/tests/ui/const-generics/type-dependent/issue-71348.full.stderr @@ -0,0 +1,10 @@ +warning: elided lifetime has a name + --> $DIR/issue-71348.rs:18:68 + | +LL | fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<N>>::Target + | -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a` + | + = note: `#[warn(elided_named_lifetimes)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/const-generics/type-dependent/issue-71348.min.stderr b/tests/ui/const-generics/type-dependent/issue-71348.min.stderr index 858900a500d..5aee282952a 100644 --- a/tests/ui/const-generics/type-dependent/issue-71348.min.stderr +++ b/tests/ui/const-generics/type-dependent/issue-71348.min.stderr @@ -1,3 +1,11 @@ +warning: elided lifetime has a name + --> $DIR/issue-71348.rs:18:68 + | +LL | fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<N>>::Target + | -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a` + | + = note: `#[warn(elided_named_lifetimes)]` on by default + error: `&'static str` is forbidden as the type of a const generic parameter --> $DIR/issue-71348.rs:10:24 | @@ -30,5 +38,5 @@ help: add `#![feature(unsized_const_params)]` to the crate attributes to enable LL + #![feature(unsized_const_params)] | -error: aborting due to 2 previous errors +error: aborting due to 2 previous errors; 1 warning emitted diff --git a/tests/ui/const-generics/type-dependent/issue-71348.rs b/tests/ui/const-generics/type-dependent/issue-71348.rs index 2ffbd015485..97e786405fe 100644 --- a/tests/ui/const-generics/type-dependent/issue-71348.rs +++ b/tests/ui/const-generics/type-dependent/issue-71348.rs @@ -17,6 +17,7 @@ trait Get<'a, const N: &'static str> { impl Foo { fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<N>>::Target //[min]~^ ERROR `&'static str` is forbidden as the type of a const generic parameter + //~^^ WARNING elided lifetime has a name where Self: Get<'a, N>, { diff --git a/tests/ui/const-generics/type_mismatch.rs b/tests/ui/const-generics/type_mismatch.rs index 8187c785cd1..9c7217cd83e 100644 --- a/tests/ui/const-generics/type_mismatch.rs +++ b/tests/ui/const-generics/type_mismatch.rs @@ -1,10 +1,12 @@ fn foo<const N: usize>() -> [u8; N] { bar::<N>() //~^ ERROR the constant `N` is not of type `u8` + //~| ERROR: mismatched types } fn bar<const N: u8>() -> [u8; N] {} //~^ ERROR the constant `N` is not of type `usize` +//~| ERROR: mismatched types //~| ERROR mismatched types fn main() {} diff --git a/tests/ui/const-generics/type_mismatch.stderr b/tests/ui/const-generics/type_mismatch.stderr index d1bb5c1242f..77e9f5e2b44 100644 --- a/tests/ui/const-generics/type_mismatch.stderr +++ b/tests/ui/const-generics/type_mismatch.stderr @@ -1,5 +1,5 @@ error: the constant `N` is not of type `usize` - --> $DIR/type_mismatch.rs:6:26 + --> $DIR/type_mismatch.rs:7:26 | LL | fn bar<const N: u8>() -> [u8; N] {} | ^^^^^^^ expected `usize`, found `u8` @@ -11,19 +11,31 @@ LL | bar::<N>() | ^ expected `u8`, found `usize` | note: required by a const generic parameter in `bar` - --> $DIR/type_mismatch.rs:6:8 + --> $DIR/type_mismatch.rs:7:8 | LL | fn bar<const N: u8>() -> [u8; N] {} | ^^^^^^^^^^^ required by this const generic parameter in `bar` error[E0308]: mismatched types - --> $DIR/type_mismatch.rs:6:26 + --> $DIR/type_mismatch.rs:7:26 | LL | fn bar<const N: u8>() -> [u8; N] {} | --- ^^^^^^^ expected `[u8; N]`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression -error: aborting due to 3 previous errors +error[E0308]: mismatched types + --> $DIR/type_mismatch.rs:2:11 + | +LL | bar::<N>() + | ^ expected `u8`, found `usize` + +error[E0308]: mismatched types + --> $DIR/type_mismatch.rs:7:31 + | +LL | fn bar<const N: u8>() -> [u8; N] {} + | ^ expected `usize`, found `u8` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/consts/const-address-of-interior-mut.rs b/tests/ui/consts/const-address-of-interior-mut.rs index 60c7c31daca..930fa0c492f 100644 --- a/tests/ui/consts/const-address-of-interior-mut.rs +++ b/tests/ui/consts/const-address-of-interior-mut.rs @@ -1,5 +1,3 @@ -#![feature(raw_ref_op)] - use std::cell::Cell; const A: () = { let x = Cell::new(2); &raw const x; }; //~ ERROR interior mutability diff --git a/tests/ui/consts/const-address-of-interior-mut.stderr b/tests/ui/consts/const-address-of-interior-mut.stderr index 12c8917d740..203745f0b01 100644 --- a/tests/ui/consts/const-address-of-interior-mut.stderr +++ b/tests/ui/consts/const-address-of-interior-mut.stderr @@ -1,5 +1,5 @@ error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/const-address-of-interior-mut.rs:5:39 + --> $DIR/const-address-of-interior-mut.rs:3:39 | LL | const A: () = { let x = Cell::new(2); &raw const x; }; | ^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | const A: () = { let x = Cell::new(2); &raw const x; }; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/const-address-of-interior-mut.rs:7:40 + --> $DIR/const-address-of-interior-mut.rs:5:40 | LL | static B: () = { let x = Cell::new(2); &raw const x; }; | ^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | static B: () = { let x = Cell::new(2); &raw const x; }; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/const-address-of-interior-mut.rs:9:44 + --> $DIR/const-address-of-interior-mut.rs:7:44 | LL | static mut C: () = { let x = Cell::new(2); &raw const x; }; | ^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | static mut C: () = { let x = Cell::new(2); &raw const x; }; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: cannot borrow here, since the borrowed element may contain interior mutability - --> $DIR/const-address-of-interior-mut.rs:13:13 + --> $DIR/const-address-of-interior-mut.rs:11:13 | LL | let y = &raw const x; | ^^^^^^^^^^^^ diff --git a/tests/ui/consts/const-address-of-mut.rs b/tests/ui/consts/const-address-of-mut.rs index 0018bf18e41..c3f37843d3c 100644 --- a/tests/ui/consts/const-address-of-mut.rs +++ b/tests/ui/consts/const-address-of-mut.rs @@ -1,5 +1,3 @@ -#![feature(raw_ref_op)] - const A: () = { let mut x = 2; &raw mut x; }; //~ mutable pointer static B: () = { let mut x = 2; &raw mut x; }; //~ mutable pointer diff --git a/tests/ui/consts/const-address-of-mut.stderr b/tests/ui/consts/const-address-of-mut.stderr index 95a91ff463f..d4243485de1 100644 --- a/tests/ui/consts/const-address-of-mut.stderr +++ b/tests/ui/consts/const-address-of-mut.stderr @@ -1,5 +1,5 @@ error[E0658]: raw mutable pointers are not allowed in constants - --> $DIR/const-address-of-mut.rs:3:32 + --> $DIR/const-address-of-mut.rs:1:32 | LL | const A: () = { let mut x = 2; &raw mut x; }; | ^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | const A: () = { let mut x = 2; &raw mut x; }; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: raw mutable pointers are not allowed in statics - --> $DIR/const-address-of-mut.rs:5:33 + --> $DIR/const-address-of-mut.rs:3:33 | LL | static B: () = { let mut x = 2; &raw mut x; }; | ^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | static B: () = { let mut x = 2; &raw mut x; }; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: raw mutable pointers are not allowed in constant functions - --> $DIR/const-address-of-mut.rs:9:13 + --> $DIR/const-address-of-mut.rs:7:13 | LL | let y = &raw mut x; | ^^^^^^^^^^ diff --git a/tests/ui/consts/const-address-of.rs b/tests/ui/consts/const-address-of.rs index 4eb3c3840ba..39ed430e17e 100644 --- a/tests/ui/consts/const-address-of.rs +++ b/tests/ui/consts/const-address-of.rs @@ -1,7 +1,5 @@ //@ check-pass -#![feature(raw_ref_op)] - const A: *const i32 = &raw const *&2; static B: () = { &raw const *&2; }; static mut C: *const i32 = &raw const *&2; diff --git a/tests/ui/consts/const-eval/const_fn_target_feature.rs b/tests/ui/consts/const-eval/const_fn_target_feature.rs index ee669abb51e..8db41ba11c0 100644 --- a/tests/ui/consts/const-eval/const_fn_target_feature.rs +++ b/tests/ui/consts/const-eval/const_fn_target_feature.rs @@ -1,6 +1,7 @@ //@ only-x86_64 // Set the base cpu explicitly, in case the default has been changed. //@ compile-flags: -C target-cpu=x86-64 -C target-feature=+ssse3 +//@ check-pass #![crate_type = "lib"] @@ -9,7 +10,8 @@ const A: () = unsafe { ssse3_fn() }; // error (avx2 not enabled at compile time) const B: () = unsafe { avx2_fn() }; -//~^ ERROR evaluation of constant value failed +// FIXME: currently we do not detect this UB, since we don't want the result of const-eval +// to depend on `tcx.sess` which can differ between crates in a crate graph. #[target_feature(enable = "ssse3")] const unsafe fn ssse3_fn() {} diff --git a/tests/ui/consts/const-eval/const_fn_target_feature.stderr b/tests/ui/consts/const-eval/const_fn_target_feature.stderr deleted file mode 100644 index d3a00b57ebb..00000000000 --- a/tests/ui/consts/const-eval/const_fn_target_feature.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0080]: evaluation of constant value failed - --> $DIR/const_fn_target_feature.rs:11:24 - | -LL | const B: () = unsafe { avx2_fn() }; - | ^^^^^^^^^ calling a function that requires unavailable target features: avx2 - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs b/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs index deed09e4b2a..8ddfe61943c 100644 --- a/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs +++ b/tests/ui/consts/const-eval/const_fn_target_feature_wasm.rs @@ -7,7 +7,9 @@ #[cfg(target_feature = "simd128")] compile_error!("simd128 target feature should be disabled"); -// Calling functions with `#[target_feature]` is not unsound on WASM, see #84988 +// Calling functions with `#[target_feature]` is not unsound on WASM, see #84988. +// (It can still lead to a runtime error though so we'd be in our right to abort execution, +// just not to declare it UB.) const A: () = simd128_fn(); #[target_feature(enable = "simd128")] diff --git a/tests/ui/consts/const-eval/ub-write-through-immutable.rs b/tests/ui/consts/const-eval/ub-write-through-immutable.rs index 945367f1823..9860b8fde4a 100644 --- a/tests/ui/consts/const-eval/ub-write-through-immutable.rs +++ b/tests/ui/consts/const-eval/ub-write-through-immutable.rs @@ -1,6 +1,5 @@ //! Ensure we catch UB due to writing through a shared reference. #![feature(const_mut_refs, const_refs_to_cell)] -#![deny(writes_through_immutable_pointer)] #![allow(invalid_reference_casting)] use std::mem; @@ -9,15 +8,15 @@ use std::cell::UnsafeCell; const WRITE_AFTER_CAST: () = unsafe { let mut x = 0; let ptr = &x as *const i32 as *mut i32; - *ptr = 0; //~ERROR: writes_through_immutable_pointer - //~^ previously accepted + *ptr = 0; //~ERROR: evaluation of constant value failed + //~| immutable }; const WRITE_AFTER_TRANSMUTE: () = unsafe { let mut x = 0; let ptr: *mut i32 = mem::transmute(&x); - *ptr = 0; //~ERROR: writes_through_immutable_pointer - //~^ previously accepted + *ptr = 0; //~ERROR: evaluation of constant value failed + //~| immutable }; // it's okay when there is interior mutability; diff --git a/tests/ui/consts/const-eval/ub-write-through-immutable.stderr b/tests/ui/consts/const-eval/ub-write-through-immutable.stderr index 27eb2d2c0d1..dbcd35e0b88 100644 --- a/tests/ui/consts/const-eval/ub-write-through-immutable.stderr +++ b/tests/ui/consts/const-eval/ub-write-through-immutable.stderr @@ -1,55 +1,15 @@ -error: writing through a pointer that was derived from a shared (immutable) reference - --> $DIR/ub-write-through-immutable.rs:12:5 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-write-through-immutable.rs:11:5 | LL | *ptr = 0; - | ^^^^^^^^ - | - = 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 #X <https://github.com/rust-lang/rust/issues/X> -note: the lint level is defined here - --> $DIR/ub-write-through-immutable.rs:3:9 - | -LL | #![deny(writes_through_immutable_pointer)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ writing through a pointer that was derived from a shared (immutable) reference -error: writing through a pointer that was derived from a shared (immutable) reference - --> $DIR/ub-write-through-immutable.rs:19:5 +error[E0080]: evaluation of constant value failed + --> $DIR/ub-write-through-immutable.rs:18:5 | LL | *ptr = 0; - | ^^^^^^^^ - | - = 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 #X <https://github.com/rust-lang/rust/issues/X> + | ^^^^^^^^ writing through a pointer that was derived from a shared (immutable) reference error: aborting due to 2 previous errors -Future incompatibility report: Future breakage diagnostic: -error: writing through a pointer that was derived from a shared (immutable) reference - --> $DIR/ub-write-through-immutable.rs:12:5 - | -LL | *ptr = 0; - | ^^^^^^^^ - | - = 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 #X <https://github.com/rust-lang/rust/issues/X> -note: the lint level is defined here - --> $DIR/ub-write-through-immutable.rs:3:9 - | -LL | #![deny(writes_through_immutable_pointer)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Future breakage diagnostic: -error: writing through a pointer that was derived from a shared (immutable) reference - --> $DIR/ub-write-through-immutable.rs:19:5 - | -LL | *ptr = 0; - | ^^^^^^^^ - | - = 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 #X <https://github.com/rust-lang/rust/issues/X> -note: the lint level is defined here - --> $DIR/ub-write-through-immutable.rs:3:9 - | -LL | #![deny(writes_through_immutable_pointer)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs b/tests/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs index c7078e46fa6..efc0a1c2fba 100644 --- a/tests/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs +++ b/tests/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs @@ -1,9 +1,5 @@ #![feature(const_extern_fn)] -const extern "C" fn unsize(x: &[u8; 3]) -> &[u8] { x } -const unsafe extern "C" fn closure() -> fn() { || {} } -const unsafe extern "C" fn use_float() { 1.0 + 1.0; } -//~^ ERROR floating point arithmetic const extern "C" fn ptr_cast(val: *const u8) { val as usize; } //~^ ERROR pointers cannot be cast to integers diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr b/tests/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr index 29fa90d611c..9cdeec159be 100644 --- a/tests/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr +++ b/tests/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr @@ -1,15 +1,5 @@ -error[E0658]: floating point arithmetic is not allowed in constant functions - --> $DIR/const-extern-fn-min-const-fn.rs:5:42 - | -LL | const unsafe extern "C" fn use_float() { 1.0 + 1.0; } - | ^^^^^^^^^ - | - = note: see issue #57241 <https://github.com/rust-lang/rust/issues/57241> for more information - = help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error: pointers cannot be cast to integers during const eval - --> $DIR/const-extern-fn-min-const-fn.rs:7:48 + --> $DIR/const-extern-fn-min-const-fn.rs:3:48 | LL | const extern "C" fn ptr_cast(val: *const u8) { val as usize; } | ^^^^^^^^^^^^ @@ -17,6 +7,5 @@ LL | const extern "C" fn ptr_cast(val: *const u8) { val as usize; } = note: at compile-time, pointers do not have an integer value = note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior -error: aborting due to 2 previous errors +error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/consts/const-extern-fn/const-extern-fn.rs b/tests/ui/consts/const-extern-fn/const-extern-fn.rs index 57f5da8d0af..4b164767064 100644 --- a/tests/ui/consts/const-extern-fn/const-extern-fn.rs +++ b/tests/ui/consts/const-extern-fn/const-extern-fn.rs @@ -17,6 +17,19 @@ const unsafe extern "C" fn bar2(val: bool) -> bool { !val } +#[allow(improper_ctypes_definitions)] +const extern "C" fn unsize(x: &[u8; 3]) -> &[u8] { + x +} + +#[allow(improper_ctypes_definitions)] +const unsafe extern "C" fn closure() -> fn() { + || {} +} + +const unsafe extern "C" fn use_float() -> f32 { + 1.0 + 1.0 +} fn main() { let a: [u8; foo1(25) as usize] = [0; 26]; @@ -32,4 +45,8 @@ fn main() { let _foo2_cast: extern "C" fn(u8) -> u8 = foo2; let _bar1_cast: unsafe extern "C" fn(bool) -> bool = bar1; let _bar2_cast: unsafe extern "C" fn(bool) -> bool = bar2; + + unsize(&[0, 1, 2]); + unsafe { closure(); } + unsafe { use_float(); } } diff --git a/tests/ui/consts/const-float-bits-conv.rs b/tests/ui/consts/const-float-bits-conv.rs index ba8db4c23dc..3a526c54dc3 100644 --- a/tests/ui/consts/const-float-bits-conv.rs +++ b/tests/ui/consts/const-float-bits-conv.rs @@ -3,8 +3,9 @@ #![feature(const_float_bits_conv)] #![feature(const_float_classify)] +#![feature(f16)] +#![feature(f128)] #![allow(unused_macro_rules)] - // Don't promote const fn nop<T>(x: T) -> T { x } @@ -23,6 +24,42 @@ macro_rules! const_assert { }; } +fn has_broken_floats() -> bool { + // i586 targets are broken due to <https://github.com/rust-lang/rust/issues/114479>. + std::env::var("TARGET").is_ok_and(|v| v.contains("i586")) +} + +#[cfg(target_arch = "x86_64")] +fn f16(){ + const_assert!((1f16).to_bits(), 0x3c00); + const_assert!(u16::from_be_bytes(1f16.to_be_bytes()), 0x3c00); + const_assert!((12.5f16).to_bits(), 0x4a40); + const_assert!(u16::from_le_bytes(12.5f16.to_le_bytes()), 0x4a40); + const_assert!((1337f16).to_bits(), 0x6539); + const_assert!(u16::from_ne_bytes(1337f16.to_ne_bytes()), 0x6539); + const_assert!((-14.25f16).to_bits(), 0xcb20); + const_assert!(f16::from_bits(0x3c00), 1.0); + const_assert!(f16::from_be_bytes(0x3c00u16.to_be_bytes()), 1.0); + const_assert!(f16::from_bits(0x4a40), 12.5); + const_assert!(f16::from_le_bytes(0x4a40u16.to_le_bytes()), 12.5); + const_assert!(f16::from_bits(0x5be0), 252.0); + const_assert!(f16::from_ne_bytes(0x5be0u16.to_ne_bytes()), 252.0); + const_assert!(f16::from_bits(0xcb20), -14.25); + + // Check that NaNs roundtrip their bits regardless of signalingness + // 0xA is 0b1010; 0x5 is 0b0101 -- so these two together clobbers all the mantissa bits + // NOTE: These names assume `f{BITS}::NAN` is a quiet NAN and IEEE754-2008's NaN rules apply! + const QUIET_NAN: u16 = f16::NAN.to_bits() ^ 0x0155; + const SIGNALING_NAN: u16 = f16::NAN.to_bits() ^ 0x02AA; + + const_assert!(f16::from_bits(QUIET_NAN).is_nan()); + const_assert!(f16::from_bits(SIGNALING_NAN).is_nan()); + const_assert!(f16::from_bits(QUIET_NAN).to_bits(), QUIET_NAN); + if !has_broken_floats() { + const_assert!(f16::from_bits(SIGNALING_NAN).to_bits(), SIGNALING_NAN); + } +} + fn f32() { const_assert!((1f32).to_bits(), 0x3f800000); const_assert!(u32::from_be_bytes(1f32.to_be_bytes()), 0x3f800000); @@ -38,6 +75,19 @@ fn f32() { const_assert!(f32::from_bits(0x44a72000), 1337.0); const_assert!(f32::from_ne_bytes(0x44a72000u32.to_ne_bytes()), 1337.0); const_assert!(f32::from_bits(0xc1640000), -14.25); + + // Check that NaNs roundtrip their bits regardless of signalingness + // 0xA is 0b1010; 0x5 is 0b0101 -- so these two together clobbers all the mantissa bits + // NOTE: These names assume `f{BITS}::NAN` is a quiet NAN and IEEE754-2008's NaN rules apply! + const QUIET_NAN: u32 = f32::NAN.to_bits() ^ 0x002A_AAAA; + const SIGNALING_NAN: u32 = f32::NAN.to_bits() ^ 0x0055_5555; + + const_assert!(f32::from_bits(QUIET_NAN).is_nan()); + const_assert!(f32::from_bits(SIGNALING_NAN).is_nan()); + const_assert!(f32::from_bits(QUIET_NAN).to_bits(), QUIET_NAN); + if !has_broken_floats() { + const_assert!(f32::from_bits(SIGNALING_NAN).to_bits(), SIGNALING_NAN); + } } fn f64() { @@ -55,9 +105,58 @@ fn f64() { const_assert!(f64::from_bits(0x4094e40000000000), 1337.0); const_assert!(f64::from_ne_bytes(0x4094e40000000000u64.to_ne_bytes()), 1337.0); const_assert!(f64::from_bits(0xc02c800000000000), -14.25); + + // Check that NaNs roundtrip their bits regardless of signalingness + // 0xA is 0b1010; 0x5 is 0b0101 -- so these two together clobbers all the mantissa bits + // NOTE: These names assume `f{BITS}::NAN` is a quiet NAN and IEEE754-2008's NaN rules apply! + const QUIET_NAN: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555; + const SIGNALING_NAN: u64 = f64::NAN.to_bits() ^ 0x000A_AAAA_AAAA_AAAA; + + const_assert!(f64::from_bits(QUIET_NAN).is_nan()); + const_assert!(f64::from_bits(SIGNALING_NAN).is_nan()); + const_assert!(f64::from_bits(QUIET_NAN).to_bits(), QUIET_NAN); + if !has_broken_floats() { + const_assert!(f64::from_bits(SIGNALING_NAN).to_bits(), SIGNALING_NAN); + } +} + +#[cfg(target_arch = "x86_64")] +fn f128() { + const_assert!((1f128).to_bits(), 0x3fff0000000000000000000000000000); + const_assert!(u128::from_be_bytes(1f128.to_be_bytes()), 0x3fff0000000000000000000000000000); + const_assert!((12.5f128).to_bits(), 0x40029000000000000000000000000000); + const_assert!(u128::from_le_bytes(12.5f128.to_le_bytes()), 0x40029000000000000000000000000000); + const_assert!((1337f128).to_bits(), 0x40094e40000000000000000000000000); + const_assert!(u128::from_ne_bytes(1337f128.to_ne_bytes()), 0x40094e40000000000000000000000000); + const_assert!((-14.25f128).to_bits(), 0xc002c800000000000000000000000000); + const_assert!(f128::from_bits(0x3fff0000000000000000000000000000), 1.0); + const_assert!(f128::from_be_bytes(0x3fff0000000000000000000000000000u128.to_be_bytes()), 1.0); + const_assert!(f128::from_bits(0x40029000000000000000000000000000), 12.5); + const_assert!(f128::from_le_bytes(0x40029000000000000000000000000000u128.to_le_bytes()), 12.5); + const_assert!(f128::from_bits(0x40094e40000000000000000000000000), 1337.0); + assert_eq!(f128::from_ne_bytes(0x40094e40000000000000000000000000u128.to_ne_bytes()), 1337.0); + const_assert!(f128::from_bits(0xc002c800000000000000000000000000), -14.25); + + // Check that NaNs roundtrip their bits regardless of signalingness + // 0xA is 0b1010; 0x5 is 0b0101 -- so these two together clobbers all the mantissa bits + // NOTE: These names assume `f{BITS}::NAN` is a quiet NAN and IEEE754-2008's NaN rules apply! + const QUIET_NAN: u128 = f128::NAN.to_bits() | 0x0000_AAAA_AAAA_AAAA_AAAA_AAAA_AAAA_AAAA; + const SIGNALING_NAN: u128 = f128::NAN.to_bits() ^ 0x0000_5555_5555_5555_5555_5555_5555_5555; + + const_assert!(f128::from_bits(QUIET_NAN).is_nan()); + const_assert!(f128::from_bits(SIGNALING_NAN).is_nan()); + const_assert!(f128::from_bits(QUIET_NAN).to_bits(), QUIET_NAN); + if !has_broken_floats() { + const_assert!(f128::from_bits(SIGNALING_NAN).to_bits(), SIGNALING_NAN); + } } fn main() { + #[cfg(target_arch = "x86_64")] + { + f16(); + f128(); + } f32(); f64(); } diff --git a/tests/ui/consts/const-float-bits-reject-conv.rs b/tests/ui/consts/const-float-bits-reject-conv.rs deleted file mode 100644 index febb272869a..00000000000 --- a/tests/ui/consts/const-float-bits-reject-conv.rs +++ /dev/null @@ -1,68 +0,0 @@ -//@ compile-flags: -Zmir-opt-level=0 -//@ error-pattern: cannot use f32::to_bits on a NaN -#![feature(const_float_bits_conv)] -#![feature(const_float_classify)] - -// Don't promote -const fn nop<T>(x: T) -> T { x } - -macro_rules! const_assert { - ($a:expr) => { - { - const _: () = assert!($a); - assert!(nop($a)); - } - }; - ($a:expr, $b:expr) => { - { - const _: () = assert!($a == $b); - assert_eq!(nop($a), nop($b)); - } - }; -} - -fn f32() { - // Check that NaNs roundtrip their bits regardless of signalingness - // 0xA is 0b1010; 0x5 is 0b0101 -- so these two together clobbers all the mantissa bits - // ...actually, let's just check that these break. :D - const MASKED_NAN1: u32 = f32::NAN.to_bits() ^ 0x002A_AAAA; - //~^ inside - const MASKED_NAN2: u32 = f32::NAN.to_bits() ^ 0x0055_5555; - //~^ inside - - // The rest of the code is dead because the constants already fail to evaluate. - - const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); - const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); - - // LLVM does not guarantee that loads and stores of NaNs preserve their exact bit pattern. - // In practice, this seems to only cause a problem on x86, since the most widely used calling - // convention mandates that floating point values are returned on the x87 FPU stack. See #73328. - // However, during CTFE we still preserve bit patterns (though that is not a guarantee). - const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); - const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); -} - -fn f64() { - // Check that NaNs roundtrip their bits regardless of signalingness - // 0xA is 0b1010; 0x5 is 0b0101 -- so these two together clobbers all the mantissa bits - // ...actually, let's just check that these break. :D - const MASKED_NAN1: u64 = f64::NAN.to_bits() ^ 0x000A_AAAA_AAAA_AAAA; - //~^ inside - const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555; - //~^ inside - - // The rest of the code is dead because the constants already fail to evaluate. - - const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); - const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); - - // See comment above. - const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); - const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); -} - -fn main() { - f32(); - f64(); -} diff --git a/tests/ui/consts/const-float-bits-reject-conv.stderr b/tests/ui/consts/const-float-bits-reject-conv.stderr deleted file mode 100644 index 1511dab12b0..00000000000 --- a/tests/ui/consts/const-float-bits-reject-conv.stderr +++ /dev/null @@ -1,115 +0,0 @@ -error[E0080]: evaluation of constant value failed - --> $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 - | -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; - | ^^^^^^^^^^^^^^^^^^ - = 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 - | - = 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 - | -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; - | ^^^^^^^^^^^^^^^^^^ - = 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 encountered - --> $DIR/const-float-bits-reject-conv.rs:35:34 - | -LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); - | ^^^^^^^^^^^ - -note: erroneous constant encountered - --> $DIR/const-float-bits-reject-conv.rs:36:34 - | -LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan()); - | ^^^^^^^^^^^ - -note: erroneous constant encountered - --> $DIR/const-float-bits-reject-conv.rs:42:34 - | -LL | const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); - | ^^^^^^^^^^^ - -note: erroneous constant encountered - --> $DIR/const-float-bits-reject-conv.rs:43:34 - | -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 - | - = 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 - | -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; - | ^^^^^^^^^^^^^^^^^^ - = 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 - | - = 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 - | -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; - | ^^^^^^^^^^^^^^^^^^ - = 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 encountered - --> $DIR/const-float-bits-reject-conv.rs:57:34 - | -LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); - | ^^^^^^^^^^^ - -note: erroneous constant encountered - --> $DIR/const-float-bits-reject-conv.rs:58:34 - | -LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan()); - | ^^^^^^^^^^^ - -note: erroneous constant encountered - --> $DIR/const-float-bits-reject-conv.rs:61:34 - | -LL | const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1); - | ^^^^^^^^^^^ - -note: erroneous constant encountered - --> $DIR/const-float-bits-reject-conv.rs:62:34 - | -LL | const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2); - | ^^^^^^^^^^^ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/consts/const-mut-refs/const_mut_address_of.rs b/tests/ui/consts/const-mut-refs/const_mut_address_of.rs index 66a4ec50c11..437bdc88722 100644 --- a/tests/ui/consts/const-mut-refs/const_mut_address_of.rs +++ b/tests/ui/consts/const-mut-refs/const_mut_address_of.rs @@ -1,6 +1,5 @@ //@ check-pass #![feature(const_mut_refs)] -#![feature(raw_ref_op)] struct Foo { x: usize diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs b/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs index 93197d5bce4..10339ee6798 100644 --- a/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs +++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final.rs @@ -1,5 +1,4 @@ #![feature(const_mut_refs)] -#![feature(raw_ref_op)] const NULL: *mut i32 = std::ptr::null_mut(); const A: *const i32 = &4; diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final.stderr index 59e6aa4011c..00a8421076b 100644 --- a/tests/ui/consts/const-mut-refs/mut_ref_in_final.stderr +++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final.stderr @@ -1,11 +1,11 @@ error[E0764]: mutable references are not allowed in the final value of constants - --> $DIR/mut_ref_in_final.rs:10:21 + --> $DIR/mut_ref_in_final.rs:9:21 | LL | const B: *mut i32 = &mut 4; | ^^^^^^ error[E0716]: temporary value dropped while borrowed - --> $DIR/mut_ref_in_final.rs:16:40 + --> $DIR/mut_ref_in_final.rs:15:40 | LL | const B3: Option<&mut i32> = Some(&mut 42); | ----------^^- @@ -15,7 +15,7 @@ LL | const B3: Option<&mut i32> = Some(&mut 42); | using this value as a constant requires that borrow lasts for `'static` error[E0716]: temporary value dropped while borrowed - --> $DIR/mut_ref_in_final.rs:19:42 + --> $DIR/mut_ref_in_final.rs:18:42 | LL | const B4: Option<&mut i32> = helper(&mut 42); | ------------^^- @@ -25,7 +25,7 @@ LL | const B4: Option<&mut i32> = helper(&mut 42); | using this value as a constant requires that borrow lasts for `'static` error[E0716]: temporary value dropped while borrowed - --> $DIR/mut_ref_in_final.rs:34:65 + --> $DIR/mut_ref_in_final.rs:33:65 | LL | const FOO: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); | -------------------------------^^-- @@ -35,7 +35,7 @@ LL | const FOO: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); | using this value as a constant requires that borrow lasts for `'static` error[E0716]: temporary value dropped while borrowed - --> $DIR/mut_ref_in_final.rs:37:67 + --> $DIR/mut_ref_in_final.rs:36:67 | LL | static FOO2: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); | -------------------------------^^-- @@ -45,7 +45,7 @@ LL | static FOO2: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); | using this value as a static requires that borrow lasts for `'static` error[E0716]: temporary value dropped while borrowed - --> $DIR/mut_ref_in_final.rs:40:71 + --> $DIR/mut_ref_in_final.rs:39:71 | LL | static mut FOO3: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); | -------------------------------^^-- @@ -55,25 +55,25 @@ LL | static mut FOO3: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42)); | using this value as a static requires that borrow lasts for `'static` error[E0764]: mutable references are not allowed in the final value of statics - --> $DIR/mut_ref_in_final.rs:53:53 + --> $DIR/mut_ref_in_final.rs:52:53 | LL | static RAW_MUT_CAST_S: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ }; | ^^^^^^^ error[E0764]: mutable references are not allowed in the final value of statics - --> $DIR/mut_ref_in_final.rs:55:54 + --> $DIR/mut_ref_in_final.rs:54:54 | LL | static RAW_MUT_COERCE_S: SyncPtr<i32> = SyncPtr { x: &mut 0 }; | ^^^^^^ error[E0764]: mutable references are not allowed in the final value of constants - --> $DIR/mut_ref_in_final.rs:57:52 + --> $DIR/mut_ref_in_final.rs:56:52 | LL | const RAW_MUT_CAST_C: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ }; | ^^^^^^^ error[E0764]: mutable references are not allowed in the final value of constants - --> $DIR/mut_ref_in_final.rs:59:53 + --> $DIR/mut_ref_in_final.rs:58:53 | LL | const RAW_MUT_COERCE_C: SyncPtr<i32> = SyncPtr { x: &mut 0 }; | ^^^^^^ diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs index c12c22447b5..e208845e747 100644 --- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs +++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.rs @@ -2,7 +2,6 @@ //@ normalize-stderr-test: "( 0x[0-9a-f][0-9a-f] │)? ([0-9a-f][0-9a-f] |__ |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> " HEX_DUMP" //@ normalize-stderr-test: "HEX_DUMP\s*\n\s*HEX_DUMP" -> "HEX_DUMP" #![feature(const_mut_refs, const_refs_to_static)] -#![feature(raw_ref_op)] use std::sync::Mutex; diff --git a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr index ea9dccf0173..4ea6fa62475 100644 --- a/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr +++ b/tests/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/mut_ref_in_final_dynamic_check.rs:20:1 + --> $DIR/mut_ref_in_final_dynamic_check.rs:19:1 | LL | const MUT: Option<&mut i32> = helper(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered reference to mutable memory in `const` @@ -10,7 +10,7 @@ LL | const MUT: Option<&mut i32> = helper(); } error[E0080]: it is undefined behavior to use this value - --> $DIR/mut_ref_in_final_dynamic_check.rs:27:1 + --> $DIR/mut_ref_in_final_dynamic_check.rs:26:1 | LL | const INT2PTR: Option<&mut i32> = helper_int2ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered a dangling reference (0x2a[noalloc] has no provenance) @@ -21,7 +21,7 @@ LL | const INT2PTR: Option<&mut i32> = helper_int2ptr(); } error[E0080]: it is undefined behavior to use this value - --> $DIR/mut_ref_in_final_dynamic_check.rs:29:1 + --> $DIR/mut_ref_in_final_dynamic_check.rs:28:1 | LL | static INT2PTR_STATIC: Option<&mut i32> = helper_int2ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered a dangling reference (0x2a[noalloc] has no provenance) @@ -32,7 +32,7 @@ LL | static INT2PTR_STATIC: Option<&mut i32> = helper_int2ptr(); } error[E0080]: it is undefined behavior to use this value - --> $DIR/mut_ref_in_final_dynamic_check.rs:36:1 + --> $DIR/mut_ref_in_final_dynamic_check.rs:35:1 | LL | const DANGLING: Option<&mut i32> = helper_dangling(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered a dangling reference (use-after-free) @@ -43,7 +43,7 @@ LL | const DANGLING: Option<&mut i32> = helper_dangling(); } error[E0080]: it is undefined behavior to use this value - --> $DIR/mut_ref_in_final_dynamic_check.rs:37:1 + --> $DIR/mut_ref_in_final_dynamic_check.rs:36:1 | LL | static DANGLING_STATIC: Option<&mut i32> = helper_dangling(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered a dangling reference (use-after-free) diff --git a/tests/ui/consts/const_fn_floating_point_arithmetic.gated.stderr b/tests/ui/consts/const_fn_floating_point_arithmetic.gated.stderr deleted file mode 100644 index e1b8154a287..00000000000 --- a/tests/ui/consts/const_fn_floating_point_arithmetic.gated.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: fatal error triggered by #[rustc_error] - --> $DIR/const_fn_floating_point_arithmetic.rs:20:1 - | -LL | fn main() {} - | ^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/consts/const_fn_floating_point_arithmetic.rs b/tests/ui/consts/const_fn_floating_point_arithmetic.rs deleted file mode 100644 index b0d0bc6b9f4..00000000000 --- a/tests/ui/consts/const_fn_floating_point_arithmetic.rs +++ /dev/null @@ -1,20 +0,0 @@ -// gate-test-const_fn_floating_point_arithmetic - -//@ revisions: stock gated - -#![feature(rustc_attrs)] -#![cfg_attr(gated, feature(const_fn_floating_point_arithmetic))] - -const fn add(f: f32) -> f32 { f + 2.0 } -//[stock]~^ floating point arithmetic -const fn sub(f: f32) -> f32 { 2.0 - f } -//[stock]~^ floating point arithmetic -const fn mul(f: f32, g: f32) -> f32 { f * g } -//[stock]~^ floating point arithmetic -const fn div(f: f32, g: f32) -> f32 { f / g } -//[stock]~^ floating point arithmetic -const fn neg(f: f32) -> f32 { -f } -//[stock]~^ floating point arithmetic - -#[rustc_error] -fn main() {} //[gated]~ fatal error triggered by #[rustc_error] diff --git a/tests/ui/consts/const_fn_floating_point_arithmetic.stock.stderr b/tests/ui/consts/const_fn_floating_point_arithmetic.stock.stderr deleted file mode 100644 index b5b94786ebb..00000000000 --- a/tests/ui/consts/const_fn_floating_point_arithmetic.stock.stderr +++ /dev/null @@ -1,53 +0,0 @@ -error[E0658]: floating point arithmetic is not allowed in constant functions - --> $DIR/const_fn_floating_point_arithmetic.rs:8:31 - | -LL | const fn add(f: f32) -> f32 { f + 2.0 } - | ^^^^^^^ - | - = note: see issue #57241 <https://github.com/rust-lang/rust/issues/57241> for more information - = help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: floating point arithmetic is not allowed in constant functions - --> $DIR/const_fn_floating_point_arithmetic.rs:10:31 - | -LL | const fn sub(f: f32) -> f32 { 2.0 - f } - | ^^^^^^^ - | - = note: see issue #57241 <https://github.com/rust-lang/rust/issues/57241> for more information - = help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: floating point arithmetic is not allowed in constant functions - --> $DIR/const_fn_floating_point_arithmetic.rs:12:39 - | -LL | const fn mul(f: f32, g: f32) -> f32 { f * g } - | ^^^^^ - | - = note: see issue #57241 <https://github.com/rust-lang/rust/issues/57241> for more information - = help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: floating point arithmetic is not allowed in constant functions - --> $DIR/const_fn_floating_point_arithmetic.rs:14:39 - | -LL | const fn div(f: f32, g: f32) -> f32 { f / g } - | ^^^^^ - | - = note: see issue #57241 <https://github.com/rust-lang/rust/issues/57241> for more information - = help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: floating point arithmetic is not allowed in constant functions - --> $DIR/const_fn_floating_point_arithmetic.rs:16:31 - | -LL | const fn neg(f: f32) -> f32 { -f } - | ^^ - | - = note: see issue #57241 <https://github.com/rust-lang/rust/issues/57241> for more information - = help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/consts/const_let_eq_float.rs b/tests/ui/consts/const_let_eq_float.rs index 30d839cdc2a..c9ca6b8b7ea 100644 --- a/tests/ui/consts/const_let_eq_float.rs +++ b/tests/ui/consts/const_let_eq_float.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(const_fn_floating_point_arithmetic)] - struct Foo<T>(T); struct Bar<T> { x: T } struct W(f32); diff --git a/tests/ui/consts/issue-36163.stderr b/tests/ui/consts/issue-36163.stderr index 52d3e003f0a..8a7a0981f41 100644 --- a/tests/ui/consts/issue-36163.stderr +++ b/tests/ui/consts/issue-36163.stderr @@ -1,10 +1,10 @@ -error[E0391]: cycle detected when simplifying constant for the type system `Foo::{constant#0}` +error[E0391]: cycle detected when simplifying constant for the type system `Foo::B::{constant#0}` --> $DIR/issue-36163.rs:4:9 | LL | B = A, | ^ | -note: ...which requires const-evaluating + checking `Foo::{constant#0}`... +note: ...which requires const-evaluating + checking `Foo::B::{constant#0}`... --> $DIR/issue-36163.rs:4:9 | LL | B = A, @@ -19,7 +19,7 @@ note: ...which requires const-evaluating + checking `A`... | LL | const A: isize = Foo::B as isize; | ^^^^^^^^^^^^^^^ - = note: ...which again requires simplifying constant for the type system `Foo::{constant#0}`, completing the cycle + = note: ...which again requires simplifying constant for the type system `Foo::B::{constant#0}`, completing the cycle note: cycle used when checking that `Foo` is well-formed --> $DIR/issue-36163.rs:3:1 | diff --git a/tests/ui/consts/min_const_fn/address_of.rs b/tests/ui/consts/min_const_fn/address_of.rs index aa75423ca4d..dc481e17ba3 100644 --- a/tests/ui/consts/min_const_fn/address_of.rs +++ b/tests/ui/consts/min_const_fn/address_of.rs @@ -1,5 +1,3 @@ -#![feature(raw_ref_op)] - const fn mutable_address_of_in_const() { let mut a = 0; let b = &raw mut a; //~ ERROR mutable pointer diff --git a/tests/ui/consts/min_const_fn/address_of.stderr b/tests/ui/consts/min_const_fn/address_of.stderr index 143760c0943..dd6fe6486d4 100644 --- a/tests/ui/consts/min_const_fn/address_of.stderr +++ b/tests/ui/consts/min_const_fn/address_of.stderr @@ -1,5 +1,5 @@ error[E0658]: raw mutable pointers are not allowed in constant functions - --> $DIR/address_of.rs:5:13 + --> $DIR/address_of.rs:3:13 | LL | let b = &raw mut a; | ^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | let b = &raw mut a; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: raw mutable pointers are not allowed in constant functions - --> $DIR/address_of.rs:13:17 + --> $DIR/address_of.rs:11:17 | LL | let b = &raw mut a; | ^^^^^^^^^^ diff --git a/tests/ui/consts/min_const_fn/address_of_const.rs b/tests/ui/consts/min_const_fn/address_of_const.rs index 4280d0745c1..1520622679f 100644 --- a/tests/ui/consts/min_const_fn/address_of_const.rs +++ b/tests/ui/consts/min_const_fn/address_of_const.rs @@ -1,7 +1,5 @@ //@ check-pass -#![feature(raw_ref_op)] - const fn const_address_of_in_const() { let mut a = 0; let b = &raw const a; diff --git a/tests/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs b/tests/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs index a97eeadd92f..fe92787aec1 100644 --- a/tests/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs +++ b/tests/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs @@ -1,6 +1,4 @@ //@ run-pass -#![feature(rustc_allow_const_fn_unstable)] - #![feature(rustc_attrs, staged_api)] #![stable(feature = "rust1", since = "1.0.0")] diff --git a/tests/ui/consts/min_const_fn/const-fn-lang-feature.rs b/tests/ui/consts/min_const_fn/const-fn-lang-feature.rs new file mode 100644 index 00000000000..63ef12085f1 --- /dev/null +++ b/tests/ui/consts/min_const_fn/const-fn-lang-feature.rs @@ -0,0 +1,20 @@ +//! Ensure that we can use a language feature with a `const fn`: +//! enabling the feature gate actually lets us call the function. +//@ check-pass + +#![feature(staged_api, abi_unadjusted)] +#![stable(feature = "rust_test", since = "1.0.0")] + +#[unstable(feature = "abi_unadjusted", issue = "42")] +#[rustc_const_unstable(feature = "abi_unadjusted", issue = "42")] +const fn my_fun() {} + +#[unstable(feature = "abi_unadjusted", issue = "42")] +#[rustc_const_unstable(feature = "abi_unadjusted", issue = "42")] +const fn my_fun2() { + my_fun() +} + +fn main() { + const { my_fun2() }; +} diff --git a/tests/ui/consts/min_const_fn/min_const_fn.rs b/tests/ui/consts/min_const_fn/min_const_fn.rs index 76245c08ffc..f7663f6044e 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn.rs +++ b/tests/ui/consts/min_const_fn/min_const_fn.rs @@ -44,8 +44,8 @@ impl<T> Foo<T> { impl<'a, T> Foo<T> { const fn new_lt(t: T) -> Self { Foo(t) } const fn into_inner_lt(self) -> T { self.0 } //~ destructor of - const fn get_lt(&'a self) -> &T { &self.0 } - const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } + const fn get_lt(&'a self) -> &T { &self.0 } //~ WARNING elided lifetime has a name + const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } //~ WARNING elided lifetime has a name //~^ mutable references //~| mutable references //~| mutable references diff --git a/tests/ui/consts/min_const_fn/min_const_fn.stderr b/tests/ui/consts/min_const_fn/min_const_fn.stderr index daa0ab2614f..4b348a182b8 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn.stderr +++ b/tests/ui/consts/min_const_fn/min_const_fn.stderr @@ -1,3 +1,23 @@ +warning: elided lifetime has a name + --> $DIR/min_const_fn.rs:47:34 + | +LL | impl<'a, T> Foo<T> { + | -- lifetime `'a` declared here +... +LL | const fn get_lt(&'a self) -> &T { &self.0 } + | ^ this elided lifetime gets resolved as `'a` + | + = note: `#[warn(elided_named_lifetimes)]` on by default + +warning: elided lifetime has a name + --> $DIR/min_const_fn.rs:48:42 + | +LL | impl<'a, T> Foo<T> { + | -- lifetime `'a` declared here +... +LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } + | ^ this elided lifetime gets resolved as `'a` + error[E0493]: destructor of `Foo<T>` cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:37:25 | @@ -228,7 +248,7 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {} | | | the destructor for this type cannot be evaluated in constant functions -error: aborting due to 24 previous errors +error: aborting due to 24 previous errors; 2 warnings emitted Some errors have detailed explanations: E0493, E0658. For more information about an error, try `rustc --explain E0493`. diff --git a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs index bb240fb4ad6..480b16b28a5 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs +++ b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs @@ -3,7 +3,7 @@ we're apparently really bad at it", issue = "none")] -#![feature(const_fn_floating_point_arithmetic, foo, foo2)] +#![feature(const_refs_to_cell, foo, foo2)] #![feature(staged_api)] #[stable(feature = "rust1", since = "1.0.0")] @@ -25,9 +25,15 @@ const fn bar2() -> u32 { foo2() } //~ ERROR not yet stable as a const fn #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rust1", since = "1.0.0")] -// Const-stable functions cannot rely on unstable const-eval features. -const fn bar3() -> u32 { (5f32 + 6f32) as u32 } -//~^ ERROR const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]` +// conformity is required +const fn bar3() -> u32 { + let x = std::cell::Cell::new(0u32); + x.get(); + //~^ ERROR const-stable function cannot use `#[feature(const_refs_to_cell)]` + //~| ERROR cannot call non-const fn + foo() + //~^ ERROR is not yet stable as a const fn +} // check whether this function cannot be called even with the feature gate active #[unstable(feature = "foo2", issue = "none")] diff --git a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr index 7ec2508ca93..cb447719f9c 100644 --- a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr +++ b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr @@ -14,30 +14,47 @@ LL | const fn bar2() -> u32 { foo2() } | = help: const-stable functions can only call other const-stable functions -error: const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]` - --> $DIR/min_const_fn_libstd_stability.rs:29:26 +error: const-stable function cannot use `#[feature(const_refs_to_cell)]` + --> $DIR/min_const_fn_libstd_stability.rs:31:5 | -LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } - | ^^^^^^^^^^^^^ +LL | x.get(); + | ^ | -help: if it is not part of the public API, make this function unstably const +help: if the function is not (yet) meant to be stable, make this function unstably const | LL + #[rustc_const_unstable(feature = "...", issue = "...")] -LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } +LL | const fn bar3() -> u32 { | -help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks +help: otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (but requires team approval) | -LL + #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)] -LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } +LL + #[rustc_allow_const_fn_unstable(const_refs_to_cell)] +LL | const fn bar3() -> u32 { | +error[E0015]: cannot call non-const fn `Cell::<u32>::get` in constant functions + --> $DIR/min_const_fn_libstd_stability.rs:31:7 + | +LL | x.get(); + | ^^^^^ + | + = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants + +error: `foo` is not yet stable as a const fn + --> $DIR/min_const_fn_libstd_stability.rs:34:5 + | +LL | foo() + | ^^^^^ + | + = help: const-stable functions can only call other const-stable functions + error: `foo2_gated` is not yet stable as a const fn - --> $DIR/min_const_fn_libstd_stability.rs:39:32 + --> $DIR/min_const_fn_libstd_stability.rs:45:32 | LL | const fn bar2_gated() -> u32 { foo2_gated() } | ^^^^^^^^^^^^ | = help: const-stable functions can only call other const-stable functions -error: aborting due to 4 previous errors +error: aborting due to 6 previous errors +For more information about this error, try `rustc --explain E0015`. diff --git a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs index 03084c8674d..f2a54b8a13d 100644 --- a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs +++ b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs @@ -3,7 +3,7 @@ we're apparently really bad at it", issue = "none")] -#![feature(const_fn_floating_point_arithmetic, foo, foo2)] +#![feature(const_refs_to_cell, foo, foo2)] #![feature(staged_api)] #[stable(feature = "rust1", since = "1.0.0")] @@ -23,12 +23,6 @@ const unsafe fn foo2() -> u32 { 42 } // can't call non-min_const_fn const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR not yet stable as a const fn -#[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_stable(feature = "rust1", since = "1.0.0")] -// conformity is required -const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } -//~^ ERROR const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]` - // check whether this function cannot be called even with the feature gate active #[unstable(feature = "foo2", issue = "none")] const unsafe fn foo2_gated() -> u32 { 42 } diff --git a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr index 72c1f175d1d..353b117efbc 100644 --- a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr +++ b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr @@ -14,30 +14,13 @@ LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } | = help: const-stable functions can only call other const-stable functions -error: const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]` - --> $DIR/min_const_unsafe_fn_libstd_stability.rs:29:33 - | -LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } - | ^^^^^^^^^^^^^ - | -help: if it is not part of the public API, make this function unstably const - | -LL + #[rustc_const_unstable(feature = "...", issue = "...")] -LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } - | -help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks - | -LL + #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)] -LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } - | - error: `foo2_gated` is not yet stable as a const fn - --> $DIR/min_const_unsafe_fn_libstd_stability.rs:39:48 + --> $DIR/min_const_unsafe_fn_libstd_stability.rs:33:48 | LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } | ^^^^^^^^^^^^ | = help: const-stable functions can only call other const-stable functions -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/tests/ui/consts/packed_pattern.stderr b/tests/ui/consts/packed_pattern.stderr index a0b434b2d78..dc26078fb63 100644 --- a/tests/ui/consts/packed_pattern.stderr +++ b/tests/ui/consts/packed_pattern.stderr @@ -2,9 +2,9 @@ warning: unreachable pattern --> $DIR/packed_pattern.rs:16:9 | LL | Foo { field: (5, 6, 7, 8) } => {}, - | --------------------------- matches all the values already + | --------------------------- matches all the relevant values LL | FOO => unreachable!(), - | ^^^ unreachable pattern + | ^^^ no value can reach this | = note: `#[warn(unreachable_patterns)]` on by default diff --git a/tests/ui/consts/packed_pattern2.stderr b/tests/ui/consts/packed_pattern2.stderr index 4785f4d0297..013f61f733c 100644 --- a/tests/ui/consts/packed_pattern2.stderr +++ b/tests/ui/consts/packed_pattern2.stderr @@ -2,9 +2,9 @@ warning: unreachable pattern --> $DIR/packed_pattern2.rs:24:9 | LL | Bar { a: Foo { field: (5, 6) } } => {}, - | -------------------------------- matches all the values already + | -------------------------------- matches all the relevant values LL | FOO => unreachable!(), - | ^^^ unreachable pattern + | ^^^ no value can reach this | = note: `#[warn(unreachable_patterns)]` on by default diff --git a/tests/ui/consts/precise-drop-allow-const-fn-unstable.not_allow.stderr b/tests/ui/consts/precise-drop-allow-const-fn-unstable.not_allow.stderr new file mode 100644 index 00000000000..6038c6d332f --- /dev/null +++ b/tests/ui/consts/precise-drop-allow-const-fn-unstable.not_allow.stderr @@ -0,0 +1,12 @@ +error[E0493]: destructor of `Option<T>` cannot be evaluated at compile-time + --> $DIR/precise-drop-allow-const-fn-unstable.rs:11:24 + | +LL | pub const fn unwrap<T>(this: Option<T>) -> T { + | ^^^^ the destructor for this type cannot be evaluated in constant functions +... +LL | } + | - value is dropped here + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0493`. diff --git a/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs b/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs new file mode 100644 index 00000000000..56155e519dc --- /dev/null +++ b/tests/ui/consts/precise-drop-allow-const-fn-unstable.rs @@ -0,0 +1,17 @@ +//@ revisions: allow not_allow +//@ compile-flags: --crate-type=lib -Cinstrument-coverage -Zno-profiler-runtime +//@[allow] check-pass + +#![feature(staged_api, rustc_allow_const_fn_unstable)] +#![stable(feature = "rust_test", since = "1.0.0")] + +#[stable(feature = "rust_test", since = "1.0.0")] +#[rustc_const_stable(feature = "rust_test", since = "1.0.0")] +#[cfg_attr(allow, rustc_allow_const_fn_unstable(const_precise_live_drops))] +pub const fn unwrap<T>(this: Option<T>) -> T { +//[not_allow]~^ ERROR: cannot be evaluated + match this { + Some(x) => x, + None => panic!(), + } +} diff --git a/tests/ui/consts/qualif-indirect-mutation-fail.rs b/tests/ui/consts/qualif-indirect-mutation-fail.rs index 420e32128a4..a99d0633ba1 100644 --- a/tests/ui/consts/qualif-indirect-mutation-fail.rs +++ b/tests/ui/consts/qualif-indirect-mutation-fail.rs @@ -2,7 +2,6 @@ #![feature(const_mut_refs)] #![feature(const_precise_live_drops)] #![feature(const_swap)] -#![feature(raw_ref_op)] // Mutable borrow of a field with drop impl. pub const fn f() { diff --git a/tests/ui/consts/qualif-indirect-mutation-fail.stderr b/tests/ui/consts/qualif-indirect-mutation-fail.stderr index 458dc2071c4..21c872ed13f 100644 --- a/tests/ui/consts/qualif-indirect-mutation-fail.stderr +++ b/tests/ui/consts/qualif-indirect-mutation-fail.stderr @@ -1,5 +1,5 @@ error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time - --> $DIR/qualif-indirect-mutation-fail.rs:15:9 + --> $DIR/qualif-indirect-mutation-fail.rs:14:9 | LL | let mut x = None; | ^^^^^ the destructor for this type cannot be evaluated in constants @@ -16,13 +16,13 @@ note: inside `std::ptr::drop_in_place::<String> - shim(Some(String))` note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `A1` - --> $DIR/qualif-indirect-mutation-fail.rs:21:1 + --> $DIR/qualif-indirect-mutation-fail.rs:20:1 | LL | }; | ^ error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time - --> $DIR/qualif-indirect-mutation-fail.rs:31:9 + --> $DIR/qualif-indirect-mutation-fail.rs:30:9 | LL | let _z = x; | ^^ the destructor for this type cannot be evaluated in constants @@ -39,49 +39,49 @@ note: inside `std::ptr::drop_in_place::<String> - shim(Some(String))` note: inside `std::ptr::drop_in_place::<Option<String>> - shim(Some(Option<String>))` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `A2` - --> $DIR/qualif-indirect-mutation-fail.rs:32:1 + --> $DIR/qualif-indirect-mutation-fail.rs:31:1 | LL | }; | ^ error[E0493]: destructor of `(u32, Option<String>)` cannot be evaluated at compile-time - --> $DIR/qualif-indirect-mutation-fail.rs:9:9 + --> $DIR/qualif-indirect-mutation-fail.rs:8:9 | LL | let mut a: (u32, Option<String>) = (0, None); | ^^^^^ the destructor for this type cannot be evaluated in constant functions error[E0493]: destructor of `Option<T>` cannot be evaluated at compile-time - --> $DIR/qualif-indirect-mutation-fail.rs:36:9 + --> $DIR/qualif-indirect-mutation-fail.rs:35:9 | LL | let x: Option<T> = None; | ^ the destructor for this type cannot be evaluated in constant functions error[E0493]: destructor of `Option<T>` cannot be evaluated at compile-time - --> $DIR/qualif-indirect-mutation-fail.rs:44:9 + --> $DIR/qualif-indirect-mutation-fail.rs:43:9 | LL | let _y = x; | ^^ the destructor for this type cannot be evaluated in constant functions error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time - --> $DIR/qualif-indirect-mutation-fail.rs:52:9 + --> $DIR/qualif-indirect-mutation-fail.rs:51:9 | LL | let mut y: Option<String> = None; | ^^^^^ the destructor for this type cannot be evaluated in constant functions error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time - --> $DIR/qualif-indirect-mutation-fail.rs:49:9 + --> $DIR/qualif-indirect-mutation-fail.rs:48:9 | LL | let mut x: Option<String> = None; | ^^^^^ the destructor for this type cannot be evaluated in constant functions error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time - --> $DIR/qualif-indirect-mutation-fail.rs:62:9 + --> $DIR/qualif-indirect-mutation-fail.rs:61:9 | LL | let y: Option<String> = None; | ^ the destructor for this type cannot be evaluated in constant functions error[E0493]: destructor of `Option<String>` cannot be evaluated at compile-time - --> $DIR/qualif-indirect-mutation-fail.rs:59:9 + --> $DIR/qualif-indirect-mutation-fail.rs:58:9 | LL | let x: Option<String> = None; | ^ the destructor for this type cannot be evaluated in constant functions diff --git a/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr b/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr index d4fc1717538..ec01225c6bf 100644 --- a/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr +++ b/tests/ui/consts/static-default-lifetime/elided-lifetime.stderr @@ -48,10 +48,10 @@ LL | const STATIC: &str = ""; = note: expected reference `&'static _` found reference `&_` note: the anonymous lifetime as defined here... - --> $DIR/elided-lifetime.rs:15:18 + --> $DIR/elided-lifetime.rs:16:19 | -LL | impl Bar for Foo<'_> { - | ^^ +LL | const STATIC: &str = ""; + | ^ = note: ...does not necessarily outlive the static lifetime error: aborting due to 3 previous errors diff --git a/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr b/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr index 8e4c27875ab..b8e2f412b49 100644 --- a/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr +++ b/tests/ui/consts/static-default-lifetime/static-trait-impl.stderr @@ -30,10 +30,10 @@ LL | const STATIC: &str = ""; = note: expected reference `&_` found reference `&_` note: the anonymous lifetime as defined here... - --> $DIR/static-trait-impl.rs:8:10 + --> $DIR/static-trait-impl.rs:9:19 | -LL | impl Bar<'_> for A { - | ^^ +LL | const STATIC: &str = ""; + | ^ note: ...does not necessarily outlive the anonymous lifetime as defined here --> $DIR/static-trait-impl.rs:8:10 | diff --git a/tests/ui/coroutine/issue-58888.rs b/tests/ui/coroutine/issue-58888.rs index 6266f97ce8c..e4fada0cd43 100644 --- a/tests/ui/coroutine/issue-58888.rs +++ b/tests/ui/coroutine/issue-58888.rs @@ -13,7 +13,8 @@ impl Database { } fn check_connection(&self) -> impl Coroutine<Yield = (), Return = ()> + '_ { - #[coroutine] move || { + #[coroutine] + move || { let iter = self.get_connection(); for i in iter { yield i @@ -23,5 +24,5 @@ impl Database { } fn main() { - Database.check_connection(); + let _ = Database.check_connection(); } diff --git a/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr b/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr index 934ab08cf17..daf88fc1f23 100644 --- a/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr +++ b/tests/ui/coroutine/print/coroutine-print-verbose-1.stderr @@ -10,7 +10,7 @@ note: coroutine is not `Send` as this value is used across a yield --> $DIR/coroutine-print-verbose-1.rs:35:9 | LL | let _non_send_gen = make_non_send_coroutine(); - | ------------- has type `Opaque(DefId(0:34 ~ coroutine_print_verbose_1[75fb]::make_non_send_coroutine::{opaque#0}), [])` which is not `Send` + | ------------- has type `Opaque(DefId(0:24 ~ coroutine_print_verbose_1[75fb]::make_non_send_coroutine::{opaque#0}), [])` which is not `Send` LL | yield; | ^^^^^ yield occurs here, with `_non_send_gen` maybe used later note: required by a bound in `require_send` @@ -33,12 +33,12 @@ note: required because it's used within this coroutine | LL | #[coroutine] || { | ^^ -note: required because it appears within the type `Opaque(DefId(0:35 ~ coroutine_print_verbose_1[75fb]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])` +note: required because it appears within the type `Opaque(DefId(0:29 ~ coroutine_print_verbose_1[75fb]::make_gen2::{opaque#0}), [Arc<RefCell<i32>>])` --> $DIR/coroutine-print-verbose-1.rs:41:30 | LL | pub fn make_gen2<T>(t: T) -> impl Coroutine<Return = T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required because it appears within the type `Opaque(DefId(0:36 ~ coroutine_print_verbose_1[75fb]::make_non_send_coroutine2::{opaque#0}), [])` +note: required because it appears within the type `Opaque(DefId(0:32 ~ coroutine_print_verbose_1[75fb]::make_non_send_coroutine2::{opaque#0}), [])` --> $DIR/coroutine-print-verbose-1.rs:47:34 | LL | fn make_non_send_coroutine2() -> impl Coroutine<Return = Arc<RefCell<i32>>> { diff --git a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.rs b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.rs new file mode 100644 index 00000000000..0a7ec5ab5c1 --- /dev/null +++ b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.rs @@ -0,0 +1,34 @@ +#![feature(fn_delegation)] +#![allow(incomplete_features)] + +use std::marker::PhantomData; + +pub struct InvariantRef<'a, T: ?Sized>(&'a T, PhantomData<&'a mut &'a T>); + +impl<'a> InvariantRef<'a, ()> { + pub const NEW: Self = InvariantRef::new(&()); + //~^ ERROR: no function or associated item named `new` found +} + +trait Trait { + fn foo(&self) -> u8 { 0 } + fn bar(&self) -> u8 { 1 } + fn meh(&self) -> u8 { 2 } +} + +struct Z(u8); + +impl Trait for Z { + reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + //~^ ERROR: use of undeclared lifetime name `'a` + //~| ERROR: use of undeclared lifetime name `'a` + //~| ERROR: use of undeclared lifetime name `'a` + //~| ERROR: the trait bound `u8: Trait` is not satisfied + //~| ERROR: the trait bound `u8: Trait` is not satisfied + //~| ERROR: the trait bound `u8: Trait` is not satisfied + //~| ERROR: mismatched types + //~| ERROR: mismatched types + //~| ERROR: mismatched types +} + +fn main() { } diff --git a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr new file mode 100644 index 00000000000..2ce3b388073 --- /dev/null +++ b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr @@ -0,0 +1,113 @@ +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:68 + | +LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | reuse <u8 as Trait>::{foo'a, , bar, meh} { &const { InvariantRef::<'a>::NEW } } + | +++ +help: consider introducing lifetime `'a` here + | +LL | impl<'a> Trait for Z { + | ++++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:68 + | +LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | reuse <u8 as Trait>::{foo, bar'a, , meh} { &const { InvariantRef::<'a>::NEW } } + | +++ +help: consider introducing lifetime `'a` here + | +LL | impl<'a> Trait for Z { + | ++++ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:68 + | +LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + | ^^ undeclared lifetime + | +help: consider introducing lifetime `'a` here + | +LL | reuse <u8 as Trait>::{foo, bar, meh'a, } { &const { InvariantRef::<'a>::NEW } } + | +++ +help: consider introducing lifetime `'a` here + | +LL | impl<'a> Trait for Z { + | ++++ + +error[E0599]: no function or associated item named `new` found for struct `InvariantRef` in the current scope + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:9:41 + | +LL | pub struct InvariantRef<'a, T: ?Sized>(&'a T, PhantomData<&'a mut &'a T>); + | -------------------------------------- function or associated item `new` not found for this struct +... +LL | pub const NEW: Self = InvariantRef::new(&()); + | ^^^ function or associated item not found in `InvariantRef<'_, _>` + +error[E0308]: mismatched types + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:53 + | +LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `InvariantRef<'_, ()>` + | + = note: expected type `u8` + found struct `InvariantRef<'_, ()>` + +error[E0277]: the trait bound `u8: Trait` is not satisfied + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:12 + | +LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + | ^^ the trait `Trait` is not implemented for `u8` + | + = help: the trait `Trait` is implemented for `Z` + +error[E0308]: mismatched types + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:53 + | +LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `InvariantRef<'_, ()>` + | + = note: expected type `u8` + found struct `InvariantRef<'_, ()>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0277]: the trait bound `u8: Trait` is not satisfied + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:12 + | +LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + | ^^ the trait `Trait` is not implemented for `u8` + | + = help: the trait `Trait` is implemented for `Z` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0308]: mismatched types + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:53 + | +LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `InvariantRef<'_, ()>` + | + = note: expected type `u8` + found struct `InvariantRef<'_, ()>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0277]: the trait bound `u8: Trait` is not satisfied + --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:12 + | +LL | reuse <u8 as Trait>::{foo, bar, meh} { &const { InvariantRef::<'a>::NEW } } + | ^^ the trait `Trait` is not implemented for `u8` + | + = help: the trait `Trait` is implemented for `Z` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 10 previous errors + +Some errors have detailed explanations: E0261, E0277, E0308, E0599. +For more information about an error, try `rustc --explain E0261`. diff --git a/tests/ui/delegation/inner-attr.stderr b/tests/ui/delegation/inner-attr.stderr index f3b53e331ad..257ab760ffc 100644 --- a/tests/ui/delegation/inner-attr.stderr +++ b/tests/ui/delegation/inner-attr.stderr @@ -8,11 +8,6 @@ LL | fn main() {} | ------------ the inner attribute doesn't annotate this function | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files -help: to annotate the function, change the attribute from inner to outer style - | -LL - reuse a as b { #![rustc_dummy] self } -LL + reuse a as b { #[rustc_dummy] self } - | error: aborting due to 1 previous error diff --git a/tests/ui/deriving/auxiliary/another-proc-macro.rs b/tests/ui/deriving/auxiliary/another-proc-macro.rs new file mode 100644 index 00000000000..a05175c9de9 --- /dev/null +++ b/tests/ui/deriving/auxiliary/another-proc-macro.rs @@ -0,0 +1,45 @@ +//@ force-host +//@ no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro_quote)] + +extern crate proc_macro; + +use proc_macro::{quote, TokenStream}; + +#[proc_macro_derive(AnotherMacro, attributes(pointee))] +pub fn derive(_input: TokenStream) -> TokenStream { + quote! { + const _: () = { + const ANOTHER_MACRO_DERIVED: () = (); + }; + } + .into() +} + +#[proc_macro_attribute] +pub fn pointee( + _attr: proc_macro::TokenStream, + _item: proc_macro::TokenStream, +) -> proc_macro::TokenStream { + quote! { + const _: () = { + const POINTEE_MACRO_ATTR_DERIVED: () = (); + }; + } + .into() +} + +#[proc_macro_attribute] +pub fn default( + _attr: proc_macro::TokenStream, + _item: proc_macro::TokenStream, +) -> proc_macro::TokenStream { + quote! { + const _: () = { + const DEFAULT_MACRO_ATTR_DERIVED: () = (); + }; + } + .into() +} diff --git a/tests/ui/deriving/built-in-proc-macro-scope.rs b/tests/ui/deriving/built-in-proc-macro-scope.rs new file mode 100644 index 00000000000..41c95f63b13 --- /dev/null +++ b/tests/ui/deriving/built-in-proc-macro-scope.rs @@ -0,0 +1,25 @@ +//@ check-pass +//@ aux-build: another-proc-macro.rs +//@ compile-flags: -Zunpretty=expanded + +#![feature(derive_smart_pointer)] + +#[macro_use] +extern crate another_proc_macro; + +use another_proc_macro::{pointee, AnotherMacro}; + +#[derive(core::marker::SmartPointer)] +#[repr(transparent)] +pub struct Ptr<'a, #[pointee] T: ?Sized> { + data: &'a mut T, +} + +#[pointee] +fn f() {} + +#[derive(AnotherMacro)] +#[pointee] +struct MyStruct; + +fn main() {} diff --git a/tests/ui/deriving/built-in-proc-macro-scope.stdout b/tests/ui/deriving/built-in-proc-macro-scope.stdout new file mode 100644 index 00000000000..c649b7a9a57 --- /dev/null +++ b/tests/ui/deriving/built-in-proc-macro-scope.stdout @@ -0,0 +1,43 @@ +#![feature(prelude_import)] +#![no_std] +//@ check-pass +//@ aux-build: another-proc-macro.rs +//@ compile-flags: -Zunpretty=expanded + +#![feature(derive_smart_pointer)] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; + +#[macro_use] +extern crate another_proc_macro; + +use another_proc_macro::{pointee, AnotherMacro}; + +#[repr(transparent)] +pub struct Ptr<'a, #[pointee] T: ?Sized> { + data: &'a mut T, +} +#[automatically_derived] +impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> + ::core::ops::DispatchFromDyn<Ptr<'a, __S>> for Ptr<'a, T> { +} +#[automatically_derived] +impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> + ::core::ops::CoerceUnsized<Ptr<'a, __S>> for Ptr<'a, T> { +} + + + +const _: () = + { + const POINTEE_MACRO_ATTR_DERIVED: () = (); + }; +#[pointee] +struct MyStruct; +const _: () = + { + const ANOTHER_MACRO_DERIVED: () = (); + }; +fn main() {} diff --git a/tests/ui/deriving/deriving-smart-pointer-expanded.rs b/tests/ui/deriving/deriving-smart-pointer-expanded.rs index b78258c2529..e48ad3dd4bc 100644 --- a/tests/ui/deriving/deriving-smart-pointer-expanded.rs +++ b/tests/ui/deriving/deriving-smart-pointer-expanded.rs @@ -20,3 +20,9 @@ where data: &'a mut T, x: core::marker::PhantomData<X>, } + +#[derive(SmartPointer)] +#[repr(transparent)] +struct MyPointerWithoutPointee<'a, T: ?Sized> { + ptr: &'a T, +} diff --git a/tests/ui/deriving/deriving-smart-pointer-expanded.stdout b/tests/ui/deriving/deriving-smart-pointer-expanded.stdout index 3c7e7198180..68ef17f2b05 100644 --- a/tests/ui/deriving/deriving-smart-pointer-expanded.stdout +++ b/tests/ui/deriving/deriving-smart-pointer-expanded.stdout @@ -42,3 +42,18 @@ impl<'a, Y, Z: MyTrait<T> + MyTrait<__S>, T: ?Sized + MyTrait<T> + MyTrait<__S>> ::core::ops::CoerceUnsized<MyPointer2<'a, Y, Z, __S, X>> for MyPointer2<'a, Y, Z, T, X> where Y: MyTrait<T>, Y: MyTrait<__S> { } + +#[repr(transparent)] +struct MyPointerWithoutPointee<'a, T: ?Sized> { + ptr: &'a T, +} +#[automatically_derived] +impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> + ::core::ops::DispatchFromDyn<MyPointerWithoutPointee<'a, __S>> for + MyPointerWithoutPointee<'a, T> { +} +#[automatically_derived] +impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> + ::core::ops::CoerceUnsized<MyPointerWithoutPointee<'a, __S>> for + MyPointerWithoutPointee<'a, T> { +} diff --git a/tests/ui/deriving/deriving-smart-pointer-neg.rs b/tests/ui/deriving/deriving-smart-pointer-neg.rs index 04f52a154fe..f02fb56130f 100644 --- a/tests/ui/deriving/deriving-smart-pointer-neg.rs +++ b/tests/ui/deriving/deriving-smart-pointer-neg.rs @@ -10,13 +10,6 @@ enum NotStruct<'a, T: ?Sized> { } #[derive(SmartPointer)] -//~^ ERROR: At least one generic type should be designated as `#[pointee]` in order to derive `SmartPointer` traits -#[repr(transparent)] -struct NoPointee<'a, T: ?Sized> { - ptr: &'a T, -} - -#[derive(SmartPointer)] //~^ ERROR: `SmartPointer` can only be derived on `struct`s with at least one field #[repr(transparent)] struct NoField<'a, #[pointee] T: ?Sized> {} @@ -31,6 +24,23 @@ struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); //~| ERROR: type parameter `T` is never used #[derive(SmartPointer)] +//~^ ERROR: `SmartPointer` can only be derived on `struct`s that are generic over at least one type +#[repr(transparent)] +struct NoGeneric<'a>(&'a u8); + +#[derive(SmartPointer)] +//~^ ERROR: exactly one generic type parameter must be marked as #[pointee] to derive SmartPointer traits +#[repr(transparent)] +struct AmbiguousPointee<'a, T1: ?Sized, T2: ?Sized> { + a: (&'a T1, &'a T2), +} + +#[derive(SmartPointer)] +#[repr(transparent)] +struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, &'a B)); +//~^ ERROR: only one type parameter can be marked as `#[pointee]` when deriving SmartPointer traits + +#[derive(SmartPointer)] //~^ ERROR: `SmartPointer` can only be derived on `struct`s with `#[repr(transparent)]` struct NotTransparent<'a, #[pointee] T: ?Sized> { ptr: &'a T, diff --git a/tests/ui/deriving/deriving-smart-pointer-neg.stderr b/tests/ui/deriving/deriving-smart-pointer-neg.stderr index 8b0f91d41fb..e7c2afc8b00 100644 --- a/tests/ui/deriving/deriving-smart-pointer-neg.stderr +++ b/tests/ui/deriving/deriving-smart-pointer-neg.stderr @@ -6,7 +6,7 @@ LL | #[derive(SmartPointer)] | = note: this error originates in the derive macro `SmartPointer` (in Nightly builds, run with -Z macro-backtrace for more info) -error: At least one generic type should be designated as `#[pointee]` in order to derive `SmartPointer` traits +error: `SmartPointer` can only be derived on `struct`s with at least one field --> $DIR/deriving-smart-pointer-neg.rs:12:10 | LL | #[derive(SmartPointer)] @@ -22,7 +22,7 @@ LL | #[derive(SmartPointer)] | = note: this error originates in the derive macro `SmartPointer` (in Nightly builds, run with -Z macro-backtrace for more info) -error: `SmartPointer` can only be derived on `struct`s with at least one field +error: `SmartPointer` can only be derived on `struct`s that are generic over at least one type --> $DIR/deriving-smart-pointer-neg.rs:26:10 | LL | #[derive(SmartPointer)] @@ -30,8 +30,22 @@ LL | #[derive(SmartPointer)] | = note: this error originates in the derive macro `SmartPointer` (in Nightly builds, run with -Z macro-backtrace for more info) +error: exactly one generic type parameter must be marked as #[pointee] to derive SmartPointer traits + --> $DIR/deriving-smart-pointer-neg.rs:31:10 + | +LL | #[derive(SmartPointer)] + | ^^^^^^^^^^^^ + | + = note: this error originates in the derive macro `SmartPointer` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: only one type parameter can be marked as `#[pointee]` when deriving SmartPointer traits + --> $DIR/deriving-smart-pointer-neg.rs:40:39 + | +LL | struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, &'a B)); + | ^ ^ + error: `SmartPointer` can only be derived on `struct`s with `#[repr(transparent)]` - --> $DIR/deriving-smart-pointer-neg.rs:33:10 + --> $DIR/deriving-smart-pointer-neg.rs:43:10 | LL | #[derive(SmartPointer)] | ^^^^^^^^^^^^ @@ -39,13 +53,13 @@ LL | #[derive(SmartPointer)] = note: this error originates in the derive macro `SmartPointer` (in Nightly builds, run with -Z macro-backtrace for more info) error: `derive(SmartPointer)` requires T to be marked `?Sized` - --> $DIR/deriving-smart-pointer-neg.rs:41:36 + --> $DIR/deriving-smart-pointer-neg.rs:51:36 | LL | struct NoMaybeSized<'a, #[pointee] T> { | ^ error[E0392]: lifetime parameter `'a` is never used - --> $DIR/deriving-smart-pointer-neg.rs:22:16 + --> $DIR/deriving-smart-pointer-neg.rs:15:16 | LL | struct NoField<'a, #[pointee] T: ?Sized> {} | ^^ unused lifetime parameter @@ -53,7 +67,7 @@ LL | struct NoField<'a, #[pointee] T: ?Sized> {} = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used - --> $DIR/deriving-smart-pointer-neg.rs:22:31 + --> $DIR/deriving-smart-pointer-neg.rs:15:31 | LL | struct NoField<'a, #[pointee] T: ?Sized> {} | ^ unused type parameter @@ -61,7 +75,7 @@ LL | struct NoField<'a, #[pointee] T: ?Sized> {} = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: lifetime parameter `'a` is never used - --> $DIR/deriving-smart-pointer-neg.rs:29:20 + --> $DIR/deriving-smart-pointer-neg.rs:22:20 | LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); | ^^ unused lifetime parameter @@ -69,13 +83,13 @@ LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used - --> $DIR/deriving-smart-pointer-neg.rs:29:35 + --> $DIR/deriving-smart-pointer-neg.rs:22:35 | LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` -error: aborting due to 10 previous errors +error: aborting due to 12 previous errors For more information about this error, try `rustc --explain E0392`. diff --git a/tests/ui/deriving/proc-macro-attribute-mixing.rs b/tests/ui/deriving/proc-macro-attribute-mixing.rs new file mode 100644 index 00000000000..489665ebeb5 --- /dev/null +++ b/tests/ui/deriving/proc-macro-attribute-mixing.rs @@ -0,0 +1,20 @@ +// This test certify that we can mix attribute macros from Rust and external proc-macros. +// For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(SmartPointer)]` uses +// `#[pointee]`. +// The scoping rule should allow the use of the said two attributes when external proc-macros +// are in scope. + +//@ check-pass +//@ aux-build: another-proc-macro.rs +//@ compile-flags: -Zunpretty=expanded + +#![feature(derive_smart_pointer)] + +#[macro_use] +extern crate another_proc_macro; + +#[pointee] +fn f() {} + +#[default] +fn g() {} diff --git a/tests/ui/deriving/proc-macro-attribute-mixing.stdout b/tests/ui/deriving/proc-macro-attribute-mixing.stdout new file mode 100644 index 00000000000..f314f6efbe2 --- /dev/null +++ b/tests/ui/deriving/proc-macro-attribute-mixing.stdout @@ -0,0 +1,30 @@ +#![feature(prelude_import)] +#![no_std] +// This test certify that we can mix attribute macros from Rust and external proc-macros. +// For instance, `#[derive(Default)]` uses `#[default]` and `#[derive(SmartPointer)]` uses +// `#[pointee]`. +// The scoping rule should allow the use of the said two attributes when external proc-macros +// are in scope. + +//@ check-pass +//@ aux-build: another-proc-macro.rs +//@ compile-flags: -Zunpretty=expanded + +#![feature(derive_smart_pointer)] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; + +#[macro_use] +extern crate another_proc_macro; + + +const _: () = + { + const POINTEE_MACRO_ATTR_DERIVED: () = (); + }; +const _: () = + { + const DEFAULT_MACRO_ATTR_DERIVED: () = (); + }; diff --git a/tests/ui/drop/lint-tail-expr-drop-order-gated.rs b/tests/ui/drop/lint-tail-expr-drop-order-gated.rs new file mode 100644 index 00000000000..b22e72bcfad --- /dev/null +++ b/tests/ui/drop/lint-tail-expr-drop-order-gated.rs @@ -0,0 +1,35 @@ +// This test ensures that `tail_expr_drop_order` does not activate in case Edition 2024 is not used +// or the feature gate `shorter_tail_lifetimes` is disabled. + +//@ revisions: neither no_feature_gate edition_less_than_2024 +//@ check-pass +//@ [neither] edition: 2021 +//@ [no_feature_gate] compile-flags: -Z unstable-options +//@ [no_feature_gate] edition: 2024 +//@ [edition_less_than_2024] edition: 2021 + +#![deny(tail_expr_drop_order)] +#![cfg_attr(edition_less_than_2024, feature(shorter_tail_lifetimes))] + +struct LoudDropper; +impl Drop for LoudDropper { + fn drop(&mut self) { + // This destructor should be considered significant because it is a custom destructor + // and we will assume that the destructor can generate side effects arbitrarily so that + // a change in drop order is visible. + println!("loud drop"); + } +} +impl LoudDropper { + fn get(&self) -> i32 { + 0 + } +} + +fn should_not_lint() -> i32 { + let x = LoudDropper; + x.get() + LoudDropper.get() + // Lint should not action +} + +fn main() {} diff --git a/tests/ui/drop/lint-tail-expr-drop-order.rs b/tests/ui/drop/lint-tail-expr-drop-order.rs new file mode 100644 index 00000000000..0aa0ef02610 --- /dev/null +++ b/tests/ui/drop/lint-tail-expr-drop-order.rs @@ -0,0 +1,71 @@ +//@ compile-flags: -Z unstable-options +//@ edition: 2024 + +// Edition 2024 lint for change in drop order at tail expression +// This lint is to capture potential change in program semantics +// due to implementation of RFC 3606 <https://github.com/rust-lang/rfcs/pull/3606> + +#![deny(tail_expr_drop_order)] +#![feature(shorter_tail_lifetimes)] + +struct LoudDropper; +impl Drop for LoudDropper { + fn drop(&mut self) { + // This destructor should be considered significant because it is a custom destructor + // and we will assume that the destructor can generate side effects arbitrarily so that + // a change in drop order is visible. + println!("loud drop"); + } +} +impl LoudDropper { + fn get(&self) -> i32 { + 0 + } +} + +fn should_lint() -> i32 { + let x = LoudDropper; + // Should lint + x.get() + LoudDropper.get() + //~^ ERROR: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 + //~| WARN: this changes meaning in Rust 2024 +} + +fn should_lint_closure() -> impl FnOnce() -> i32 { + let x = LoudDropper; + move || x.get() + LoudDropper.get() + //~^ ERROR: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 + //~| WARN: this changes meaning in Rust 2024 +} + +fn should_not_lint() -> i32 { + let x = LoudDropper; + // Should not lint + x.get() +} + +fn should_not_lint_in_nested_block() -> i32 { + let x = LoudDropper; + // Should not lint because Edition 2021 drops temporaries in blocks earlier already + { LoudDropper.get() } +} + +fn should_not_lint_in_match_arm() -> i32 { + let x = LoudDropper; + // Should not lint because Edition 2021 drops temporaries in blocks earlier already + match &x { + _ => LoudDropper.get(), + } +} + +fn should_lint_in_nested_items() { + fn should_lint_me() -> i32 { + let x = LoudDropper; + // Should lint + x.get() + LoudDropper.get() + //~^ ERROR: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 + //~| WARN: this changes meaning in Rust 2024 + } +} + +fn main() {} diff --git a/tests/ui/drop/lint-tail-expr-drop-order.stderr b/tests/ui/drop/lint-tail-expr-drop-order.stderr new file mode 100644 index 00000000000..630f0a80f09 --- /dev/null +++ b/tests/ui/drop/lint-tail-expr-drop-order.stderr @@ -0,0 +1,42 @@ +error: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 + --> $DIR/lint-tail-expr-drop-order.rs:29:15 + | +LL | let x = LoudDropper; + | - these values have significant drop implementation and will observe changes in drop order under Edition 2024 +LL | // Should lint +LL | x.get() + LoudDropper.get() + | ^^^^^^^^^^^ + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see issue #123739 <https://github.com/rust-lang/rust/issues/123739> +note: the lint level is defined here + --> $DIR/lint-tail-expr-drop-order.rs:8:9 + | +LL | #![deny(tail_expr_drop_order)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 + --> $DIR/lint-tail-expr-drop-order.rs:36:23 + | +LL | let x = LoudDropper; + | - these values have significant drop implementation and will observe changes in drop order under Edition 2024 +LL | move || x.get() + LoudDropper.get() + | ^^^^^^^^^^^ + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see issue #123739 <https://github.com/rust-lang/rust/issues/123739> + +error: these values and local bindings have significant drop implementation that will have a different drop order from that of Edition 2021 + --> $DIR/lint-tail-expr-drop-order.rs:65:19 + | +LL | let x = LoudDropper; + | - these values have significant drop implementation and will observe changes in drop order under Edition 2024 +LL | // Should lint +LL | x.get() + LoudDropper.get() + | ^^^^^^^^^^^ + | + = warning: this changes meaning in Rust 2024 + = note: for more information, see issue #123739 <https://github.com/rust-lang/rust/issues/123739> + +error: aborting due to 3 previous errors + diff --git a/tests/ui/dst/dst-rvalue.stderr b/tests/ui/dst/dst-rvalue.stderr index 8d0a82b707d..d8c529617f7 100644 --- a/tests/ui/dst/dst-rvalue.stderr +++ b/tests/ui/dst/dst-rvalue.stderr @@ -9,6 +9,11 @@ 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 +help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression + | +LL - let _x: Box<str> = Box::new(*"hello world"); +LL + let _x: Box<str> = Box::new("hello world"); + | error[E0277]: the size for values of type `[isize]` cannot be known at compilation time --> $DIR/dst-rvalue.rs:8:37 @@ -21,6 +26,11 @@ 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 +help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression + | +LL - let _x: Box<[isize]> = Box::new(*array); +LL + let _x: Box<[isize]> = Box::new(array); + | error: aborting due to 2 previous errors diff --git a/tests/ui/duplicate-label-E0381-issue-129274.rs b/tests/ui/duplicate-label-E0381-issue-129274.rs new file mode 100644 index 00000000000..b2156e630c8 --- /dev/null +++ b/tests/ui/duplicate-label-E0381-issue-129274.rs @@ -0,0 +1,13 @@ +fn main() { + fn test() { + loop { + let blah: Option<String>; + if true { + blah = Some("".to_string()); + } + if let Some(blah) = blah.as_ref() { //~ ERROR E0381 + } + } + } + println!("{:?}", test()) +} diff --git a/tests/ui/duplicate-label-E0381-issue-129274.stderr b/tests/ui/duplicate-label-E0381-issue-129274.stderr new file mode 100644 index 00000000000..7f8bddb17c5 --- /dev/null +++ b/tests/ui/duplicate-label-E0381-issue-129274.stderr @@ -0,0 +1,15 @@ +error[E0381]: used binding `blah` is possibly-uninitialized + --> $DIR/duplicate-label-E0381-issue-129274.rs:8:33 + | +LL | let blah: Option<String>; + | ---- binding declared here but left uninitialized +LL | if true { +LL | blah = Some("".to_string()); + | ---- binding initialized here in some conditions +LL | } +LL | if let Some(blah) = blah.as_ref() { + | ^^^^ `blah` used here but it is possibly-uninitialized + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0381`. diff --git a/tests/ui/dyn-keyword/suggest-dyn-on-bare-trait-in-pat.rs b/tests/ui/dyn-keyword/suggest-dyn-on-bare-trait-in-pat.rs new file mode 100644 index 00000000000..19b5edb620f --- /dev/null +++ b/tests/ui/dyn-keyword/suggest-dyn-on-bare-trait-in-pat.rs @@ -0,0 +1,14 @@ +//@ edition: 2021 + +trait Trait {} + +impl dyn Trait { + const CONST: () = (); +} + +fn main() { + match () { + Trait::CONST => {} + //~^ ERROR trait objects must include the `dyn` keyword + } +} diff --git a/tests/ui/dyn-keyword/suggest-dyn-on-bare-trait-in-pat.stderr b/tests/ui/dyn-keyword/suggest-dyn-on-bare-trait-in-pat.stderr new file mode 100644 index 00000000000..4446a89b63b --- /dev/null +++ b/tests/ui/dyn-keyword/suggest-dyn-on-bare-trait-in-pat.stderr @@ -0,0 +1,14 @@ +error[E0782]: trait objects must include the `dyn` keyword + --> $DIR/suggest-dyn-on-bare-trait-in-pat.rs:11:9 + | +LL | Trait::CONST => {} + | ^^^^^ + | +help: add `dyn` keyword before this trait + | +LL | <dyn Trait>::CONST => {} + | ++++ + + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0782`. diff --git a/tests/ui/error-codes/E0001.stderr b/tests/ui/error-codes/E0001.stderr index 40008230ec8..30d0df960f3 100644 --- a/tests/ui/error-codes/E0001.stderr +++ b/tests/ui/error-codes/E0001.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/E0001.rs:8:9 | LL | _ => {/* ... */} - | ^ unreachable pattern + | ^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/E0001.rs:8:9 | LL | Some(_) => {/* ... */} diff --git a/tests/ui/error-codes/E0208.rs b/tests/ui/error-codes/E0208.rs index 74c138af483..2713ba6ed6c 100644 --- a/tests/ui/error-codes/E0208.rs +++ b/tests/ui/error-codes/E0208.rs @@ -1,7 +1,7 @@ #![feature(rustc_attrs)] #[rustc_variance] -struct Foo<'a, T> { //~ ERROR [+, o] +struct Foo<'a, T> { //~ ERROR ['a: +, T: o] t: &'a mut T, } diff --git a/tests/ui/error-codes/E0208.stderr b/tests/ui/error-codes/E0208.stderr index 77b6ceae4dc..a39e93afab3 100644 --- a/tests/ui/error-codes/E0208.stderr +++ b/tests/ui/error-codes/E0208.stderr @@ -1,4 +1,4 @@ -error: [+, o] +error: ['a: +, T: o] --> $DIR/E0208.rs:4:1 | LL | struct Foo<'a, T> { diff --git a/tests/ui/error-codes/E0602.stderr b/tests/ui/error-codes/E0602.stderr index b0b6033aadd..b6b5cd5c3d3 100644 --- a/tests/ui/error-codes/E0602.stderr +++ b/tests/ui/error-codes/E0602.stderr @@ -13,11 +13,6 @@ warning[E0602]: unknown lint: `bogus` = note: requested on the command line with `-D bogus` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -warning[E0602]: unknown lint: `bogus` - | - = note: requested on the command line with `-D bogus` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -warning: 4 warnings emitted +warning: 3 warnings emitted For more information about this error, try `rustc --explain E0602`. diff --git a/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr b/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr index 83492988479..044c1ae2dd4 100644 --- a/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr +++ b/tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr @@ -1,21 +1,21 @@ -warning: `extern` fn uses type `[i8 or u8 (arch dependant)]`, which is not FFI-safe +warning: `extern` fn uses type `CStr`, which is not FFI-safe --> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:7:12 | LL | type Foo = extern "C" fn(::std::ffi::CStr); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | - = help: consider using a raw pointer instead - = note: slices have no C equivalent + = help: consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + = note: `CStr`/`CString` do not have a guaranteed layout = note: `#[warn(improper_ctypes_definitions)]` on by default -warning: `extern` block uses type `[i8 or u8 (arch dependant)]`, which is not FFI-safe +warning: `extern` block uses type `CStr`, which is not FFI-safe --> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:10:18 | LL | fn meh(blah: Foo); | ^^^ not FFI-safe | - = help: consider using a raw pointer instead - = note: slices have no C equivalent + = help: consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + = note: `CStr`/`CString` do not have a guaranteed layout = note: `#[warn(improper_ctypes)]` on by default warning: 2 warnings emitted diff --git a/tests/ui/extern/extern-main-issue-86110.stderr b/tests/ui/extern/extern-main-issue-86110.stderr index 8a3262fbcc7..d69f4e61768 100644 --- a/tests/ui/extern/extern-main-issue-86110.stderr +++ b/tests/ui/extern/extern-main-issue-86110.stderr @@ -2,7 +2,7 @@ error: the `main` function cannot be declared in an `extern` block --> $DIR/extern-main-issue-86110.rs:4:5 | LL | fn main(); - | ^^^^^^^^^ + | ^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-asm_const.rs b/tests/ui/feature-gates/feature-gate-asm_const.rs deleted file mode 100644 index 42d5ba69222..00000000000 --- a/tests/ui/feature-gates/feature-gate-asm_const.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ only-x86_64 - -use std::arch::asm; - -unsafe fn foo<const N: usize>() { - asm!("mov eax, {}", const N + 1); - //~^ ERROR const operands for inline assembly are unstable -} - -fn main() { - unsafe { - foo::<0>(); - asm!("mov eax, {}", const 123); - //~^ ERROR const operands for inline assembly are unstable - } -} diff --git a/tests/ui/feature-gates/feature-gate-asm_const.stderr b/tests/ui/feature-gates/feature-gate-asm_const.stderr deleted file mode 100644 index 4f83fee6759..00000000000 --- a/tests/ui/feature-gates/feature-gate-asm_const.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0658]: const operands for inline assembly are unstable - --> $DIR/feature-gate-asm_const.rs:6:25 - | -LL | asm!("mov eax, {}", const N + 1); - | ^^^^^^^^^^^ - | - = note: see issue #93332 <https://github.com/rust-lang/rust/issues/93332> for more information - = help: add `#![feature(asm_const)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: const operands for inline assembly are unstable - --> $DIR/feature-gate-asm_const.rs:13:29 - | -LL | asm!("mov eax, {}", const 123); - | ^^^^^^^^^ - | - = note: see issue #93332 <https://github.com/rust-lang/rust/issues/93332> for more information - = help: add `#![feature(asm_const)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-const-arg-path.rs b/tests/ui/feature-gates/feature-gate-const-arg-path.rs new file mode 100644 index 00000000000..0938c5733a2 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-const-arg-path.rs @@ -0,0 +1,5 @@ +//@ check-pass + +// this doesn't really have any user facing impact.... + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-derive-smart-pointer.rs b/tests/ui/feature-gates/feature-gate-derive-smart-pointer.rs index 3257a9ca624..7b4764ee768 100644 --- a/tests/ui/feature-gates/feature-gate-derive-smart-pointer.rs +++ b/tests/ui/feature-gates/feature-gate-derive-smart-pointer.rs @@ -3,7 +3,6 @@ use std::marker::SmartPointer; //~ ERROR use of unstable library feature 'derive #[derive(SmartPointer)] //~ ERROR use of unstable library feature 'derive_smart_pointer' #[repr(transparent)] struct MyPointer<'a, #[pointee] T: ?Sized> { - //~^ ERROR the `#[pointee]` attribute is an experimental feature ptr: &'a T, } diff --git a/tests/ui/feature-gates/feature-gate-derive-smart-pointer.stderr b/tests/ui/feature-gates/feature-gate-derive-smart-pointer.stderr index 19501939dc5..ea4d1271b7c 100644 --- a/tests/ui/feature-gates/feature-gate-derive-smart-pointer.stderr +++ b/tests/ui/feature-gates/feature-gate-derive-smart-pointer.stderr @@ -8,16 +8,6 @@ LL | #[derive(SmartPointer)] = help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error[E0658]: the `#[pointee]` attribute is an experimental feature - --> $DIR/feature-gate-derive-smart-pointer.rs:5:22 - | -LL | struct MyPointer<'a, #[pointee] T: ?Sized> { - | ^^^^^^^^^^ - | - = note: see issue #123430 <https://github.com/rust-lang/rust/issues/123430> for more information - = help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: use of unstable library feature 'derive_smart_pointer' --> $DIR/feature-gate-derive-smart-pointer.rs:1:5 | @@ -28,6 +18,6 @@ LL | use std::marker::SmartPointer; = help: add `#![feature(derive_smart_pointer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-fmt-debug.rs b/tests/ui/feature-gates/feature-gate-fmt-debug.rs new file mode 100644 index 00000000000..f30befbd19c --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-fmt-debug.rs @@ -0,0 +1,5 @@ +#[cfg(fmt_debug = "full")] +//~^ ERROR is experimental +fn main() { + +} diff --git a/tests/ui/feature-gates/feature-gate-fmt-debug.stderr b/tests/ui/feature-gates/feature-gate-fmt-debug.stderr new file mode 100644 index 00000000000..9ced0b8facf --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-fmt-debug.stderr @@ -0,0 +1,13 @@ +error[E0658]: `cfg(fmt_debug)` is experimental and subject to change + --> $DIR/feature-gate-fmt-debug.rs:1:7 + | +LL | #[cfg(fmt_debug = "full")] + | ^^^^^^^^^^^^^^^^^^ + | + = note: see issue #129709 <https://github.com/rust-lang/rust/issues/129709> for more information + = help: add `#![feature(fmt_debug)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-lifetime-capture-rules-2024.stderr b/tests/ui/feature-gates/feature-gate-lifetime-capture-rules-2024.stderr index 173e3dc02cc..d0b18df6a5e 100644 --- a/tests/ui/feature-gates/feature-gate-lifetime-capture-rules-2024.stderr +++ b/tests/ui/feature-gates/feature-gate-lifetime-capture-rules-2024.stderr @@ -8,10 +8,10 @@ LL | fn foo(x: &Vec<i32>) -> impl Sized { LL | x | ^ | -help: to declare that `impl Sized` captures `'_`, you can add an explicit `'_` lifetime bound +help: add a `use<...>` bound to explicitly capture `'_` | -LL | fn foo(x: &Vec<i32>) -> impl Sized + '_ { - | ++++ +LL | fn foo(x: &Vec<i32>) -> impl Sized + use<'_> { + | +++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-precise-capturing.rs b/tests/ui/feature-gates/feature-gate-precise-capturing.rs deleted file mode 100644 index 47a21539d37..00000000000 --- a/tests/ui/feature-gates/feature-gate-precise-capturing.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn hello() -> impl Sized + use<> {} -//~^ ERROR precise captures on `impl Trait` are experimental - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-precise-capturing.stderr b/tests/ui/feature-gates/feature-gate-precise-capturing.stderr deleted file mode 100644 index 04365408880..00000000000 --- a/tests/ui/feature-gates/feature-gate-precise-capturing.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0658]: precise captures on `impl Trait` are experimental - --> $DIR/feature-gate-precise-capturing.rs:1:28 - | -LL | fn hello() -> impl Sized + use<> {} - | ^^^ - | - = note: see issue #123432 <https://github.com/rust-lang/rust/issues/123432> for more information - = help: add `#![feature(precise_capturing)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-repr-simd.stderr b/tests/ui/feature-gates/feature-gate-repr-simd.stderr index 5b490c0c0c3..5a0ceb2dd74 100644 --- a/tests/ui/feature-gates/feature-gate-repr-simd.stderr +++ b/tests/ui/feature-gates/feature-gate-repr-simd.stderr @@ -35,3 +35,17 @@ error: aborting due to 3 previous errors Some errors have detailed explanations: E0566, E0658. For more information about an error, try `rustc --explain E0566`. +Future incompatibility report: Future breakage diagnostic: +error[E0566]: conflicting representation hints + --> $DIR/feature-gate-repr-simd.rs:4:8 + | +LL | #[repr(C)] + | ^ +LL | +LL | #[repr(simd)] + | ^^^^ + | + = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> + = note: `#[deny(conflicting_repr_hints)]` on by default + diff --git a/tests/ui/feature-gates/feature-gate-unsafe-attributes.rs b/tests/ui/feature-gates/feature-gate-unsafe-attributes.rs deleted file mode 100644 index 9eba415dda0..00000000000 --- a/tests/ui/feature-gates/feature-gate-unsafe-attributes.rs +++ /dev/null @@ -1,8 +0,0 @@ -#[unsafe(no_mangle)] //~ ERROR [E0658] -extern "C" fn foo() { - -} - -fn main() { - foo(); -} diff --git a/tests/ui/feature-gates/feature-gate-unsafe-attributes.stderr b/tests/ui/feature-gates/feature-gate-unsafe-attributes.stderr deleted file mode 100644 index dfcea756b02..00000000000 --- a/tests/ui/feature-gates/feature-gate-unsafe-attributes.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0658]: `#[unsafe()]` markers for attributes are experimental - --> $DIR/feature-gate-unsafe-attributes.rs:1:3 - | -LL | #[unsafe(no_mangle)] - | ^^^^^^ - | - = note: see issue #123757 <https://github.com/rust-lang/rust/issues/123757> for more information - = help: add `#![feature(unsafe_attributes)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/fmt/fmt_debug/full.rs b/tests/ui/fmt/fmt_debug/full.rs new file mode 100644 index 00000000000..4e9384d2c52 --- /dev/null +++ b/tests/ui/fmt/fmt_debug/full.rs @@ -0,0 +1,15 @@ +//@ compile-flags: -Zfmt-debug=full +//@ run-pass +#![feature(fmt_debug)] +#![allow(dead_code)] +#![allow(unused)] + +#[derive(Debug)] +struct Foo { + bar: u32, +} + +fn main() { + let s = format!("Still works: {:?} '{:?}'", cfg!(fmt_debug = "full"), Foo { bar: 1 }); + assert_eq!("Still works: true 'Foo { bar: 1 }'", s); +} diff --git a/tests/ui/fmt/fmt_debug/invalid.rs b/tests/ui/fmt/fmt_debug/invalid.rs new file mode 100644 index 00000000000..09cb46f1ea6 --- /dev/null +++ b/tests/ui/fmt/fmt_debug/invalid.rs @@ -0,0 +1,4 @@ +//@ compile-flags: -Zfmt-debug=invalid-value +//@ failure-status: 1 +fn main() { +} diff --git a/tests/ui/fmt/fmt_debug/invalid.stderr b/tests/ui/fmt/fmt_debug/invalid.stderr new file mode 100644 index 00000000000..fa6c9380744 --- /dev/null +++ b/tests/ui/fmt/fmt_debug/invalid.stderr @@ -0,0 +1,2 @@ +error: incorrect value `invalid-value` for unstable option `fmt-debug` - either `full`, `shallow`, or `none` was expected + diff --git a/tests/ui/fmt/fmt_debug/none.rs b/tests/ui/fmt/fmt_debug/none.rs new file mode 100644 index 00000000000..f45d37d9da2 --- /dev/null +++ b/tests/ui/fmt/fmt_debug/none.rs @@ -0,0 +1,37 @@ +//@ compile-flags: -Zfmt-debug=none +//@ run-pass +#![feature(fmt_debug)] +#![allow(dead_code)] +#![allow(unused)] + +#[derive(Debug)] +struct Foo { + bar: u32, +} + +#[derive(Debug)] +enum Baz { + Quz, +} + +#[cfg(fmt_debug = "full")] +compile_error!("nope"); + +#[cfg(fmt_debug = "none")] +struct Custom; + +impl std::fmt::Debug for Custom { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("custom_fmt") + } +} + +fn main() { + let c = Custom; + let s = format!("Debug is '{:?}', '{:#?}', and '{c:?}'", Foo { bar: 1 }, Baz::Quz); + assert_eq!("Debug is '', '', and ''", s); + + let f = 3.0; + let s = format_args!("{:?}x{:#?}y{f:?}", 1234, "can't debug this").to_string(); + assert_eq!("xy", s); +} diff --git a/tests/ui/fmt/fmt_debug/shallow.rs b/tests/ui/fmt/fmt_debug/shallow.rs new file mode 100644 index 00000000000..479cd1b8875 --- /dev/null +++ b/tests/ui/fmt/fmt_debug/shallow.rs @@ -0,0 +1,33 @@ +//@ compile-flags: -Zfmt-debug=shallow +//@ run-pass +#![feature(fmt_debug)] +#![allow(dead_code)] +#![allow(unused)] + +#[derive(Debug)] +struct Foo { + bar: u32, + bomb: Bomb, +} + +#[derive(Debug)] +enum Baz { + Quz, +} + +struct Bomb; + +impl std::fmt::Debug for Bomb { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + panic!() + } +} + +fn main() { + let s = format!("Debug is '{:?}' and '{:#?}'", Foo { bar: 1, bomb: Bomb }, Baz::Quz); + assert_eq!("Debug is 'Foo' and 'Quz'", s); + + let f = 3.0; + let s = format_args!("{:?}{:#?}{f:?}", 1234, cfg!(fmt_debug = "shallow")).to_string(); + assert_eq!("1234true3.0", s); +} diff --git a/tests/ui/foreign/foreign-safe-fn-arg-mismatch.rs b/tests/ui/foreign/foreign-safe-fn-arg-mismatch.rs new file mode 100644 index 00000000000..bb1052b15e9 --- /dev/null +++ b/tests/ui/foreign/foreign-safe-fn-arg-mismatch.rs @@ -0,0 +1,13 @@ +// Make sure we don't ICE when a foreign fn doesn't implement `Fn` due to arg mismatch. + +unsafe extern "Rust" { + pub safe fn foo(); + pub safe fn bar(x: u32); +} + +fn test(_: impl Fn(i32)) {} + +fn main() { + test(foo); //~ ERROR function is expected to take 1 argument, but it takes 0 arguments + test(bar); //~ ERROR type mismatch in function arguments +} diff --git a/tests/ui/foreign/foreign-safe-fn-arg-mismatch.stderr b/tests/ui/foreign/foreign-safe-fn-arg-mismatch.stderr new file mode 100644 index 00000000000..73ccecff5ab --- /dev/null +++ b/tests/ui/foreign/foreign-safe-fn-arg-mismatch.stderr @@ -0,0 +1,44 @@ +error[E0593]: function is expected to take 1 argument, but it takes 0 arguments + --> $DIR/foreign-safe-fn-arg-mismatch.rs:11:10 + | +LL | pub safe fn foo(); + | ------------------ takes 0 arguments +... +LL | test(foo); + | ---- ^^^ expected function that takes 1 argument + | | + | required by a bound introduced by this call + | +note: required by a bound in `test` + --> $DIR/foreign-safe-fn-arg-mismatch.rs:8:17 + | +LL | fn test(_: impl Fn(i32)) {} + | ^^^^^^^ required by this bound in `test` + +error[E0631]: type mismatch in function arguments + --> $DIR/foreign-safe-fn-arg-mismatch.rs:12:10 + | +LL | pub safe fn bar(x: u32); + | ------------------------ found signature defined here +... +LL | test(bar); + | ---- ^^^ expected due to this + | | + | required by a bound introduced by this call + | + = note: expected function signature `fn(i32) -> _` + found function signature `fn(u32) -> _` +note: required by a bound in `test` + --> $DIR/foreign-safe-fn-arg-mismatch.rs:8:17 + | +LL | fn test(_: impl Fn(i32)) {} + | ^^^^^^^ required by this bound in `test` +help: consider wrapping the function in a closure + | +LL | test(|arg0: i32| bar(/* u32 */)); + | +++++++++++ +++++++++++ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0593, E0631. +For more information about an error, try `rustc --explain E0593`. diff --git a/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr b/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr index d1decc0c3f1..37491ca12b0 100644 --- a/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr +++ b/tests/ui/generic-associated-types/gat-in-trait-path.base.stderr @@ -51,7 +51,7 @@ LL | type A<'a> where Self: 'a; = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `Foo` for this new enum and using it instead: Fooy Fooer<T> - = note: required for the cast from `Box<Fooer<{integer}>>` to `Box<(dyn Foo<A = &'a ()> + 'static)>` + = note: required for the cast from `Box<Fooer<{integer}>>` to `Box<(dyn Foo<A<'a> = &'a ()> + 'static)>` error: aborting due to 3 previous errors diff --git a/tests/ui/generic-associated-types/issue-76535.base.stderr b/tests/ui/generic-associated-types/issue-76535.base.stderr index bb14e297174..88c08051da7 100644 --- a/tests/ui/generic-associated-types/issue-76535.base.stderr +++ b/tests/ui/generic-associated-types/issue-76535.base.stderr @@ -47,7 +47,7 @@ LL | type SubType<'a>: SubTrait where Self: 'a; = help: consider moving `SubType` to another trait = help: only type `SuperStruct` is seen to implement the trait in this crate, consider using it directly instead = note: `SuperTrait` can be implemented in other crates; if you want to support your users passing their own types here, you can't refer to a specific type - = note: required for the cast from `Box<SuperStruct>` to `Box<dyn SuperTrait<SubType = SubStruct<'_>>>` + = note: required for the cast from `Box<SuperStruct>` to `Box<dyn SuperTrait<SubType<'_> = SubStruct<'_>>>` error: aborting due to 3 previous errors diff --git a/tests/ui/generic-associated-types/issue-79422.base.stderr b/tests/ui/generic-associated-types/issue-79422.base.stderr index bcc6382cf7c..551ad2a8fdf 100644 --- a/tests/ui/generic-associated-types/issue-79422.base.stderr +++ b/tests/ui/generic-associated-types/issue-79422.base.stderr @@ -49,7 +49,7 @@ LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a; = help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `MapLike` for this new enum and using it instead: std::collections::BTreeMap<K, V> Source - = note: required for the cast from `Box<BTreeMap<u8, u8>>` to `Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>` + = note: required for the cast from `Box<BTreeMap<u8, u8>>` to `Box<dyn MapLike<u8, u8, VRefCont<'_> = (dyn RefCont<'_, u8> + 'static)>>` error: aborting due to 3 previous errors diff --git a/tests/ui/generic-associated-types/issue-79422.extended.stderr b/tests/ui/generic-associated-types/issue-79422.extended.stderr index ae1526296a7..031f8d8d851 100644 --- a/tests/ui/generic-associated-types/issue-79422.extended.stderr +++ b/tests/ui/generic-associated-types/issue-79422.extended.stderr @@ -28,7 +28,7 @@ LL | type VRefCont<'a> = &'a V where Self: 'a; = note: expected trait object `(dyn RefCont<'_, u8> + 'static)` found reference `&u8` = help: `&u8` implements `RefCont` so you could box the found value and coerce it to the trait object `Box<dyn RefCont>`, you will have to change the expected type as well - = note: required for the cast from `Box<BTreeMap<u8, u8>>` to `Box<dyn MapLike<u8, u8, VRefCont = (dyn RefCont<'_, u8> + 'static)>>` + = note: required for the cast from `Box<BTreeMap<u8, u8>>` to `Box<dyn MapLike<u8, u8, VRefCont<'_> = (dyn RefCont<'_, u8> + 'static)>>` error: aborting due to 2 previous errors diff --git a/tests/ui/generics/generic-no-mangle.fixed b/tests/ui/generics/generic-no-mangle.fixed index 69db712f9dc..2776848c45f 100644 --- a/tests/ui/generics/generic-no-mangle.fixed +++ b/tests/ui/generics/generic-no-mangle.fixed @@ -1,5 +1,5 @@ //@ run-rustfix -#![allow(dead_code)] +#![allow(dead_code, elided_named_lifetimes)] #![deny(no_mangle_generic_items)] pub fn foo<T>() {} //~ ERROR functions generic over types or consts must be mangled diff --git a/tests/ui/generics/generic-no-mangle.rs b/tests/ui/generics/generic-no-mangle.rs index 2288b5bbe70..5314005d31f 100644 --- a/tests/ui/generics/generic-no-mangle.rs +++ b/tests/ui/generics/generic-no-mangle.rs @@ -1,5 +1,5 @@ //@ run-rustfix -#![allow(dead_code)] +#![allow(dead_code, elided_named_lifetimes)] #![deny(no_mangle_generic_items)] #[no_mangle] diff --git a/tests/ui/higher-ranked/subtyping-fn-ptr-coercion.rs b/tests/ui/higher-ranked/subtyping-fn-ptr-coercion.rs new file mode 100644 index 00000000000..0cecf6808f2 --- /dev/null +++ b/tests/ui/higher-ranked/subtyping-fn-ptr-coercion.rs @@ -0,0 +1,10 @@ +//@ check-pass + +// Check that we use subtyping when reifying a closure into a function pointer. + +fn foo(x: &str) {} + +fn main() { + let c = |_: &str| {}; + let x = c as fn(&'static str); +} diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr index 825682c52f9..a2d00edbb6d 100644 --- a/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr +++ b/tests/ui/impl-trait/alias-liveness/rpit-hidden-erased-unsoundness.stderr @@ -8,10 +8,10 @@ LL | fn step2<'a, 'b: 'a>() -> impl Sized + 'a { LL | step1::<'a, 'b>() | ^^^^^^^^^^^^^^^^^ | -help: to declare that `impl Sized + 'a` captures `'b`, you can add an explicit `'b` lifetime bound +help: add a `use<...>` bound to explicitly capture `'b` | -LL | fn step2<'a, 'b: 'a>() -> impl Sized + 'a + 'b { - | ++++ +LL | fn step2<'a, 'b: 'a>() -> impl Sized + 'a + use<'a, 'b> { + | +++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr index b87e31acc12..a1e92e53384 100644 --- a/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr +++ b/tests/ui/impl-trait/alias-liveness/rpit-hide-lifetime-for-swap.stderr @@ -8,10 +8,10 @@ LL | fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a { LL | x | ^ | -help: to declare that `impl Swap + 'a` captures `'b`, you can add an explicit `'b` lifetime bound +help: add a `use<...>` bound to explicitly capture `'b` | -LL | fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a + 'b { - | ++++ +LL | fn hide<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a + use<'a, 'b, T> { + | ++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/call_method_ambiguous.next.stderr b/tests/ui/impl-trait/call_method_ambiguous.next.stderr index a1f9a8b40a8..5251555f574 100644 --- a/tests/ui/impl-trait/call_method_ambiguous.next.stderr +++ b/tests/ui/impl-trait/call_method_ambiguous.next.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/call_method_ambiguous.rs:28:13 + --> $DIR/call_method_ambiguous.rs:26:13 | LL | let mut iter = foo(n - 1, m); | ^^^^^^^^ diff --git a/tests/ui/impl-trait/call_method_ambiguous.rs b/tests/ui/impl-trait/call_method_ambiguous.rs index 4dac605d6b8..8fd6f727b73 100644 --- a/tests/ui/impl-trait/call_method_ambiguous.rs +++ b/tests/ui/impl-trait/call_method_ambiguous.rs @@ -2,8 +2,6 @@ //@[next] compile-flags: -Znext-solver //@[current] run-pass -#![feature(precise_capturing)] - trait Get { fn get(&mut self) -> u32; } diff --git a/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs b/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs index 9c067cb6934..2fde0f200c0 100644 --- a/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs +++ b/tests/ui/impl-trait/capture-lifetime-not-in-hir.rs @@ -6,13 +6,13 @@ trait Bar<'a> { } fn foo<'a, T: Bar<'a>>() -> impl Into<T::Assoc> { - //~^ ERROR [o, o] + //~^ ERROR ['a: o, T: o] // captures both T and 'a invariantly () } fn foo2<'a, T: Bar<'a>>() -> impl Into<T::Assoc> + 'a { - //~^ ERROR [o, o, o] + //~^ ERROR ['a: o, T: o, 'a: o] // captures both T and 'a invariantly, and also duplicates `'a` // i.e. the opaque looks like `impl Into<<T as Bar<'a>>::Assoc> + 'a_duplicated` () diff --git a/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr b/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr index 9d52001b024..fe8a2772a00 100644 --- a/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr +++ b/tests/ui/impl-trait/capture-lifetime-not-in-hir.stderr @@ -1,10 +1,10 @@ -error: [o, o] +error: ['a: o, T: o] --> $DIR/capture-lifetime-not-in-hir.rs:8:29 | LL | fn foo<'a, T: Bar<'a>>() -> impl Into<T::Assoc> { | ^^^^^^^^^^^^^^^^^^^ -error: [o, o, o] +error: ['a: o, T: o, 'a: o] --> $DIR/capture-lifetime-not-in-hir.rs:14:30 | LL | fn foo2<'a, T: Bar<'a>>() -> impl Into<T::Assoc> + 'a { diff --git a/tests/ui/impl-trait/hidden-lifetimes.stderr b/tests/ui/impl-trait/hidden-lifetimes.stderr index bc8f559fdee..70d8c816ecb 100644 --- a/tests/ui/impl-trait/hidden-lifetimes.stderr +++ b/tests/ui/impl-trait/hidden-lifetimes.stderr @@ -8,10 +8,10 @@ LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a { LL | x | ^ | -help: to declare that `impl Swap + 'a` captures `'b`, you can add an explicit `'b` lifetime bound +help: add a `use<...>` bound to explicitly capture `'b` | -LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a + 'b { - | ++++ +LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a + use<'a, 'b, T> { + | ++++++++++++++++ error[E0700]: hidden type for `impl Swap + 'a` captures lifetime that does not appear in bounds --> $DIR/hidden-lifetimes.rs:46:5 @@ -23,10 +23,10 @@ LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl S LL | x | ^ | -help: to declare that `impl Swap + 'a` captures `'b`, you can add an explicit `'b` lifetime bound +help: add a `use<...>` bound to explicitly capture `'b` | -LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a + 'b { - | ++++ +LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc<RefCell<&'b T>>) -> impl Swap + 'a + use<'a, 'b, T> { + | ++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds.rs b/tests/ui/impl-trait/impl-fn-hrtb-bounds.rs index da7530b4e7a..a7f38b5c16a 100644 --- a/tests/ui/impl-trait/impl-fn-hrtb-bounds.rs +++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds.rs @@ -13,6 +13,7 @@ fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) { fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) { //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` + //~| WARNING elided lifetime has a name |x| x } diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr index 7d108b30b76..d0f8f7689d1 100644 --- a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr +++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/impl-fn-hrtb-bounds.rs:19:38 + --> $DIR/impl-fn-hrtb-bounds.rs:20:38 | LL | fn d() -> impl Fn() -> (impl Debug + '_) { | ^^ expected named lifetime parameter @@ -10,6 +10,14 @@ help: consider using the `'static` lifetime, but this is uncommon unless you're LL | fn d() -> impl Fn() -> (impl Debug + 'static) { | ~~~~~~~ +warning: elided lifetime has a name + --> $DIR/impl-fn-hrtb-bounds.rs:14:52 + | +LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) { + | -- lifetime `'a` declared here ^^ this elided lifetime gets resolved as `'a` + | + = note: `#[warn(elided_named_lifetimes)]` on by default + error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait` --> $DIR/impl-fn-hrtb-bounds.rs:4:41 | @@ -46,7 +54,7 @@ note: lifetime declared here LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) { | ^^ -error: aborting due to 4 previous errors +error: aborting due to 4 previous errors; 1 warning emitted Some errors have detailed explanations: E0106, E0657. For more information about an error, try `rustc --explain E0106`. diff --git a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs index 8aba3de530b..2f17c0ff508 100644 --- a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs +++ b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs @@ -3,6 +3,7 @@ use std::fmt::Debug; fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) { //~^ ERROR cannot resolve opaque type + //~| WARNING elided lifetime has a name |x| x //~^ ERROR expected generic lifetime parameter, found `'_` } diff --git a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr index c2386e8c88b..50a9f3ebeab 100644 --- a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr +++ b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr @@ -1,9 +1,17 @@ +warning: elided lifetime has a name + --> $DIR/impl-fn-predefined-lifetimes.rs:4:48 + | +LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) { + | -- lifetime `'a` declared here ^^ this elided lifetime gets resolved as `'a` + | + = note: `#[warn(elided_named_lifetimes)]` on by default + error[E0792]: expected generic lifetime parameter, found `'_` - --> $DIR/impl-fn-predefined-lifetimes.rs:6:9 + --> $DIR/impl-fn-predefined-lifetimes.rs:7:9 | LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) { | -- this generic parameter must be used with a generic lifetime parameter -LL | +... LL | |x| x | ^ @@ -13,7 +21,7 @@ error[E0720]: cannot resolve opaque type LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) { | ^^^^^^^^^^^^^^^ cannot resolve opaque type -error: aborting due to 2 previous errors +error: aborting due to 2 previous errors; 1 warning emitted Some errors have detailed explanations: E0720, E0792. For more information about an error, try `rustc --explain E0720`. diff --git a/tests/ui/impl-trait/implicit-capture-late.stderr b/tests/ui/impl-trait/implicit-capture-late.stderr index 080750f8497..3adf78322d2 100644 --- a/tests/ui/impl-trait/implicit-capture-late.stderr +++ b/tests/ui/impl-trait/implicit-capture-late.stderr @@ -10,7 +10,7 @@ note: lifetime declared here LL | fn foo(x: Vec<i32>) -> Box<dyn for<'a> Deref<Target = impl ?Sized>> { | ^^ -error: [o] +error: ['a: o] --> $DIR/implicit-capture-late.rs:10:55 | LL | fn foo(x: Vec<i32>) -> Box<dyn for<'a> Deref<Target = impl ?Sized>> { diff --git a/tests/ui/impl-trait/in-trait/cannot-capture-intersection.rs b/tests/ui/impl-trait/in-trait/cannot-capture-intersection.rs index d7b62436d2d..e00214fe8e0 100644 --- a/tests/ui/impl-trait/in-trait/cannot-capture-intersection.rs +++ b/tests/ui/impl-trait/in-trait/cannot-capture-intersection.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - use std::future::Future; use std::pin::Pin; diff --git a/tests/ui/impl-trait/in-trait/cannot-capture-intersection.stderr b/tests/ui/impl-trait/in-trait/cannot-capture-intersection.stderr index 92ef66c5504..a8f5bfc94c1 100644 --- a/tests/ui/impl-trait/in-trait/cannot-capture-intersection.stderr +++ b/tests/ui/impl-trait/in-trait/cannot-capture-intersection.stderr @@ -1,5 +1,5 @@ error[E0700]: hidden type for `impl Future<Output = i32>` captures lifetime that does not appear in bounds - --> $DIR/cannot-capture-intersection.rs:24:9 + --> $DIR/cannot-capture-intersection.rs:22:9 | LL | fn foo<'a, 'b>(&'a self, x: &'b i32) -> impl Future<Output = i32> { | ------------------------- opaque type defined here diff --git a/tests/ui/impl-trait/in-trait/refine-err.rs b/tests/ui/impl-trait/in-trait/refine-err.rs new file mode 100644 index 00000000000..7518cee97c4 --- /dev/null +++ b/tests/ui/impl-trait/in-trait/refine-err.rs @@ -0,0 +1,14 @@ +#![deny(refining_impl_trait)] + +trait FromRow { + fn prepare(self) -> impl Fn() -> T; + //~^ ERROR cannot find type `T` in this scope +} + +impl<T> FromRow for T { + fn prepare(self) -> impl Fn() -> T { + || todo!() + } +} + +fn main() {} diff --git a/tests/ui/impl-trait/in-trait/refine-err.stderr b/tests/ui/impl-trait/in-trait/refine-err.stderr new file mode 100644 index 00000000000..6b4ef74d50a --- /dev/null +++ b/tests/ui/impl-trait/in-trait/refine-err.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `T` in this scope + --> $DIR/refine-err.rs:4:38 + | +LL | fn prepare(self) -> impl Fn() -> T; + | ^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs index 7a51037324f..ab21dae7dc5 100644 --- a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs +++ b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.rs @@ -14,7 +14,6 @@ impl<'a, I: 'a + Iterable> Iterable for &'a I { //~^ ERROR binding for associated type `Item` references lifetime `'missing` //~| ERROR binding for associated type `Item` references lifetime `'missing` //~| ERROR `()` is not an iterator - //~| WARNING impl trait in impl method signature does not match trait method signature } fn main() {} diff --git a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr index 67c4df0f3a9..d8a2eef94a1 100644 --- a/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr +++ b/tests/ui/impl-trait/in-trait/span-bug-issue-121457.stderr @@ -32,24 +32,7 @@ LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missin | = help: the trait `Iterator` is not implemented for `()` -warning: impl trait in impl method signature does not match trait method signature - --> $DIR/span-bug-issue-121457.rs:13:51 - | -LL | fn iter(&self) -> impl Iterator; - | ------------- return type from trait method defined here -... -LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missing>> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this bound is stronger than that defined on the trait - | - = note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate - = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information - = note: `#[warn(refining_impl_trait_reachable)]` on by default -help: replace the return type so that it matches the trait - | -LL | fn iter(&self) -> impl Iterator {} - | ~~~~~~~~~~~~~ - -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 4 previous errors Some errors have detailed explanations: E0195, E0277, E0582. For more information about an error, try `rustc --explain E0195`. diff --git a/tests/ui/impl-trait/in-trait/variance.rs b/tests/ui/impl-trait/in-trait/variance.rs index 65565dcc2a6..0ac44bf7546 100644 --- a/tests/ui/impl-trait/in-trait/variance.rs +++ b/tests/ui/impl-trait/in-trait/variance.rs @@ -7,14 +7,16 @@ impl<T> Captures<'_> for T {} trait Foo<'i> { fn implicit_capture_early<'a: 'a>() -> impl Sized {} - //~^ [o, *, *, o, o] - // Self, 'i, 'a, 'i_duplicated, 'a_duplicated + //~^ [Self: o, 'i: *, 'a: *, 'a: o, 'i: o] - fn explicit_capture_early<'a: 'a>() -> impl Sized + Captures<'a> {} //~ [o, *, *, o, o] + fn explicit_capture_early<'a: 'a>() -> impl Sized + Captures<'a> {} + //~^ [Self: o, 'i: *, 'a: *, 'a: o, 'i: o] - fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {} //~ [o, *, o, o] + fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {} + //~^ [Self: o, 'i: *, 'a: o, 'i: o] - fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} //~ [o, *, o, o] + fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} + //~^ [Self: o, 'i: *, 'a: o, 'i: o] } fn main() {} diff --git a/tests/ui/impl-trait/in-trait/variance.stderr b/tests/ui/impl-trait/in-trait/variance.stderr index 8cae5a92f0d..54e0afbaa95 100644 --- a/tests/ui/impl-trait/in-trait/variance.stderr +++ b/tests/ui/impl-trait/in-trait/variance.stderr @@ -1,23 +1,23 @@ -error: [o, *, *, o, o] +error: [Self: o, 'i: *, 'a: *, 'a: o, 'i: o] --> $DIR/variance.rs:9:44 | LL | fn implicit_capture_early<'a: 'a>() -> impl Sized {} | ^^^^^^^^^^ -error: [o, *, *, o, o] - --> $DIR/variance.rs:13:44 +error: [Self: o, 'i: *, 'a: *, 'a: o, 'i: o] + --> $DIR/variance.rs:12:44 | LL | fn explicit_capture_early<'a: 'a>() -> impl Sized + Captures<'a> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [o, *, o, o] +error: [Self: o, 'i: *, 'a: o, 'i: o] --> $DIR/variance.rs:15:48 | LL | fn implicit_capture_late<'a>(_: &'a ()) -> impl Sized {} | ^^^^^^^^^^ -error: [o, *, o, o] - --> $DIR/variance.rs:17:48 +error: [Self: o, 'i: *, 'a: o, 'i: o] + --> $DIR/variance.rs:18:48 | LL | fn explicit_capture_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr index 273f51ddbe3..f620bf6dc38 100644 --- a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr +++ b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr @@ -7,10 +7,10 @@ LL | fn elided(x: &i32) -> impl Copy { x } | | opaque type defined here | hidden type `&i32` captures the anonymous lifetime defined here | -help: to declare that `impl Copy` captures `'_`, you can add an explicit `'_` lifetime bound +help: add a `use<...>` bound to explicitly capture `'_` | -LL | fn elided(x: &i32) -> impl Copy + '_ { x } - | ++++ +LL | fn elided(x: &i32) -> impl Copy + use<'_> { x } + | +++++++++ error[E0700]: hidden type for `impl Copy` captures lifetime that does not appear in bounds --> $DIR/must_outlive_least_region_or_bound.rs:6:44 @@ -21,10 +21,10 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } | | opaque type defined here | hidden type `&'a i32` captures the lifetime `'a` as defined here | -help: to declare that `impl Copy` captures `'a`, you can add an explicit `'a` lifetime bound +help: add a `use<...>` bound to explicitly capture `'a` | -LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x } - | ++++ +LL | fn explicit<'a>(x: &'a i32) -> impl Copy + use<'a> { x } + | +++++++++ error: lifetime may not live long enough --> $DIR/must_outlive_least_region_or_bound.rs:9:46 @@ -108,10 +108,10 @@ LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32 LL | move |_| println!("{}", y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: to declare that `impl Fn(&'a u32)` captures `'b`, you can add an explicit `'b` lifetime bound +help: add a `use<...>` bound to explicitly capture `'b` | -LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) + 'b { - | ++++ +LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) + use<'a, 'b> { + | +++++++++++++ error[E0310]: the parameter type `T` may not live long enough --> $DIR/must_outlive_least_region_or_bound.rs:47:5 diff --git a/tests/ui/impl-trait/nested-return-type4.stderr b/tests/ui/impl-trait/nested-return-type4.stderr index f1e3b97be02..407800eff18 100644 --- a/tests/ui/impl-trait/nested-return-type4.stderr +++ b/tests/ui/impl-trait/nested-return-type4.stderr @@ -8,14 +8,10 @@ LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized 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 +help: add a `use<...>` bound to explicitly capture `'s` | -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> { - | ++++ +LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future<Output = impl Sized> + use<'s> { + | +++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/precise-capturing/apit.rs b/tests/ui/impl-trait/precise-capturing/apit.rs index 64c15d6df96..447d8fdf2cd 100644 --- a/tests/ui/impl-trait/precise-capturing/apit.rs +++ b/tests/ui/impl-trait/precise-capturing/apit.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - fn hello(_: impl Sized + use<>) {} //~^ ERROR `use<...>` precise capturing syntax not allowed in argument-position `impl Trait` diff --git a/tests/ui/impl-trait/precise-capturing/apit.stderr b/tests/ui/impl-trait/precise-capturing/apit.stderr index 1d6225a1ff8..7573e0838ab 100644 --- a/tests/ui/impl-trait/precise-capturing/apit.stderr +++ b/tests/ui/impl-trait/precise-capturing/apit.stderr @@ -1,5 +1,5 @@ error: `use<...>` precise capturing syntax not allowed in argument-position `impl Trait` - --> $DIR/apit.rs:3:26 + --> $DIR/apit.rs:1:26 | LL | fn hello(_: impl Sized + use<>) {} | ^^^^^ diff --git a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.rs b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.rs index d2d4570c570..161fe23c899 100644 --- a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.rs +++ b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - fn no_elided_lt() -> impl Sized + use<'_> {} //~^ ERROR missing lifetime specifier //~| ERROR expected lifetime parameter in `use<...>` precise captures list, found `'_` diff --git a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr index 550996ab5e5..a8acecf10c7 100644 --- a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr +++ b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/bad-lifetimes.rs:3:39 + --> $DIR/bad-lifetimes.rs:1:39 | LL | fn no_elided_lt() -> impl Sized + use<'_> {} | ^^ expected named lifetime parameter @@ -11,7 +11,7 @@ LL | fn no_elided_lt() -> impl Sized + use<'static> {} | ~~~~~~~ error[E0261]: use of undeclared lifetime name `'missing` - --> $DIR/bad-lifetimes.rs:10:37 + --> $DIR/bad-lifetimes.rs:8:37 | LL | fn missing_lt() -> impl Sized + use<'missing> {} | - ^^^^^^^^ undeclared lifetime @@ -19,13 +19,13 @@ LL | fn missing_lt() -> impl Sized + use<'missing> {} | help: consider introducing lifetime `'missing` here: `<'missing>` error: expected lifetime parameter in `use<...>` precise captures list, found `'_` - --> $DIR/bad-lifetimes.rs:3:39 + --> $DIR/bad-lifetimes.rs:1:39 | LL | fn no_elided_lt() -> impl Sized + use<'_> {} | ^^ error: expected lifetime parameter in `use<...>` precise captures list, found `'static` - --> $DIR/bad-lifetimes.rs:7:36 + --> $DIR/bad-lifetimes.rs:5:36 | LL | fn static_lt() -> impl Sized + use<'static> {} | ^^^^^^^ diff --git a/tests/ui/impl-trait/precise-capturing/bad-params.rs b/tests/ui/impl-trait/precise-capturing/bad-params.rs index 08eee67c0e5..17b517abd74 100644 --- a/tests/ui/impl-trait/precise-capturing/bad-params.rs +++ b/tests/ui/impl-trait/precise-capturing/bad-params.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - fn missing() -> impl Sized + use<T> {} //~^ ERROR cannot find type `T` in this scope diff --git a/tests/ui/impl-trait/precise-capturing/bad-params.stderr b/tests/ui/impl-trait/precise-capturing/bad-params.stderr index e104f115aa3..06ccf356948 100644 --- a/tests/ui/impl-trait/precise-capturing/bad-params.stderr +++ b/tests/ui/impl-trait/precise-capturing/bad-params.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `T` in this scope - --> $DIR/bad-params.rs:3:34 + --> $DIR/bad-params.rs:1:34 | LL | fn missing() -> impl Sized + use<T> {} | ^ not found in this scope @@ -10,7 +10,7 @@ LL | fn missing<T>() -> impl Sized + use<T> {} | +++ error[E0411]: cannot find type `Self` in this scope - --> $DIR/bad-params.rs:6:39 + --> $DIR/bad-params.rs:4:39 | LL | fn missing_self() -> impl Sized + use<Self> {} | ------------ ^^^^ `Self` is only available in impls, traits, and type definitions @@ -18,7 +18,7 @@ LL | fn missing_self() -> impl Sized + use<Self> {} | `Self` not allowed in a function error: `Self` can't be captured in `use<...>` precise captures list, since it is an alias - --> $DIR/bad-params.rs:11:48 + --> $DIR/bad-params.rs:9:48 | LL | impl MyType { | ----------- `Self` is not a generic argument, but an alias to the type of the implementation @@ -26,7 +26,7 @@ LL | fn self_is_not_param() -> impl Sized + use<Self> {} | ^^^^ error: expected type or const parameter in `use<...>` precise captures list, found function - --> $DIR/bad-params.rs:15:32 + --> $DIR/bad-params.rs:13:32 | LL | fn hello() -> impl Sized + use<hello> {} | ^^^^^ diff --git a/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs b/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs index 15f21882628..47695814668 100644 --- a/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs +++ b/tests/ui/impl-trait/precise-capturing/bound-modifiers.rs @@ -1,7 +1,5 @@ //@ edition: 2021 -#![feature(precise_capturing)] - fn polarity() -> impl Sized + ?use<> {} //~^ ERROR expected identifier, found keyword `use` //~| ERROR cannot find trait `r#use` in this scope diff --git a/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr b/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr index 4602225e7b9..aaebfe2a86e 100644 --- a/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr +++ b/tests/ui/impl-trait/precise-capturing/bound-modifiers.stderr @@ -1,53 +1,53 @@ error: expected identifier, found keyword `use` - --> $DIR/bound-modifiers.rs:5:32 + --> $DIR/bound-modifiers.rs:3:32 | LL | fn polarity() -> impl Sized + ?use<> {} | ^^^ expected identifier, found keyword error: expected identifier, found keyword `use` - --> $DIR/bound-modifiers.rs:11:38 + --> $DIR/bound-modifiers.rs:9:38 | LL | fn asyncness() -> impl Sized + async use<> {} | ^^^ expected identifier, found keyword error: expected identifier, found keyword `use` - --> $DIR/bound-modifiers.rs:16:38 + --> $DIR/bound-modifiers.rs:14:38 | LL | fn constness() -> impl Sized + const use<> {} | ^^^ expected identifier, found keyword error: expected identifier, found keyword `use` - --> $DIR/bound-modifiers.rs:21:37 + --> $DIR/bound-modifiers.rs:19:37 | LL | fn binder() -> impl Sized + for<'a> use<> {} | ^^^ expected identifier, found keyword error[E0405]: cannot find trait `r#use` in this scope - --> $DIR/bound-modifiers.rs:5:32 + --> $DIR/bound-modifiers.rs:3:32 | LL | fn polarity() -> impl Sized + ?use<> {} | ^^^ not found in this scope error[E0405]: cannot find trait `r#use` in this scope - --> $DIR/bound-modifiers.rs:11:38 + --> $DIR/bound-modifiers.rs:9:38 | LL | fn asyncness() -> impl Sized + async use<> {} | ^^^ not found in this scope error[E0405]: cannot find trait `r#use` in this scope - --> $DIR/bound-modifiers.rs:16:38 + --> $DIR/bound-modifiers.rs:14:38 | LL | fn constness() -> impl Sized + const use<> {} | ^^^ not found in this scope error[E0405]: cannot find trait `r#use` in this scope - --> $DIR/bound-modifiers.rs:21:37 + --> $DIR/bound-modifiers.rs:19:37 | LL | fn binder() -> impl Sized + for<'a> use<> {} | ^^^ not found in this scope error[E0658]: async closures are unstable - --> $DIR/bound-modifiers.rs:11:32 + --> $DIR/bound-modifiers.rs:9:32 | LL | fn asyncness() -> impl Sized + async use<> {} | ^^^^^ @@ -58,7 +58,7 @@ LL | fn asyncness() -> impl Sized + async use<> {} = help: to use an async block, remove the `||`: `async {` error[E0658]: const trait impls are experimental - --> $DIR/bound-modifiers.rs:16:32 + --> $DIR/bound-modifiers.rs:14:32 | LL | fn constness() -> impl Sized + const use<> {} | ^^^^^ @@ -68,13 +68,13 @@ LL | fn constness() -> impl Sized + const use<> {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/bound-modifiers.rs:5:31 + --> $DIR/bound-modifiers.rs:3:31 | LL | fn polarity() -> impl Sized + ?use<> {} | ^^^^^^ warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default - --> $DIR/bound-modifiers.rs:5:31 + --> $DIR/bound-modifiers.rs:3:31 | LL | fn polarity() -> impl Sized + ?use<> {} | ^^^^^^ diff --git a/tests/ui/impl-trait/precise-capturing/capture-parent-arg.rs b/tests/ui/impl-trait/precise-capturing/capture-parent-arg.rs index 82b953bfed4..c41f136b96f 100644 --- a/tests/ui/impl-trait/precise-capturing/capture-parent-arg.rs +++ b/tests/ui/impl-trait/precise-capturing/capture-parent-arg.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - trait Tr { type Assoc; } diff --git a/tests/ui/impl-trait/precise-capturing/capture-parent-arg.stderr b/tests/ui/impl-trait/precise-capturing/capture-parent-arg.stderr index b521ee0a902..f02b8d7c850 100644 --- a/tests/ui/impl-trait/precise-capturing/capture-parent-arg.stderr +++ b/tests/ui/impl-trait/precise-capturing/capture-parent-arg.stderr @@ -1,5 +1,5 @@ error: `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list - --> $DIR/capture-parent-arg.rs:27:31 + --> $DIR/capture-parent-arg.rs:25:31 | LL | impl<'a> W<'a> { | -- this lifetime parameter is captured @@ -7,7 +7,7 @@ LL | fn bad1() -> impl Into<<W<'a> as Tr>::Assoc> + use<> {} | -------------^^------------------------ lifetime captured due to being mentioned in the bounds of the `impl Trait` error: `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list - --> $DIR/capture-parent-arg.rs:33:18 + --> $DIR/capture-parent-arg.rs:31:18 | LL | impl<'a> W<'a> { | -- this lifetime parameter is captured diff --git a/tests/ui/impl-trait/precise-capturing/duplicated-use.real.stderr b/tests/ui/impl-trait/precise-capturing/duplicated-use.real.stderr index d8edd672b48..95132c611e5 100644 --- a/tests/ui/impl-trait/precise-capturing/duplicated-use.real.stderr +++ b/tests/ui/impl-trait/precise-capturing/duplicated-use.real.stderr @@ -1,5 +1,5 @@ error: duplicate `use<...>` precise capturing syntax - --> $DIR/duplicated-use.rs:7:32 + --> $DIR/duplicated-use.rs:5:32 | LL | fn hello<'a>() -> impl Sized + use<'a> + use<'a> {} | ^^^^^^^ ------- second `use<...>` here diff --git a/tests/ui/impl-trait/precise-capturing/duplicated-use.rs b/tests/ui/impl-trait/precise-capturing/duplicated-use.rs index bfbdcdbf311..b5632dc1577 100644 --- a/tests/ui/impl-trait/precise-capturing/duplicated-use.rs +++ b/tests/ui/impl-trait/precise-capturing/duplicated-use.rs @@ -1,8 +1,6 @@ //@ revisions: real pre_expansion //@[pre_expansion] check-pass -#![feature(precise_capturing)] - #[cfg(real)] fn hello<'a>() -> impl Sized + use<'a> + use<'a> {} //[real]~^ ERROR duplicate `use<...>` precise capturing syntax diff --git a/tests/ui/impl-trait/precise-capturing/dyn-use.rs b/tests/ui/impl-trait/precise-capturing/dyn-use.rs index ce7a0f3c7b2..fb2f83e2d21 100644 --- a/tests/ui/impl-trait/precise-capturing/dyn-use.rs +++ b/tests/ui/impl-trait/precise-capturing/dyn-use.rs @@ -1,4 +1,2 @@ -#![feature(precise_capturing)] - fn dyn() -> &'static dyn use<> { &() } //~^ ERROR expected one of `!`, `(`, `::`, `<`, `where`, or `{`, found keyword `use` diff --git a/tests/ui/impl-trait/precise-capturing/dyn-use.stderr b/tests/ui/impl-trait/precise-capturing/dyn-use.stderr index 5519633de1f..d8903fc4129 100644 --- a/tests/ui/impl-trait/precise-capturing/dyn-use.stderr +++ b/tests/ui/impl-trait/precise-capturing/dyn-use.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `::`, `<`, `where`, or `{`, found keyword `use` - --> $DIR/dyn-use.rs:3:26 + --> $DIR/dyn-use.rs:1:26 | LL | fn dyn() -> &'static dyn use<> { &() } | ^^^ expected one of `!`, `(`, `::`, `<`, `where`, or `{` diff --git a/tests/ui/impl-trait/precise-capturing/elided.rs b/tests/ui/impl-trait/precise-capturing/elided.rs index 34d1ba620dc..472bac9d722 100644 --- a/tests/ui/impl-trait/precise-capturing/elided.rs +++ b/tests/ui/impl-trait/precise-capturing/elided.rs @@ -1,7 +1,5 @@ //@ check-pass -#![feature(precise_capturing)] - fn elided(x: &()) -> impl Sized + use<'_> { x } fn main() {} diff --git a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-const.rs b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-const.rs index 26d29e456ea..2bf2e5fef18 100644 --- a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-const.rs +++ b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-const.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - fn constant<const C: usize>() -> impl Sized + use<> {} //~^ ERROR `impl Trait` must mention all const parameters in scope diff --git a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-const.stderr b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-const.stderr index 989ed136d4c..e8fab0a8ad6 100644 --- a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-const.stderr +++ b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-const.stderr @@ -1,5 +1,5 @@ error: `impl Trait` must mention all const parameters in scope in `use<...>` - --> $DIR/forgot-to-capture-const.rs:3:34 + --> $DIR/forgot-to-capture-const.rs:1:34 | LL | fn constant<const C: usize>() -> impl Sized + use<> {} | -------------- ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-lifetime.rs b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-lifetime.rs index f18dbca6c5e..64bac0c8aca 100644 --- a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-lifetime.rs +++ b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-lifetime.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - fn lifetime_in_bounds<'a>(x: &'a ()) -> impl Into<&'a ()> + use<> { x } //~^ ERROR `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list diff --git a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-lifetime.stderr b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-lifetime.stderr index 979c0ca6d7b..907ed00f8c0 100644 --- a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-lifetime.stderr +++ b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-lifetime.stderr @@ -1,5 +1,5 @@ error: `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list - --> $DIR/forgot-to-capture-lifetime.rs:3:52 + --> $DIR/forgot-to-capture-lifetime.rs:1:52 | LL | fn lifetime_in_bounds<'a>(x: &'a ()) -> impl Into<&'a ()> + use<> { x } | -- -----------^^------------ @@ -8,7 +8,7 @@ LL | fn lifetime_in_bounds<'a>(x: &'a ()) -> impl Into<&'a ()> + use<> { x } | this lifetime parameter is captured error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds - --> $DIR/forgot-to-capture-lifetime.rs:6:62 + --> $DIR/forgot-to-capture-lifetime.rs:4:62 | LL | fn lifetime_in_hidden<'a>(x: &'a ()) -> impl Sized + use<> { x } | -- ------------------ ^ diff --git a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs index 0028a45cbf3..9d68819f657 100644 --- a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs +++ b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - fn type_param<T>() -> impl Sized + use<> {} //~^ ERROR `impl Trait` must mention all type parameters in scope diff --git a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr index 89bd4df4431..d9be9d543e4 100644 --- a/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr +++ b/tests/ui/impl-trait/precise-capturing/forgot-to-capture-type.stderr @@ -1,5 +1,5 @@ error: `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits - --> $DIR/forgot-to-capture-type.rs:7:30 + --> $DIR/forgot-to-capture-type.rs:5:30 | LL | fn bar() -> impl Sized + use<>; | ^^^^^ @@ -7,7 +7,7 @@ LL | fn bar() -> impl Sized + use<>; = note: currently, return-position `impl Trait` in traits and trait implementations capture all lifetimes in scope error: `impl Trait` must mention all type parameters in scope in `use<...>` - --> $DIR/forgot-to-capture-type.rs:3:23 + --> $DIR/forgot-to-capture-type.rs:1:23 | LL | fn type_param<T>() -> impl Sized + use<> {} | - ^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | fn type_param<T>() -> impl Sized + use<> {} = note: currently, all type parameters are required to be mentioned in the precise captures list error: `impl Trait` must mention the `Self` type of the trait in `use<...>` - --> $DIR/forgot-to-capture-type.rs:7:17 + --> $DIR/forgot-to-capture-type.rs:5:17 | LL | trait Foo { | --------- `Self` type parameter is implicitly captured by this `impl Trait` diff --git a/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.rs b/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.rs index b50780643f1..d34c6135596 100644 --- a/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.rs +++ b/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - fn lifetime<'a, 'b>(x: &'a ()) -> impl Sized + use<'b> { //~^ HELP add `'a` to the `use<...>` bound x diff --git a/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr b/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr index 1007a835894..b0c4cc2fea0 100644 --- a/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr +++ b/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr @@ -1,5 +1,5 @@ error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds - --> $DIR/hidden-type-suggestion.rs:5:5 + --> $DIR/hidden-type-suggestion.rs:3:5 | LL | fn lifetime<'a, 'b>(x: &'a ()) -> impl Sized + use<'b> { | -- -------------------- opaque type defined here @@ -15,7 +15,7 @@ LL | fn lifetime<'a, 'b>(x: &'a ()) -> impl Sized + use<'b, 'a> { | ++++ error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds - --> $DIR/hidden-type-suggestion.rs:11:5 + --> $DIR/hidden-type-suggestion.rs:9:5 | LL | fn param<'a, T>(x: &'a ()) -> impl Sized + use<T> { | -- ------------------- opaque type defined here @@ -31,7 +31,7 @@ LL | fn param<'a, T>(x: &'a ()) -> impl Sized + use<'a, T> { | +++ error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds - --> $DIR/hidden-type-suggestion.rs:17:5 + --> $DIR/hidden-type-suggestion.rs:15:5 | LL | fn empty<'a>(x: &'a ()) -> impl Sized + use<> { | -- ------------------ opaque type defined here @@ -47,7 +47,7 @@ LL | fn empty<'a>(x: &'a ()) -> impl Sized + use<'a> { | ++ error[E0700]: hidden type for `impl Captures<'captured>` captures lifetime that does not appear in bounds - --> $DIR/hidden-type-suggestion.rs:26:5 + --> $DIR/hidden-type-suggestion.rs:24:5 | LL | fn missing<'a, 'captured, 'not_captured, Captured>(x: &'a ()) -> impl Captures<'captured> { | -- ------------------------ opaque type defined here @@ -63,7 +63,7 @@ LL | fn missing<'a, 'captured, 'not_captured, Captured>(x: &'a ()) -> impl Captu | ++++++++++++++++++++++++++++++ error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds - --> $DIR/hidden-type-suggestion.rs:32:5 + --> $DIR/hidden-type-suggestion.rs:30:5 | LL | fn no_params_yet(_: impl Sized, y: &()) -> impl Sized { | --- ---------- opaque type defined here @@ -74,7 +74,7 @@ LL | y | ^ | note: you could use a `use<...>` bound to explicitly capture `'_`, but argument-position `impl Trait`s are not nameable - --> $DIR/hidden-type-suggestion.rs:30:21 + --> $DIR/hidden-type-suggestion.rs:28:21 | LL | fn no_params_yet(_: impl Sized, y: &()) -> impl Sized { | ^^^^^^^^^^ @@ -84,7 +84,7 @@ LL | fn no_params_yet<T: Sized>(_: T, y: &()) -> impl Sized + use<'_, T> { | ++++++++++ ~ ++++++++++++ error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds - --> $DIR/hidden-type-suggestion.rs:38:5 + --> $DIR/hidden-type-suggestion.rs:36:5 | LL | fn yes_params_yet<'a, T>(_: impl Sized, y: &'a ()) -> impl Sized { | -- ---------- opaque type defined here @@ -95,7 +95,7 @@ LL | y | ^ | note: you could use a `use<...>` bound to explicitly capture `'a`, but argument-position `impl Trait`s are not nameable - --> $DIR/hidden-type-suggestion.rs:36:29 + --> $DIR/hidden-type-suggestion.rs:34:29 | LL | fn yes_params_yet<'a, T>(_: impl Sized, y: &'a ()) -> impl Sized { | ^^^^^^^^^^ diff --git a/tests/ui/impl-trait/precise-capturing/higher-ranked.rs b/tests/ui/impl-trait/precise-capturing/higher-ranked.rs index 21ac19640bc..3dc8523e963 100644 --- a/tests/ui/impl-trait/precise-capturing/higher-ranked.rs +++ b/tests/ui/impl-trait/precise-capturing/higher-ranked.rs @@ -2,7 +2,7 @@ // Show how precise captures allow us to skip capturing a higher-ranked lifetime -#![feature(lifetime_capture_rules_2024, precise_capturing)] +#![feature(lifetime_capture_rules_2024)] trait Trait<'a> { type Item; diff --git a/tests/ui/impl-trait/precise-capturing/illegal-positions.real.stderr b/tests/ui/impl-trait/precise-capturing/illegal-positions.real.stderr index 2b234bcb6a5..95eb49daf28 100644 --- a/tests/ui/impl-trait/precise-capturing/illegal-positions.real.stderr +++ b/tests/ui/impl-trait/precise-capturing/illegal-positions.real.stderr @@ -1,53 +1,53 @@ error: `use<...>` precise capturing syntax not allowed in supertrait bounds - --> $DIR/illegal-positions.rs:8:12 + --> $DIR/illegal-positions.rs:6:12 | LL | trait Foo: use<> { | ^^^^^ error: `use<...>` precise capturing syntax not allowed in bounds - --> $DIR/illegal-positions.rs:10:33 + --> $DIR/illegal-positions.rs:8:33 | LL | type Assoc: use<> where (): use<>; | ^^^^^ error: `use<...>` precise capturing syntax not allowed in bounds - --> $DIR/illegal-positions.rs:10:17 + --> $DIR/illegal-positions.rs:8:17 | LL | type Assoc: use<> where (): use<>; | ^^^^^ error: `use<...>` precise capturing syntax not allowed in bounds - --> $DIR/illegal-positions.rs:16:11 + --> $DIR/illegal-positions.rs:14:11 | LL | fn fun<T: use<>>(_: impl use<>) where (): use<> {} | ^^^^^ error: `use<...>` precise capturing syntax not allowed in bounds - --> $DIR/illegal-positions.rs:16:43 + --> $DIR/illegal-positions.rs:14:43 | LL | fn fun<T: use<>>(_: impl use<>) where (): use<> {} | ^^^^^ error: at least one trait must be specified - --> $DIR/illegal-positions.rs:16:21 + --> $DIR/illegal-positions.rs:14:21 | LL | fn fun<T: use<>>(_: impl use<>) where (): use<> {} | ^^^^^^^^^^ error: `use<...>` precise capturing syntax not allowed in `dyn` trait object bounds - --> $DIR/illegal-positions.rs:23:25 + --> $DIR/illegal-positions.rs:21:25 | LL | fn dynamic() -> Box<dyn use<>> {} | ^^^^^ error: `use<...>` precise capturing syntax not allowed in argument-position `impl Trait` - --> $DIR/illegal-positions.rs:16:26 + --> $DIR/illegal-positions.rs:14:26 | LL | fn fun<T: use<>>(_: impl use<>) where (): use<> {} | ^^^^^ error[E0224]: at least one trait is required for an object type - --> $DIR/illegal-positions.rs:23:21 + --> $DIR/illegal-positions.rs:21:21 | LL | fn dynamic() -> Box<dyn use<>> {} | ^^^^^^^^^ diff --git a/tests/ui/impl-trait/precise-capturing/illegal-positions.rs b/tests/ui/impl-trait/precise-capturing/illegal-positions.rs index 681458e25f8..d446a50d92d 100644 --- a/tests/ui/impl-trait/precise-capturing/illegal-positions.rs +++ b/tests/ui/impl-trait/precise-capturing/illegal-positions.rs @@ -2,8 +2,6 @@ //@[pre_expansion] check-pass //@ edition: 2021 -#![feature(precise_capturing)] - #[cfg(real)] trait Foo: use<> { //[real]~^ ERROR `use<...>` precise capturing syntax not allowed diff --git a/tests/ui/impl-trait/precise-capturing/ordering.rs b/tests/ui/impl-trait/precise-capturing/ordering.rs index eb570a120cc..20638e0a623 100644 --- a/tests/ui/impl-trait/precise-capturing/ordering.rs +++ b/tests/ui/impl-trait/precise-capturing/ordering.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - fn lt<'a>() -> impl Sized + use<'a, 'a> {} //~^ ERROR cannot capture parameter `'a` twice diff --git a/tests/ui/impl-trait/precise-capturing/ordering.stderr b/tests/ui/impl-trait/precise-capturing/ordering.stderr index ecd47159059..05dec2d5c5a 100644 --- a/tests/ui/impl-trait/precise-capturing/ordering.stderr +++ b/tests/ui/impl-trait/precise-capturing/ordering.stderr @@ -1,23 +1,23 @@ error: cannot capture parameter `'a` twice - --> $DIR/ordering.rs:3:33 + --> $DIR/ordering.rs:1:33 | LL | fn lt<'a>() -> impl Sized + use<'a, 'a> {} | ^^ -- parameter captured again here error: cannot capture parameter `T` twice - --> $DIR/ordering.rs:6:32 + --> $DIR/ordering.rs:4:32 | LL | fn ty<T>() -> impl Sized + use<T, T> {} | ^ - parameter captured again here error: cannot capture parameter `N` twice - --> $DIR/ordering.rs:9:45 + --> $DIR/ordering.rs:7:45 | LL | fn ct<const N: usize>() -> impl Sized + use<N, N> {} | ^ - parameter captured again here error: lifetime parameter `'a` must be listed before non-lifetime parameters - --> $DIR/ordering.rs:12:45 + --> $DIR/ordering.rs:10:45 | LL | fn ordering<'a, T>() -> impl Sized + use<T, 'a> {} | - ^^ diff --git a/tests/ui/impl-trait/precise-capturing/outlives.rs b/tests/ui/impl-trait/precise-capturing/outlives.rs index 26ac922b5b9..f86a61be1e0 100644 --- a/tests/ui/impl-trait/precise-capturing/outlives.rs +++ b/tests/ui/impl-trait/precise-capturing/outlives.rs @@ -2,7 +2,7 @@ // Show that precise captures allow us to skip a lifetime param for outlives -#![feature(lifetime_capture_rules_2024, precise_capturing)] +#![feature(lifetime_capture_rules_2024)] fn hello<'a: 'a, 'b: 'b>() -> impl Sized + use<'a> { } diff --git a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.fixed b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.fixed index 5ac296a9cbd..89a3f3136c8 100644 --- a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.fixed +++ b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.fixed @@ -1,19 +1,21 @@ //@ run-rustfix -#![feature(precise_capturing)] -#![allow(unused, incomplete_features)] +#![allow(unused)] #![deny(impl_trait_overcaptures)] fn named<'a>(x: &'a i32) -> impl Sized + use<> { *x } //~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024 +//~| WARN this changes meaning in Rust 2024 fn implicit(x: &i32) -> impl Sized + use<> { *x } //~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024 +//~| WARN this changes meaning in Rust 2024 struct W; impl W { fn hello(&self, x: &i32) -> impl Sized + '_ + use<'_> { self } //~^ ERROR `impl Sized + '_` will capture more lifetimes than possibly intended in edition 2024 + //~| WARN this changes meaning in Rust 2024 } trait Higher<'a> { @@ -25,5 +27,6 @@ impl Higher<'_> for () { fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized + use<>> {} //~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024 +//~| WARN this changes meaning in Rust 2024 fn main() {} diff --git a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.rs b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.rs index e4b7828d60f..18c04f9f799 100644 --- a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.rs +++ b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.rs @@ -1,19 +1,21 @@ //@ run-rustfix -#![feature(precise_capturing)] -#![allow(unused, incomplete_features)] +#![allow(unused)] #![deny(impl_trait_overcaptures)] fn named<'a>(x: &'a i32) -> impl Sized { *x } //~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024 +//~| WARN this changes meaning in Rust 2024 fn implicit(x: &i32) -> impl Sized { *x } //~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024 +//~| WARN this changes meaning in Rust 2024 struct W; impl W { fn hello(&self, x: &i32) -> impl Sized + '_ { self } //~^ ERROR `impl Sized + '_` will capture more lifetimes than possibly intended in edition 2024 + //~| WARN this changes meaning in Rust 2024 } trait Higher<'a> { @@ -25,5 +27,6 @@ impl Higher<'_> for () { fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized> {} //~^ ERROR `impl Sized` will capture more lifetimes than possibly intended in edition 2024 +//~| WARN this changes meaning in Rust 2024 fn main() {} diff --git a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr index f8bb7f099af..94dafb04d64 100644 --- a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr +++ b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr @@ -1,17 +1,19 @@ error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024 - --> $DIR/overcaptures-2024.rs:7:29 + --> $DIR/overcaptures-2024.rs:6:29 | LL | fn named<'a>(x: &'a i32) -> impl Sized { *x } | ^^^^^^^^^^ | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html> note: specifically, this lifetime is in scope but not mentioned in the type's bounds - --> $DIR/overcaptures-2024.rs:7:10 + --> $DIR/overcaptures-2024.rs:6:10 | LL | fn named<'a>(x: &'a i32) -> impl Sized { *x } | ^^ = note: all lifetimes in scope will be captured by `impl Trait`s in edition 2024 note: the lint level is defined here - --> $DIR/overcaptures-2024.rs:5:9 + --> $DIR/overcaptures-2024.rs:4:9 | LL | #![deny(impl_trait_overcaptures)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,6 +28,8 @@ error: `impl Sized` will capture more lifetimes than possibly intended in editio LL | fn implicit(x: &i32) -> impl Sized { *x } | ^^^^^^^^^^ | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html> note: specifically, this lifetime is in scope but not mentioned in the type's bounds --> $DIR/overcaptures-2024.rs:10:16 | @@ -38,13 +42,15 @@ LL | fn implicit(x: &i32) -> impl Sized + use<> { *x } | +++++++ error: `impl Sized + '_` will capture more lifetimes than possibly intended in edition 2024 - --> $DIR/overcaptures-2024.rs:15:33 + --> $DIR/overcaptures-2024.rs:16:33 | LL | fn hello(&self, x: &i32) -> impl Sized + '_ { self } | ^^^^^^^^^^^^^^^ | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html> note: specifically, this lifetime is in scope but not mentioned in the type's bounds - --> $DIR/overcaptures-2024.rs:15:24 + --> $DIR/overcaptures-2024.rs:16:24 | LL | fn hello(&self, x: &i32) -> impl Sized + '_ { self } | ^ @@ -55,13 +61,15 @@ LL | fn hello(&self, x: &i32) -> impl Sized + '_ + use<'_> { self } | +++++++++ error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024 - --> $DIR/overcaptures-2024.rs:26:47 + --> $DIR/overcaptures-2024.rs:28:47 | LL | fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized> {} | ^^^^^^^^^^ | + = warning: this changes meaning in Rust 2024 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rpit-lifetime-capture.html> note: specifically, this lifetime is in scope but not mentioned in the type's bounds - --> $DIR/overcaptures-2024.rs:26:23 + --> $DIR/overcaptures-2024.rs:28:23 | LL | fn hrtb() -> impl for<'a> Higher<'a, Output = impl Sized> {} | ^^ diff --git a/tests/ui/impl-trait/precise-capturing/redundant.normal.stderr b/tests/ui/impl-trait/precise-capturing/redundant.normal.stderr index 44bc9f7daad..d1bcbaa33ae 100644 --- a/tests/ui/impl-trait/precise-capturing/redundant.normal.stderr +++ b/tests/ui/impl-trait/precise-capturing/redundant.normal.stderr @@ -1,5 +1,5 @@ warning: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant - --> $DIR/redundant.rs:7:19 + --> $DIR/redundant.rs:5:19 | LL | fn hello<'a>() -> impl Sized + use<'a> {} | ^^^^^^^^^^^^^------- @@ -9,7 +9,7 @@ LL | fn hello<'a>() -> impl Sized + use<'a> {} = note: `#[warn(impl_trait_redundant_captures)]` on by default warning: all possible in-scope parameters are already captured, so `use<...>` syntax is redundant - --> $DIR/redundant.rs:12:27 + --> $DIR/redundant.rs:10:27 | LL | fn inherent(&self) -> impl Sized + use<'_> {} | ^^^^^^^^^^^^^------- diff --git a/tests/ui/impl-trait/precise-capturing/redundant.rpitit.stderr b/tests/ui/impl-trait/precise-capturing/redundant.rpitit.stderr index 9aa73353126..213888356e5 100644 --- a/tests/ui/impl-trait/precise-capturing/redundant.rpitit.stderr +++ b/tests/ui/impl-trait/precise-capturing/redundant.rpitit.stderr @@ -1,5 +1,5 @@ error: `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits - --> $DIR/redundant.rs:18:35 + --> $DIR/redundant.rs:16:35 | LL | fn in_trait() -> impl Sized + use<'a, Self>; | ^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | fn in_trait() -> impl Sized + use<'a, Self>; = note: currently, return-position `impl Trait` in traits and trait implementations capture all lifetimes in scope error: `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits - --> $DIR/redundant.rs:23:35 + --> $DIR/redundant.rs:21:35 | LL | fn in_trait() -> impl Sized + use<'a> {} | ^^^^^^^ diff --git a/tests/ui/impl-trait/precise-capturing/redundant.rs b/tests/ui/impl-trait/precise-capturing/redundant.rs index ef4f05bd7e4..4a08ffb61be 100644 --- a/tests/ui/impl-trait/precise-capturing/redundant.rs +++ b/tests/ui/impl-trait/precise-capturing/redundant.rs @@ -2,8 +2,6 @@ //@ revisions: normal rpitit //@[normal] check-pass -#![feature(precise_capturing)] - fn hello<'a>() -> impl Sized + use<'a> {} //[normal]~^ WARN all possible in-scope parameters are already captured diff --git a/tests/ui/impl-trait/precise-capturing/rpitit.rs b/tests/ui/impl-trait/precise-capturing/rpitit.rs index 4eb053573e1..feeeb1461e8 100644 --- a/tests/ui/impl-trait/precise-capturing/rpitit.rs +++ b/tests/ui/impl-trait/precise-capturing/rpitit.rs @@ -5,8 +5,6 @@ // To fix this soundly, we need to make sure that all the trait header args // remain captured, since they affect trait selection. -#![feature(precise_capturing)] - trait Foo<'a> { fn hello() -> impl PartialEq + use<Self>; } diff --git a/tests/ui/impl-trait/precise-capturing/rpitit.stderr b/tests/ui/impl-trait/precise-capturing/rpitit.stderr index 45eceef2f49..5a120df9f04 100644 --- a/tests/ui/impl-trait/precise-capturing/rpitit.stderr +++ b/tests/ui/impl-trait/precise-capturing/rpitit.stderr @@ -1,5 +1,5 @@ error: `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits - --> $DIR/rpitit.rs:11:36 + --> $DIR/rpitit.rs:9:36 | LL | fn hello() -> impl PartialEq + use<Self>; | ^^^^^^^^^ @@ -7,7 +7,7 @@ LL | fn hello() -> impl PartialEq + use<Self>; = note: currently, return-position `impl Trait` in traits and trait implementations capture all lifetimes in scope error: `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list - --> $DIR/rpitit.rs:11:19 + --> $DIR/rpitit.rs:9:19 | LL | trait Foo<'a> { | -- this lifetime parameter is captured @@ -15,7 +15,7 @@ LL | fn hello() -> impl PartialEq + use<Self>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime captured due to being mentioned in the bounds of the `impl Trait` error: lifetime may not live long enough - --> $DIR/rpitit.rs:15:5 + --> $DIR/rpitit.rs:13:5 | LL | fn test<'a, 'b, T: for<'r> Foo<'r>>() { | -- -- lifetime `'b` defined here @@ -30,7 +30,7 @@ LL | | ); = help: consider adding the following bound: `'a: 'b` error: lifetime may not live long enough - --> $DIR/rpitit.rs:15:5 + --> $DIR/rpitit.rs:13:5 | LL | fn test<'a, 'b, T: for<'r> Foo<'r>>() { | -- -- lifetime `'b` defined here diff --git a/tests/ui/impl-trait/precise-capturing/self-capture.rs b/tests/ui/impl-trait/precise-capturing/self-capture.rs index 07bb417f9f7..a61a7f06edc 100644 --- a/tests/ui/impl-trait/precise-capturing/self-capture.rs +++ b/tests/ui/impl-trait/precise-capturing/self-capture.rs @@ -1,5 +1,3 @@ -#![feature(precise_capturing)] - trait Foo { fn bar<'a>() -> impl Sized + use<Self>; //~^ ERROR `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits diff --git a/tests/ui/impl-trait/precise-capturing/self-capture.stderr b/tests/ui/impl-trait/precise-capturing/self-capture.stderr index 351de86dd5f..c1974600f30 100644 --- a/tests/ui/impl-trait/precise-capturing/self-capture.stderr +++ b/tests/ui/impl-trait/precise-capturing/self-capture.stderr @@ -1,5 +1,5 @@ error: `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits - --> $DIR/self-capture.rs:4:34 + --> $DIR/self-capture.rs:2:34 | LL | fn bar<'a>() -> impl Sized + use<Self>; | ^^^^^^^^^ diff --git a/tests/ui/impl-trait/recursive-ice-101862.stderr b/tests/ui/impl-trait/recursive-ice-101862.stderr index f4148720c33..970373422e8 100644 --- a/tests/ui/impl-trait/recursive-ice-101862.stderr +++ b/tests/ui/impl-trait/recursive-ice-101862.stderr @@ -11,13 +11,13 @@ LL | vec![].append(&mut ice(x.as_ref())); = note: `#[warn(unconditional_recursion)]` on by default error[E0792]: expected generic type parameter, found `&str` - --> $DIR/recursive-ice-101862.rs:6:5 + --> $DIR/recursive-ice-101862.rs:6:19 | LL | pub fn ice(x: impl AsRef<str>) -> impl IntoIterator<Item = ()> { | --------------- this generic parameter must be used with a generic type parameter LL | LL | vec![].append(&mut ice(x.as_ref())); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/impl-trait/region-escape-via-bound.stderr b/tests/ui/impl-trait/region-escape-via-bound.stderr index 43f0eeeb558..0518231cfe9 100644 --- a/tests/ui/impl-trait/region-escape-via-bound.stderr +++ b/tests/ui/impl-trait/region-escape-via-bound.stderr @@ -9,10 +9,10 @@ LL | fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y> LL | x | ^ | -help: to declare that `impl Trait<'y>` captures `'x`, you can add an explicit `'x` lifetime bound +help: add a `use<...>` bound to explicitly capture `'x` | -LL | fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y> + 'x - | ++++ +LL | fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y> + use<'y, 'x> + | +++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.rs b/tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.rs index 73c8a6c0aed..e48441f533d 100644 --- a/tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.rs +++ b/tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.rs @@ -1,6 +1,7 @@ //@ check-pass pub fn iter<'a>(v: Vec<(u32, &'a u32)>) -> impl DoubleEndedIterator<Item = (u32, &u32)> { + //~^ WARNING elided lifetime has a name v.into_iter() } diff --git a/tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.stderr b/tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.stderr new file mode 100644 index 00000000000..bff3ffd934a --- /dev/null +++ b/tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.stderr @@ -0,0 +1,10 @@ +warning: elided lifetime has a name + --> $DIR/rpit-assoc-pair-with-lifetime.rs:3:82 + | +LL | pub fn iter<'a>(v: Vec<(u32, &'a u32)>) -> impl DoubleEndedIterator<Item = (u32, &u32)> { + | -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a` + | + = note: `#[warn(elided_named_lifetimes)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr index 4be244068d2..21e3187d019 100644 --- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr @@ -8,10 +8,10 @@ LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> { LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: to declare that `impl Iterator<Item = u32>` captures `'_`, you can add an explicit `'_` lifetime bound +help: add a `use<...>` bound to explicitly capture `'_` | -LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ { - | ++++ +LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + use<'_> { + | +++++++++ error[E0700]: hidden type for `impl Iterator<Item = u32>` captures lifetime that does not appear in bounds --> $DIR/static-return-lifetime-infered.rs:11:9 @@ -23,10 +23,10 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> { LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: to declare that `impl Iterator<Item = u32>` captures `'a`, you can add an explicit `'a` lifetime bound +help: add a `use<...>` bound to explicitly capture `'a` | -LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a { - | ++++ +LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + use<'a> { + | +++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/impl-trait/variance.e2024.stderr b/tests/ui/impl-trait/variance.e2024.stderr index 17245055744..011ab3259c4 100644 --- a/tests/ui/impl-trait/variance.e2024.stderr +++ b/tests/ui/impl-trait/variance.e2024.stderr @@ -1,22 +1,22 @@ -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:14:36 | LL | fn not_captured_early<'a: 'a>() -> impl Sized {} | ^^^^^^^^^^ -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:19:32 | LL | fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [o] +error: ['a: o] --> $DIR/variance.rs:21:40 | LL | fn not_captured_late<'a>(_: &'a ()) -> impl Sized {} | ^^^^^^^^^^ -error: [o] +error: ['a: o] --> $DIR/variance.rs:26:36 | LL | fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} diff --git a/tests/ui/impl-trait/variance.new.stderr b/tests/ui/impl-trait/variance.new.stderr index 17245055744..011ab3259c4 100644 --- a/tests/ui/impl-trait/variance.new.stderr +++ b/tests/ui/impl-trait/variance.new.stderr @@ -1,22 +1,22 @@ -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:14:36 | LL | fn not_captured_early<'a: 'a>() -> impl Sized {} | ^^^^^^^^^^ -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:19:32 | LL | fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [o] +error: ['a: o] --> $DIR/variance.rs:21:40 | LL | fn not_captured_late<'a>(_: &'a ()) -> impl Sized {} | ^^^^^^^^^^ -error: [o] +error: ['a: o] --> $DIR/variance.rs:26:36 | LL | fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} diff --git a/tests/ui/impl-trait/variance.old.stderr b/tests/ui/impl-trait/variance.old.stderr index 9410b54b491..ac3bcd2723f 100644 --- a/tests/ui/impl-trait/variance.old.stderr +++ b/tests/ui/impl-trait/variance.old.stderr @@ -1,10 +1,10 @@ -error: [*] +error: ['a: *] --> $DIR/variance.rs:14:36 | LL | fn not_captured_early<'a: 'a>() -> impl Sized {} | ^^^^^^^^^^ -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:19:32 | LL | fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {} @@ -16,7 +16,7 @@ error: [] LL | fn not_captured_late<'a>(_: &'a ()) -> impl Sized {} | ^^^^^^^^^^ -error: [o] +error: ['a: o] --> $DIR/variance.rs:26:36 | LL | fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} diff --git a/tests/ui/impl-trait/variance.rs b/tests/ui/impl-trait/variance.rs index 72b4a831bad..43f7207a904 100644 --- a/tests/ui/impl-trait/variance.rs +++ b/tests/ui/impl-trait/variance.rs @@ -12,17 +12,17 @@ trait Captures<'a> {} impl<T> Captures<'_> for T {} fn not_captured_early<'a: 'a>() -> impl Sized {} -//[old]~^ [*] -//[new]~^^ [*, o] -//[e2024]~^^^ [*, o] +//[old]~^ ['a: *] +//[new]~^^ ['a: *, 'a: o] +//[e2024]~^^^ ['a: *, 'a: o] -fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {} //~ [*, o] +fn captured_early<'a: 'a>() -> impl Sized + Captures<'a> {} //~ ['a: *, 'a: o] fn not_captured_late<'a>(_: &'a ()) -> impl Sized {} //[old]~^ [] -//[new]~^^ [o] -//[e2024]~^^^ [o] +//[new]~^^ ['a: o] +//[e2024]~^^^ ['a: o] -fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} //~ [o] +fn captured_late<'a>(_: &'a ()) -> impl Sized + Captures<'a> {} //~ ['a: o] fn main() {} diff --git a/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr b/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr index c8d1614a7f3..f498257e12f 100644 --- a/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr +++ b/tests/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr @@ -5,9 +5,9 @@ LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'s` as defined here... - --> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:12 + --> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:8:12 | -LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { +LL | fn get<'s>(s: &'s str, _: ()) -> &'static str; | ^^ note: ...so that the method type is compatible with trait --> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5 diff --git a/tests/ui/imports/auxiliary/issue-85992-extern-2.rs b/tests/ui/imports/auxiliary/empty.rs index e9b6a44cfe2..e9b6a44cfe2 100644 --- a/tests/ui/imports/auxiliary/issue-85992-extern-2.rs +++ b/tests/ui/imports/auxiliary/empty.rs diff --git a/tests/ui/imports/auxiliary/issue-85992-extern-1.rs b/tests/ui/imports/auxiliary/issue-85992-extern.rs index a2d0e206065..076d6045190 100644 --- a/tests/ui/imports/auxiliary/issue-85992-extern-1.rs +++ b/tests/ui/imports/auxiliary/issue-85992-extern.rs @@ -1,6 +1,6 @@ #[macro_export] macro_rules! m { () => { - use issue_85992_extern_2::Outcome; + use empty::Outcome; } } diff --git a/tests/ui/imports/issue-85992.rs b/tests/ui/imports/issue-85992.rs index 321c3a9218d..38cf0384501 100644 --- a/tests/ui/imports/issue-85992.rs +++ b/tests/ui/imports/issue-85992.rs @@ -1,11 +1,11 @@ //@ edition: 2021 -//@ compile-flags: --extern issue_85992_extern_1 --extern issue_85992_extern_2 -//@ aux-build: issue-85992-extern-1.rs -//@ aux-build: issue-85992-extern-2.rs +//@ compile-flags: --extern issue_85992_extern --extern empty +//@ aux-build: issue-85992-extern.rs +//@ aux-build: empty.rs -issue_85992_extern_1::m!(); +issue_85992_extern::m!(); -use crate::issue_85992_extern_2; -//~^ ERROR unresolved import `crate::issue_85992_extern_2` +use crate::empty; +//~^ ERROR unresolved import `crate::empty` fn main() {} diff --git a/tests/ui/imports/issue-85992.stderr b/tests/ui/imports/issue-85992.stderr index 6c75b45d926..490b2d4d88b 100644 --- a/tests/ui/imports/issue-85992.stderr +++ b/tests/ui/imports/issue-85992.stderr @@ -1,8 +1,8 @@ -error[E0432]: unresolved import `crate::issue_85992_extern_2` +error[E0432]: unresolved import `crate::empty` --> $DIR/issue-85992.rs:8:5 | -LL | use crate::issue_85992_extern_2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `issue_85992_extern_2` in the root +LL | use crate::empty; + | ^^^^^^^^^^^^ no `empty` in the root error: aborting due to 1 previous error diff --git a/tests/ui/imports/multiple-extern-by-macro-for-buitlin.rs b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.rs new file mode 100644 index 00000000000..f0e5e4b4325 --- /dev/null +++ b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.rs @@ -0,0 +1,18 @@ +//@ edition: 2021 + +// issue#128813 + +extern crate core; + +macro_rules! m { + () => { + extern crate std as core; + //~^ ERROR: the name `core` is defined multiple times + }; +} + +m!(); + +fn main() { + use ::core; +} diff --git a/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr new file mode 100644 index 00000000000..a84a6c42aa8 --- /dev/null +++ b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr @@ -0,0 +1,22 @@ +error[E0259]: the name `core` is defined multiple times + --> $DIR/multiple-extern-by-macro-for-buitlin.rs:9:9 + | +LL | extern crate core; + | ------------------ previous import of the extern crate `core` here +... +LL | extern crate std as core; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ `core` reimported here +... +LL | m!(); + | ---- in this macro invocation + | + = note: `core` must be defined only once in the type namespace of this module + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: you can use `as` to change the binding name of the import + | +LL | extern crate std as other_core; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0259`. diff --git a/tests/ui/imports/multiple-extern-by-macro-for-custom.rs b/tests/ui/imports/multiple-extern-by-macro-for-custom.rs new file mode 100644 index 00000000000..6bf544566e3 --- /dev/null +++ b/tests/ui/imports/multiple-extern-by-macro-for-custom.rs @@ -0,0 +1,19 @@ +//@ edition: 2021 +//@ aux-build: empty.rs + +// issue#128813 + +extern crate empty; + +macro_rules! m { + () => { + extern crate std as empty; + //~^ ERROR: the name `empty` is defined multiple times + }; +} + +m!(); + +fn main() { + use ::empty; +} diff --git a/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr b/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr new file mode 100644 index 00000000000..556d75a4dbb --- /dev/null +++ b/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr @@ -0,0 +1,22 @@ +error[E0259]: the name `empty` is defined multiple times + --> $DIR/multiple-extern-by-macro-for-custom.rs:10:9 + | +LL | extern crate empty; + | ------------------- previous import of the extern crate `empty` here +... +LL | extern crate std as empty; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `empty` reimported here +... +LL | m!(); + | ---- in this macro invocation + | + = note: `empty` must be defined only once in the type namespace of this module + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: you can use `as` to change the binding name of the import + | +LL | extern crate std as other_empty; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0259`. diff --git a/tests/ui/imports/multiple-extern-by-macro-for-inexist.rs b/tests/ui/imports/multiple-extern-by-macro-for-inexist.rs new file mode 100644 index 00000000000..c23f275b9ff --- /dev/null +++ b/tests/ui/imports/multiple-extern-by-macro-for-inexist.rs @@ -0,0 +1,19 @@ +//@ edition: 2021 + +// issue#128813 + +extern crate non_existent; +//~^ ERROR: can't find crate for `non_existent` + +macro_rules! m { + () => { + extern crate std as non_existent; + //~^ ERROR: the name `non_existent` is defined multiple times + }; +} + +m!(); + +fn main() { + use ::non_existent; +} diff --git a/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr b/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr new file mode 100644 index 00000000000..ec34489f232 --- /dev/null +++ b/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr @@ -0,0 +1,29 @@ +error[E0463]: can't find crate for `non_existent` + --> $DIR/multiple-extern-by-macro-for-inexist.rs:5:1 + | +LL | extern crate non_existent; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate + +error[E0259]: the name `non_existent` is defined multiple times + --> $DIR/multiple-extern-by-macro-for-inexist.rs:10:9 + | +LL | extern crate non_existent; + | -------------------------- previous import of the extern crate `non_existent` here +... +LL | extern crate std as non_existent; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `non_existent` reimported here +... +LL | m!(); + | ---- in this macro invocation + | + = note: `non_existent` must be defined only once in the type namespace of this module + = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: you can use `as` to change the binding name of the import + | +LL | extern crate std as other_non_existent; + | + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0259, E0463. +For more information about an error, try `rustc --explain E0259`. diff --git a/tests/ui/imports/multiple-extern-by-macro-for-underscore.rs b/tests/ui/imports/multiple-extern-by-macro-for-underscore.rs new file mode 100644 index 00000000000..ddf735d8947 --- /dev/null +++ b/tests/ui/imports/multiple-extern-by-macro-for-underscore.rs @@ -0,0 +1,18 @@ +//@ edition: 2021 + +// issue#128813 + +extern crate core as _; + +macro_rules! m { + () => { + extern crate std as _; + }; +} + +m!(); + +fn main() { + use ::_; + //~^ ERROR: expected identifier, found reserved identifier `_` +} diff --git a/tests/ui/imports/multiple-extern-by-macro-for-underscore.stderr b/tests/ui/imports/multiple-extern-by-macro-for-underscore.stderr new file mode 100644 index 00000000000..1da5aa87070 --- /dev/null +++ b/tests/ui/imports/multiple-extern-by-macro-for-underscore.stderr @@ -0,0 +1,8 @@ +error: expected identifier, found reserved identifier `_` + --> $DIR/multiple-extern-by-macro-for-underscore.rs:16:11 + | +LL | use ::_; + | ^ expected identifier, found reserved identifier + +error: aborting due to 1 previous error + diff --git a/tests/ui/inference/detect-old-time-version-format_description-parse.rs b/tests/ui/inference/detect-old-time-version-format_description-parse.rs new file mode 100644 index 00000000000..386b2a3bf3c --- /dev/null +++ b/tests/ui/inference/detect-old-time-version-format_description-parse.rs @@ -0,0 +1,13 @@ +#![crate_name = "time"] +#![crate_type = "lib"] + +// This code compiled without error in Rust 1.79, but started failing in 1.80 +// after the addition of several `impl FromIterator<_> for Box<str>`. + +pub fn parse() -> Option<Vec<()>> { + let iter = std::iter::once(Some(())).map(|o| o.map(Into::into)); + let items = iter.collect::<Option<Box<_>>>()?; //~ ERROR E0282 + //~^ NOTE this is an inference error on crate `time` caused by an API change in Rust 1.80.0; update `time` to version `>=0.3.35` + Some(items.into()) + //~^ NOTE type must be known at this point +} diff --git a/tests/ui/inference/detect-old-time-version-format_description-parse.stderr b/tests/ui/inference/detect-old-time-version-format_description-parse.stderr new file mode 100644 index 00000000000..a70ce9dd268 --- /dev/null +++ b/tests/ui/inference/detect-old-time-version-format_description-parse.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `Box<_>` + --> $DIR/detect-old-time-version-format_description-parse.rs:9:9 + | +LL | let items = iter.collect::<Option<Box<_>>>()?; + | ^^^^^ +LL | +LL | Some(items.into()) + | ---- type must be known at this point + | + = note: this is an inference error on crate `time` caused by an API change in Rust 1.80.0; update `time` to version `>=0.3.35` by calling `cargo update` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/internal/internal-unstable-const.rs b/tests/ui/internal/internal-unstable-const.rs deleted file mode 100644 index 4ec2426dfee..00000000000 --- a/tests/ui/internal/internal-unstable-const.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Don't allow unstable features in stable functions without `allow_internal_unstable`. - -#![stable(feature = "rust1", since = "1.0.0")] -#![feature(staged_api)] -#![feature(const_fn_floating_point_arithmetic)] - -#[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_stable(feature = "rust1", since = "1.0.0")] -pub const fn foo() -> f32 { - 1.0 + 1.0 //~ ERROR const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]` -} - -fn main() {} diff --git a/tests/ui/internal/internal-unstable-const.stderr b/tests/ui/internal/internal-unstable-const.stderr deleted file mode 100644 index ed9196d2b63..00000000000 --- a/tests/ui/internal/internal-unstable-const.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error: const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]` - --> $DIR/internal-unstable-const.rs:10:5 - | -LL | 1.0 + 1.0 - | ^^^^^^^^^ - | -help: if it is not part of the public API, make this function unstably const - | -LL + #[rustc_const_unstable(feature = "...", issue = "...")] -LL | pub const fn foo() -> f32 { - | -help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks - | -LL + #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)] -LL | pub const fn foo() -> f32 { - | - -error: aborting due to 1 previous error - diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs index ab46fd796c5..99f98c3f27a 100644 --- a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs +++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs @@ -13,5 +13,13 @@ const RAW_EQ_PTR: bool = unsafe { //~| unable to turn pointer into integer }; +const RAW_EQ_NOT_ALIGNED: bool = unsafe { + let arr = [0u8; 4]; + let aref = &*arr.as_ptr().cast::<i32>(); + std::intrinsics::raw_eq(aref, aref) +//~^ ERROR evaluation of constant value failed +//~| alignment +}; + pub fn main() { } diff --git a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr index af16c2bc64a..bedfc8283ea 100644 --- a/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr +++ b/tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr @@ -13,6 +13,12 @@ LL | std::intrinsics::raw_eq(&(&0), &(&1)) = 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 -error: aborting due to 2 previous errors +error[E0080]: evaluation of constant value failed + --> $DIR/intrinsic-raw_eq-const-bad.rs:19:5 + | +LL | std::intrinsics::raw_eq(aref, aref) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ accessing memory with alignment 1, but alignment 4 is required + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/intrinsics/reify-intrinsic.stderr b/tests/ui/intrinsics/reify-intrinsic.stderr index 0119a1a6650..21b7bf4e1cb 100644 --- a/tests/ui/intrinsics/reify-intrinsic.stderr +++ b/tests/ui/intrinsics/reify-intrinsic.stderr @@ -7,9 +7,9 @@ LL | let _: unsafe extern "rust-intrinsic" fn(isize) -> usize = std::mem::tr | expected due to this | = note: expected fn pointer `unsafe extern "rust-intrinsic" fn(isize) -> usize` - found fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` + found fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}` -error[E0606]: casting `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}` as `unsafe extern "rust-intrinsic" fn(isize) -> usize` is invalid +error[E0606]: casting `unsafe extern "rust-intrinsic" fn(_) -> _ {std::intrinsics::transmute::<_, _>}` as `unsafe extern "rust-intrinsic" fn(isize) -> usize` is invalid --> $DIR/reify-intrinsic.rs:11:13 | LL | let _ = std::mem::transmute as unsafe extern "rust-intrinsic" fn(isize) -> usize; diff --git a/tests/ui/intrinsics/safe-intrinsic-mismatch.effects.stderr b/tests/ui/intrinsics/safe-intrinsic-mismatch.effects.stderr index d9a4960feec..55983a445a4 100644 --- a/tests/ui/intrinsics/safe-intrinsic-mismatch.effects.stderr +++ b/tests/ui/intrinsics/safe-intrinsic-mismatch.effects.stderr @@ -7,13 +7,13 @@ error: intrinsic safety mismatch between list of intrinsics within the compiler --> $DIR/safe-intrinsic-mismatch.rs:11:5 | LL | fn size_of<T>() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` --> $DIR/safe-intrinsic-mismatch.rs:11:5 | LL | fn size_of<T>() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/intrinsics/safe-intrinsic-mismatch.stock.stderr b/tests/ui/intrinsics/safe-intrinsic-mismatch.stock.stderr index 6864c0f36de..c59e357b275 100644 --- a/tests/ui/intrinsics/safe-intrinsic-mismatch.stock.stderr +++ b/tests/ui/intrinsics/safe-intrinsic-mismatch.stock.stderr @@ -2,13 +2,13 @@ error: intrinsic safety mismatch between list of intrinsics within the compiler --> $DIR/safe-intrinsic-mismatch.rs:11:5 | LL | fn size_of<T>() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: intrinsic safety mismatch between list of intrinsics within the compiler and core library intrinsics for intrinsic `size_of` --> $DIR/safe-intrinsic-mismatch.rs:11:5 | LL | fn size_of<T>() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/issues/issue-16725.stderr b/tests/ui/issues/issue-16725.stderr index a4a406b3d4b..dcb7d58b0f9 100644 --- a/tests/ui/issues/issue-16725.stderr +++ b/tests/ui/issues/issue-16725.stderr @@ -8,7 +8,7 @@ note: the function `bar` is defined here --> $DIR/auxiliary/issue-16725.rs:2:5 | LL | fn bar(); - | ^^^^^^^^ + | ^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-17651.stderr b/tests/ui/issues/issue-17651.stderr index 0c95a3c0c40..9519507320d 100644 --- a/tests/ui/issues/issue-17651.stderr +++ b/tests/ui/issues/issue-17651.stderr @@ -9,6 +9,11 @@ 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 +help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression + | +LL - (|| Box::new(*(&[0][..])))(); +LL + (|| Box::new((&[0][..])))(); + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-20831-debruijn.stderr b/tests/ui/issues/issue-20831-debruijn.stderr index 60721f001b7..fe310998f09 100644 --- a/tests/ui/issues/issue-20831-debruijn.stderr +++ b/tests/ui/issues/issue-20831-debruijn.stderr @@ -5,10 +5,10 @@ LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime as defined here... - --> $DIR/issue-20831-debruijn.rs:28:18 + --> $DIR/issue-20831-debruijn.rs:28:67 | LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) { - | ^ + | ^^^^^^^^^ note: ...but the lifetime must also be valid for the lifetime `'a` as defined here... --> $DIR/issue-20831-debruijn.rs:26:6 | diff --git a/tests/ui/issues/issue-37884.stderr b/tests/ui/issues/issue-37884.stderr index b7c0095d682..17037d2180d 100644 --- a/tests/ui/issues/issue-37884.stderr +++ b/tests/ui/issues/issue-37884.stderr @@ -7,10 +7,7 @@ LL | fn next(&'a mut self) -> Option<Self::Item> = note: expected signature `fn(&mut RepeatMut<'_, _>) -> Option<_>` found signature `fn(&'a mut RepeatMut<'_, _>) -> Option<_>` note: the anonymous lifetime as defined here... - --> $DIR/issue-37884.rs:6:5 - | -LL | fn next(&'a mut self) -> Option<Self::Item> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL note: ...does not necessarily outlive the lifetime `'a` as defined here --> $DIR/issue-37884.rs:3:6 | diff --git a/tests/ui/issues/issue-47094.stderr b/tests/ui/issues/issue-47094.stderr index 970e3184710..1c6693403b8 100644 --- a/tests/ui/issues/issue-47094.stderr +++ b/tests/ui/issues/issue-47094.stderr @@ -23,3 +23,28 @@ LL | #[repr(u8)] error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0566`. +Future incompatibility report: Future breakage diagnostic: +error[E0566]: conflicting representation hints + --> $DIR/issue-47094.rs:1:8 + | +LL | #[repr(C, u8)] + | ^ ^^ + | + = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> + = note: `#[deny(conflicting_repr_hints)]` on by default + +Future breakage diagnostic: +error[E0566]: conflicting representation hints + --> $DIR/issue-47094.rs:8:8 + | +LL | #[repr(C)] + | ^ +LL | +LL | #[repr(u8)] + | ^^ + | + = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> + = note: `#[deny(conflicting_repr_hints)]` on by default + diff --git a/tests/ui/lifetimes/issue-105227.fixed b/tests/ui/lifetimes/issue-105227.fixed deleted file mode 100644 index ef64e1e6541..00000000000 --- a/tests/ui/lifetimes/issue-105227.fixed +++ /dev/null @@ -1,26 +0,0 @@ -// Regression test for issue #105227. - -//@ run-rustfix -#![allow(warnings)] -fn chars0<'a>(v :(&'a str, &'a str)) -> impl Iterator<Item = char> + 'a { -//~^ HELP to declare that `impl Iterator<Item = char>` captures `'_`, you can introduce a named lifetime parameter `'a` - v.0.chars().chain(v.1.chars()) - //~^ ERROR hidden type for `impl Iterator<Item = char>` captures lifetime that does not appear in bounds -} - -fn chars1<'a>(v0 : &'a str, v1 : &'a str) -> impl Iterator<Item = char> + 'a { -//~^ HELP to declare that `impl Iterator<Item = char>` captures `'_`, you can introduce a named lifetime parameter `'a` - v0.chars().chain(v1.chars()) - //~^ ERROR hidden type for `impl Iterator<Item = char>` captures lifetime that does not appear in bound -} - -fn chars2<'b>(v0 : &'b str, v1 : &'b str, v2 : &'b str) -> -//~^ HELP to declare that `impl Iterator<Item = char>` captures `'_`, you can use the named lifetime parameter `'b` - (impl Iterator<Item = char> + 'b , &'b str) -{ - (v0.chars().chain(v1.chars()), v2) - //~^ ERROR hidden type for `impl Iterator<Item = char>` captures lifetime that does not appear in bound -} - -fn main() { -} diff --git a/tests/ui/lifetimes/issue-105227.rs b/tests/ui/lifetimes/issue-105227.rs index f37765ffafa..8a0a49e8f0c 100644 --- a/tests/ui/lifetimes/issue-105227.rs +++ b/tests/ui/lifetimes/issue-105227.rs @@ -1,23 +1,23 @@ // Regression test for issue #105227. -//@ run-rustfix -#![allow(warnings)] +// FIXME(precise_capturing): Add rustfix here after dealing w/ elided lifetimes + +#![allow(unused)] + fn chars0(v :(& str, &str)) -> impl Iterator<Item = char> { -//~^ HELP to declare that `impl Iterator<Item = char>` captures `'_`, you can introduce a named lifetime parameter `'a` + //~^ HELP add a `use<...>` bound v.0.chars().chain(v.1.chars()) //~^ ERROR hidden type for `impl Iterator<Item = char>` captures lifetime that does not appear in bounds } fn chars1(v0 : & str, v1 : &str) -> impl Iterator<Item = char> { -//~^ HELP to declare that `impl Iterator<Item = char>` captures `'_`, you can introduce a named lifetime parameter `'a` + //~^ HELP add a `use<...>` bound v0.chars().chain(v1.chars()) //~^ ERROR hidden type for `impl Iterator<Item = char>` captures lifetime that does not appear in bound } -fn chars2<'b>(v0 : &str, v1 : &'_ str, v2 : &'b str) -> -//~^ HELP to declare that `impl Iterator<Item = char>` captures `'_`, you can use the named lifetime parameter `'b` - (impl Iterator<Item = char>, &'b str) -{ +fn chars2<'b>(v0 : &str, v1 : &'_ str, v2 : &'b str) -> (impl Iterator<Item = char>, &'b str) { + //~^ HELP add a `use<...>` bound (v0.chars().chain(v1.chars()), v2) //~^ ERROR hidden type for `impl Iterator<Item = char>` captures lifetime that does not appear in bound } diff --git a/tests/ui/lifetimes/issue-105227.stderr b/tests/ui/lifetimes/issue-105227.stderr index b514db461b4..35c05f28854 100644 --- a/tests/ui/lifetimes/issue-105227.stderr +++ b/tests/ui/lifetimes/issue-105227.stderr @@ -1,5 +1,5 @@ error[E0700]: hidden type for `impl Iterator<Item = char>` captures lifetime that does not appear in bounds - --> $DIR/issue-105227.rs:7:5 + --> $DIR/issue-105227.rs:9:5 | LL | fn chars0(v :(& str, &str)) -> impl Iterator<Item = char> { | ----- -------------------------- opaque type defined here @@ -9,13 +9,13 @@ LL | LL | v.0.chars().chain(v.1.chars()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: to declare that `impl Iterator<Item = char>` captures `'_`, you can introduce a named lifetime parameter `'a` +help: add a `use<...>` bound to explicitly capture `'_` | -LL | fn chars0<'a>(v :(&'a str, &'a str)) -> impl Iterator<Item = char> + 'a { - | ++++ ++ ++ ++++ +LL | fn chars0(v :(& str, &str)) -> impl Iterator<Item = char> + use<'_> { + | +++++++++ error[E0700]: hidden type for `impl Iterator<Item = char>` captures lifetime that does not appear in bounds - --> $DIR/issue-105227.rs:13:5 + --> $DIR/issue-105227.rs:15:5 | LL | fn chars1(v0 : & str, v1 : &str) -> impl Iterator<Item = char> { | ----- -------------------------- opaque type defined here @@ -25,29 +25,26 @@ LL | LL | v0.chars().chain(v1.chars()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: to declare that `impl Iterator<Item = char>` captures `'_`, you can introduce a named lifetime parameter `'a` +help: add a `use<...>` bound to explicitly capture `'_` | -LL | fn chars1<'a>(v0 : &'a str, v1 : &'a str) -> impl Iterator<Item = char> + 'a { - | ++++ ++ ++ ++++ +LL | fn chars1(v0 : & str, v1 : &str) -> impl Iterator<Item = char> + use<'_> { + | +++++++++ error[E0700]: hidden type for `impl Iterator<Item = char>` captures lifetime that does not appear in bounds --> $DIR/issue-105227.rs:21:5 | -LL | fn chars2<'b>(v0 : &str, v1 : &'_ str, v2 : &'b str) -> - | ---- hidden type `std::iter::Chain<Chars<'_>, Chars<'_>>` captures the anonymous lifetime defined here +LL | fn chars2<'b>(v0 : &str, v1 : &'_ str, v2 : &'b str) -> (impl Iterator<Item = char>, &'b str) { + | ---- -------------------------- opaque type defined here + | | + | hidden type `std::iter::Chain<Chars<'_>, Chars<'_>>` captures the anonymous lifetime defined here LL | -LL | (impl Iterator<Item = char>, &'b str) - | -------------------------- opaque type defined here -LL | { LL | (v0.chars().chain(v1.chars()), v2) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: to declare that `impl Iterator<Item = char>` captures `'_`, you can use the named lifetime parameter `'b` - | -LL ~ fn chars2<'b>(v0 : &'b str, v1 : &'b str, v2 : &'b str) -> -LL | -LL ~ (impl Iterator<Item = char> + 'b , &'b str) +help: add a `use<...>` bound to explicitly capture `'_` | +LL | fn chars2<'b>(v0 : &str, v1 : &'_ str, v2 : &'b str) -> (impl Iterator<Item = char> + use<'_>, &'b str) { + | +++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/lifetimes/issue-95023.rs b/tests/ui/lifetimes/issue-95023.rs index bcacd01474f..8461d92fc33 100644 --- a/tests/ui/lifetimes/issue-95023.rs +++ b/tests/ui/lifetimes/issue-95023.rs @@ -2,12 +2,13 @@ struct ErrorKind; struct Error(ErrorKind); impl Fn(&isize) for Error { //~^ ERROR manual implementations of `Fn` are experimental [E0183] - //~^^ ERROR associated item constraints are not allowed here [E0229] + //~| ERROR associated item constraints are not allowed here [E0229] //~| ERROR not all trait items implemented //~| ERROR expected a `FnMut(&isize)` closure, found `Error` fn foo<const N: usize>(&self) -> Self::B<{ N }>; //~^ ERROR associated function in `impl` without body - //~^^ ERROR method `foo` is not a member of trait `Fn` [E0407] - //~^^^ ERROR associated type `B` not found for `Self` [E0220] + //~| ERROR method `foo` is not a member of trait `Fn` [E0407] + //~| ERROR associated type `B` not found for `Self` [E0220] + //~| ERROR: associated type `B` not found for `Self` } fn main() {} diff --git a/tests/ui/lifetimes/issue-95023.stderr b/tests/ui/lifetimes/issue-95023.stderr index cbc0eeebee1..310dee51406 100644 --- a/tests/ui/lifetimes/issue-95023.stderr +++ b/tests/ui/lifetimes/issue-95023.stderr @@ -56,7 +56,15 @@ error[E0220]: associated type `B` not found for `Self` LL | fn foo<const N: usize>(&self) -> Self::B<{ N }>; | ^ help: `Self` has the following associated type: `Output` -error: aborting due to 7 previous errors +error[E0220]: associated type `B` not found for `Self` + --> $DIR/issue-95023.rs:8:44 + | +LL | fn foo<const N: usize>(&self) -> Self::B<{ N }>; + | ^ help: `Self` has the following associated type: `Output` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 8 previous errors Some errors have detailed explanations: E0046, E0183, E0220, E0229, E0277, E0407. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs b/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs index d0a8fe795ef..63a2c9be9eb 100644 --- a/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs +++ b/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs @@ -47,5 +47,6 @@ fn l<'a>(_: &'a str, _: &'a str) -> &str { "" } // This is ok because both `'a` are for the same parameter. fn m<'a>(_: &'a Foo<'a>) -> &str { "" } +//~^ WARNING elided lifetime has a name fn main() {} diff --git a/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr b/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr index 23ef36888f0..f835d2655bb 100644 --- a/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr +++ b/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr @@ -105,6 +105,16 @@ help: consider using the `'a` lifetime LL | fn l<'a>(_: &'a str, _: &'a str) -> &'a str { "" } | ++ -error: aborting due to 7 previous errors +warning: elided lifetime has a name + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:49:29 + | +LL | fn m<'a>(_: &'a Foo<'a>) -> &str { "" } + | -- ^ this elided lifetime gets resolved as `'a` + | | + | lifetime `'a` declared here + | + = note: `#[warn(elided_named_lifetimes)]` on by default + +error: aborting due to 7 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0106`. diff --git a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs index a1126d6bb15..598633d7576 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs +++ b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs @@ -4,6 +4,7 @@ struct Foo { impl Foo { fn foo<'a>(&'a self, x: &i32) -> &i32 { + //~^ WARNING elided lifetime has a name if true { &self.field } else { x } //~ ERROR explicit lifetime diff --git a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr index 6dda9e61a79..2d5d4fb0e72 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr @@ -1,12 +1,22 @@ +warning: elided lifetime has a name + --> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:6:36 + | +LL | fn foo<'a>(&'a self, x: &i32) -> &i32 { + | -- ^ this elided lifetime gets resolved as `'a` + | | + | lifetime `'a` declared here + | + = note: `#[warn(elided_named_lifetimes)]` on by default + error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:8:36 + --> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:9:36 | LL | fn foo<'a>(&'a self, x: &i32) -> &i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` -LL | +... LL | if true { &self.field } else { x } | ^ lifetime `'a` required -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted For more information about this error, try `rustc --explain E0621`. diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index 43c8cdead9f..f75ff6d05a1 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -21,10 +21,10 @@ warning: `clash` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:14:13 | LL | fn clash(x: u8); - | --------------- `clash` previously declared here + | ---------------- `clash` previously declared here ... LL | fn clash(x: u64); - | ^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(u8)` found `unsafe extern "C" fn(u64)` @@ -41,7 +41,7 @@ LL | #[link_name = "extern_link_name"] | --------------------------------- `extern_link_name` previously declared here ... LL | fn extern_link_name(x: u32); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(i16)` found `unsafe extern "C" fn(u32)` @@ -50,7 +50,7 @@ warning: `some_other_extern_link_name` redeclares `some_other_new_name` with a d --> $DIR/clashing-extern-fn.rs:55:9 | LL | fn some_other_new_name(x: i16); - | ------------------------------ `some_other_new_name` previously declared here + | ------------------------------- `some_other_new_name` previously declared here ... LL | #[link_name = "some_other_new_name"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration @@ -74,10 +74,10 @@ warning: `different_mod` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:72:9 | LL | fn different_mod(x: u8); - | ----------------------- `different_mod` previously declared here + | ------------------------ `different_mod` previously declared here ... LL | fn different_mod(x: u64); - | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(u8)` found `unsafe extern "C" fn(u64)` @@ -86,10 +86,10 @@ warning: `variadic_decl` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:82:9 | LL | fn variadic_decl(x: u8, ...); - | ---------------------------- `variadic_decl` previously declared here + | ----------------------------- `variadic_decl` previously declared here ... LL | fn variadic_decl(x: u8); - | ^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(u8, ...)` found `unsafe extern "C" fn(u8)` @@ -98,10 +98,10 @@ warning: `weigh_banana` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:142:13 | LL | fn weigh_banana(count: *const Banana) -> u64; - | -------------------------------------------- `weigh_banana` previously declared here + | --------------------------------------------- `weigh_banana` previously declared here ... LL | fn weigh_banana(count: *const Banana) -> u64; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(*const one::Banana) -> u64` found `unsafe extern "C" fn(*const three::Banana) -> u64` @@ -110,10 +110,10 @@ warning: `draw_point` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:171:13 | LL | fn draw_point(p: Point); - | ----------------------- `draw_point` previously declared here + | ------------------------ `draw_point` previously declared here ... LL | fn draw_point(p: Point); - | ^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(sameish_members::a::Point)` found `unsafe extern "C" fn(sameish_members::b::Point)` @@ -122,10 +122,10 @@ warning: `origin` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:197:13 | LL | fn origin() -> Point3; - | --------------------- `origin` previously declared here + | ---------------------- `origin` previously declared here ... LL | fn origin() -> Point3; - | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> same_sized_members_clash::a::Point3` found `unsafe extern "C" fn() -> same_sized_members_clash::b::Point3` @@ -134,10 +134,10 @@ warning: `transparent_incorrect` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:220:13 | LL | fn transparent_incorrect() -> T; - | ------------------------------- `transparent_incorrect` previously declared here + | -------------------------------- `transparent_incorrect` previously declared here ... LL | fn transparent_incorrect() -> isize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> T` found `unsafe extern "C" fn() -> isize` @@ -146,10 +146,10 @@ warning: `missing_return_type` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:259:13 | LL | fn missing_return_type() -> usize; - | --------------------------------- `missing_return_type` previously declared here + | ---------------------------------- `missing_return_type` previously declared here ... LL | fn missing_return_type(); - | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> usize` found `unsafe extern "C" fn()` @@ -158,10 +158,10 @@ warning: `non_zero_usize` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:277:13 | LL | fn non_zero_usize() -> core::num::NonZero<usize>; - | ------------------------------------------------ `non_zero_usize` previously declared here + | ------------------------------------------------- `non_zero_usize` previously declared here ... LL | fn non_zero_usize() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> NonZero<usize>` found `unsafe extern "C" fn() -> usize` @@ -170,10 +170,10 @@ warning: `non_null_ptr` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:279:13 | LL | fn non_null_ptr() -> core::ptr::NonNull<usize>; - | ---------------------------------------------- `non_null_ptr` previously declared here + | ----------------------------------------------- `non_null_ptr` previously declared here ... LL | fn non_null_ptr() -> *const usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> NonNull<usize>` found `unsafe extern "C" fn() -> *const usize` @@ -182,10 +182,10 @@ warning: `option_non_zero_usize_incorrect` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:373:13 | LL | fn option_non_zero_usize_incorrect() -> usize; - | --------------------------------------------- `option_non_zero_usize_incorrect` previously declared here + | ---------------------------------------------- `option_non_zero_usize_incorrect` previously declared here ... LL | fn option_non_zero_usize_incorrect() -> isize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> usize` found `unsafe extern "C" fn() -> isize` @@ -194,10 +194,10 @@ warning: `option_non_null_ptr_incorrect` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:375:13 | LL | fn option_non_null_ptr_incorrect() -> *const usize; - | -------------------------------------------------- `option_non_null_ptr_incorrect` previously declared here + | --------------------------------------------------- `option_non_null_ptr_incorrect` previously declared here ... LL | fn option_non_null_ptr_incorrect() -> *const isize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> *const usize` found `unsafe extern "C" fn() -> *const isize` @@ -206,10 +206,10 @@ warning: `hidden_niche_transparent_no_niche` redeclared with a different signatu --> $DIR/clashing-extern-fn.rs:429:13 | LL | fn hidden_niche_transparent_no_niche() -> usize; - | ----------------------------------------------- `hidden_niche_transparent_no_niche` previously declared here + | ------------------------------------------------ `hidden_niche_transparent_no_niche` previously declared here ... LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoNiche>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> usize` found `unsafe extern "C" fn() -> Option<TransparentNoNiche>` @@ -218,10 +218,10 @@ warning: `hidden_niche_unsafe_cell` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:433:13 | LL | fn hidden_niche_unsafe_cell() -> usize; - | -------------------------------------- `hidden_niche_unsafe_cell` previously declared here + | --------------------------------------- `hidden_niche_unsafe_cell` previously declared here ... LL | fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZero<usize>>>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn() -> usize` found `unsafe extern "C" fn() -> Option<UnsafeCell<NonZero<usize>>>` diff --git a/tests/ui/lint/cli-unknown-force-warn.stderr b/tests/ui/lint/cli-unknown-force-warn.stderr index cfff190b54a..5084b4a4001 100644 --- a/tests/ui/lint/cli-unknown-force-warn.stderr +++ b/tests/ui/lint/cli-unknown-force-warn.stderr @@ -13,11 +13,6 @@ warning[E0602]: unknown lint: `foo_qux` = note: requested on the command line with `--force-warn foo_qux` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -warning[E0602]: unknown lint: `foo_qux` - | - = note: requested on the command line with `--force-warn foo_qux` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -warning: 4 warnings emitted +warning: 3 warnings emitted For more information about this error, try `rustc --explain E0602`. diff --git a/tests/ui/lint/dropping_copy_types-macros.fixed b/tests/ui/lint/dropping_copy_types-macros.fixed new file mode 100644 index 00000000000..a8ceedadc80 --- /dev/null +++ b/tests/ui/lint/dropping_copy_types-macros.fixed @@ -0,0 +1,12 @@ +//@ check-fail +//@ run-rustfix + +#![deny(dropping_copy_types)] + +use std::fmt::Write; + +fn main() { + let mut msg = String::new(); + let _ = writeln!(&mut msg, "test"); + //~^ ERROR calls to `std::mem::drop` +} diff --git a/tests/ui/lint/dropping_copy_types-macros.rs b/tests/ui/lint/dropping_copy_types-macros.rs new file mode 100644 index 00000000000..b249b0c868f --- /dev/null +++ b/tests/ui/lint/dropping_copy_types-macros.rs @@ -0,0 +1,12 @@ +//@ check-fail +//@ run-rustfix + +#![deny(dropping_copy_types)] + +use std::fmt::Write; + +fn main() { + let mut msg = String::new(); + drop(writeln!(&mut msg, "test")); + //~^ ERROR calls to `std::mem::drop` +} diff --git a/tests/ui/lint/dropping_copy_types-macros.stderr b/tests/ui/lint/dropping_copy_types-macros.stderr new file mode 100644 index 00000000000..117e9f4fe09 --- /dev/null +++ b/tests/ui/lint/dropping_copy_types-macros.stderr @@ -0,0 +1,21 @@ +error: calls to `std::mem::drop` with a value that implements `Copy` does nothing + --> $DIR/dropping_copy_types-macros.rs:10:5 + | +LL | drop(writeln!(&mut msg, "test")); + | ^^^^^--------------------------^ + | | + | argument has type `Result<(), std::fmt::Error>` + | +note: the lint level is defined here + --> $DIR/dropping_copy_types-macros.rs:4:9 + | +LL | #![deny(dropping_copy_types)] + | ^^^^^^^^^^^^^^^^^^^ +help: use `let _ = ...` to ignore the expression or result + | +LL - drop(writeln!(&mut msg, "test")); +LL + let _ = writeln!(&mut msg, "test"); + | + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.rs b/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.rs new file mode 100644 index 00000000000..eac7c32a9aa --- /dev/null +++ b/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.rs @@ -0,0 +1,12 @@ +#![deny(elided_named_lifetimes)] + +struct Foo; + +impl Foo { + pub fn get_mut(&'static self, x: &mut u8) -> &mut u8 { + //~^ ERROR elided lifetime has a name + unsafe { &mut *(x as *mut _) } + } +} + +fn main() {} diff --git a/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr b/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr new file mode 100644 index 00000000000..8c5426a60cb --- /dev/null +++ b/tests/ui/lint/elided-named-lifetimes/example-from-issue48686.stderr @@ -0,0 +1,14 @@ +error: elided lifetime has a name + --> $DIR/example-from-issue48686.rs:6:50 + | +LL | pub fn get_mut(&'static self, x: &mut u8) -> &mut u8 { + | ^ this elided lifetime gets resolved as `'static` + | +note: the lint level is defined here + --> $DIR/example-from-issue48686.rs:1:9 + | +LL | #![deny(elided_named_lifetimes)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/elided-named-lifetimes/missing-lifetime-kind.rs b/tests/ui/lint/elided-named-lifetimes/missing-lifetime-kind.rs new file mode 100644 index 00000000000..2f9083ed65f --- /dev/null +++ b/tests/ui/lint/elided-named-lifetimes/missing-lifetime-kind.rs @@ -0,0 +1,27 @@ +#![deny(elided_named_lifetimes)] + +fn ampersand<'a>(x: &'a u8) -> &u8 { + //~^ ERROR elided lifetime has a name + x +} + +struct Brackets<'a>(&'a u8); + +fn brackets<'a>(x: &'a u8) -> Brackets { + //~^ ERROR elided lifetime has a name + Brackets(x) +} + +struct Comma<'a, T>(&'a T); + +fn comma<'a>(x: &'a u8) -> Comma<u8> { + //~^ ERROR elided lifetime has a name + Comma(x) +} + +fn underscore<'a>(x: &'a u8) -> &'_ u8 { + //~^ ERROR elided lifetime has a name + x +} + +fn main() {} diff --git a/tests/ui/lint/elided-named-lifetimes/missing-lifetime-kind.stderr b/tests/ui/lint/elided-named-lifetimes/missing-lifetime-kind.stderr new file mode 100644 index 00000000000..249ae146b16 --- /dev/null +++ b/tests/ui/lint/elided-named-lifetimes/missing-lifetime-kind.stderr @@ -0,0 +1,40 @@ +error: elided lifetime has a name + --> $DIR/missing-lifetime-kind.rs:3:32 + | +LL | fn ampersand<'a>(x: &'a u8) -> &u8 { + | -- ^ this elided lifetime gets resolved as `'a` + | | + | lifetime `'a` declared here + | +note: the lint level is defined here + --> $DIR/missing-lifetime-kind.rs:1:9 + | +LL | #![deny(elided_named_lifetimes)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: elided lifetime has a name + --> $DIR/missing-lifetime-kind.rs:10:31 + | +LL | fn brackets<'a>(x: &'a u8) -> Brackets { + | -- ^^^^^^^^ this elided lifetime gets resolved as `'a` + | | + | lifetime `'a` declared here + +error: elided lifetime has a name + --> $DIR/missing-lifetime-kind.rs:17:33 + | +LL | fn comma<'a>(x: &'a u8) -> Comma<u8> { + | -- ^ this elided lifetime gets resolved as `'a` + | | + | lifetime `'a` declared here + +error: elided lifetime has a name + --> $DIR/missing-lifetime-kind.rs:22:34 + | +LL | fn underscore<'a>(x: &'a u8) -> &'_ u8 { + | -- ^^ this elided lifetime gets resolved as `'a` + | | + | lifetime `'a` declared here + +error: aborting due to 4 previous errors + diff --git a/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.rs b/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.rs new file mode 100644 index 00000000000..4f9218130fb --- /dev/null +++ b/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.rs @@ -0,0 +1,17 @@ +#![allow(elided_named_lifetimes)] + +#[warn(elided_named_lifetimes)] +mod foo { + fn bar(x: &'static u8) -> &u8 { + //~^ WARNING elided lifetime has a name + x + } + + #[deny(elided_named_lifetimes)] + fn baz(x: &'static u8) -> &u8 { + //~^ ERROR elided lifetime has a name + x + } +} + +fn main() {} diff --git a/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr b/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr new file mode 100644 index 00000000000..c465aab1a03 --- /dev/null +++ b/tests/ui/lint/elided-named-lifetimes/not-tied-to-crate.stderr @@ -0,0 +1,26 @@ +warning: elided lifetime has a name + --> $DIR/not-tied-to-crate.rs:5:31 + | +LL | fn bar(x: &'static u8) -> &u8 { + | ^ this elided lifetime gets resolved as `'static` + | +note: the lint level is defined here + --> $DIR/not-tied-to-crate.rs:3:8 + | +LL | #[warn(elided_named_lifetimes)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: elided lifetime has a name + --> $DIR/not-tied-to-crate.rs:11:31 + | +LL | fn baz(x: &'static u8) -> &u8 { + | ^ this elided lifetime gets resolved as `'static` + | +note: the lint level is defined here + --> $DIR/not-tied-to-crate.rs:10:12 + | +LL | #[deny(elided_named_lifetimes)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error; 1 warning emitted + diff --git a/tests/ui/lint/elided-named-lifetimes/static.rs b/tests/ui/lint/elided-named-lifetimes/static.rs new file mode 100644 index 00000000000..dc8222c6e6e --- /dev/null +++ b/tests/ui/lint/elided-named-lifetimes/static.rs @@ -0,0 +1,46 @@ +#![deny(elided_named_lifetimes)] + +use std::borrow::Cow; + +const A: &[u8] = &[]; +static B: &str = "hello"; + +trait Trait { + const C: &u8 = &0; +} + +impl Trait for () { + const C: &u8 = &1; +} + +fn ampersand(x: &'static u8) -> &u8 { + //~^ ERROR elided lifetime has a name + x +} + +struct Brackets<'a>(&'a u8); + +fn brackets(x: &'static u8) -> Brackets { + //~^ ERROR elided lifetime has a name + Brackets(x) +} + +struct Comma<'a, T>(&'a T); + +fn comma(x: &'static u8) -> Comma<u8> { + //~^ ERROR elided lifetime has a name + Comma(x) +} + +fn underscore(x: &'static u8) -> &'_ u8 { + //~^ ERROR elided lifetime has a name + x +} + +const NESTED: &Vec<&Box<Cow<str>>> = &vec![]; + +fn main() { + const HELLO: &str = "Hello"; + static WORLD: &str = "world"; + println!("{HELLO}, {WORLD}!") +} diff --git a/tests/ui/lint/elided-named-lifetimes/static.stderr b/tests/ui/lint/elided-named-lifetimes/static.stderr new file mode 100644 index 00000000000..d2e9776cb4f --- /dev/null +++ b/tests/ui/lint/elided-named-lifetimes/static.stderr @@ -0,0 +1,32 @@ +error: elided lifetime has a name + --> $DIR/static.rs:16:33 + | +LL | fn ampersand(x: &'static u8) -> &u8 { + | ^ this elided lifetime gets resolved as `'static` + | +note: the lint level is defined here + --> $DIR/static.rs:1:9 + | +LL | #![deny(elided_named_lifetimes)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: elided lifetime has a name + --> $DIR/static.rs:23:32 + | +LL | fn brackets(x: &'static u8) -> Brackets { + | ^^^^^^^^ this elided lifetime gets resolved as `'static` + +error: elided lifetime has a name + --> $DIR/static.rs:30:34 + | +LL | fn comma(x: &'static u8) -> Comma<u8> { + | ^ this elided lifetime gets resolved as `'static` + +error: elided lifetime has a name + --> $DIR/static.rs:35:35 + | +LL | fn underscore(x: &'static u8) -> &'_ u8 { + | ^^ this elided lifetime gets resolved as `'static` + +error: aborting due to 4 previous errors + diff --git a/tests/ui/lint/issue-1866.stderr b/tests/ui/lint/issue-1866.stderr index 36d323825a4..d19a1349668 100644 --- a/tests/ui/lint/issue-1866.stderr +++ b/tests/ui/lint/issue-1866.stderr @@ -2,10 +2,10 @@ warning: `rust_task_is_unwinding` redeclared with a different signature --> $DIR/issue-1866.rs:23:13 | LL | pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; - | ----------------------------------------------------------- `rust_task_is_unwinding` previously declared here + | ------------------------------------------------------------ `rust_task_is_unwinding` previously declared here ... LL | pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn(*const usize) -> bool` found `unsafe extern "C" fn(*const bool) -> bool` diff --git a/tests/ui/lint/issue-30302.stderr b/tests/ui/lint/issue-30302.stderr index baf6c0d7a59..317fefee466 100644 --- a/tests/ui/lint/issue-30302.stderr +++ b/tests/ui/lint/issue-30302.stderr @@ -13,7 +13,7 @@ LL | Nil => true, | --- matches any value LL | LL | _ => false - | ^ unreachable pattern + | ^ no value can reach this | note: the lint level is defined here --> $DIR/issue-30302.rs:4:9 diff --git a/tests/ui/lint/lint-attr-everywhere-late.stderr b/tests/ui/lint/lint-attr-everywhere-late.stderr index ddc31905afb..1937b618236 100644 --- a/tests/ui/lint/lint-attr-everywhere-late.stderr +++ b/tests/ui/lint/lint-attr-everywhere-late.stderr @@ -406,10 +406,10 @@ error: `clashing1` redeclared with a different signature --> $DIR/lint-attr-everywhere-late.rs:123:5 | LL | fn clashing1(); - | -------------- `clashing1` previously declared here + | --------------- `clashing1` previously declared here ... LL | fn clashing1(_: i32); - | ^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn()` found `unsafe extern "C" fn(i32)` @@ -423,10 +423,10 @@ error: `clashing2` redeclared with a different signature --> $DIR/lint-attr-everywhere-late.rs:128:5 | LL | fn clashing2(); - | -------------- `clashing2` previously declared here + | --------------- `clashing2` previously declared here ... LL | fn clashing2(_: i32); - | ^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | = note: expected `unsafe extern "C" fn()` found `unsafe extern "C" fn(i32)` diff --git a/tests/ui/lint/lint-ctypes-cstr.rs b/tests/ui/lint/lint-ctypes-cstr.rs new file mode 100644 index 00000000000..b04decd0bca --- /dev/null +++ b/tests/ui/lint/lint-ctypes-cstr.rs @@ -0,0 +1,36 @@ +#![crate_type = "lib"] +#![deny(improper_ctypes, improper_ctypes_definitions)] + +use std::ffi::{CStr, CString}; + +extern "C" { + fn take_cstr(s: CStr); + //~^ ERROR `extern` block uses type `CStr`, which is not FFI-safe + //~| HELP consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + fn take_cstr_ref(s: &CStr); + //~^ ERROR `extern` block uses type `CStr`, which is not FFI-safe + //~| HELP consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + fn take_cstring(s: CString); + //~^ ERROR `extern` block uses type `CString`, which is not FFI-safe + //~| HELP consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + fn take_cstring_ref(s: &CString); + //~^ ERROR `extern` block uses type `CString`, which is not FFI-safe + //~| HELP consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + + fn no_special_help_for_mut_cstring(s: *mut CString); + //~^ ERROR `extern` block uses type `CString`, which is not FFI-safe + //~| HELP consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct + + fn no_special_help_for_mut_cstring_ref(s: &mut CString); + //~^ ERROR `extern` block uses type `CString`, which is not FFI-safe + //~| HELP consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct +} + +extern "C" fn rust_take_cstr_ref(s: &CStr) {} +//~^ ERROR `extern` fn uses type `CStr`, which is not FFI-safe +//~| HELP consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` +extern "C" fn rust_take_cstring(s: CString) {} +//~^ ERROR `extern` fn uses type `CString`, which is not FFI-safe +//~| HELP consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` +extern "C" fn rust_no_special_help_for_mut_cstring(s: *mut CString) {} +extern "C" fn rust_no_special_help_for_mut_cstring_ref(s: &mut CString) {} diff --git a/tests/ui/lint/lint-ctypes-cstr.stderr b/tests/ui/lint/lint-ctypes-cstr.stderr new file mode 100644 index 00000000000..8957758d577 --- /dev/null +++ b/tests/ui/lint/lint-ctypes-cstr.stderr @@ -0,0 +1,84 @@ +error: `extern` block uses type `CStr`, which is not FFI-safe + --> $DIR/lint-ctypes-cstr.rs:7:21 + | +LL | fn take_cstr(s: CStr); + | ^^^^ not FFI-safe + | + = help: consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + = note: `CStr`/`CString` do not have a guaranteed layout +note: the lint level is defined here + --> $DIR/lint-ctypes-cstr.rs:2:9 + | +LL | #![deny(improper_ctypes, improper_ctypes_definitions)] + | ^^^^^^^^^^^^^^^ + +error: `extern` block uses type `CStr`, which is not FFI-safe + --> $DIR/lint-ctypes-cstr.rs:10:25 + | +LL | fn take_cstr_ref(s: &CStr); + | ^^^^^ not FFI-safe + | + = help: consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + = note: `CStr`/`CString` do not have a guaranteed layout + +error: `extern` block uses type `CString`, which is not FFI-safe + --> $DIR/lint-ctypes-cstr.rs:13:24 + | +LL | fn take_cstring(s: CString); + | ^^^^^^^ not FFI-safe + | + = help: consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + = note: `CStr`/`CString` do not have a guaranteed layout + +error: `extern` block uses type `CString`, which is not FFI-safe + --> $DIR/lint-ctypes-cstr.rs:16:28 + | +LL | fn take_cstring_ref(s: &CString); + | ^^^^^^^^ not FFI-safe + | + = help: consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + = note: `CStr`/`CString` do not have a guaranteed layout + +error: `extern` block uses type `CString`, which is not FFI-safe + --> $DIR/lint-ctypes-cstr.rs:20:43 + | +LL | fn no_special_help_for_mut_cstring(s: *mut CString); + | ^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct + = note: this struct has unspecified layout + +error: `extern` block uses type `CString`, which is not FFI-safe + --> $DIR/lint-ctypes-cstr.rs:24:47 + | +LL | fn no_special_help_for_mut_cstring_ref(s: &mut CString); + | ^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct + = note: this struct has unspecified layout + +error: `extern` fn uses type `CStr`, which is not FFI-safe + --> $DIR/lint-ctypes-cstr.rs:29:37 + | +LL | extern "C" fn rust_take_cstr_ref(s: &CStr) {} + | ^^^^^ not FFI-safe + | + = help: consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + = note: `CStr`/`CString` do not have a guaranteed layout +note: the lint level is defined here + --> $DIR/lint-ctypes-cstr.rs:2:26 + | +LL | #![deny(improper_ctypes, improper_ctypes_definitions)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: `extern` fn uses type `CString`, which is not FFI-safe + --> $DIR/lint-ctypes-cstr.rs:32:36 + | +LL | extern "C" fn rust_take_cstring(s: CString) {} + | ^^^^^^^ not FFI-safe + | + = help: consider passing a `*const std::ffi::c_char` instead, and use `CStr::as_ptr()` + = note: `CStr`/`CString` do not have a guaranteed layout + +error: aborting due to 8 previous errors + diff --git a/tests/ui/lint/lint-missing-doc.stderr b/tests/ui/lint/lint-missing-doc.stderr index 4e9ee4f2769..5165ccc3fd0 100644 --- a/tests/ui/lint/lint-missing-doc.stderr +++ b/tests/ui/lint/lint-missing-doc.stderr @@ -116,7 +116,7 @@ error: missing documentation for a function --> $DIR/lint-missing-doc.rs:196:5 | LL | pub fn extern_fn_undocumented(f: f32) -> f32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static --> $DIR/lint-missing-doc.rs:201:5 diff --git a/tests/ui/lint/lint-removed-cmdline-deny.stderr b/tests/ui/lint/lint-removed-cmdline-deny.stderr index 2a24e795f44..3321afa7fcd 100644 --- a/tests/ui/lint/lint-removed-cmdline-deny.stderr +++ b/tests/ui/lint/lint-removed-cmdline-deny.stderr @@ -26,10 +26,5 @@ LL | #[deny(warnings)] | ^^^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]` -error: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok - | - = note: requested on the command line with `-D raw_pointer_derive` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors diff --git a/tests/ui/lint/lint-removed-cmdline.stderr b/tests/ui/lint/lint-removed-cmdline.stderr index 78ae2fd8fbf..fd63433c308 100644 --- a/tests/ui/lint/lint-removed-cmdline.stderr +++ b/tests/ui/lint/lint-removed-cmdline.stderr @@ -26,10 +26,5 @@ LL | #[deny(warnings)] | ^^^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]` -warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok - | - = note: requested on the command line with `-D raw_pointer_derive` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 1 previous error; 4 warnings emitted +error: aborting due to 1 previous error; 3 warnings emitted diff --git a/tests/ui/lint/lint-renamed-cmdline-deny.stderr b/tests/ui/lint/lint-renamed-cmdline-deny.stderr index 3c1a59ec1e1..0e182a4e5de 100644 --- a/tests/ui/lint/lint-renamed-cmdline-deny.stderr +++ b/tests/ui/lint/lint-renamed-cmdline-deny.stderr @@ -29,11 +29,5 @@ LL | #[deny(unused)] | ^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` -error: lint `bare_trait_object` has been renamed to `bare_trait_objects` - | - = help: use the new name `bare_trait_objects` - = note: requested on the command line with `-D bare_trait_object` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors diff --git a/tests/ui/lint/lint-renamed-cmdline.stderr b/tests/ui/lint/lint-renamed-cmdline.stderr index 6544416f611..d6bb72f34dc 100644 --- a/tests/ui/lint/lint-renamed-cmdline.stderr +++ b/tests/ui/lint/lint-renamed-cmdline.stderr @@ -29,11 +29,5 @@ LL | #[deny(unused)] | ^^^^^^ = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` -warning: lint `bare_trait_object` has been renamed to `bare_trait_objects` - | - = help: use the new name `bare_trait_objects` - = note: requested on the command line with `-D bare_trait_object` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 1 previous error; 4 warnings emitted +error: aborting due to 1 previous error; 3 warnings emitted diff --git a/tests/ui/lint/lint-unexported-no-mangle.stderr b/tests/ui/lint/lint-unexported-no-mangle.stderr index 39377b6fe84..0efec51abaf 100644 --- a/tests/ui/lint/lint-unexported-no-mangle.stderr +++ b/tests/ui/lint/lint-unexported-no-mangle.stderr @@ -45,15 +45,5 @@ LL | pub const PUB_FOO: u64 = 1; | | | help: try a static value: `pub static` -warning: lint `private_no_mangle_fns` has been removed: no longer a warning, `#[no_mangle]` functions always exported - | - = note: requested on the command line with `-F private_no_mangle_fns` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -warning: lint `private_no_mangle_statics` has been removed: no longer a warning, `#[no_mangle]` statics always exported - | - = note: requested on the command line with `-F private_no_mangle_statics` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 2 previous errors; 8 warnings emitted +error: aborting due to 2 previous errors; 6 warnings emitted diff --git a/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr index 1ce55706d76..f12ce03ddfc 100644 --- a/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr +++ b/tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr @@ -30,17 +30,6 @@ error[E0602]: unknown lint: `dead_cod` = note: requested on the command line with `-D dead_cod` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0602]: unknown lint: `bogus` - | - = note: requested on the command line with `-D bogus` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0602]: unknown lint: `dead_cod` - | - = help: did you mean: `dead_code` - = note: requested on the command line with `-D dead_cod` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 8 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0602`. diff --git a/tests/ui/lint/lint-unknown-lint-cmdline.stderr b/tests/ui/lint/lint-unknown-lint-cmdline.stderr index 4e0c5dbcb07..f452fc9eb94 100644 --- a/tests/ui/lint/lint-unknown-lint-cmdline.stderr +++ b/tests/ui/lint/lint-unknown-lint-cmdline.stderr @@ -30,17 +30,6 @@ warning[E0602]: unknown lint: `dead_cod` = note: requested on the command line with `-D dead_cod` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -warning[E0602]: unknown lint: `bogus` - | - = note: requested on the command line with `-D bogus` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -warning[E0602]: unknown lint: `dead_cod` - | - = help: did you mean: `dead_code` - = note: requested on the command line with `-D dead_cod` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -warning: 8 warnings emitted +warning: 6 warnings emitted For more information about this error, try `rustc --explain E0602`. diff --git a/tests/ui/lint/lint-unnecessary-parens.fixed b/tests/ui/lint/lint-unnecessary-parens.fixed index 089aa1b7ab7..a8c8dd1d512 100644 --- a/tests/ui/lint/lint-unnecessary-parens.fixed +++ b/tests/ui/lint/lint-unnecessary-parens.fixed @@ -1,7 +1,6 @@ //@ run-rustfix #![deny(unused_parens)] -#![feature(raw_ref_op)] #![allow(while_true)] // for rustfix #[derive(Eq, PartialEq)] diff --git a/tests/ui/lint/lint-unnecessary-parens.rs b/tests/ui/lint/lint-unnecessary-parens.rs index dc77ee00352..02aa78283c7 100644 --- a/tests/ui/lint/lint-unnecessary-parens.rs +++ b/tests/ui/lint/lint-unnecessary-parens.rs @@ -1,7 +1,6 @@ //@ run-rustfix #![deny(unused_parens)] -#![feature(raw_ref_op)] #![allow(while_true)] // for rustfix #[derive(Eq, PartialEq)] diff --git a/tests/ui/lint/lint-unnecessary-parens.stderr b/tests/ui/lint/lint-unnecessary-parens.stderr index c9422437a9f..f2e5debd6e0 100644 --- a/tests/ui/lint/lint-unnecessary-parens.stderr +++ b/tests/ui/lint/lint-unnecessary-parens.stderr @@ -1,5 +1,5 @@ error: unnecessary parentheses around `return` value - --> $DIR/lint-unnecessary-parens.rs:14:12 + --> $DIR/lint-unnecessary-parens.rs:13:12 | LL | return (1); | ^ ^ @@ -16,7 +16,7 @@ LL + return 1; | error: unnecessary parentheses around `return` value - --> $DIR/lint-unnecessary-parens.rs:17:12 + --> $DIR/lint-unnecessary-parens.rs:16:12 | LL | return (X { y }); | ^ ^ @@ -28,7 +28,7 @@ LL + return X { y }; | error: unnecessary parentheses around type - --> $DIR/lint-unnecessary-parens.rs:20:46 + --> $DIR/lint-unnecessary-parens.rs:19:46 | LL | pub fn unused_parens_around_return_type() -> (u32) { | ^ ^ @@ -40,7 +40,7 @@ LL + pub fn unused_parens_around_return_type() -> u32 { | error: unnecessary parentheses around block return value - --> $DIR/lint-unnecessary-parens.rs:26:9 + --> $DIR/lint-unnecessary-parens.rs:25:9 | LL | (5) | ^ ^ @@ -52,7 +52,7 @@ LL + 5 | error: unnecessary parentheses around block return value - --> $DIR/lint-unnecessary-parens.rs:28:5 + --> $DIR/lint-unnecessary-parens.rs:27:5 | LL | (5) | ^ ^ @@ -64,7 +64,7 @@ LL + 5 | error: unnecessary parentheses around `if` condition - --> $DIR/lint-unnecessary-parens.rs:40:7 + --> $DIR/lint-unnecessary-parens.rs:39:7 | LL | if(true) {} | ^ ^ @@ -76,7 +76,7 @@ LL + if true {} | error: unnecessary parentheses around `while` condition - --> $DIR/lint-unnecessary-parens.rs:41:10 + --> $DIR/lint-unnecessary-parens.rs:40:10 | LL | while(true) {} | ^ ^ @@ -88,7 +88,7 @@ LL + while true {} | error: unnecessary parentheses around `for` iterator expression - --> $DIR/lint-unnecessary-parens.rs:42:13 + --> $DIR/lint-unnecessary-parens.rs:41:13 | LL | for _ in(e) {} | ^ ^ @@ -100,7 +100,7 @@ LL + for _ in e {} | error: unnecessary parentheses around `match` scrutinee expression - --> $DIR/lint-unnecessary-parens.rs:43:10 + --> $DIR/lint-unnecessary-parens.rs:42:10 | LL | match(1) { _ => ()} | ^ ^ @@ -112,7 +112,7 @@ LL + match 1 { _ => ()} | error: unnecessary parentheses around `return` value - --> $DIR/lint-unnecessary-parens.rs:44:11 + --> $DIR/lint-unnecessary-parens.rs:43:11 | LL | return(1); | ^ ^ @@ -124,7 +124,7 @@ LL + return 1; | error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:75:31 + --> $DIR/lint-unnecessary-parens.rs:74:31 | LL | pub const CONST_ITEM: usize = (10); | ^ ^ @@ -136,7 +136,7 @@ LL + pub const CONST_ITEM: usize = 10; | error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:76:33 + --> $DIR/lint-unnecessary-parens.rs:75:33 | LL | pub static STATIC_ITEM: usize = (10); | ^ ^ @@ -148,7 +148,7 @@ LL + pub static STATIC_ITEM: usize = 10; | error: unnecessary parentheses around function argument - --> $DIR/lint-unnecessary-parens.rs:80:9 + --> $DIR/lint-unnecessary-parens.rs:79:9 | LL | bar((true)); | ^ ^ @@ -160,7 +160,7 @@ LL + bar(true); | error: unnecessary parentheses around `if` condition - --> $DIR/lint-unnecessary-parens.rs:82:8 + --> $DIR/lint-unnecessary-parens.rs:81:8 | LL | if (true) {} | ^ ^ @@ -172,7 +172,7 @@ LL + if true {} | error: unnecessary parentheses around `while` condition - --> $DIR/lint-unnecessary-parens.rs:83:11 + --> $DIR/lint-unnecessary-parens.rs:82:11 | LL | while (true) {} | ^ ^ @@ -184,7 +184,7 @@ LL + while true {} | error: unnecessary parentheses around `match` scrutinee expression - --> $DIR/lint-unnecessary-parens.rs:84:11 + --> $DIR/lint-unnecessary-parens.rs:83:11 | LL | match (true) { | ^ ^ @@ -196,7 +196,7 @@ LL + match true { | error: unnecessary parentheses around `let` scrutinee expression - --> $DIR/lint-unnecessary-parens.rs:87:16 + --> $DIR/lint-unnecessary-parens.rs:86:16 | LL | if let 1 = (1) {} | ^ ^ @@ -208,7 +208,7 @@ LL + if let 1 = 1 {} | error: unnecessary parentheses around `let` scrutinee expression - --> $DIR/lint-unnecessary-parens.rs:88:19 + --> $DIR/lint-unnecessary-parens.rs:87:19 | LL | while let 1 = (2) {} | ^ ^ @@ -220,7 +220,7 @@ LL + while let 1 = 2 {} | error: unnecessary parentheses around method argument - --> $DIR/lint-unnecessary-parens.rs:104:24 + --> $DIR/lint-unnecessary-parens.rs:103:24 | LL | X { y: false }.foo((true)); | ^ ^ @@ -232,7 +232,7 @@ LL + X { y: false }.foo(true); | error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:106:18 + --> $DIR/lint-unnecessary-parens.rs:105:18 | LL | let mut _a = (0); | ^ ^ @@ -244,7 +244,7 @@ LL + let mut _a = 0; | error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:107:10 + --> $DIR/lint-unnecessary-parens.rs:106:10 | LL | _a = (0); | ^ ^ @@ -256,7 +256,7 @@ LL + _a = 0; | error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:108:11 + --> $DIR/lint-unnecessary-parens.rs:107:11 | LL | _a += (1); | ^ ^ @@ -268,7 +268,7 @@ LL + _a += 1; | error: unnecessary parentheses around pattern - --> $DIR/lint-unnecessary-parens.rs:110:8 + --> $DIR/lint-unnecessary-parens.rs:109:8 | LL | let(mut _a) = 3; | ^ ^ @@ -280,7 +280,7 @@ LL + let mut _a = 3; | error: unnecessary parentheses around pattern - --> $DIR/lint-unnecessary-parens.rs:111:9 + --> $DIR/lint-unnecessary-parens.rs:110:9 | LL | let (mut _a) = 3; | ^ ^ @@ -292,7 +292,7 @@ LL + let mut _a = 3; | error: unnecessary parentheses around pattern - --> $DIR/lint-unnecessary-parens.rs:112:8 + --> $DIR/lint-unnecessary-parens.rs:111:8 | LL | let( mut _a) = 3; | ^^ ^ @@ -304,7 +304,7 @@ LL + let mut _a = 3; | error: unnecessary parentheses around pattern - --> $DIR/lint-unnecessary-parens.rs:114:8 + --> $DIR/lint-unnecessary-parens.rs:113:8 | LL | let(_a) = 3; | ^ ^ @@ -316,7 +316,7 @@ LL + let _a = 3; | error: unnecessary parentheses around pattern - --> $DIR/lint-unnecessary-parens.rs:115:9 + --> $DIR/lint-unnecessary-parens.rs:114:9 | LL | let (_a) = 3; | ^ ^ @@ -328,7 +328,7 @@ LL + let _a = 3; | error: unnecessary parentheses around pattern - --> $DIR/lint-unnecessary-parens.rs:116:8 + --> $DIR/lint-unnecessary-parens.rs:115:8 | LL | let( _a) = 3; | ^^ ^ @@ -340,7 +340,7 @@ LL + let _a = 3; | error: unnecessary parentheses around block return value - --> $DIR/lint-unnecessary-parens.rs:122:9 + --> $DIR/lint-unnecessary-parens.rs:121:9 | LL | (unit!() - One) | ^ ^ @@ -352,7 +352,7 @@ LL + unit!() - One | error: unnecessary parentheses around block return value - --> $DIR/lint-unnecessary-parens.rs:124:9 + --> $DIR/lint-unnecessary-parens.rs:123:9 | LL | (unit![] - One) | ^ ^ @@ -364,7 +364,7 @@ LL + unit![] - One | error: unnecessary parentheses around block return value - --> $DIR/lint-unnecessary-parens.rs:127:9 + --> $DIR/lint-unnecessary-parens.rs:126:9 | LL | (unit! {} - One) | ^ ^ @@ -376,7 +376,7 @@ LL + unit! {} - One | error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:132:14 + --> $DIR/lint-unnecessary-parens.rs:131:14 | LL | let _r = (&x); | ^ ^ @@ -388,7 +388,7 @@ LL + let _r = &x; | error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:133:14 + --> $DIR/lint-unnecessary-parens.rs:132:14 | LL | let _r = (&mut x); | ^ ^ diff --git a/tests/ui/lint/must_not_suspend/other_items.stderr b/tests/ui/lint/must_not_suspend/other_items.stderr index e6c36b78951..dff5210b7e4 100644 --- a/tests/ui/lint/must_not_suspend/other_items.stderr +++ b/tests/ui/lint/must_not_suspend/other_items.stderr @@ -1,10 +1,10 @@ -error: `must_not_suspend` attribute should be applied to a struct, enum, or trait +error: `must_not_suspend` attribute should be applied to a struct, enum, union, or trait --> $DIR/other_items.rs:5:1 | LL | #[must_not_suspend] | ^^^^^^^^^^^^^^^^^^^ LL | mod inner {} - | ------------ is not a struct, enum, or trait + | ------------ is not a struct, enum, union, or trait error: aborting due to 1 previous error diff --git a/tests/ui/lint/must_not_suspend/return.stderr b/tests/ui/lint/must_not_suspend/return.stderr index 5a73064c787..440f8165686 100644 --- a/tests/ui/lint/must_not_suspend/return.stderr +++ b/tests/ui/lint/must_not_suspend/return.stderr @@ -1,4 +1,4 @@ -error: `must_not_suspend` attribute should be applied to a struct, enum, or trait +error: `must_not_suspend` attribute should be applied to a struct, enum, union, or trait --> $DIR/return.rs:5:1 | LL | #[must_not_suspend] @@ -6,7 +6,7 @@ LL | #[must_not_suspend] LL | / fn foo() -> i32 { LL | | 0 LL | | } - | |_- is not a struct, enum, or trait + | |_- is not a struct, enum, union, or trait error: aborting due to 1 previous error diff --git a/tests/ui/lint/unreachable_pub.stderr b/tests/ui/lint/unreachable_pub.stderr index 705a537a3f1..65f45fbd816 100644 --- a/tests/ui/lint/unreachable_pub.stderr +++ b/tests/ui/lint/unreachable_pub.stderr @@ -130,7 +130,7 @@ warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:48:9 | LL | pub fn catalyze() -> bool; - | ---^^^^^^^^^^^^^^^^^^^^^^ + | ---^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | diff --git a/tests/ui/lint/unused/lint-unused-mut-variables.rs b/tests/ui/lint/unused/lint-unused-mut-variables.rs index f0c7dff666e..bc38af9867c 100644 --- a/tests/ui/lint/unused/lint-unused-mut-variables.rs +++ b/tests/ui/lint/unused/lint-unused-mut-variables.rs @@ -3,7 +3,7 @@ // Exercise the unused_mut attribute in some positive and negative cases #![warn(unused_mut)] -#![feature(async_closure, raw_ref_op)] +#![feature(async_closure)] async fn baz_async( mut a: i32, diff --git a/tests/ui/lint/unused/lint-unused-variables.stderr b/tests/ui/lint/unused/lint-unused-variables.stderr index 09729eeba79..ef590d85aef 100644 --- a/tests/ui/lint/unused/lint-unused-variables.stderr +++ b/tests/ui/lint/unused/lint-unused-variables.stderr @@ -16,6 +16,12 @@ error: unused variable: `a` LL | a: i32, | ^ help: if this is intentional, prefix it with an underscore: `_a` +error: unused variable: `a` + --> $DIR/lint-unused-variables.rs:68:9 + | +LL | a: i32, + | ^ help: if this is intentional, prefix it with an underscore: `_a` + error: unused variable: `b` --> $DIR/lint-unused-variables.rs:14:5 | @@ -58,12 +64,6 @@ error: unused variable: `b` LL | b: i32, | ^ help: if this is intentional, prefix it with an underscore: `_b` -error: unused variable: `a` - --> $DIR/lint-unused-variables.rs:68:9 - | -LL | a: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_a` - error: unused variable: `b` --> $DIR/lint-unused-variables.rs:74:9 | diff --git a/tests/ui/macros/macro-match-nonterminal.stderr b/tests/ui/macros/macro-match-nonterminal.stderr index 831579c4fef..f221f92c3cd 100644 --- a/tests/ui/macros/macro-match-nonterminal.stderr +++ b/tests/ui/macros/macro-match-nonterminal.stderr @@ -1,14 +1,14 @@ error: missing fragment specifier - --> $DIR/macro-match-nonterminal.rs:2:8 + --> $DIR/macro-match-nonterminal.rs:2:6 | LL | ($a, $b) => { - | ^ + | ^^ error: missing fragment specifier - --> $DIR/macro-match-nonterminal.rs:2:8 + --> $DIR/macro-match-nonterminal.rs:2:6 | LL | ($a, $b) => { - | ^ + | ^^ | = 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 #40107 <https://github.com/rust-lang/rust/issues/40107> @@ -27,10 +27,10 @@ error: aborting due to 3 previous errors Future incompatibility report: Future breakage diagnostic: error: missing fragment specifier - --> $DIR/macro-match-nonterminal.rs:2:8 + --> $DIR/macro-match-nonterminal.rs:2:6 | LL | ($a, $b) => { - | ^ + | ^^ | = 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 #40107 <https://github.com/rust-lang/rust/issues/40107> diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs index f06c1f99069..f405cd253de 100644 --- a/tests/ui/macros/stringify.rs +++ b/tests/ui/macros/stringify.rs @@ -14,7 +14,6 @@ #![feature(let_chains)] #![feature(more_qualified_paths)] #![feature(never_patterns)] -#![feature(raw_ref_op)] #![feature(trait_alias)] #![feature(try_blocks)] #![feature(type_ascription)] @@ -33,8 +32,6 @@ macro_rules! stmt { ($stmt:stmt) => { stringify!($stmt) }; } macro_rules! ty { ($ty:ty) => { stringify!($ty) }; } macro_rules! vis { ($vis:vis) => { stringify!($vis) }; } -// Use this when AST pretty-printing and TokenStream pretty-printing give -// the same result (which is preferable.) macro_rules! c1 { ($frag:ident, [$($tt:tt)*], $s:literal) => { // Prior to #125174: @@ -66,6 +63,8 @@ fn test_block() { } ], "{ let _; true }" ); + + // Attributes are not allowed on vanilla blocks. } #[test] @@ -332,6 +331,20 @@ fn test_expr() { // ExprKind::FormatArgs: untestable because this test works pre-expansion. // ExprKind::Err: untestable. + + // Ones involving attributes. + c1!(expr, [ #[aa] 1 ], "#[aa] 1"); + c1!(expr, [ #[aa] #[bb] x ], "#[aa] #[bb] x"); + c1!(expr, [ #[aa] 1 + 2 ], "#[aa] 1 + 2"); + c1!(expr, [ #[aa] x + 2 ], "#[aa] x + 2"); + c1!(expr, [ #[aa] 1 / #[bb] 2 ], "#[aa] 1 / #[bb] 2"); + c1!(expr, [ #[aa] x / #[bb] 2 ], "#[aa] x / #[bb] 2"); + c1!(expr, [ 1 << #[bb] 2 ], "1 << #[bb] 2"); + c1!(expr, [ x << #[bb] 2 ], "x << #[bb] 2"); + c1!(expr, [ #[aa] (1 + 2) ], "#[aa] (1 + 2)"); + c1!(expr, [ #[aa] #[bb] (x + 2) ], "#[aa] #[bb] (x + 2)"); + c1!(expr, [ #[aa] x[0].p ], "#[aa] x[0].p"); + c1!(expr, [ #[aa] { #![bb] 0 } ], "#[aa] { #![bb] 0 }"); } #[test] @@ -484,6 +497,11 @@ fn test_item() { "macro_rules! stringify { () => {}; }" ); c1!(item, [ pub macro stringify() {} ], "pub macro stringify() {}"); + + // Ones involving attributes. + c1!(item, [ #[aa] mod m; ], "#[aa] mod m;"); + c1!(item, [ mod m { #![bb] } ], "mod m { #![bb] }"); + c1!(item, [ #[aa] mod m { #![bb] } ], "#[aa] mod m { #![bb] }"); } #[test] @@ -492,6 +510,8 @@ fn test_meta() { c1!(meta, [ k = "v" ], "k = \"v\""); c1!(meta, [ list(k1, k2 = "v") ], "list(k1, k2 = \"v\")"); c1!(meta, [ serde::k ], "serde::k"); + + // Attributes are not allowed on metas. } #[test] @@ -580,6 +600,8 @@ fn test_pat() { c1!(pat, [ mac!(...) ], "mac!(...)"); c1!(pat, [ mac![...] ], "mac![...]"); c1!(pat, [ mac! { ... } ], "mac! { ... }"); + + // Attributes are not allowed on patterns. } #[test] @@ -593,6 +615,8 @@ fn test_path() { c1!(path, [ Self::<'static> ], "Self::<'static>"); c1!(path, [ Self() ], "Self()"); c1!(path, [ Self() -> () ], "Self() -> ()"); + + // Attributes are not allowed on paths. } #[test] @@ -622,6 +646,20 @@ fn test_stmt() { c1!(stmt, [ mac!(...) ], "mac!(...)"); c1!(stmt, [ mac![...] ], "mac![...]"); c1!(stmt, [ mac! { ... } ], "mac! { ... }"); + + // Ones involving attributes. + c1!(stmt, [ #[aa] 1 ], "#[aa] 1"); + c1!(stmt, [ #[aa] #[bb] x ], "#[aa] #[bb] x"); + c1!(stmt, [ #[aa] 1 as u32 ], "#[aa] 1 as u32"); + c1!(stmt, [ #[aa] x as u32 ], "#[aa] x as u32"); + c1!(stmt, [ #[aa] 1 .. #[bb] 2 ], "#[aa] 1 .. #[bb] 2"); + c1!(stmt, [ #[aa] x .. #[bb] 2 ], "#[aa] x .. #[bb] 2"); + c1!(stmt, [ 1 || #[bb] 2 ], "1 || #[bb] 2"); + c1!(stmt, [ x || #[bb] 2 ], "x || #[bb] 2"); + c1!(stmt, [ #[aa] (1 + 2) ], "#[aa] (1 + 2)"); + c1!(stmt, [ #[aa] #[bb] (x + 2) ], "#[aa] #[bb] (x + 2)"); + c1!(stmt, [ #[aa] x[0].p ], "#[aa] x[0].p"); + c1!(stmt, [ #[aa] { #![bb] 0 } ], "#[aa] { #![bb] 0 }"); } #[test] @@ -708,6 +746,8 @@ fn test_ty() { // TyKind::CVarArgs // FIXME: todo + + // Attributes are not allowed on types. } #[test] @@ -732,6 +772,8 @@ fn test_vis() { macro_rules! inherited_vis { ($vis:vis struct) => { vis!($vis) }; } assert_eq!(inherited_vis!(struct), ""); assert_eq!(stringify!(), ""); + + // Attributes are not allowed on visibilities. } macro_rules! p { diff --git a/tests/ui/methods/missing-method-on-type-parameter.rs b/tests/ui/methods/missing-method-on-type-parameter.rs new file mode 100644 index 00000000000..cbcbeea4d4c --- /dev/null +++ b/tests/ui/methods/missing-method-on-type-parameter.rs @@ -0,0 +1,6 @@ +// Regression test for https://github.com/rust-lang/rust/issues/129205 +fn x<T: Copy>() { + T::try_from(); //~ ERROR E0599 +} + +fn main() {} diff --git a/tests/ui/methods/missing-method-on-type-parameter.stderr b/tests/ui/methods/missing-method-on-type-parameter.stderr new file mode 100644 index 00000000000..c53d7afe4e2 --- /dev/null +++ b/tests/ui/methods/missing-method-on-type-parameter.stderr @@ -0,0 +1,19 @@ +error[E0599]: no function or associated item named `try_from` found for type parameter `T` in the current scope + --> $DIR/missing-method-on-type-parameter.rs:3:8 + | +LL | fn x<T: Copy>() { + | - function or associated item `try_from` not found for this type parameter +LL | T::try_from(); + | ^^^^^^^^ function or associated item not found in `T` + | + = help: items from traits can only be used if the trait is in scope +help: there is an associated function `from` with a similar name + --> $SRC_DIR/core/src/convert/mod.rs:LL:COL +help: trait `TryFrom` which provides `try_from` is implemented but not in scope; perhaps you want to import it + | +LL + use std::convert::TryFrom; + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/mir/mir_raw_fat_ptr.rs b/tests/ui/mir/mir_raw_fat_ptr.rs index a5a48587e3b..96c030b70e5 100644 --- a/tests/ui/mir/mir_raw_fat_ptr.rs +++ b/tests/ui/mir/mir_raw_fat_ptr.rs @@ -2,7 +2,6 @@ // check raw fat pointer ops in mir // FIXME: please improve this when we get monomorphization support -#![feature(raw_ref_op)] #![allow(ambiguous_wide_pointer_comparisons)] use std::mem; diff --git a/tests/ui/mir/mir_raw_fat_ptr.stderr b/tests/ui/mir/mir_raw_fat_ptr.stderr index a9e9dd66ebd..cd99d566654 100644 --- a/tests/ui/mir/mir_raw_fat_ptr.stderr +++ b/tests/ui/mir/mir_raw_fat_ptr.stderr @@ -1,5 +1,5 @@ warning: method `foo` is never used - --> $DIR/mir_raw_fat_ptr.rs:101:16 + --> $DIR/mir_raw_fat_ptr.rs:100:16 | LL | trait Foo { fn foo(&self) -> usize; } | --- ^^^ diff --git a/tests/ui/nll/issue-73159-rpit-static.stderr b/tests/ui/nll/issue-73159-rpit-static.stderr index 472db30fbeb..7c564b84a56 100644 --- a/tests/ui/nll/issue-73159-rpit-static.stderr +++ b/tests/ui/nll/issue-73159-rpit-static.stderr @@ -7,6 +7,11 @@ LL | fn make_it(&self) -> impl Iterator<Item = u8> { | ------------------------ opaque type defined here LL | self.0.iter().copied() | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: add a `use<...>` bound to explicitly capture `'a` + | +LL | fn make_it(&self) -> impl Iterator<Item = u8> + use<'a> { + | +++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr index cab75e630a7..911ddd3dc80 100644 --- a/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr +++ b/tests/ui/nll/member-constraints/min-choice-reject-ambiguous.stderr @@ -37,10 +37,10 @@ LL | fn test_ambiguous<'a, 'b, 'c>(s: &'a u8) -> impl Cap<'b> + Cap<'c> LL | s | ^ | -help: to declare that `impl Cap<'b> + Cap<'c>` captures `'a`, you can add an explicit `'a` lifetime bound +help: add a `use<...>` bound to explicitly capture `'a` | -LL | fn test_ambiguous<'a, 'b, 'c>(s: &'a u8) -> impl Cap<'b> + Cap<'c> + 'a - | ++++ +LL | fn test_ambiguous<'a, 'b, 'c>(s: &'a u8) -> impl Cap<'b> + Cap<'c> + use<'b, 'c, 'a> + | +++++++++++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/nll/member-constraints/nested-impl-trait-fail.stderr b/tests/ui/nll/member-constraints/nested-impl-trait-fail.stderr index 483b5822b9d..1a0611e715e 100644 --- a/tests/ui/nll/member-constraints/nested-impl-trait-fail.stderr +++ b/tests/ui/nll/member-constraints/nested-impl-trait-fail.stderr @@ -9,14 +9,10 @@ LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl LL | [a] | ^^^ | -help: to declare that `impl IntoIterator<Item = impl Cap<'a> + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound +help: add a `use<...>` bound to explicitly capture `'s` | -LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + 's - | ++++ -help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound - | -LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b> + 's> - | ++++ +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + use<'a, 'b, 's> + | +++++++++++++++++ error[E0700]: hidden type for `impl Cap<'a> + Cap<'b>` captures lifetime that does not appear in bounds --> $DIR/nested-impl-trait-fail.rs:17:5 @@ -29,14 +25,10 @@ LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl LL | [a] | ^^^ | -help: to declare that `impl IntoIterator<Item = impl Cap<'a> + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound - | -LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + 's - | ++++ -help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound +help: add a `use<...>` bound to explicitly capture `'s` | -LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b> + 's> - | ++++ +LL | fn fail_early_bound<'s, 'a, 'b>(a: &'s u8) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b> + use<'a, 'b, 's>> + | +++++++++++++++++ error[E0700]: hidden type for `impl IntoIterator<Item = impl Cap<'a> + Cap<'b>>` captures lifetime that does not appear in bounds --> $DIR/nested-impl-trait-fail.rs:28:5 @@ -49,14 +41,10 @@ LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> { LL | [a] | ^^^ | -help: to declare that `impl IntoIterator<Item = impl Cap<'a> + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound +help: add a `use<...>` bound to explicitly capture `'s` | -LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + 's { - | ++++ -help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound - | -LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b> + 's> { - | ++++ +LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + use<'a, 'b, 's> { + | +++++++++++++++++ error[E0700]: hidden type for `impl Cap<'a> + Cap<'b>` captures lifetime that does not appear in bounds --> $DIR/nested-impl-trait-fail.rs:28:5 @@ -69,14 +57,10 @@ LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> { LL | [a] | ^^^ | -help: to declare that `impl IntoIterator<Item = impl Cap<'a> + Cap<'b>>` captures `'s`, you can add an explicit `'s` lifetime bound - | -LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b>> + 's { - | ++++ -help: to declare that `impl Cap<'a> + Cap<'b>` captures `'s`, you can add an explicit `'s` lifetime bound +help: add a `use<...>` bound to explicitly capture `'s` | -LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b> + 's> { - | ++++ +LL | ) -> impl IntoIterator<Item = impl Cap<'a> + Cap<'b> + use<'a, 'b, 's>> { + | +++++++++++++++++ error: aborting due to 4 previous errors diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr index 6f9b3303163..cdf394505a2 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.nll.stderr @@ -25,10 +25,10 @@ LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { LL | <&mut i32 as Callable>::call(y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: to declare that `impl PlusOne` captures `'a`, you can add an explicit `'a` lifetime bound +help: add a `use<...>` bound to explicitly capture `'a` | -LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne + 'a { - | ++++ +LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne + use<'a> { + | +++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr index 6f9b3303163..cdf394505a2 100644 --- a/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr +++ b/tests/ui/nll/polonius/location-insensitive-scopes-issue-116657.polonius.stderr @@ -25,10 +25,10 @@ LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { LL | <&mut i32 as Callable>::call(y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: to declare that `impl PlusOne` captures `'a`, you can add an explicit `'a` lifetime bound +help: add a `use<...>` bound to explicitly capture `'a` | -LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne + 'a { - | ++++ +LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne + use<'a> { + | +++++++++ error: aborting due to 3 previous errors diff --git a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr index 48569d1446d..87bbd50a15c 100644 --- a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -1,17 +1,17 @@ -error[E0700]: hidden type for `Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), ['a/#0, T, 'a/#0])` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `Opaque(DefId(0:11 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), ['a/#0, T, 'a/#0])` captures lifetime that does not appear in bounds --> $DIR/impl-trait-captures.rs:11:5 | LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { | -- ------------ opaque type defined here | | - | hidden type `&ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_)) T` captures the anonymous lifetime defined here + | hidden type `&ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::'_), '_)) T` captures the anonymous lifetime defined here LL | x | ^ | -help: to declare that `Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), ['a/#0, T, 'a/#2])` captures `ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_))`, you can add an explicit `ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_))` lifetime bound +help: add a `use<...>` bound to explicitly capture `ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::'_), '_))` | -LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:12 ~ impl_trait_captures[aeb9]::foo::'_), '_)) { - | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + use<'a, ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), BrNamed(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::'_), '_)), T> { + | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/object-lifetime/object-lifetime-default-elision.rs b/tests/ui/object-lifetime/object-lifetime-default-elision.rs index f7c0261cfbb..ede6af51174 100644 --- a/tests/ui/object-lifetime/object-lifetime-default-elision.rs +++ b/tests/ui/object-lifetime/object-lifetime-default-elision.rs @@ -46,6 +46,8 @@ fn load1(ss: &dyn SomeTrait) -> &dyn SomeTrait { } fn load2<'a>(ss: &'a dyn SomeTrait) -> &dyn SomeTrait { + //~^ WARNING elided lifetime has a name + // Same as `load1` but with an explicit name thrown in for fun. ss diff --git a/tests/ui/object-lifetime/object-lifetime-default-elision.stderr b/tests/ui/object-lifetime/object-lifetime-default-elision.stderr index b5995687927..b44a184c684 100644 --- a/tests/ui/object-lifetime/object-lifetime-default-elision.stderr +++ b/tests/ui/object-lifetime/object-lifetime-default-elision.stderr @@ -1,5 +1,15 @@ +warning: elided lifetime has a name + --> $DIR/object-lifetime-default-elision.rs:48:40 + | +LL | fn load2<'a>(ss: &'a dyn SomeTrait) -> &dyn SomeTrait { + | -- ^ this elided lifetime gets resolved as `'a` + | | + | lifetime `'a` declared here + | + = note: `#[warn(elided_named_lifetimes)]` on by default + error: lifetime may not live long enough - --> $DIR/object-lifetime-default-elision.rs:71:5 + --> $DIR/object-lifetime-default-elision.rs:73:5 | LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { | -- -- lifetime `'b` defined here @@ -11,5 +21,5 @@ LL | ss | = help: consider adding the following bound: `'a: 'b` -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr b/tests/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr index 5570390b21c..6ddc0595665 100644 --- a/tests/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr +++ b/tests/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:8:9 | LL | (1 | 2,) => {} - | -------- matches all the values already + | -------- matches all the relevant values LL | (1,) => {} - | ^^^^ unreachable pattern + | ^^^^ no value can reach this | note: the lint level is defined here --> $DIR/exhaustiveness-unreachable-pattern.rs:1:9 @@ -16,17 +16,17 @@ error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:13:9 | LL | (1 | 2,) => {} - | -------- matches all the values already + | -------- matches all the relevant values LL | (2,) => {} - | ^^^^ unreachable pattern + | ^^^^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:19:9 | LL | (1 | 2,) => {} - | ^^^^^^^^ unreachable pattern + | ^^^^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/exhaustiveness-unreachable-pattern.rs:19:9 | LL | (1,) => {} @@ -40,44 +40,44 @@ error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:24:9 | LL | (1 | 2, 3 | 4) => {} - | -------------- matches all the values already + | -------------- matches all the relevant values LL | (1, 3) => {} - | ^^^^^^ unreachable pattern + | ^^^^^^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:25:9 | LL | (1 | 2, 3 | 4) => {} - | -------------- matches all the values already + | -------------- matches all the relevant values LL | (1, 3) => {} LL | (1, 4) => {} - | ^^^^^^ unreachable pattern + | ^^^^^^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:26:9 | LL | (1 | 2, 3 | 4) => {} - | -------------- matches all the values already + | -------------- matches all the relevant values ... LL | (2, 4) => {} - | ^^^^^^ unreachable pattern + | ^^^^^^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:27:9 | LL | (1 | 2, 3 | 4) => {} - | -------------- matches all the values already + | -------------- matches all the relevant values ... LL | (2 | 1, 4) => {} - | ^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:29:9 | LL | (1, 4 | 5) => {} - | ^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/exhaustiveness-unreachable-pattern.rs:29:9 | LL | (1 | 2, 3 | 4) => {} @@ -92,107 +92,107 @@ error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:34:13 | LL | (0, 0, 0) => {} - | - matches all the values already + | - matches all the relevant values LL | (0, 0 | 1, 0) => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:42:9 | LL | (None | Some(1 | 2),) => {} - | --------------------- matches all the values already + | --------------------- matches all the relevant values LL | (Some(1),) => {} - | ^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:43:9 | LL | (None | Some(1 | 2),) => {} - | --------------------- matches all the values already + | --------------------- matches all the relevant values LL | (Some(1),) => {} LL | (None,) => {} - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:48:9 | LL | ((1 | 2,) | (3 | 4,),) => {} - | ---------------------- matches all the values already + | ---------------------- matches all the relevant values LL | ((1..=4,),) => {} - | ^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:53:14 | LL | (1 | 1,) => {} - | - ^ unreachable pattern + | - ^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:57:19 | LL | (0 | 1) | 1 => {} - | - ^ unreachable pattern + | - ^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:63:14 | LL | 0 | (0 | 0) => {} - | - ^ unreachable pattern + | - ^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:63:18 | LL | 0 | (0 | 0) => {} - | - ^ unreachable pattern + | - ^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:71:13 | LL | Some(0) | - | ------- matches all the values already + | ------- matches all the relevant values LL | / Some( LL | | 0 | 0) => {} - | |______________________^ unreachable pattern + | |______________________^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:77:15 | LL | [0 - | - matches all the values already + | - matches all the relevant values LL | | 0 - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:79:15 | LL | , 0 - | - matches all the values already + | - matches all the relevant values LL | | 0] => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:83:20 | LL | (true, 0 | 0) => {} - | - ^ unreachable pattern + | - ^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:84:17 | LL | (_, 0 | 0) => {} - | ^ unreachable pattern + | ^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/exhaustiveness-unreachable-pattern.rs:84:17 | LL | (true, 0 | 0) => {} @@ -206,25 +206,25 @@ error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:92:10 | LL | [1, ..] => {} - | - matches all the values already + | - matches all the relevant values LL | [1 - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:104:10 | LL | [true, ..] => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | [true - | ^^^^ unreachable pattern + | ^^^^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:111:36 | LL | (true | false, None | Some(true - | ^^^^ unreachable pattern + | ^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/exhaustiveness-unreachable-pattern.rs:111:36 | LL | (true, Some(_)) => {} @@ -238,12 +238,12 @@ error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:116:14 | LL | (true - | ^^^^ unreachable pattern + | ^^^^ no value can reach this ... LL | (true | false, None | Some(t_or_f!())) => {} | --------- in this macro invocation | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/exhaustiveness-unreachable-pattern.rs:116:14 | LL | (true @@ -261,26 +261,26 @@ error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:127:14 | LL | Some(0) => {} - | - matches all the values already + | - matches all the relevant values LL | Some(0 - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:146:19 | LL | Some(false) => {} - | ----- matches all the values already + | ----- matches all the relevant values LL | None | Some(true LL | | false) => {} - | ^^^^^ unreachable pattern + | ^^^^^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:154:15 | LL | | true) => {} - | ^^^^ unreachable pattern + | ^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/exhaustiveness-unreachable-pattern.rs:154:15 | LL | (false, true) => {} @@ -295,9 +295,9 @@ error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:160:15 | LL | | true, - | ^^^^ unreachable pattern + | ^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/exhaustiveness-unreachable-pattern.rs:160:15 | LL | (true, false) => {} @@ -314,13 +314,13 @@ error: unreachable pattern LL | (x, y) | ------ matches any value LL | | (y, x) => {} - | ^^^^^^ unreachable pattern + | ^^^^^^ no value can reach this error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:169:30 | LL | fn unreachable_in_param((_ | (_, _)): (bool, bool)) {} - | - ^^^^^^ unreachable pattern + | - ^^^^^^ no value can reach this | | | matches any value @@ -328,7 +328,7 @@ error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:176:14 | LL | let (_ | (_, _)) = bool_pair; - | - ^^^^^^ unreachable pattern + | - ^^^^^^ no value can reach this | | | matches any value @@ -336,7 +336,7 @@ error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:178:14 | LL | for (_ | (_, _)) in [bool_pair] {} - | - ^^^^^^ unreachable pattern + | - ^^^^^^ no value can reach this | | | matches any value @@ -344,25 +344,25 @@ error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:181:20 | LL | let (Some(_) | Some(true)) = bool_option else { return }; - | ------- ^^^^^^^^^^ unreachable pattern + | ------- ^^^^^^^^^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:183:22 | LL | if let Some(_) | Some(true) = bool_option {} - | ------- ^^^^^^^^^^ unreachable pattern + | ------- ^^^^^^^^^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/exhaustiveness-unreachable-pattern.rs:185:25 | LL | while let Some(_) | Some(true) = bool_option {} - | ------- ^^^^^^^^^^ unreachable pattern + | ------- ^^^^^^^^^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: aborting due to 36 previous errors diff --git a/tests/ui/packed/packed-struct-address-of-element.rs b/tests/ui/packed/packed-struct-address-of-element.rs index 3fc27d4a96a..5d7c0b3d8b1 100644 --- a/tests/ui/packed/packed-struct-address-of-element.rs +++ b/tests/ui/packed/packed-struct-address-of-element.rs @@ -1,6 +1,5 @@ //@ run-pass #![allow(dead_code)] -#![feature(raw_ref_op)] //@ ignore-emscripten weird assertion? #[repr(packed)] diff --git a/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr index 1ba130e20b5..bd860841b80 100644 --- a/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr +++ b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr @@ -359,11 +359,6 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } | previous outer attribute | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files -help: to annotate the item macro invocation, change the attribute from inner to outer style - | -LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } -LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!(); } - | error: an inner attribute is not permitted following an outer attribute --> $DIR/attr-stmt-expr-attr-bad.rs:77:32 @@ -375,11 +370,6 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } | previous outer attribute | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files -help: to annotate the item macro invocation, change the attribute from inner to outer style - | -LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } -LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo![]; } - | error: an inner attribute is not permitted following an outer attribute --> $DIR/attr-stmt-expr-attr-bad.rs:79:32 @@ -391,11 +381,6 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } | previous outer attribute | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files -help: to annotate the item macro invocation, change the attribute from inner to outer style - | -LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } -LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!{}; } - | error[E0586]: inclusive range with no end --> $DIR/attr-stmt-expr-attr-bad.rs:85:35 diff --git a/tests/ui/parser/attribute/attr.stderr b/tests/ui/parser/attribute/attr.stderr index 2e0b16efb6c..a79a5246c2a 100644 --- a/tests/ui/parser/attribute/attr.stderr +++ b/tests/ui/parser/attribute/attr.stderr @@ -7,11 +7,6 @@ LL | fn foo() {} | ----------- the inner attribute doesn't annotate this function | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files -help: to annotate the function, change the attribute from inner to outer style - | -LL - #![lang = "foo"] -LL + #[lang = "foo"] - | error: aborting due to 1 previous error diff --git a/tests/ui/parser/inner-attr-after-doc-comment.stderr b/tests/ui/parser/inner-attr-after-doc-comment.stderr index 6dbc0fd93fd..f087c2e4d65 100644 --- a/tests/ui/parser/inner-attr-after-doc-comment.stderr +++ b/tests/ui/parser/inner-attr-after-doc-comment.stderr @@ -13,11 +13,6 @@ LL | fn main() {} | ------------ the inner attribute doesn't annotate this function | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files -help: to annotate the function, change the attribute from inner to outer style - | -LL - #![recursion_limit="100"] -LL + #[recursion_limit="100"] - | error: aborting due to 1 previous error diff --git a/tests/ui/parser/inner-attr.stderr b/tests/ui/parser/inner-attr.stderr index 57ca164fc15..18a82ea4c38 100644 --- a/tests/ui/parser/inner-attr.stderr +++ b/tests/ui/parser/inner-attr.stderr @@ -10,11 +10,6 @@ LL | fn main() {} | ------------ the inner attribute doesn't annotate this function | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files -help: to annotate the function, change the attribute from inner to outer style - | -LL - #![recursion_limit="100"] -LL + #[recursion_limit="100"] - | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/isgg-invalid-outer-attttr-issue-127930.rs b/tests/ui/parser/issues/isgg-invalid-outer-attttr-issue-127930.rs new file mode 100644 index 00000000000..26541a89a56 --- /dev/null +++ b/tests/ui/parser/issues/isgg-invalid-outer-attttr-issue-127930.rs @@ -0,0 +1,10 @@ +#![allow(dead_code)] +fn foo() {} + +#![feature(iter_array_chunks)] //~ ERROR an inner attribute is not permitted in this context +fn bar() {} + +fn main() { + foo(); + bar(); +} diff --git a/tests/ui/parser/issues/isgg-invalid-outer-attttr-issue-127930.stderr b/tests/ui/parser/issues/isgg-invalid-outer-attttr-issue-127930.stderr new file mode 100644 index 00000000000..d6daa21e741 --- /dev/null +++ b/tests/ui/parser/issues/isgg-invalid-outer-attttr-issue-127930.stderr @@ -0,0 +1,12 @@ +error: an inner attribute is not permitted in this context + --> $DIR/isgg-invalid-outer-attttr-issue-127930.rs:4:1 + | +LL | #![feature(iter_array_chunks)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn bar() {} + | ----------- the inner attribute doesn't annotate this function + | + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/issues/issue-30318.fixed b/tests/ui/parser/issues/issue-30318.fixed index d1661be5193..d4720834746 100644 --- a/tests/ui/parser/issues/issue-30318.fixed +++ b/tests/ui/parser/issues/issue-30318.fixed @@ -6,7 +6,7 @@ fn foo() { } //~^ ERROR expected outer doc comment fn bar() { } //~ NOTE the inner doc comment doesn't annotate this function -#[test] //~ ERROR an inner attribute is not permitted in this context +#[cfg(test)] //~ ERROR an inner attribute is not permitted in this context fn baz() { } //~ NOTE the inner attribute doesn't annotate this function //~^^ NOTE inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually diff --git a/tests/ui/parser/issues/issue-30318.rs b/tests/ui/parser/issues/issue-30318.rs index 6f055cd4f7e..0555379836a 100644 --- a/tests/ui/parser/issues/issue-30318.rs +++ b/tests/ui/parser/issues/issue-30318.rs @@ -6,7 +6,7 @@ fn foo() { } //~^ ERROR expected outer doc comment fn bar() { } //~ NOTE the inner doc comment doesn't annotate this function -#![test] //~ ERROR an inner attribute is not permitted in this context +#![cfg(test)] //~ ERROR an inner attribute is not permitted in this context fn baz() { } //~ NOTE the inner attribute doesn't annotate this function //~^^ NOTE inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually diff --git a/tests/ui/parser/issues/issue-30318.stderr b/tests/ui/parser/issues/issue-30318.stderr index c441a92abad..56bc200db1d 100644 --- a/tests/ui/parser/issues/issue-30318.stderr +++ b/tests/ui/parser/issues/issue-30318.stderr @@ -15,16 +15,16 @@ LL | /// Misplaced comment... error: an inner attribute is not permitted in this context --> $DIR/issue-30318.rs:9:1 | -LL | #![test] - | ^^^^^^^^ +LL | #![cfg(test)] + | ^^^^^^^^^^^^^ LL | fn baz() { } | ------------ the inner attribute doesn't annotate this function | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files help: to annotate the function, change the attribute from inner to outer style | -LL - #![test] -LL + #[test] +LL - #![cfg(test)] +LL + #[cfg(test)] | error[E0753]: expected outer doc comment diff --git a/tests/ui/pattern/issue-14221.stderr b/tests/ui/pattern/issue-14221.stderr index 7ea51b5f804..44b2923d606 100644 --- a/tests/ui/pattern/issue-14221.stderr +++ b/tests/ui/pattern/issue-14221.stderr @@ -19,7 +19,7 @@ LL | A => "A", | - matches any value LL | LL | B => "B", - | ^ unreachable pattern + | ^ no value can reach this | note: the lint level is defined here --> $DIR/issue-14221.rs:1:9 diff --git a/tests/ui/pattern/patterns-dont-match-nt-statement.rs b/tests/ui/pattern/patterns-dont-match-nt-statement.rs new file mode 100644 index 00000000000..c8d41459383 --- /dev/null +++ b/tests/ui/pattern/patterns-dont-match-nt-statement.rs @@ -0,0 +1,19 @@ +//@ check-pass + +// Make sure that a `stmt` nonterminal does not eagerly match against +// a `pat`, since this will always cause a parse error... + +macro_rules! m { + ($pat:pat) => {}; + ($stmt:stmt) => {}; +} + +macro_rules! m2 { + ($stmt:stmt) => { + m! { $stmt } + }; +} + +m2! { let x = 1 } + +fn main() {} diff --git a/tests/ui/pattern/usefulness/consts-opaque.stderr b/tests/ui/pattern/usefulness/consts-opaque.stderr index 9d3a35321ca..32d385eecb4 100644 --- a/tests/ui/pattern/usefulness/consts-opaque.stderr +++ b/tests/ui/pattern/usefulness/consts-opaque.stderr @@ -52,7 +52,7 @@ error: unreachable pattern LL | Bar => {} | --- matches any value LL | BAR => {} - | ^^^ unreachable pattern + | ^^^ no value can reach this | note: the lint level is defined here --> $DIR/consts-opaque.rs:6:9 @@ -67,7 +67,7 @@ LL | Bar => {} | --- matches any value ... LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/consts-opaque.rs:56:9 @@ -75,7 +75,7 @@ error: unreachable pattern LL | BAR => {} | --- matches any value LL | Bar => {} - | ^^^ unreachable pattern + | ^^^ no value can reach this error: unreachable pattern --> $DIR/consts-opaque.rs:58:9 @@ -84,7 +84,7 @@ LL | BAR => {} | --- matches any value ... LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/consts-opaque.rs:64:9 @@ -92,7 +92,7 @@ error: unreachable pattern LL | BAR => {} | --- matches any value LL | BAR => {} // should not be emitting unreachable warning - | ^^^ unreachable pattern + | ^^^ no value can reach this error: unreachable pattern --> $DIR/consts-opaque.rs:66:9 @@ -101,31 +101,31 @@ LL | BAR => {} | --- matches any value ... LL | _ => {} // should not be emitting unreachable warning - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/consts-opaque.rs:72:9 | LL | BAZ => {} - | --- matches all the values already + | --- matches all the relevant values LL | Baz::Baz1 => {} // should not be emitting unreachable warning - | ^^^^^^^^^ unreachable pattern + | ^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/consts-opaque.rs:79:9 | LL | Baz::Baz1 => {} - | --------- matches all the values already + | --------- matches all the relevant values LL | BAZ => {} - | ^^^ unreachable pattern + | ^^^ no value can reach this error: unreachable pattern --> $DIR/consts-opaque.rs:87:9 | LL | _ => {} // should not be emitting unreachable warning - | ^ unreachable pattern + | ^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/consts-opaque.rs:87:9 | LL | BAZ => {} diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr index 1b65ff7aa57..60ab4d52c30 100644 --- a/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/empty-match-check-notes.rs:17:9 | LL | _ => {} - | ^ + | ^ matches no values because `EmptyEnum` is uninhabited | - = note: this pattern matches no values because `EmptyEnum` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/empty-match-check-notes.rs:7:9 | @@ -12,31 +12,31 @@ LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:21:9 + --> $DIR/empty-match-check-notes.rs:22:9 | LL | _ if false => {} - | ^ + | ^ matches no values because `EmptyEnum` is uninhabited | - = note: this pattern matches no values because `EmptyEnum` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:29:9 + --> $DIR/empty-match-check-notes.rs:31:9 | LL | _ => {} - | ^ + | ^ matches no values because `EmptyForeignEnum` is uninhabited | - = note: this pattern matches no values because `EmptyForeignEnum` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:33:9 + --> $DIR/empty-match-check-notes.rs:36:9 | LL | _ if false => {} - | ^ + | ^ matches no values because `EmptyForeignEnum` is uninhabited | - = note: this pattern matches no values because `EmptyForeignEnum` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0005]: refutable pattern in local binding - --> $DIR/empty-match-check-notes.rs:39:9 + --> $DIR/empty-match-check-notes.rs:43:9 | LL | let None = *x; | ^^^^ pattern `Some(_)` not covered @@ -51,7 +51,7 @@ LL | if let None = *x { todo!() }; | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered - --> $DIR/empty-match-check-notes.rs:49:11 + --> $DIR/empty-match-check-notes.rs:53:11 | LL | match 0u8 { | ^^^ pattern `0_u8..=u8::MAX` not covered diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr b/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr index 1b65ff7aa57..60ab4d52c30 100644 --- a/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/empty-match-check-notes.rs:17:9 | LL | _ => {} - | ^ + | ^ matches no values because `EmptyEnum` is uninhabited | - = note: this pattern matches no values because `EmptyEnum` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/empty-match-check-notes.rs:7:9 | @@ -12,31 +12,31 @@ LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:21:9 + --> $DIR/empty-match-check-notes.rs:22:9 | LL | _ if false => {} - | ^ + | ^ matches no values because `EmptyEnum` is uninhabited | - = note: this pattern matches no values because `EmptyEnum` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:29:9 + --> $DIR/empty-match-check-notes.rs:31:9 | LL | _ => {} - | ^ + | ^ matches no values because `EmptyForeignEnum` is uninhabited | - = note: this pattern matches no values because `EmptyForeignEnum` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:33:9 + --> $DIR/empty-match-check-notes.rs:36:9 | LL | _ if false => {} - | ^ + | ^ matches no values because `EmptyForeignEnum` is uninhabited | - = note: this pattern matches no values because `EmptyForeignEnum` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0005]: refutable pattern in local binding - --> $DIR/empty-match-check-notes.rs:39:9 + --> $DIR/empty-match-check-notes.rs:43:9 | LL | let None = *x; | ^^^^ pattern `Some(_)` not covered @@ -51,7 +51,7 @@ LL | if let None = *x { todo!() }; | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered - --> $DIR/empty-match-check-notes.rs:49:11 + --> $DIR/empty-match-check-notes.rs:53:11 | LL | match 0u8 { | ^^^ pattern `0_u8..=u8::MAX` not covered diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.rs b/tests/ui/pattern/usefulness/empty-match-check-notes.rs index 61a75e6c801..48d20fd2d5c 100644 --- a/tests/ui/pattern/usefulness/empty-match-check-notes.rs +++ b/tests/ui/pattern/usefulness/empty-match-check-notes.rs @@ -16,10 +16,12 @@ fn empty_enum(x: EmptyEnum) { match x { _ => {} //~ ERROR unreachable pattern //~^ NOTE matches no values + //~| NOTE to learn more about uninhabited types, see } match x { _ if false => {} //~ ERROR unreachable pattern //~^ NOTE matches no values + //~| NOTE to learn more about uninhabited types, see } } @@ -28,10 +30,12 @@ fn empty_foreign_enum(x: empty::EmptyForeignEnum) { match x { _ => {} //~ ERROR unreachable pattern //~^ NOTE matches no values + //~| NOTE to learn more about uninhabited types, see } match x { _ if false => {} //~ ERROR unreachable pattern //~^ NOTE matches no values + //~| NOTE to learn more about uninhabited types, see } } diff --git a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr index 17cb6fbd94b..9decddfe5de 100644 --- a/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/empty-types.rs:49:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/empty-types.rs:15:9 | @@ -15,9 +15,9 @@ error: unreachable pattern --> $DIR/empty-types.rs:52:9 | LL | _x => {} - | ^^ + | ^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `&!` is non-empty --> $DIR/empty-types.rs:56:11 @@ -38,33 +38,33 @@ error: unreachable pattern --> $DIR/empty-types.rs:70:9 | LL | (_, _) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `(u32, !)` is uninhabited | - = note: this pattern matches no values because `(u32, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:76:9 | LL | _ => {} - | ^ + | ^ matches no values because `(!, !)` is uninhabited | - = note: this pattern matches no values because `(!, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:79:9 | LL | (_, _) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `(!, !)` is uninhabited | - = note: this pattern matches no values because `(!, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:83:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Ok(_)` not covered --> $DIR/empty-types.rs:87:11 @@ -89,17 +89,17 @@ error: unreachable pattern --> $DIR/empty-types.rs:94:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:99:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered --> $DIR/empty-types.rs:96:11 @@ -137,156 +137,156 @@ error: unreachable pattern --> $DIR/empty-types.rs:112:9 | LL | _ => {} - | ^ + | ^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:115:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:118:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:119:9 | LL | _ => {} - | ^ + | ^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:122:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:123:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:132:13 | LL | _ => {} - | ^ + | ^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:135:13 | LL | _ if false => {} - | ^ + | ^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:143:13 | LL | Some(_) => {} - | ^^^^^^^ + | ^^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:147:13 | LL | None => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/empty-types.rs:199:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:204:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:209:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:214:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:220:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:279:9 + --> $DIR/empty-types.rs:281:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:282:9 + --> $DIR/empty-types.rs:284:9 | LL | (_, _) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `(!, !)` is uninhabited | - = note: this pattern matches no values because `(!, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:285:9 + --> $DIR/empty-types.rs:287:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:286:9 + --> $DIR/empty-types.rs:288:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty - --> $DIR/empty-types.rs:318:11 + --> $DIR/empty-types.rs:327:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -300,7 +300,7 @@ LL + } | error[E0004]: non-exhaustive patterns: `&[]` not covered - --> $DIR/empty-types.rs:329:11 + --> $DIR/empty-types.rs:338:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[]` not covered @@ -313,7 +313,7 @@ LL + &[] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` not covered - --> $DIR/empty-types.rs:343:11 + --> $DIR/empty-types.rs:352:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[]` not covered @@ -327,7 +327,7 @@ LL + &[] => todo!() | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty - --> $DIR/empty-types.rs:350:11 + --> $DIR/empty-types.rs:359:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -341,31 +341,31 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:359:9 + --> $DIR/empty-types.rs:368:9 | LL | _ => {} - | ^ + | ^ matches no values because `[!; 3]` is uninhabited | - = note: this pattern matches no values because `[!; 3]` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:362:9 + --> $DIR/empty-types.rs:371:9 | LL | [_, _, _] => {} - | ^^^^^^^^^ + | ^^^^^^^^^ matches no values because `[!; 3]` is uninhabited | - = note: this pattern matches no values because `[!; 3]` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:365:9 + --> $DIR/empty-types.rs:374:9 | LL | [_, ..] => {} - | ^^^^^^^ + | ^^^^^^^ matches no values because `[!; 3]` is uninhabited | - = note: this pattern matches no values because `[!; 3]` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-types.rs:379:11 + --> $DIR/empty-types.rs:388:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -379,15 +379,15 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:386:9 + --> $DIR/empty-types.rs:395:9 | LL | [] => {} - | -- matches all the values already + | -- matches all the relevant values LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-types.rs:388:11 + --> $DIR/empty-types.rs:397:11 | LL | match array_0_never { | ^^^^^^^^^^^^^ pattern `[]` not covered @@ -401,70 +401,70 @@ LL + [] => todo!() | error: unreachable pattern - --> $DIR/empty-types.rs:407:9 + --> $DIR/empty-types.rs:416:9 | LL | Some(_) => {} - | ^^^^^^^ + | ^^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:412:9 + --> $DIR/empty-types.rs:421:9 | LL | Some(_a) => {} - | ^^^^^^^^ + | ^^^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:417:9 + --> $DIR/empty-types.rs:426:9 | LL | None => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | // !useful, !reachable LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern - --> $DIR/empty-types.rs:422:9 + --> $DIR/empty-types.rs:431:9 | LL | None => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | // !useful, !reachable LL | _a => {} - | ^^ unreachable pattern + | ^^ no value can reach this error: unreachable pattern - --> $DIR/empty-types.rs:594:9 + --> $DIR/empty-types.rs:603:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:597:9 + --> $DIR/empty-types.rs:606:9 | LL | _x => {} - | ^^ + | ^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:600:9 + --> $DIR/empty-types.rs:609:9 | LL | _ if false => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:603:9 + --> $DIR/empty-types.rs:612:9 | LL | _x if false => {} - | ^^ + | ^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: aborting due to 49 previous errors diff --git a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr index 1ecb15f2cae..68213a2d661 100644 --- a/tests/ui/pattern/usefulness/empty-types.never_pats.stderr +++ b/tests/ui/pattern/usefulness/empty-types.never_pats.stderr @@ -11,9 +11,9 @@ error: unreachable pattern --> $DIR/empty-types.rs:49:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/empty-types.rs:15:9 | @@ -24,9 +24,9 @@ error: unreachable pattern --> $DIR/empty-types.rs:52:9 | LL | _x => {} - | ^^ + | ^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `&!` is non-empty --> $DIR/empty-types.rs:56:11 @@ -47,33 +47,33 @@ error: unreachable pattern --> $DIR/empty-types.rs:70:9 | LL | (_, _) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `(u32, !)` is uninhabited | - = note: this pattern matches no values because `(u32, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:76:9 | LL | _ => {} - | ^ + | ^ matches no values because `(!, !)` is uninhabited | - = note: this pattern matches no values because `(!, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:79:9 | LL | (_, _) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `(!, !)` is uninhabited | - = note: this pattern matches no values because `(!, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:83:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Ok(_)` not covered --> $DIR/empty-types.rs:87:11 @@ -98,17 +98,17 @@ error: unreachable pattern --> $DIR/empty-types.rs:94:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:99:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered --> $DIR/empty-types.rs:96:11 @@ -160,81 +160,81 @@ error: unreachable pattern --> $DIR/empty-types.rs:112:9 | LL | _ => {} - | ^ + | ^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:115:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:118:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:119:9 | LL | _ => {} - | ^ + | ^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:122:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:123:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:132:13 | LL | _ => {} - | ^ + | ^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:135:13 | LL | _ if false => {} - | ^ + | ^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:143:13 | LL | Some(_) => {} - | ^^^^^^^ + | ^^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:147:13 | LL | None => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error[E0004]: non-exhaustive patterns: `Some(!)` not covered --> $DIR/empty-types.rs:156:15 @@ -259,76 +259,90 @@ error: unreachable pattern --> $DIR/empty-types.rs:199:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:204:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:209:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:214:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:220:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:279:9 + --> $DIR/empty-types.rs:281:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:282:9 + --> $DIR/empty-types.rs:284:9 | LL | (_, _) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `(!, !)` is uninhabited | - = note: this pattern matches no values because `(!, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:285:9 + --> $DIR/empty-types.rs:287:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:286:9 + --> $DIR/empty-types.rs:288:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types + +error[E0005]: refutable pattern in local binding + --> $DIR/empty-types.rs:297:13 + | +LL | let Ok(_) = *ptr_result_never_err; + | ^^^^^ pattern `Err(!)` not covered + | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html + = note: the matched value is of type `Result<u8, !>` +help: you might want to use `if let` to ignore the variant that isn't matched + | +LL | if let Ok(_) = *ptr_result_never_err { todo!() }; + | ++ +++++++++++ error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:307:11 + --> $DIR/empty-types.rs:316:11 | LL | match *x {} | ^^ @@ -342,7 +356,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty - --> $DIR/empty-types.rs:309:11 + --> $DIR/empty-types.rs:318:11 | LL | match *x {} | ^^ @@ -356,7 +370,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(!)` and `Err(!)` not covered - --> $DIR/empty-types.rs:311:11 + --> $DIR/empty-types.rs:320:11 | LL | match *x {} | ^^ patterns `Ok(!)` and `Err(!)` not covered @@ -378,7 +392,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty - --> $DIR/empty-types.rs:313:11 + --> $DIR/empty-types.rs:322:11 | LL | match *x {} | ^^ @@ -392,7 +406,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty - --> $DIR/empty-types.rs:318:11 + --> $DIR/empty-types.rs:327:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -406,7 +420,7 @@ LL + } | error[E0004]: non-exhaustive patterns: `&[!, ..]` not covered - --> $DIR/empty-types.rs:320:11 + --> $DIR/empty-types.rs:329:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[!, ..]` not covered @@ -420,7 +434,7 @@ LL + &[!, ..] | error[E0004]: non-exhaustive patterns: `&[]`, `&[!]` and `&[!, !]` not covered - --> $DIR/empty-types.rs:329:11 + --> $DIR/empty-types.rs:338:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]`, `&[!]` and `&[!, !]` not covered @@ -433,7 +447,7 @@ LL + &[] | &[!] | &[!, !] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` and `&[!, ..]` not covered - --> $DIR/empty-types.rs:343:11 + --> $DIR/empty-types.rs:352:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]` and `&[!, ..]` not covered @@ -447,7 +461,7 @@ LL + &[] | &[!, ..] => todo!() | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty - --> $DIR/empty-types.rs:350:11 + --> $DIR/empty-types.rs:359:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -461,31 +475,31 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:359:9 + --> $DIR/empty-types.rs:368:9 | LL | _ => {} - | ^ + | ^ matches no values because `[!; 3]` is uninhabited | - = note: this pattern matches no values because `[!; 3]` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:362:9 + --> $DIR/empty-types.rs:371:9 | LL | [_, _, _] => {} - | ^^^^^^^^^ + | ^^^^^^^^^ matches no values because `[!; 3]` is uninhabited | - = note: this pattern matches no values because `[!; 3]` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:365:9 + --> $DIR/empty-types.rs:374:9 | LL | [_, ..] => {} - | ^^^^^^^ + | ^^^^^^^ matches no values because `[!; 3]` is uninhabited | - = note: this pattern matches no values because `[!; 3]` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-types.rs:379:11 + --> $DIR/empty-types.rs:388:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -499,15 +513,15 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:386:9 + --> $DIR/empty-types.rs:395:9 | LL | [] => {} - | -- matches all the values already + | -- matches all the relevant values LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-types.rs:388:11 + --> $DIR/empty-types.rs:397:11 | LL | match array_0_never { | ^^^^^^^^^^^^^ pattern `[]` not covered @@ -521,41 +535,41 @@ LL + [] => todo!() | error: unreachable pattern - --> $DIR/empty-types.rs:407:9 + --> $DIR/empty-types.rs:416:9 | LL | Some(_) => {} - | ^^^^^^^ + | ^^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:412:9 + --> $DIR/empty-types.rs:421:9 | LL | Some(_a) => {} - | ^^^^^^^^ + | ^^^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:417:9 + --> $DIR/empty-types.rs:426:9 | LL | None => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | // !useful, !reachable LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern - --> $DIR/empty-types.rs:422:9 + --> $DIR/empty-types.rs:431:9 | LL | None => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | // !useful, !reachable LL | _a => {} - | ^^ unreachable pattern + | ^^ no value can reach this error[E0004]: non-exhaustive patterns: `&Some(!)` not covered - --> $DIR/empty-types.rs:442:11 + --> $DIR/empty-types.rs:451:11 | LL | match ref_opt_never { | ^^^^^^^^^^^^^ pattern `&Some(!)` not covered @@ -574,7 +588,7 @@ LL + &Some(!) | error[E0004]: non-exhaustive patterns: `Some(!)` not covered - --> $DIR/empty-types.rs:483:11 + --> $DIR/empty-types.rs:492:11 | LL | match *ref_opt_never { | ^^^^^^^^^^^^^^ pattern `Some(!)` not covered @@ -593,7 +607,7 @@ LL + Some(!) | error[E0004]: non-exhaustive patterns: `Err(!)` not covered - --> $DIR/empty-types.rs:531:11 + --> $DIR/empty-types.rs:540:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered @@ -612,7 +626,7 @@ LL + Err(!) | error[E0004]: non-exhaustive patterns: `Err(!)` not covered - --> $DIR/empty-types.rs:542:11 + --> $DIR/empty-types.rs:551:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(!)` not covered @@ -631,7 +645,7 @@ LL + Err(!) | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:561:11 + --> $DIR/empty-types.rs:570:11 | LL | match *ref_tuple_half_never {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -645,39 +659,39 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:594:9 + --> $DIR/empty-types.rs:603:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:597:9 + --> $DIR/empty-types.rs:606:9 | LL | _x => {} - | ^^ + | ^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:600:9 + --> $DIR/empty-types.rs:609:9 | LL | _ if false => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:603:9 + --> $DIR/empty-types.rs:612:9 | LL | _x if false => {} - | ^^ + | ^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `&!` not covered - --> $DIR/empty-types.rs:628:11 + --> $DIR/empty-types.rs:637:11 | LL | match ref_never { | ^^^^^^^^^ pattern `&!` not covered @@ -693,7 +707,7 @@ LL + &! | error[E0004]: non-exhaustive patterns: `Ok(!)` not covered - --> $DIR/empty-types.rs:644:11 + --> $DIR/empty-types.rs:653:11 | LL | match *ref_result_never { | ^^^^^^^^^^^^^^^^^ pattern `Ok(!)` not covered @@ -712,7 +726,7 @@ LL + Ok(!) | error[E0004]: non-exhaustive patterns: `Some(!)` not covered - --> $DIR/empty-types.rs:664:11 + --> $DIR/empty-types.rs:673:11 | LL | match *x { | ^^ pattern `Some(!)` not covered @@ -730,7 +744,7 @@ LL ~ None => {}, LL + Some(!) | -error: aborting due to 64 previous errors; 1 warning emitted +error: aborting due to 65 previous errors; 1 warning emitted Some errors have detailed explanations: E0004, E0005. For more information about an error, try `rustc --explain E0004`. diff --git a/tests/ui/pattern/usefulness/empty-types.normal.stderr b/tests/ui/pattern/usefulness/empty-types.normal.stderr index c3421cd592e..8f60dad4467 100644 --- a/tests/ui/pattern/usefulness/empty-types.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-types.normal.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/empty-types.rs:49:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/empty-types.rs:15:9 | @@ -15,9 +15,9 @@ error: unreachable pattern --> $DIR/empty-types.rs:52:9 | LL | _x => {} - | ^^ + | ^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `&!` is non-empty --> $DIR/empty-types.rs:56:11 @@ -38,33 +38,33 @@ error: unreachable pattern --> $DIR/empty-types.rs:70:9 | LL | (_, _) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `(u32, !)` is uninhabited | - = note: this pattern matches no values because `(u32, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:76:9 | LL | _ => {} - | ^ + | ^ matches no values because `(!, !)` is uninhabited | - = note: this pattern matches no values because `(!, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:79:9 | LL | (_, _) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `(!, !)` is uninhabited | - = note: this pattern matches no values because `(!, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:83:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Ok(_)` not covered --> $DIR/empty-types.rs:87:11 @@ -89,17 +89,17 @@ error: unreachable pattern --> $DIR/empty-types.rs:94:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:99:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `Ok(1_u32..=u32::MAX)` not covered --> $DIR/empty-types.rs:96:11 @@ -151,81 +151,81 @@ error: unreachable pattern --> $DIR/empty-types.rs:112:9 | LL | _ => {} - | ^ + | ^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:115:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:118:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:119:9 | LL | _ => {} - | ^ + | ^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:122:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:123:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:132:13 | LL | _ => {} - | ^ + | ^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:135:13 | LL | _ if false => {} - | ^ + | ^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:143:13 | LL | Some(_) => {} - | ^^^^^^^ + | ^^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:147:13 | LL | None => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error[E0004]: non-exhaustive patterns: `Some(_)` not covered --> $DIR/empty-types.rs:156:15 @@ -250,76 +250,90 @@ error: unreachable pattern --> $DIR/empty-types.rs:199:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:204:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:209:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:214:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/empty-types.rs:220:13 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:279:9 + --> $DIR/empty-types.rs:281:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:282:9 + --> $DIR/empty-types.rs:284:9 | LL | (_, _) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `(!, !)` is uninhabited | - = note: this pattern matches no values because `(!, !)` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:285:9 + --> $DIR/empty-types.rs:287:9 | LL | Ok(_) => {} - | ^^^^^ + | ^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:286:9 + --> $DIR/empty-types.rs:288:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `Result<!, !>` is uninhabited | - = note: this pattern matches no values because `Result<!, !>` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types + +error[E0005]: refutable pattern in local binding + --> $DIR/empty-types.rs:297:13 + | +LL | let Ok(_) = *ptr_result_never_err; + | ^^^^^ pattern `Err(_)` not covered + | + = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant + = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html + = note: the matched value is of type `Result<u8, !>` +help: you might want to use `if let` to ignore the variant that isn't matched + | +LL | if let Ok(_) = *ptr_result_never_err { todo!() }; + | ++ +++++++++++ error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:307:11 + --> $DIR/empty-types.rs:316:11 | LL | match *x {} | ^^ @@ -333,7 +347,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `(!, !)` is non-empty - --> $DIR/empty-types.rs:309:11 + --> $DIR/empty-types.rs:318:11 | LL | match *x {} | ^^ @@ -347,7 +361,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: `Ok(_)` and `Err(_)` not covered - --> $DIR/empty-types.rs:311:11 + --> $DIR/empty-types.rs:320:11 | LL | match *x {} | ^^ patterns `Ok(_)` and `Err(_)` not covered @@ -369,7 +383,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `[!; 3]` is non-empty - --> $DIR/empty-types.rs:313:11 + --> $DIR/empty-types.rs:322:11 | LL | match *x {} | ^^ @@ -383,7 +397,7 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `&[!]` is non-empty - --> $DIR/empty-types.rs:318:11 + --> $DIR/empty-types.rs:327:11 | LL | match slice_never {} | ^^^^^^^^^^^ @@ -397,7 +411,7 @@ LL + } | error[E0004]: non-exhaustive patterns: `&[_, ..]` not covered - --> $DIR/empty-types.rs:320:11 + --> $DIR/empty-types.rs:329:11 | LL | match slice_never { | ^^^^^^^^^^^ pattern `&[_, ..]` not covered @@ -411,7 +425,7 @@ LL + &[_, ..] => todo!() | error[E0004]: non-exhaustive patterns: `&[]`, `&[_]` and `&[_, _]` not covered - --> $DIR/empty-types.rs:329:11 + --> $DIR/empty-types.rs:338:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _]` not covered @@ -424,7 +438,7 @@ LL + &[] | &[_] | &[_, _] => todo!() | error[E0004]: non-exhaustive patterns: `&[]` and `&[_, ..]` not covered - --> $DIR/empty-types.rs:343:11 + --> $DIR/empty-types.rs:352:11 | LL | match slice_never { | ^^^^^^^^^^^ patterns `&[]` and `&[_, ..]` not covered @@ -438,7 +452,7 @@ LL + &[] | &[_, ..] => todo!() | error[E0004]: non-exhaustive patterns: type `[!]` is non-empty - --> $DIR/empty-types.rs:350:11 + --> $DIR/empty-types.rs:359:11 | LL | match *slice_never {} | ^^^^^^^^^^^^ @@ -452,31 +466,31 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:359:9 + --> $DIR/empty-types.rs:368:9 | LL | _ => {} - | ^ + | ^ matches no values because `[!; 3]` is uninhabited | - = note: this pattern matches no values because `[!; 3]` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:362:9 + --> $DIR/empty-types.rs:371:9 | LL | [_, _, _] => {} - | ^^^^^^^^^ + | ^^^^^^^^^ matches no values because `[!; 3]` is uninhabited | - = note: this pattern matches no values because `[!; 3]` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:365:9 + --> $DIR/empty-types.rs:374:9 | LL | [_, ..] => {} - | ^^^^^^^ + | ^^^^^^^ matches no values because `[!; 3]` is uninhabited | - = note: this pattern matches no values because `[!; 3]` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `[!; 0]` is non-empty - --> $DIR/empty-types.rs:379:11 + --> $DIR/empty-types.rs:388:11 | LL | match array_0_never {} | ^^^^^^^^^^^^^ @@ -490,15 +504,15 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:386:9 + --> $DIR/empty-types.rs:395:9 | LL | [] => {} - | -- matches all the values already + | -- matches all the relevant values LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/empty-types.rs:388:11 + --> $DIR/empty-types.rs:397:11 | LL | match array_0_never { | ^^^^^^^^^^^^^ pattern `[]` not covered @@ -512,41 +526,41 @@ LL + [] => todo!() | error: unreachable pattern - --> $DIR/empty-types.rs:407:9 + --> $DIR/empty-types.rs:416:9 | LL | Some(_) => {} - | ^^^^^^^ + | ^^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:412:9 + --> $DIR/empty-types.rs:421:9 | LL | Some(_a) => {} - | ^^^^^^^^ + | ^^^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:417:9 + --> $DIR/empty-types.rs:426:9 | LL | None => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | // !useful, !reachable LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern - --> $DIR/empty-types.rs:422:9 + --> $DIR/empty-types.rs:431:9 | LL | None => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | // !useful, !reachable LL | _a => {} - | ^^ unreachable pattern + | ^^ no value can reach this error[E0004]: non-exhaustive patterns: `&Some(_)` not covered - --> $DIR/empty-types.rs:442:11 + --> $DIR/empty-types.rs:451:11 | LL | match ref_opt_never { | ^^^^^^^^^^^^^ pattern `&Some(_)` not covered @@ -565,7 +579,7 @@ LL + &Some(_) => todo!() | error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:483:11 + --> $DIR/empty-types.rs:492:11 | LL | match *ref_opt_never { | ^^^^^^^^^^^^^^ pattern `Some(_)` not covered @@ -584,7 +598,7 @@ LL + Some(_) => todo!() | error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/empty-types.rs:531:11 + --> $DIR/empty-types.rs:540:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered @@ -603,7 +617,7 @@ LL + Err(_) => todo!() | error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/empty-types.rs:542:11 + --> $DIR/empty-types.rs:551:11 | LL | match *ref_res_never { | ^^^^^^^^^^^^^^ pattern `Err(_)` not covered @@ -622,7 +636,7 @@ LL + Err(_) => todo!() | error[E0004]: non-exhaustive patterns: type `(u32, !)` is non-empty - --> $DIR/empty-types.rs:561:11 + --> $DIR/empty-types.rs:570:11 | LL | match *ref_tuple_half_never {} | ^^^^^^^^^^^^^^^^^^^^^ @@ -636,39 +650,39 @@ LL + } | error: unreachable pattern - --> $DIR/empty-types.rs:594:9 + --> $DIR/empty-types.rs:603:9 | LL | _ => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:597:9 + --> $DIR/empty-types.rs:606:9 | LL | _x => {} - | ^^ + | ^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:600:9 + --> $DIR/empty-types.rs:609:9 | LL | _ if false => {} - | ^ + | ^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-types.rs:603:9 + --> $DIR/empty-types.rs:612:9 | LL | _x if false => {} - | ^^ + | ^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: `&_` not covered - --> $DIR/empty-types.rs:628:11 + --> $DIR/empty-types.rs:637:11 | LL | match ref_never { | ^^^^^^^^^ pattern `&_` not covered @@ -684,7 +698,7 @@ LL + &_ => todo!() | error[E0004]: non-exhaustive patterns: `Ok(_)` not covered - --> $DIR/empty-types.rs:644:11 + --> $DIR/empty-types.rs:653:11 | LL | match *ref_result_never { | ^^^^^^^^^^^^^^^^^ pattern `Ok(_)` not covered @@ -703,7 +717,7 @@ LL + Ok(_) => todo!() | error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/empty-types.rs:664:11 + --> $DIR/empty-types.rs:673:11 | LL | match *x { | ^^ pattern `Some(_)` not covered @@ -721,7 +735,7 @@ LL ~ None => {}, LL + Some(_) => todo!() | -error: aborting due to 64 previous errors +error: aborting due to 65 previous errors Some errors have detailed explanations: E0004, E0005. For more information about an error, try `rustc --explain E0004`. diff --git a/tests/ui/pattern/usefulness/empty-types.rs b/tests/ui/pattern/usefulness/empty-types.rs index 639c48cea12..d561a0e9c12 100644 --- a/tests/ui/pattern/usefulness/empty-types.rs +++ b/tests/ui/pattern/usefulness/empty-types.rs @@ -17,7 +17,7 @@ #[derive(Copy, Clone)] enum Void {} -/// A bunch of never situations that can't be normally constructed. +/// A bunch of never situations that can't be normally constructed so we take them as argument. #[derive(Copy, Clone)] struct NeverBundle { never: !, @@ -272,6 +272,8 @@ fn nested_validity_tracking(bundle: NeverBundle) { let ref_never: &! = &never; let tuple_never: (!, !) = bundle.tuple_never; let result_never: Result<!, !> = bundle.result_never; + let result_never_err: Result<u8, !> = Ok(0); + let ptr_result_never_err: *const Result<u8, !> = &result_never_err as *const _; let union_never = Uninit::<!>::new(); // These should be considered known_valid and warn unreachable. @@ -287,6 +289,13 @@ fn nested_validity_tracking(bundle: NeverBundle) { } // These should be considered !known_valid and not warn unreachable. + unsafe { + match *ptr_result_never_err { + Ok(_) => {} + Err(_) => {} + } + let Ok(_) = *ptr_result_never_err; //[normal,never_pats]~ ERROR refutable pattern + } match ref_never { &_ => {} } diff --git a/tests/ui/pattern/usefulness/explain-unreachable-pats.rs b/tests/ui/pattern/usefulness/explain-unreachable-pats.rs index 44d194055d9..1cfa5212414 100644 --- a/tests/ui/pattern/usefulness/explain-unreachable-pats.rs +++ b/tests/ui/pattern/usefulness/explain-unreachable-pats.rs @@ -6,10 +6,10 @@ fn main() { match (0u8,) { (1 | 2,) => {} - //~^ NOTE matches all the values already + //~^ NOTE matches all the relevant values (2,) => {} //~^ ERROR unreachable pattern - //~| NOTE unreachable pattern + //~| NOTE no value can reach this _ => {} } @@ -20,18 +20,38 @@ fn main() { //~^ NOTE matches some of the same values (1 | 2,) => {} //~^ ERROR unreachable pattern - //~| NOTE unreachable pattern - //~| NOTE these patterns collectively make the last one unreachable + //~| NOTE no value can reach this + //~| NOTE multiple earlier patterns match some of the same values //~| NOTE collectively making this unreachable _ => {} } + match 0u8 { + 1 => {} + //~^ NOTE matches some of the same values + 2 => {} + //~^ NOTE matches some of the same values + 3 => {} + //~^ NOTE matches some of the same values + 4 => {} + //~^ NOTE matches some of the same values + 5 => {} + 6 => {} + 1 ..= 6 => {} + //~^ ERROR unreachable pattern + //~| NOTE no value can reach this + //~| NOTE multiple earlier patterns match some of the same values + //~| NOTE ...and 2 other patterns + _ => {} + } + let res: Result<(),!> = Ok(()); match res { Ok(_) => {} Err(_) => {} //~^ ERROR unreachable pattern - //~| NOTE this pattern matches no values because `!` is uninhabited + //~| NOTE matches no values because `!` is uninhabited + //~| NOTE to learn more about uninhabited types, see } #[derive(Copy, Clone)] @@ -44,22 +64,24 @@ fn main() { match (&res1, res2) { (Err(_), Err(_)) => {} //~^ ERROR unreachable pattern - //~| NOTE this pattern matches no values because `Void2` is uninhabited + //~| NOTE matches no values because `Void2` is uninhabited + //~| NOTE to learn more about uninhabited types, see _ => {} } match (res1, &res2) { (Err(_), Err(_)) => {} //~^ ERROR unreachable pattern - //~| NOTE this pattern matches no values because `Void1` is uninhabited + //~| NOTE matches no values because `Void1` is uninhabited + //~| NOTE to learn more about uninhabited types, see _ => {} } if let (0 - //~^ NOTE matches all the values already + //~^ NOTE matches all the relevant values | 0, _) = (0, 0) {} //~^ ERROR unreachable pattern - //~| NOTE unreachable pattern + //~| NOTE no value can reach this match (true, true) { (_, true) if false => {} // Guarded patterns don't cover others @@ -69,20 +91,20 @@ fn main() { //~^ NOTE matches some of the same values (_, true) => {} //~^ ERROR unreachable pattern - //~| NOTE unreachable pattern - //~| NOTE these patterns collectively make the last one unreachable + //~| NOTE no value can reach this + //~| NOTE multiple earlier patterns match some of the same values //~| NOTE collectively making this unreachable } match (true, true) { (true, _) => {} - //~^ NOTE matches all the values already + //~^ NOTE matches all the relevant values (false, _) => {} #[allow(unreachable_patterns)] (_, true) => {} // Doesn't cover below because it's already unreachable. (true, true) => {} //~^ ERROR unreachable pattern - //~| NOTE unreachable pattern + //~| NOTE no value can reach this } // Despite skipping some irrelevant cases, we still report a set of rows that covers the @@ -90,11 +112,11 @@ fn main() { match (true, true, 0) { (true, _, _) => {} (_, true, 0..10) => {} - //~^ NOTE matches all the values already + //~^ NOTE matches all the relevant values (_, true, 10..) => {} (_, true, 3) => {} //~^ ERROR unreachable pattern - //~| NOTE unreachable pattern + //~| NOTE no value can reach this _ => {} } } diff --git a/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr b/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr index 105d4f73f66..7023c2775e9 100644 --- a/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr +++ b/tests/ui/pattern/usefulness/explain-unreachable-pats.stderr @@ -2,10 +2,10 @@ error: unreachable pattern --> $DIR/explain-unreachable-pats.rs:10:9 | LL | (1 | 2,) => {} - | -------- matches all the values already + | -------- matches all the relevant values LL | LL | (2,) => {} - | ^^^^ unreachable pattern + | ^^^^ no value can reach this | note: the lint level is defined here --> $DIR/explain-unreachable-pats.rs:2:9 @@ -17,9 +17,9 @@ error: unreachable pattern --> $DIR/explain-unreachable-pats.rs:21:9 | LL | (1 | 2,) => {} - | ^^^^^^^^ unreachable pattern + | ^^^^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/explain-unreachable-pats.rs:21:9 | LL | (1,) => {} @@ -32,46 +32,70 @@ LL | (1 | 2,) => {} | ^^^^^^^^ collectively making this unreachable error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:32:9 + --> $DIR/explain-unreachable-pats.rs:40:9 + | +LL | 1 ..= 6 => {} + | ^^^^^^^ no value can reach this + | +note: multiple earlier patterns match some of the same values + --> $DIR/explain-unreachable-pats.rs:40:9 + | +LL | 1 => {} + | - matches some of the same values +LL | +LL | 2 => {} + | - matches some of the same values +LL | +LL | 3 => {} + | - matches some of the same values +LL | +LL | 4 => {} + | - matches some of the same values +... +LL | 1 ..= 6 => {} + | ^^^^^^^ ...and 2 other patterns collectively make this unreachable + +error: unreachable pattern + --> $DIR/explain-unreachable-pats.rs:51:9 | LL | Err(_) => {} - | ^^^^^^ + | ^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:45:9 + --> $DIR/explain-unreachable-pats.rs:65:9 | LL | (Err(_), Err(_)) => {} - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ matches no values because `Void2` is uninhabited | - = note: this pattern matches no values because `Void2` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:51:9 + --> $DIR/explain-unreachable-pats.rs:72:9 | LL | (Err(_), Err(_)) => {} - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ matches no values because `Void1` is uninhabited | - = note: this pattern matches no values because `Void1` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:60:11 + --> $DIR/explain-unreachable-pats.rs:82:11 | LL | if let (0 - | - matches all the values already + | - matches all the relevant values LL | LL | | 0, _) = (0, 0) {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:70:9 + --> $DIR/explain-unreachable-pats.rs:92:9 | LL | (_, true) => {} - | ^^^^^^^^^ unreachable pattern + | ^^^^^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable - --> $DIR/explain-unreachable-pats.rs:70:9 +note: multiple earlier patterns match some of the same values + --> $DIR/explain-unreachable-pats.rs:92:9 | LL | (true, _) => {} | --------- matches some of the same values @@ -83,22 +107,22 @@ LL | (_, true) => {} | ^^^^^^^^^ collectively making this unreachable error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:83:9 + --> $DIR/explain-unreachable-pats.rs:105:9 | LL | (true, _) => {} - | --------- matches all the values already + | --------- matches all the relevant values ... LL | (true, true) => {} - | ^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^ no value can reach this error: unreachable pattern - --> $DIR/explain-unreachable-pats.rs:95:9 + --> $DIR/explain-unreachable-pats.rs:117:9 | LL | (_, true, 0..10) => {} - | ---------------- matches all the values already + | ---------------- matches all the relevant values ... LL | (_, true, 3) => {} - | ^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^ no value can reach this -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors diff --git a/tests/ui/pattern/usefulness/floats.stderr b/tests/ui/pattern/usefulness/floats.stderr index d0a8841d6a8..61aaa2c7626 100644 --- a/tests/ui/pattern/usefulness/floats.stderr +++ b/tests/ui/pattern/usefulness/floats.stderr @@ -15,9 +15,9 @@ error: unreachable pattern --> $DIR/floats.rs:18:9 | LL | 0.01f16..=6.5f16 => {} - | ---------------- matches all the values already + | ---------------- matches all the relevant values LL | 0.01f16 => {} - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/floats.rs:1:9 @@ -29,117 +29,117 @@ error: unreachable pattern --> $DIR/floats.rs:19:9 | LL | 0.01f16..=6.5f16 => {} - | ---------------- matches all the values already + | ---------------- matches all the relevant values LL | 0.01f16 => {} LL | 0.02f16 => {} - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:20:9 | LL | 0.01f16..=6.5f16 => {} - | ---------------- matches all the values already + | ---------------- matches all the relevant values ... LL | 6.5f16 => {} - | ^^^^^^ unreachable pattern + | ^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:31:9 | LL | 0.01f32..=6.5f32 => {} - | ---------------- matches all the values already + | ---------------- matches all the relevant values LL | 0.01f32 => {} - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:32:9 | LL | 0.01f32..=6.5f32 => {} - | ---------------- matches all the values already + | ---------------- matches all the relevant values LL | 0.01f32 => {} LL | 0.02f32 => {} - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:33:9 | LL | 0.01f32..=6.5f32 => {} - | ---------------- matches all the values already + | ---------------- matches all the relevant values ... LL | 6.5f32 => {} - | ^^^^^^ unreachable pattern + | ^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:45:9 | LL | 0.01f64..=6.5f64 => {} - | ---------------- matches all the values already + | ---------------- matches all the relevant values LL | 0.005f64 => {} LL | 0.01f64 => {} - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:46:9 | LL | 0.01f64..=6.5f64 => {} - | ---------------- matches all the values already + | ---------------- matches all the relevant values ... LL | 0.02f64 => {} - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:47:9 | LL | 0.01f64..=6.5f64 => {} - | ---------------- matches all the values already + | ---------------- matches all the relevant values ... LL | 6.5f64 => {} - | ^^^^^^ unreachable pattern + | ^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:49:9 | LL | 0.01f64..=6.5f64 => {} - | ---------------- matches all the values already + | ---------------- matches all the relevant values ... LL | 1.0f64..=4.0f64 => {} - | ^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:62:9 | LL | 0.01f128..=6.5f128 => {} - | ------------------ matches all the values already + | ------------------ matches all the relevant values LL | 0.005f128 => {} LL | 0.01f128 => {} - | ^^^^^^^^ unreachable pattern + | ^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:63:9 | LL | 0.01f128..=6.5f128 => {} - | ------------------ matches all the values already + | ------------------ matches all the relevant values ... LL | 0.02f128 => {} - | ^^^^^^^^ unreachable pattern + | ^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:64:9 | LL | 0.01f128..=6.5f128 => {} - | ------------------ matches all the values already + | ------------------ matches all the relevant values ... LL | 6.5f128 => {} - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/floats.rs:66:9 | LL | 0.01f128..=6.5f128 => {} - | ------------------ matches all the values already + | ------------------ matches all the relevant values ... LL | 1.0f128..=4.0f128 => {} - | ^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^ no value can reach this error: aborting due to 15 previous errors diff --git a/tests/ui/pattern/usefulness/impl-trait.stderr b/tests/ui/pattern/usefulness/impl-trait.stderr index 92932e48538..34b157f0fc4 100644 --- a/tests/ui/pattern/usefulness/impl-trait.stderr +++ b/tests/ui/pattern/usefulness/impl-trait.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/impl-trait.rs:16:13 | LL | _ => {} - | ^ + | ^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/impl-trait.rs:4:9 | @@ -15,49 +15,49 @@ error: unreachable pattern --> $DIR/impl-trait.rs:30:13 | LL | _ => {} - | ^ + | ^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/impl-trait.rs:44:13 | LL | Some(_) => {} - | ^^^^^^^ + | ^^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/impl-trait.rs:48:13 | LL | None => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/impl-trait.rs:58:13 | LL | Some(_) => {} - | ^^^^^^^ + | ^^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/impl-trait.rs:62:13 | LL | None => {} - | ---- matches all the values already + | ---- matches all the relevant values LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/impl-trait.rs:75:9 | LL | _ => {} - | ^ + | ^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/impl-trait.rs:85:9 @@ -65,23 +65,23 @@ error: unreachable pattern LL | _ => {} | - matches any value LL | Some((a, b)) => {} - | ^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/impl-trait.rs:93:13 | LL | _ => {} - | ^ + | ^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/impl-trait.rs:104:9 | LL | Some((a, b)) => {} - | ------------ matches all the values already + | ------------ matches all the relevant values LL | Some((mut x, mut y)) => { - | ^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/impl-trait.rs:123:13 @@ -89,23 +89,23 @@ error: unreachable pattern LL | _ => {} | - matches any value LL | Rec { n: 0, w: Some(Rec { n: 0, w: _ }) } => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/impl-trait.rs:137:13 | LL | _ => {} - | ^ + | ^ matches no values because `SecretelyVoid` is uninhabited | - = note: this pattern matches no values because `SecretelyVoid` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/impl-trait.rs:150:13 | LL | _ => {} - | ^ + | ^ matches no values because `SecretelyDoubleVoid` is uninhabited | - = note: this pattern matches no values because `SecretelyDoubleVoid` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0004]: non-exhaustive patterns: type `impl Copy` is non-empty --> $DIR/impl-trait.rs:22:11 diff --git a/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr b/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr index 5d86007a853..0d495bcbec1 100644 --- a/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr +++ b/tests/ui/pattern/usefulness/integer-ranges/reachability.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/reachability.rs:18:17 | LL | m!(0u8, 42, 42); - | -- ^^ unreachable pattern + | -- ^^ no value can reach this | | - | matches all the values already + | matches all the relevant values | note: the lint level is defined here --> $DIR/reachability.rs:3:9 @@ -16,129 +16,129 @@ error: unreachable pattern --> $DIR/reachability.rs:22:22 | LL | m!(0u8, 20..=30, 20); - | ------- ^^ unreachable pattern + | ------- ^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:23:22 | LL | m!(0u8, 20..=30, 21); - | ------- ^^ unreachable pattern + | ------- ^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:24:22 | LL | m!(0u8, 20..=30, 25); - | ------- ^^ unreachable pattern + | ------- ^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:25:22 | LL | m!(0u8, 20..=30, 29); - | ------- ^^ unreachable pattern + | ------- ^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:26:22 | LL | m!(0u8, 20..=30, 30); - | ------- ^^ unreachable pattern + | ------- ^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:29:21 | LL | m!(0u8, 20..30, 20); - | ------ ^^ unreachable pattern + | ------ ^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:30:21 | LL | m!(0u8, 20..30, 21); - | ------ ^^ unreachable pattern + | ------ ^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:31:21 | LL | m!(0u8, 20..30, 25); - | ------ ^^ unreachable pattern + | ------ ^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:32:21 | LL | m!(0u8, 20..30, 29); - | ------ ^^ unreachable pattern + | ------ ^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:36:22 | LL | m!(0u8, 20..=30, 20..=30); - | ------- ^^^^^^^ unreachable pattern + | ------- ^^^^^^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:37:22 | LL | m!(0u8, 20.. 30, 20.. 30); - | ------- ^^^^^^^ unreachable pattern + | ------- ^^^^^^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:38:22 | LL | m!(0u8, 20..=30, 20.. 30); - | ------- ^^^^^^^ unreachable pattern + | ------- ^^^^^^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:40:22 | LL | m!(0u8, 20..=30, 21..=30); - | ------- ^^^^^^^ unreachable pattern + | ------- ^^^^^^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:41:22 | LL | m!(0u8, 20..=30, 20..=29); - | ------- ^^^^^^^ unreachable pattern + | ------- ^^^^^^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:43:24 | LL | m!('a', 'A'..='z', 'a'..='z'); - | --------- ^^^^^^^^^ unreachable pattern + | --------- ^^^^^^^^^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/reachability.rs:50:9 | LL | 5..=8 => {}, - | ^^^^^ unreachable pattern + | ^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/reachability.rs:50:9 | LL | 5 => {}, @@ -156,9 +156,9 @@ error: unreachable pattern --> $DIR/reachability.rs:56:9 | LL | 5..15 => {}, - | ^^^^^ unreachable pattern + | ^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/reachability.rs:56:9 | LL | 0..10 => {}, @@ -172,9 +172,9 @@ error: unreachable pattern --> $DIR/reachability.rs:63:9 | LL | 5..25 => {}, - | ^^^^^ unreachable pattern + | ^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/reachability.rs:63:9 | LL | 0..10 => {}, @@ -190,9 +190,9 @@ error: unreachable pattern --> $DIR/reachability.rs:71:9 | LL | 5..25 => {}, - | ^^^^^ unreachable pattern + | ^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/reachability.rs:71:9 | LL | 0..10 => {}, @@ -210,9 +210,9 @@ error: unreachable pattern --> $DIR/reachability.rs:77:9 | LL | 5..15 => {}, - | ^^^^^ unreachable pattern + | ^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/reachability.rs:77:9 | LL | 0..10 => {}, @@ -228,15 +228,15 @@ error: unreachable pattern LL | _ => {}, | - matches any value LL | '\u{D7FF}'..='\u{E000}' => {}, - | ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/reachability.rs:89:9 | LL | '\u{D7FF}'..='\u{E000}' => {}, - | ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/reachability.rs:89:9 | LL | '\u{0}'..='\u{D7FF}' => {}, @@ -250,18 +250,18 @@ error: unreachable pattern --> $DIR/reachability.rs:105:9 | LL | &42 => {} - | --- matches all the values already + | --- matches all the relevant values LL | &FOO => {} - | ^^^^ unreachable pattern + | ^^^^ no value can reach this error: unreachable pattern --> $DIR/reachability.rs:106:9 | LL | &42 => {} - | --- matches all the values already + | --- matches all the relevant values LL | &FOO => {} LL | BAR => {} - | ^^^ unreachable pattern + | ^^^ no value can reach this error: aborting due to 25 previous errors diff --git a/tests/ui/pattern/usefulness/issue-12116.stderr b/tests/ui/pattern/usefulness/issue-12116.stderr index b2c2be97563..5929b81f6c2 100644 --- a/tests/ui/pattern/usefulness/issue-12116.stderr +++ b/tests/ui/pattern/usefulness/issue-12116.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/issue-12116.rs:15:9 | LL | &IntList::Cons(val, box ref next_list) => tail(next_list), - | -------------------------------------- matches all the values already + | -------------------------------------- matches all the relevant values LL | &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, Box::new(IntList::Nil)), - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/issue-12116.rs:4:9 diff --git a/tests/ui/pattern/usefulness/issue-12369.stderr b/tests/ui/pattern/usefulness/issue-12369.stderr index 7754cbc2484..fb6f89379f8 100644 --- a/tests/ui/pattern/usefulness/issue-12369.stderr +++ b/tests/ui/pattern/usefulness/issue-12369.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/issue-12369.rs:9:9 | LL | &[10,a, ref rest @ ..] => 10 - | ^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/issue-12369.rs:9:9 | LL | &[a,b,c] => 3, diff --git a/tests/ui/pattern/usefulness/issue-13727.stderr b/tests/ui/pattern/usefulness/issue-13727.stderr index ca8533b33a4..fdba8c87015 100644 --- a/tests/ui/pattern/usefulness/issue-13727.stderr +++ b/tests/ui/pattern/usefulness/issue-13727.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/issue-13727.rs:7:5 | LL | 256 => print!("0b1110\n"), - | --- matches all the values already + | --- matches all the relevant values LL | 512 => print!("0b1111\n"), - | ^^^ unreachable pattern + | ^^^ no value can reach this | note: the lint level is defined here --> $DIR/issue-13727.rs:2:9 diff --git a/tests/ui/pattern/usefulness/issue-30240-b.stderr b/tests/ui/pattern/usefulness/issue-30240-b.stderr index 749515fc94b..4805083c129 100644 --- a/tests/ui/pattern/usefulness/issue-30240-b.stderr +++ b/tests/ui/pattern/usefulness/issue-30240-b.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/issue-30240-b.rs:12:9 | LL | "hello" => {} - | ------- matches all the values already + | ------- matches all the relevant values LL | "hello" => {} - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/issue-30240-b.rs:1:9 diff --git a/tests/ui/pattern/usefulness/issue-31221.stderr b/tests/ui/pattern/usefulness/issue-31221.stderr index 596f4d8096d..e198a9397ee 100644 --- a/tests/ui/pattern/usefulness/issue-31221.stderr +++ b/tests/ui/pattern/usefulness/issue-31221.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | Var3 => (), | ---- matches any value LL | Var2 => (), - | ^^^^ unreachable pattern + | ^^^^ no value can reach this | note: the lint level is defined here --> $DIR/issue-31221.rs:4:9 @@ -18,15 +18,15 @@ error: unreachable pattern LL | &Var3 => (), | ----- matches any value LL | &Var2 => (), - | ^^^^^ unreachable pattern + | ^^^^^ no value can reach this error: unreachable pattern --> $DIR/issue-31221.rs:31:9 | LL | anything => () - | ^^^^^^^^ unreachable pattern + | ^^^^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/issue-31221.rs:31:9 | LL | (Var1, b) => (), diff --git a/tests/ui/pattern/usefulness/issue-57472.stderr b/tests/ui/pattern/usefulness/issue-57472.stderr index 68b5b7cb791..5a35dbd7f93 100644 --- a/tests/ui/pattern/usefulness/issue-57472.stderr +++ b/tests/ui/pattern/usefulness/issue-57472.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/issue-57472.rs:15:13 | LL | Punned { foo: [_], .. } => println!("foo"), - | ----------------------- matches all the values already + | ----------------------- matches all the relevant values LL | Punned { bar: [_], .. } => println!("bar"), - | ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/issue-57472.rs:2:9 @@ -16,9 +16,9 @@ error: unreachable pattern --> $DIR/issue-57472.rs:32:17 | LL | Punned { foo: [_] } => println!("foo"), - | ------------------- matches all the values already + | ------------------- matches all the relevant values LL | Punned { bar: [_] } => println!("bar"), - | ^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^ no value can reach this error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/match-arm-statics.stderr b/tests/ui/pattern/usefulness/match-arm-statics.stderr index b6f2b47047d..d5b8a4e6d79 100644 --- a/tests/ui/pattern/usefulness/match-arm-statics.stderr +++ b/tests/ui/pattern/usefulness/match-arm-statics.stderr @@ -2,10 +2,10 @@ error: unreachable pattern --> $DIR/match-arm-statics.rs:25:9 | LL | TRUE_TRUE => (), - | --------- matches all the values already + | --------- matches all the relevant values ... LL | (true, true) => () - | ^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/match-arm-statics.rs:2:9 @@ -17,18 +17,18 @@ error: unreachable pattern --> $DIR/match-arm-statics.rs:40:9 | LL | Some(Some(EAST)) => (), - | ---------------- matches all the values already + | ---------------- matches all the relevant values ... LL | Some(Some(East)) => (), - | ^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/match-arm-statics.rs:60:9 | LL | Foo { bar: Some(EAST), baz: NewBool(false) } => () - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/match-arm-statics.rs:60:9 | LL | Foo { bar: _, baz: NEW_FALSE } => (), diff --git a/tests/ui/pattern/usefulness/match-byte-array-patterns.stderr b/tests/ui/pattern/usefulness/match-byte-array-patterns.stderr index 39675e2bdd4..79a0fb9a8dd 100644 --- a/tests/ui/pattern/usefulness/match-byte-array-patterns.stderr +++ b/tests/ui/pattern/usefulness/match-byte-array-patterns.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:8:9 | LL | b"AAAA" => {}, - | ------- matches all the values already + | ------- matches all the relevant values LL | &[0x41, 0x41, 0x41, 0x41] => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/match-byte-array-patterns.rs:1:9 @@ -16,57 +16,57 @@ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:14:9 | LL | &[0x41, 0x41, 0x41, 0x41] => {} - | ------------------------- matches all the values already + | ------------------------- matches all the relevant values LL | b"AAAA" => {}, - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:20:9 | LL | &[_, 0x41, 0x41, 0x41] => {}, - | ---------------------- matches all the values already + | ---------------------- matches all the relevant values LL | b"AAAA" => {}, - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:26:9 | LL | &[0x41, .., 0x41] => {} - | ----------------- matches all the values already + | ----------------- matches all the relevant values LL | b"AAAA" => {}, - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:34:9 | LL | b"AAAA" => {}, - | ------- matches all the values already + | ------- matches all the relevant values LL | &[0x41, 0x41, 0x41, 0x41] => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:40:9 | LL | &[0x41, 0x41, 0x41, 0x41] => {} - | ------------------------- matches all the values already + | ------------------------- matches all the relevant values LL | b"AAAA" => {}, - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:46:9 | LL | &[_, 0x41, 0x41, 0x41] => {}, - | ---------------------- matches all the values already + | ---------------------- matches all the relevant values LL | b"AAAA" => {}, - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:52:9 | LL | &[0x41, .., 0x41] => {} - | ----------------- matches all the values already + | ----------------- matches all the relevant values LL | b"AAAA" => {}, - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: aborting due to 8 previous errors diff --git a/tests/ui/pattern/usefulness/match-ref-ice.stderr b/tests/ui/pattern/usefulness/match-ref-ice.stderr index 9c5af47cc1e..c5f8a95b16b 100644 --- a/tests/ui/pattern/usefulness/match-ref-ice.stderr +++ b/tests/ui/pattern/usefulness/match-ref-ice.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/match-ref-ice.rs:13:9 | LL | [1, ref _madoka, 3] => (), - | ------------------- matches all the values already + | ------------------- matches all the relevant values LL | [1, 2, 3] => (), - | ^^^^^^^^^ unreachable pattern + | ^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/match-ref-ice.rs:1:9 diff --git a/tests/ui/pattern/usefulness/match-vec-fixed.stderr b/tests/ui/pattern/usefulness/match-vec-fixed.stderr index 04507a22856..b0b8cdf887a 100644 --- a/tests/ui/pattern/usefulness/match-vec-fixed.stderr +++ b/tests/ui/pattern/usefulness/match-vec-fixed.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/match-vec-fixed.rs:7:9 | LL | [_, _, _] => {} - | --------- matches all the values already + | --------- matches all the relevant values LL | [_, _, _] => {} - | ^^^^^^^^^ unreachable pattern + | ^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/match-vec-fixed.rs:1:9 @@ -16,9 +16,9 @@ error: unreachable pattern --> $DIR/match-vec-fixed.rs:11:9 | LL | [_, 1, _] => {} - | --------- matches all the values already + | --------- matches all the relevant values LL | [_, 1, _] => {} - | ^^^^^^^^^ unreachable pattern + | ^^^^^^^^^ no value can reach this error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/usefulness/match-vec-unreachable.stderr b/tests/ui/pattern/usefulness/match-vec-unreachable.stderr index 865f5b319a7..6ed8f0019fe 100644 --- a/tests/ui/pattern/usefulness/match-vec-unreachable.stderr +++ b/tests/ui/pattern/usefulness/match-vec-unreachable.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/match-vec-unreachable.rs:8:9 | LL | [a, (2, 3), _] => (), - | -------------- matches all the values already + | -------------- matches all the relevant values LL | [(1, 2), (2, 3), b] => (), - | ^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/match-vec-unreachable.rs:1:9 @@ -16,17 +16,17 @@ error: unreachable pattern --> $DIR/match-vec-unreachable.rs:18:9 | LL | [ref a, _, _, ..] => { println!("{}", a); } - | ----------------- matches all the values already + | ----------------- matches all the relevant values LL | [_, _, _, _, _] => { } - | ^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/match-vec-unreachable.rs:26:9 | LL | ['a', 'b', 'c', ref _tail @ ..] => {} - | ------------------------------- matches all the values already + | ------------------------------- matches all the relevant values LL | ['a', 'b', 'c'] => {} - | ^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^ no value can reach this error: aborting due to 3 previous errors diff --git a/tests/ui/pattern/usefulness/slice-pattern-const-2.stderr b/tests/ui/pattern/usefulness/slice-pattern-const-2.stderr index 12db48590a4..a6031eaa730 100644 --- a/tests/ui/pattern/usefulness/slice-pattern-const-2.stderr +++ b/tests/ui/pattern/usefulness/slice-pattern-const-2.stderr @@ -2,10 +2,10 @@ error: unreachable pattern --> $DIR/slice-pattern-const-2.rs:9:9 | LL | MAGIC_TEST => (), - | ---------- matches all the values already + | ---------- matches all the relevant values LL | [0x00, 0x00, 0x00, 0x00] => (), LL | [4, 5, 6, 7] => (), - | ^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/slice-pattern-const-2.rs:1:9 @@ -17,25 +17,25 @@ error: unreachable pattern --> $DIR/slice-pattern-const-2.rs:15:9 | LL | MAGIC_TEST => (), - | ---------- matches all the values already + | ---------- matches all the relevant values LL | [4, 5, 6, 7] => (), - | ^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/slice-pattern-const-2.rs:21:9 | LL | [4, 5, 6, 7] => (), - | ------------ matches all the values already + | ------------ matches all the relevant values LL | MAGIC_TEST => (), - | ^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/slice-pattern-const-2.rs:28:9 | LL | [4] => (), - | --- matches all the values already + | --- matches all the relevant values LL | FOO => (), - | ^^^ unreachable pattern + | ^^^ no value can reach this error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/usefulness/slice-pattern-const-3.stderr b/tests/ui/pattern/usefulness/slice-pattern-const-3.stderr index 5a66799d9c9..bbec9f23602 100644 --- a/tests/ui/pattern/usefulness/slice-pattern-const-3.stderr +++ b/tests/ui/pattern/usefulness/slice-pattern-const-3.stderr @@ -2,10 +2,10 @@ error: unreachable pattern --> $DIR/slice-pattern-const-3.rs:9:9 | LL | MAGIC_TEST => (), - | ---------- matches all the values already + | ---------- matches all the relevant values LL | ["0x00", "0x00", "0x00", "0x00"] => (), LL | ["4", "5", "6", "7"] => (), - | ^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/slice-pattern-const-3.rs:1:9 @@ -17,25 +17,25 @@ error: unreachable pattern --> $DIR/slice-pattern-const-3.rs:15:9 | LL | MAGIC_TEST => (), - | ---------- matches all the values already + | ---------- matches all the relevant values LL | ["4", "5", "6", "7"] => (), - | ^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/slice-pattern-const-3.rs:21:9 | LL | ["4", "5", "6", "7"] => (), - | -------------------- matches all the values already + | -------------------- matches all the relevant values LL | MAGIC_TEST => (), - | ^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/slice-pattern-const-3.rs:28:9 | LL | ["boo"] => (), - | ------- matches all the values already + | ------- matches all the relevant values LL | FOO => (), - | ^^^ unreachable pattern + | ^^^ no value can reach this error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/usefulness/slice-pattern-const.stderr b/tests/ui/pattern/usefulness/slice-pattern-const.stderr index 87a85acc4c5..09bbee73577 100644 --- a/tests/ui/pattern/usefulness/slice-pattern-const.stderr +++ b/tests/ui/pattern/usefulness/slice-pattern-const.stderr @@ -2,10 +2,10 @@ error: unreachable pattern --> $DIR/slice-pattern-const.rs:9:9 | LL | MAGIC_TEST => (), - | ---------- matches all the values already + | ---------- matches all the relevant values LL | [0x00, 0x00, 0x00, 0x00] => (), LL | [84, 69, 83, 84] => (), - | ^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/slice-pattern-const.rs:1:9 @@ -17,67 +17,67 @@ error: unreachable pattern --> $DIR/slice-pattern-const.rs:15:9 | LL | MAGIC_TEST => (), - | ---------- matches all the values already + | ---------- matches all the relevant values LL | [84, 69, 83, 84] => (), - | ^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/slice-pattern-const.rs:21:9 | LL | [84, 69, 83, 84] => (), - | ---------------- matches all the values already + | ---------------- matches all the relevant values LL | MAGIC_TEST => (), - | ^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/slice-pattern-const.rs:28:9 | LL | [4] => (), - | --- matches all the values already + | --- matches all the relevant values LL | FOO => (), - | ^^^ unreachable pattern + | ^^^ no value can reach this error: unreachable pattern --> $DIR/slice-pattern-const.rs:35:9 | LL | [4] => (), - | --- matches all the values already + | --- matches all the relevant values LL | BAR => (), - | ^^^ unreachable pattern + | ^^^ no value can reach this error: unreachable pattern --> $DIR/slice-pattern-const.rs:43:9 | LL | [] => (), - | -- matches all the values already + | -- matches all the relevant values LL | BOO => (), - | ^^^ unreachable pattern + | ^^^ no value can reach this error: unreachable pattern --> $DIR/slice-pattern-const.rs:44:9 | LL | [] => (), - | -- matches all the values already + | -- matches all the relevant values LL | BOO => (), LL | b"" => (), - | ^^^ unreachable pattern + | ^^^ no value can reach this error: unreachable pattern --> $DIR/slice-pattern-const.rs:45:9 | LL | [] => (), - | -- matches all the values already + | -- matches all the relevant values ... LL | _ => (), - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/slice-pattern-const.rs:51:9 | LL | CONST1 => {} - | ------ matches all the values already + | ------ matches all the relevant values LL | [true] => {} - | ^^^^^^ unreachable pattern + | ^^^^^^ no value can reach this error: aborting due to 9 previous errors diff --git a/tests/ui/pattern/usefulness/slice-patterns-reachability.stderr b/tests/ui/pattern/usefulness/slice-patterns-reachability.stderr index 40fbb00de1f..d45779f09a5 100644 --- a/tests/ui/pattern/usefulness/slice-patterns-reachability.stderr +++ b/tests/ui/pattern/usefulness/slice-patterns-reachability.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/slice-patterns-reachability.rs:8:9 | LL | [true, ..] => {} - | ---------- matches all the values already + | ---------- matches all the relevant values LL | [true, ..] => {} - | ^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/slice-patterns-reachability.rs:1:9 @@ -16,44 +16,44 @@ error: unreachable pattern --> $DIR/slice-patterns-reachability.rs:9:9 | LL | [true, ..] => {} - | ---------- matches all the values already + | ---------- matches all the relevant values LL | [true, ..] => {} LL | [true] => {} - | ^^^^^^ unreachable pattern + | ^^^^^^ no value can reach this error: unreachable pattern --> $DIR/slice-patterns-reachability.rs:14:9 | LL | [.., true] => {} - | ---------- matches all the values already + | ---------- matches all the relevant values LL | [.., true] => {} - | ^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/slice-patterns-reachability.rs:15:9 | LL | [.., true] => {} - | ---------- matches all the values already + | ---------- matches all the relevant values LL | [.., true] => {} LL | [true] => {} - | ^^^^^^ unreachable pattern + | ^^^^^^ no value can reach this error: unreachable pattern --> $DIR/slice-patterns-reachability.rs:20:9 | LL | [false, .., true] => {} - | ----------------- matches all the values already + | ----------------- matches all the relevant values LL | [false, .., true] => {} - | ^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/slice-patterns-reachability.rs:21:9 | LL | [false, .., true] => {} - | ----------------- matches all the values already + | ----------------- matches all the relevant values LL | [false, .., true] => {} LL | [false, true] => {} - | ^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^ no value can reach this error: aborting due to 6 previous errors diff --git a/tests/ui/pattern/usefulness/struct-pattern-match-useless.stderr b/tests/ui/pattern/usefulness/struct-pattern-match-useless.stderr index cc29c42e4d6..502fa2deda9 100644 --- a/tests/ui/pattern/usefulness/struct-pattern-match-useless.stderr +++ b/tests/ui/pattern/usefulness/struct-pattern-match-useless.stderr @@ -4,7 +4,7 @@ error: unreachable pattern LL | Foo { x: _x, y: _y } => (), | -------------------- matches any value LL | Foo { .. } => () - | ^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/struct-pattern-match-useless.rs:1:9 diff --git a/tests/ui/pattern/usefulness/top-level-alternation.stderr b/tests/ui/pattern/usefulness/top-level-alternation.stderr index ad846f23155..7fc03143bc3 100644 --- a/tests/ui/pattern/usefulness/top-level-alternation.stderr +++ b/tests/ui/pattern/usefulness/top-level-alternation.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/top-level-alternation.rs:4:23 | LL | while let 0..=2 | 1 = 0 {} - | ----- ^ unreachable pattern + | ----- ^ no value can reach this | | - | matches all the values already + | matches all the relevant values | note: the lint level is defined here --> $DIR/top-level-alternation.rs:1:9 @@ -16,66 +16,66 @@ error: unreachable pattern --> $DIR/top-level-alternation.rs:5:20 | LL | if let 0..=2 | 1 = 0 {} - | ----- ^ unreachable pattern + | ----- ^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: unreachable pattern --> $DIR/top-level-alternation.rs:9:15 | LL | 0 - | - matches all the values already + | - matches all the relevant values LL | | 0 => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/top-level-alternation.rs:14:15 | LL | Some(0) - | ------- matches all the values already + | ------- matches all the relevant values LL | | Some(0) => {} - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/top-level-alternation.rs:19:9 | LL | (0, _) | (_, 0) => {} - | --------------- matches all the values already + | --------------- matches all the relevant values LL | (0, 0) => {} - | ^^^^^^ unreachable pattern + | ^^^^^^ no value can reach this error: unreachable pattern --> $DIR/top-level-alternation.rs:39:9 | LL | None | Some(_) => {} - | -------------- matches all the values already + | -------------- matches all the relevant values LL | _ => {} - | ^ unreachable pattern + | ^ no value can reach this error: unreachable pattern --> $DIR/top-level-alternation.rs:43:9 | LL | None | Some(_) => {} - | -------------- matches all the values already + | -------------- matches all the relevant values LL | Some(_) => {} - | ^^^^^^^ unreachable pattern + | ^^^^^^^ no value can reach this error: unreachable pattern --> $DIR/top-level-alternation.rs:44:9 | LL | None | Some(_) => {} - | -------------- matches all the values already + | -------------- matches all the relevant values LL | Some(_) => {} LL | None => {} - | ^^^^ unreachable pattern + | ^^^^ no value can reach this error: unreachable pattern --> $DIR/top-level-alternation.rs:49:9 | LL | None | Some(_) => {} - | ^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^ no value can reach this | -note: these patterns collectively make the last one unreachable +note: multiple earlier patterns match some of the same values --> $DIR/top-level-alternation.rs:49:9 | LL | Some(_) => {} @@ -89,17 +89,17 @@ error: unreachable pattern --> $DIR/top-level-alternation.rs:53:9 | LL | 1 | 2 => {}, - | ----- matches all the values already + | ----- matches all the relevant values LL | 1..=2 => {}, - | ^^^^^ unreachable pattern + | ^^^^^ no value can reach this error: unreachable pattern --> $DIR/top-level-alternation.rs:56:14 | LL | let (0 | 0) = 0 else { return }; - | - ^ unreachable pattern + | - ^ no value can reach this | | - | matches all the values already + | matches all the relevant values error: aborting due to 11 previous errors diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr index 3f7b8c281e7..3743879ffa6 100644 --- a/tests/ui/privacy/private-in-public-warn.stderr +++ b/tests/ui/privacy/private-in-public-warn.stderr @@ -100,7 +100,7 @@ error: type `types::Priv` is more private than the item `types::ef1` --> $DIR/private-in-public-warn.rs:28:9 | LL | pub fn ef1(arg: Priv); - | ^^^^^^^^^^^^^^^^^^^^^ function `types::ef1` is reachable at visibility `pub(crate)` + | ^^^^^^^^^^^^^^^^^^^^^^ function `types::ef1` is reachable at visibility `pub(crate)` | note: but type `types::Priv` is only usable at visibility `pub(self)` --> $DIR/private-in-public-warn.rs:9:5 @@ -112,7 +112,7 @@ error: type `types::Priv` is more private than the item `types::ef2` --> $DIR/private-in-public-warn.rs:29:9 | LL | pub fn ef2() -> Priv; - | ^^^^^^^^^^^^^^^^^^^^ function `types::ef2` is reachable at visibility `pub(crate)` + | ^^^^^^^^^^^^^^^^^^^^^ function `types::ef2` is reachable at visibility `pub(crate)` | note: but type `types::Priv` is only usable at visibility `pub(self)` --> $DIR/private-in-public-warn.rs:9:5 diff --git a/tests/ui/raw-ref-op/feature-raw-ref-op.rs b/tests/ui/raw-ref-op/feature-raw-ref-op.rs deleted file mode 100644 index 0a44b1cde40..00000000000 --- a/tests/ui/raw-ref-op/feature-raw-ref-op.rs +++ /dev/null @@ -1,21 +0,0 @@ -// gate-test-raw_ref_op - -macro_rules! is_expr { - ($e:expr) => {} -} - -is_expr!(&raw const a); //~ ERROR raw address of syntax is experimental -is_expr!(&raw mut a); //~ ERROR raw address of syntax is experimental - -#[cfg(FALSE)] -fn cfgd_out() { - let mut a = 0; - &raw const a; //~ ERROR raw address of syntax is experimental - &raw mut a; //~ ERROR raw address of syntax is experimental -} - -fn main() { - let mut y = 123; - let x = &raw const y; //~ ERROR raw address of syntax is experimental - let x = &raw mut y; //~ ERROR raw address of syntax is experimental -} diff --git a/tests/ui/raw-ref-op/feature-raw-ref-op.stderr b/tests/ui/raw-ref-op/feature-raw-ref-op.stderr deleted file mode 100644 index 4ffd0c90e48..00000000000 --- a/tests/ui/raw-ref-op/feature-raw-ref-op.stderr +++ /dev/null @@ -1,63 +0,0 @@ -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:13:5 - | -LL | &raw const a; - | ^^^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:14:5 - | -LL | &raw mut a; - | ^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:19:13 - | -LL | let x = &raw const y; - | ^^^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:20:13 - | -LL | let x = &raw mut y; - | ^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:7:10 - | -LL | is_expr!(&raw const a); - | ^^^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: raw address of syntax is experimental - --> $DIR/feature-raw-ref-op.rs:8:10 - | -LL | is_expr!(&raw mut a); - | ^^^^^^^^ - | - = note: see issue #64490 <https://github.com/rust-lang/rust/issues/64490> for more information - = help: add `#![feature(raw_ref_op)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/raw-ref-op/raw-ref-op.rs b/tests/ui/raw-ref-op/raw-ref-op.rs index 70b7a5a4806..0989a6005dc 100644 --- a/tests/ui/raw-ref-op/raw-ref-op.rs +++ b/tests/ui/raw-ref-op/raw-ref-op.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(raw_ref_op)] - fn main() { let mut x = 123; let c_p = &raw const x; diff --git a/tests/ui/raw-ref-op/raw-ref-temp-deref.rs b/tests/ui/raw-ref-op/raw-ref-temp-deref.rs index 5270bdb7a2b..a0078bbc1cd 100644 --- a/tests/ui/raw-ref-op/raw-ref-temp-deref.rs +++ b/tests/ui/raw-ref-op/raw-ref-temp-deref.rs @@ -1,7 +1,7 @@ //@ check-pass // Check that taking the address of a place that contains a dereference is // allowed. -#![feature(raw_ref_op, type_ascription)] +#![feature(type_ascription)] const PAIR_REF: &(i32, i64) = &(1, 2); diff --git a/tests/ui/raw-ref-op/raw-ref-temp.rs b/tests/ui/raw-ref-op/raw-ref-temp.rs index 10e47cb34c5..70f67602af2 100644 --- a/tests/ui/raw-ref-op/raw-ref-temp.rs +++ b/tests/ui/raw-ref-op/raw-ref-temp.rs @@ -1,5 +1,5 @@ // Ensure that we don't allow taking the address of temporary values -#![feature(raw_ref_op, type_ascription)] +#![feature(type_ascription)] const FOUR: u64 = 4; diff --git a/tests/ui/raw-ref-op/unusual_locations.rs b/tests/ui/raw-ref-op/unusual_locations.rs index badf529cb45..eb40fa8a7ee 100644 --- a/tests/ui/raw-ref-op/unusual_locations.rs +++ b/tests/ui/raw-ref-op/unusual_locations.rs @@ -1,7 +1,5 @@ //@ check-pass -#![feature(raw_ref_op)] - const USES_PTR: () = { let u = (); &raw const u; }; static ALSO_USES_PTR: () = { let u = (); &raw const u; }; diff --git a/tests/ui/reachable/unreachable-arm.stderr b/tests/ui/reachable/unreachable-arm.stderr index 79627404030..50c29b30c69 100644 --- a/tests/ui/reachable/unreachable-arm.stderr +++ b/tests/ui/reachable/unreachable-arm.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/unreachable-arm.rs:11:9 | LL | Foo::B(_) | Foo::A(box _, 1) => { } - | ---------------------------- matches all the values already + | ---------------------------- matches all the relevant values LL | Foo::A(_, 1) => { } - | ^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/unreachable-arm.rs:4:9 diff --git a/tests/ui/reachable/unreachable-loop-patterns.stderr b/tests/ui/reachable/unreachable-loop-patterns.stderr index 9b7c2ba4acd..03959ac1606 100644 --- a/tests/ui/reachable/unreachable-loop-patterns.stderr +++ b/tests/ui/reachable/unreachable-loop-patterns.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/unreachable-loop-patterns.rs:16:9 | LL | for _ in unimplemented!() as Void {} - | ^ + | ^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/unreachable-loop-patterns.rs:3:9 | diff --git a/tests/ui/reachable/unreachable-try-pattern.stderr b/tests/ui/reachable/unreachable-try-pattern.stderr index bc1a6fffda6..b082bc11603 100644 --- a/tests/ui/reachable/unreachable-try-pattern.stderr +++ b/tests/ui/reachable/unreachable-try-pattern.stderr @@ -17,9 +17,9 @@ warning: unreachable pattern --> $DIR/unreachable-try-pattern.rs:19:24 | LL | let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?; - | ^^^^^ + | ^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/unreachable-try-pattern.rs:4:9 | @@ -30,9 +30,9 @@ warning: unreachable pattern --> $DIR/unreachable-try-pattern.rs:30:40 | LL | let y = (match x { Ok(n) => Ok(n), Err(e) => Err(e) })?; - | ^^^^^^ + | ^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types warning: 3 warnings emitted diff --git a/tests/ui/regions/explicit-static-bound-on-trait.rs b/tests/ui/regions/explicit-static-bound-on-trait.rs new file mode 100644 index 00000000000..835da34d1bb --- /dev/null +++ b/tests/ui/regions/explicit-static-bound-on-trait.rs @@ -0,0 +1,13 @@ +struct Hello<'a> { + value: Box<dyn std::any::Any + 'a>, + //~^ ERROR lifetime bound not satisfied +} + +impl<'a> Hello<'a> { + fn new<T: 'a>(value: T) -> Self { + Self { value: Box::new(value) } + //~^ ERROR the parameter type `T` may not live long enough + } +} + +fn main() {} diff --git a/tests/ui/regions/explicit-static-bound-on-trait.stderr b/tests/ui/regions/explicit-static-bound-on-trait.stderr new file mode 100644 index 00000000000..30d39c6e86e --- /dev/null +++ b/tests/ui/regions/explicit-static-bound-on-trait.stderr @@ -0,0 +1,32 @@ +error[E0478]: lifetime bound not satisfied + --> $DIR/explicit-static-bound-on-trait.rs:2:12 + | +LL | value: Box<dyn std::any::Any + 'a>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/explicit-static-bound-on-trait.rs:1:14 + | +LL | struct Hello<'a> { + | ^^ +note: but lifetime parameter must outlive the static lifetime + --> $SRC_DIR/core/src/any.rs:LL:COL + +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/explicit-static-bound-on-trait.rs:8:23 + | +LL | Self { value: Box::new(value) } + | ^^^^^^^^^^^^^^^ + | | + | the parameter type `T` must be valid for the static lifetime... + | ...so that the type `T` will meet its required lifetime bounds + | +help: consider adding an explicit lifetime bound + | +LL | fn new<T: 'a + 'static>(value: T) -> Self { + | +++++++++ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0310, E0478. +For more information about an error, try `rustc --explain E0310`. diff --git a/tests/ui/repr/conflicting-repr-hints.stderr b/tests/ui/repr/conflicting-repr-hints.stderr index 4dcd8f4fc28..fbfa69e7fb1 100644 --- a/tests/ui/repr/conflicting-repr-hints.stderr +++ b/tests/ui/repr/conflicting-repr-hints.stderr @@ -81,3 +81,25 @@ error: aborting due to 12 previous errors Some errors have detailed explanations: E0566, E0587, E0634. For more information about an error, try `rustc --explain E0566`. +Future incompatibility report: Future breakage diagnostic: +error[E0566]: conflicting representation hints + --> $DIR/conflicting-repr-hints.rs:13:8 + | +LL | #[repr(C, u64)] + | ^ ^^^ + | + = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> + = note: `#[deny(conflicting_repr_hints)]` on by default + +Future breakage diagnostic: +error[E0566]: conflicting representation hints + --> $DIR/conflicting-repr-hints.rs:19:8 + | +LL | #[repr(u32, u64)] + | ^^^ ^^^ + | + = 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 #68585 <https://github.com/rust-lang/rust/issues/68585> + = note: `#[deny(conflicting_repr_hints)]` on by default + diff --git a/tests/ui/repr/repr-transparent-non-exhaustive-transparent-in-prose.rs b/tests/ui/repr/repr-transparent-non-exhaustive-transparent-in-prose.rs new file mode 100644 index 00000000000..6ab34719f06 --- /dev/null +++ b/tests/ui/repr/repr-transparent-non-exhaustive-transparent-in-prose.rs @@ -0,0 +1,25 @@ +//@ check-pass + +#![feature(sync_unsafe_cell)] +#![allow(unused)] +#![deny(repr_transparent_external_private_fields)] + +// https://github.com/rust-lang/rust/issues/129470 + +struct ZST; + +#[repr(transparent)] +struct TransparentWithManuallyDropZST { + value: i32, + md: std::mem::ManuallyDrop<ZST>, + mu: std::mem::MaybeUninit<ZST>, + p: std::pin::Pin<ZST>, + pd: std::marker::PhantomData<ZST>, + pp: std::marker::PhantomPinned, + c: std::cell::Cell<ZST>, + uc: std::cell::UnsafeCell<ZST>, + suc: std::cell::SyncUnsafeCell<ZST>, + zst: ZST, +} + +fn main() {} diff --git a/tests/ui/resolve/local-shadows-inner-generic.rs b/tests/ui/resolve/local-shadows-inner-generic.rs new file mode 100644 index 00000000000..d9145b9fe2c --- /dev/null +++ b/tests/ui/resolve/local-shadows-inner-generic.rs @@ -0,0 +1,8 @@ +//@ check-pass + +#![allow(non_camel_case_types)] + +pub fn main() { + let a = 1; + struct Foo<a> { field: a, }; +} diff --git a/tests/ui/return/return-from-residual-sugg-issue-125997.fixed b/tests/ui/return/return-from-residual-sugg-issue-125997.fixed index b2eca69aeb9..43a9907a9b4 100644 --- a/tests/ui/return/return-from-residual-sugg-issue-125997.fixed +++ b/tests/ui/return/return-from-residual-sugg-issue-125997.fixed @@ -9,7 +9,6 @@ use std::io::prelude::*; fn test1() -> Result<(), Box<dyn std::error::Error>> { let mut _file = File::create("foo.txt")?; //~^ ERROR the `?` operator can only be used in a function - Ok(()) } @@ -17,7 +16,6 @@ fn test2() -> Result<(), Box<dyn std::error::Error>> { let mut _file = File::create("foo.txt")?; //~^ ERROR the `?` operator can only be used in a function println!(); - Ok(()) } @@ -27,16 +25,31 @@ macro_rules! mac { let mut _file = File::create("foo.txt")?; //~^ ERROR the `?` operator can only be used in a function println!(); - - Ok(()) -} + Ok(()) + } }; } +struct A; + +impl A { + fn test4(&self) -> Result<(), Box<dyn std::error::Error>> { + let mut _file = File::create("foo.txt")?; + //~^ ERROR the `?` operator can only be used in a method + Ok(()) + } + + fn test5(&self) -> Result<(), Box<dyn std::error::Error>> { + let mut _file = File::create("foo.txt")?; + //~^ ERROR the `?` operator can only be used in a method + println!(); + Ok(()) + } +} + fn main() -> Result<(), Box<dyn std::error::Error>> { let mut _file = File::create("foo.txt")?; //~^ ERROR the `?` operator can only be used in a function mac!(); - Ok(()) } diff --git a/tests/ui/return/return-from-residual-sugg-issue-125997.rs b/tests/ui/return/return-from-residual-sugg-issue-125997.rs index dd8550a388b..30ca27eae45 100644 --- a/tests/ui/return/return-from-residual-sugg-issue-125997.rs +++ b/tests/ui/return/return-from-residual-sugg-issue-125997.rs @@ -27,6 +27,21 @@ macro_rules! mac { }; } +struct A; + +impl A { + fn test4(&self) { + let mut _file = File::create("foo.txt")?; + //~^ ERROR the `?` operator can only be used in a method + } + + fn test5(&self) { + let mut _file = File::create("foo.txt")?; + //~^ ERROR the `?` operator can only be used in a method + println!(); + } +} + fn main() { let mut _file = File::create("foo.txt")?; //~^ ERROR the `?` operator can only be used in a function diff --git a/tests/ui/return/return-from-residual-sugg-issue-125997.stderr b/tests/ui/return/return-from-residual-sugg-issue-125997.stderr index ef938f0213d..e22f33fd242 100644 --- a/tests/ui/return/return-from-residual-sugg-issue-125997.stderr +++ b/tests/ui/return/return-from-residual-sugg-issue-125997.stderr @@ -12,9 +12,7 @@ help: consider adding return type LL ~ fn test1() -> Result<(), Box<dyn std::error::Error>> { LL | let mut _file = File::create("foo.txt")?; LL | -LL + LL + Ok(()) -LL + } | error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) @@ -32,13 +30,48 @@ LL ~ fn test2() -> Result<(), Box<dyn std::error::Error>> { LL | let mut _file = File::create("foo.txt")?; LL | LL | println!(); -LL + LL + Ok(()) -LL + } + | + +error[E0277]: the `?` operator can only be used in a method that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/return-from-residual-sugg-issue-125997.rs:34:48 + | +LL | fn test4(&self) { + | --------------- this function should return `Result` or `Option` to accept `?` +LL | let mut _file = File::create("foo.txt")?; + | ^ cannot use the `?` operator in a method that returns `()` + | + = help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()` +help: consider adding return type + | +LL ~ fn test4(&self) -> Result<(), Box<dyn std::error::Error>> { +LL | let mut _file = File::create("foo.txt")?; +LL | +LL ~ Ok(()) +LL ~ } + | + +error[E0277]: the `?` operator can only be used in a method that returns `Result` or `Option` (or another type that implements `FromResidual`) + --> $DIR/return-from-residual-sugg-issue-125997.rs:39:48 + | +LL | fn test5(&self) { + | --------------- this function should return `Result` or `Option` to accept `?` +LL | let mut _file = File::create("foo.txt")?; + | ^ cannot use the `?` operator in a method that returns `()` + | + = help: the trait `FromResidual<Result<Infallible, std::io::Error>>` is not implemented for `()` +help: consider adding return type + | +LL ~ fn test5(&self) -> Result<(), Box<dyn std::error::Error>> { +LL | let mut _file = File::create("foo.txt")?; +LL | +LL | println!(); +LL ~ Ok(()) +LL ~ } | error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) - --> $DIR/return-from-residual-sugg-issue-125997.rs:31:44 + --> $DIR/return-from-residual-sugg-issue-125997.rs:46:44 | LL | fn main() { | --------- this function should return `Result` or `Option` to accept `?` @@ -52,9 +85,7 @@ LL ~ fn main() -> Result<(), Box<dyn std::error::Error>> { LL | let mut _file = File::create("foo.txt")?; LL | LL | mac!(); -LL + LL + Ok(()) -LL + } | error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) @@ -76,11 +107,10 @@ LL ~ fn test3() -> Result<(), Box<dyn std::error::Error>> { LL | let mut _file = File::create("foo.txt")?; LL | LL | println!(); -LL ~ -LL + Ok(()) -LL + } +LL ~ Ok(()) +LL ~ } | -error: aborting due to 4 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr b/tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr index 79b640d9f41..6b3f303eeab 100644 --- a/tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr +++ b/tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/unreachable.rs:14:9 | LL | Err(!), - | ^^^^^^ + | ^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/unreachable.rs:4:9 | @@ -15,41 +15,41 @@ error: unreachable pattern --> $DIR/unreachable.rs:17:19 | LL | let (Ok(_x) | Err(!)) = res_void; - | ^^^^^^ + | ^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/unreachable.rs:19:12 | LL | if let Err(!) = res_void {} - | ^^^^^^ + | ^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/unreachable.rs:21:24 | LL | if let (Ok(true) | Err(!)) = res_void {} - | ^^^^^^ + | ^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/unreachable.rs:23:23 | LL | for (Ok(mut _x) | Err(!)) in [res_void] {} - | ^^^^^^ + | ^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/unreachable.rs:27:18 | LL | fn foo((Ok(_x) | Err(!)): Result<bool, Void>) {} - | ^^^^^^ + | ^^^^^^ matches no values because `Void` is uninhabited | - = note: this pattern matches no values because `Void` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: aborting due to 6 previous errors diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr index d5f58e436c5..dfd7f9d6300 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/enum_same_crate_empty_match.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/enum_same_crate_empty_match.rs:28:9 | LL | _ => {} - | ^ + | ^ matches no values because `EmptyNonExhaustiveEnum` is uninhabited | - = note: this pattern matches no values because `EmptyNonExhaustiveEnum` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/enum_same_crate_empty_match.rs:1:9 | diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr index 4ec4ec9705a..956725fc10e 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/issue-65157-repeated-match-arm.rs:15:9 | LL | PartiallyInhabitedVariants::Struct { .. } => {}, - | ----------------------------------------- matches all the values already + | ----------------------------------------- matches all the relevant values LL | PartiallyInhabitedVariants::Struct { .. } => {}, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this | note: the lint level is defined here --> $DIR/issue-65157-repeated-match-arm.rs:2:9 diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr index c399bb9083f..7e7dc802e7f 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns_same_crate.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/patterns_same_crate.rs:51:9 | LL | Some(_x) => (), - | ^^^^^^^^ + | ^^^^^^^^ matches no values because `UninhabitedEnum` is uninhabited | - = note: this pattern matches no values because `UninhabitedEnum` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/patterns_same_crate.rs:1:9 | @@ -15,33 +15,33 @@ error: unreachable pattern --> $DIR/patterns_same_crate.rs:56:9 | LL | Some(_x) => (), - | ^^^^^^^^ + | ^^^^^^^^ matches no values because `UninhabitedVariants` is uninhabited | - = note: this pattern matches no values because `UninhabitedVariants` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/patterns_same_crate.rs:60:15 | LL | while let PartiallyInhabitedVariants::Struct { x } = partially_inhabited_variant() { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ matches no values because `!` is uninhabited | - = note: this pattern matches no values because `!` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/patterns_same_crate.rs:64:15 | LL | while let Some(_x) = uninhabited_struct() { - | ^^^^^^^^ + | ^^^^^^^^ matches no values because `UninhabitedStruct` is uninhabited | - = note: this pattern matches no values because `UninhabitedStruct` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/patterns_same_crate.rs:67:15 | LL | while let Some(_x) = uninhabited_tuple_struct() { - | ^^^^^^^^ + | ^^^^^^^^ matches no values because `UninhabitedTupleStruct` is uninhabited | - = note: this pattern matches no values because `UninhabitedTupleStruct` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: aborting due to 5 previous errors diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/warns.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/warns.stderr index 8d0874fa900..693a06a2297 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/warns.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/warns.stderr @@ -16,9 +16,9 @@ error: unreachable pattern --> $DIR/warns.rs:15:25 | LL | x if let None | None = x => {} - | ---- ^^^^ unreachable pattern + | ---- ^^^^ no value can reach this | | - | matches all the values already + | matches all the relevant values | note: the lint level is defined here --> $DIR/warns.rs:12:8 diff --git a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr index 16e1af46059..9b92166bcb7 100644 --- a/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr +++ b/tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-cfg.stderr @@ -16,6 +16,12 @@ error: unused variable: `a` LL | #[cfg(something)] a: i32, | ^ help: if this is intentional, prefix it with an underscore: `_a` +error: unused variable: `a` + --> $DIR/param-attrs-cfg.rs:107:27 + | +LL | #[cfg(something)] a: i32, + | ^ help: if this is intentional, prefix it with an underscore: `_a` + error: unused variable: `b` --> $DIR/param-attrs-cfg.rs:30:23 | @@ -100,12 +106,6 @@ error: unused variable: `c` LL | #[cfg_attr(nothing, cfg(nothing))] c: i32, | ^ help: if this is intentional, prefix it with an underscore: `_c` -error: unused variable: `a` - --> $DIR/param-attrs-cfg.rs:107:27 - | -LL | #[cfg(something)] a: i32, - | ^ help: if this is intentional, prefix it with an underscore: `_a` - error: unused variable: `b` --> $DIR/param-attrs-cfg.rs:113:27 | diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.stderr b/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.stderr index 7866af59444..b766b5c8dd8 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.stderr +++ b/tests/ui/rfcs/rfc-2627-raw-dylib/multiple-declarations.stderr @@ -2,7 +2,7 @@ error: multiple declarations of external function `f` from library `foo.dll` hav --> $DIR/multiple-declarations.rs:13:9 | LL | fn f(x: i32); - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.stderr b/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.stderr index d7c7344b596..ef022404e7f 100644 --- a/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.stderr +++ b/tests/ui/rfcs/rfc-2627-raw-dylib/unsupported-abi.stderr @@ -2,7 +2,7 @@ error: ABI not supported by `#[link(kind = "raw-dylib")]` on this architecture --> $DIR/unsupported-abi.rs:6:5 | LL | fn f(x: i32); - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs index 637a24f53bc..6c320c0462e 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.rs @@ -1,4 +1,4 @@ -//@ check-pass +//~ ERROR the trait bound //@ compile-flags: -Znext-solver #![allow(incomplete_features)] @@ -17,6 +17,6 @@ impl Foo for S { } impl const Bar for S {} -//FIXME ~^ ERROR the trait bound +// FIXME(effects) bad span fn main() {} diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.stderr new file mode 100644 index 00000000000..9a907bbee0a --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail.stderr @@ -0,0 +1,11 @@ +error[E0277]: the trait bound `Maybe: TyCompat<<(Foo::{synthetic#0},) as std::marker::effects::Intersection>::Output>` is not satisfied + | +note: required by a bound in `Bar::{synthetic#0}` + --> $DIR/super-traits-fail.rs:11:1 + | +LL | #[const_trait] + | ^^^^^^^^^^^^^^ required by this bound in `Bar::{synthetic#0}` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.rs b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.rs index c6f9115cde7..f3b8645abaf 100644 --- a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.rs +++ b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.rs @@ -1,5 +1,4 @@ #![deny(rust_2024_compatibility)] -#![feature(unsafe_attributes)] #[no_mangle] //~^ ERROR: unsafe attribute used without unsafe diff --git a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr index f0689d9883c..4629a154ac3 100644 --- a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr +++ b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr @@ -1,5 +1,5 @@ error: unsafe attribute used without unsafe - --> $DIR/in_2024_compatibility.rs:4:3 + --> $DIR/in_2024_compatibility.rs:3:3 | LL | #[no_mangle] | ^^^^^^^^^ usage of unsafe attribute diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attribute-marked.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attribute-marked.rs index 279ced2525a..7c919fed976 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attribute-marked.rs +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attribute-marked.rs @@ -4,7 +4,6 @@ //@[edition2024] compile-flags: -Zunstable-options //@ check-pass -#![feature(unsafe_attributes)] #[unsafe(no_mangle)] extern "C" fn foo() {} diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed index 6ebdff0334c..586881d1807 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed @@ -1,5 +1,4 @@ //@ run-rustfix -#![feature(unsafe_attributes)] #![deny(unsafe_attr_outside_unsafe)] macro_rules! tt { diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs index c78ff45ea4c..03e122c7d57 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs @@ -1,5 +1,4 @@ //@ run-rustfix -#![feature(unsafe_attributes)] #![deny(unsafe_attr_outside_unsafe)] macro_rules! tt { diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr index c95984f58ec..64debc58905 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr @@ -1,5 +1,5 @@ error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-fix.rs:44:6 + --> $DIR/unsafe-attributes-fix.rs:43:6 | LL | tt!([no_mangle]); | ^^^^^^^^^ usage of unsafe attribute @@ -7,7 +7,7 @@ LL | tt!([no_mangle]); = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! = note: for more information, see issue #123757 <https://github.com/rust-lang/rust/issues/123757> note: the lint level is defined here - --> $DIR/unsafe-attributes-fix.rs:3:9 + --> $DIR/unsafe-attributes-fix.rs:2:9 | LL | #![deny(unsafe_attr_outside_unsafe)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | tt!([unsafe(no_mangle)]); | +++++++ + error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-fix.rs:14:11 + --> $DIR/unsafe-attributes-fix.rs:13:11 | LL | #[$e] | ^^ usage of unsafe attribute @@ -34,7 +34,7 @@ LL | #[unsafe($e)] | +++++++ + error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-fix.rs:48:7 + --> $DIR/unsafe-attributes-fix.rs:47:7 | LL | meta!(no_mangle); | ^^^^^^^^^ usage of unsafe attribute @@ -47,7 +47,7 @@ LL | meta!(unsafe(no_mangle)); | +++++++ + error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-fix.rs:51:8 + --> $DIR/unsafe-attributes-fix.rs:50:8 | LL | meta2!(export_name = "baw"); | ^^^^^^^^^^^ usage of unsafe attribute @@ -60,7 +60,7 @@ LL | meta2!(unsafe(export_name = "baw")); | +++++++ + error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-fix.rs:23:11 + --> $DIR/unsafe-attributes-fix.rs:22:11 | LL | #[$e = $l] | ^^ usage of unsafe attribute @@ -77,7 +77,7 @@ LL | #[unsafe($e = $l)] | +++++++ + error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes-fix.rs:56:3 + --> $DIR/unsafe-attributes-fix.rs:55:3 | LL | #[no_mangle] | ^^^^^^^^^ usage of unsafe attribute diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.edition2024.stderr b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.edition2024.stderr index 35475d66716..fb697e14ef1 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.edition2024.stderr +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.edition2024.stderr @@ -1,5 +1,5 @@ error: unsafe attribute used without unsafe - --> $DIR/unsafe-attributes.rs:9:3 + --> $DIR/unsafe-attributes.rs:8:3 | LL | #[no_mangle] | ^^^^^^^^^ usage of unsafe attribute diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.rs index 3a6af9dfb2b..f6f2994bb6d 100644 --- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.rs +++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.rs @@ -4,7 +4,6 @@ //@[edition2024] edition:2024 //@[edition2024] compile-flags: -Zunstable-options -#![feature(unsafe_attributes)] #[no_mangle] //[edition2024]~ ERROR: unsafe attribute used without unsafe extern "C" fn foo() {} diff --git a/tests/ui/rust-2024/unsafe-before_exec.e2024.stderr b/tests/ui/rust-2024/unsafe-before_exec.e2024.stderr new file mode 100644 index 00000000000..2798ccdefd0 --- /dev/null +++ b/tests/ui/rust-2024/unsafe-before_exec.e2024.stderr @@ -0,0 +1,11 @@ +error[E0133]: call to unsafe function `before_exec` is unsafe and requires unsafe block + --> $DIR/unsafe-before_exec.rs:14:5 + | +LL | cmd.before_exec(|| Ok(())); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function + | + = note: consult the function's documentation for information on how to avoid undefined behavior + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/tests/ui/rust-2024/unsafe-before_exec.rs b/tests/ui/rust-2024/unsafe-before_exec.rs new file mode 100644 index 00000000000..540394da80e --- /dev/null +++ b/tests/ui/rust-2024/unsafe-before_exec.rs @@ -0,0 +1,17 @@ +//@ revisions: e2021 e2024 +//@ only-unix +//@[e2021] edition: 2021 +//@[e2021] check-pass +//@[e2024] edition: 2024 +//@[e2024] compile-flags: -Zunstable-options + +use std::process::Command; +use std::os::unix::process::CommandExt; + +#[allow(deprecated)] +fn main() { + let mut cmd = Command::new("sleep"); + cmd.before_exec(|| Ok(())); + //[e2024]~^ ERROR call to unsafe function `before_exec` is unsafe + drop(cmd); // we don't actually run the command. +} diff --git a/tests/ui/rust-2024/unsafe-env-suggestion.stderr b/tests/ui/rust-2024/unsafe-env-suggestion.stderr index 3aa10a3bed6..1506741f6bc 100644 --- a/tests/ui/rust-2024/unsafe-env-suggestion.stderr +++ b/tests/ui/rust-2024/unsafe-env-suggestion.stderr @@ -11,7 +11,7 @@ note: the lint level is defined here | LL | #![deny(deprecated_safe_2024)] | ^^^^^^^^^^^^^^^^^^^^ -help: you can wrap the call in an `unsafe` block if you can guarantee the code is only ever called from single-threaded code +help: you can wrap the call in an `unsafe` block if you can guarantee that the environment access only happens in single-threaded code | LL + // TODO: Audit that the environment access only happens in single-threaded code. LL ~ unsafe { env::set_var("FOO", "BAR") }; @@ -25,7 +25,7 @@ LL | env::remove_var("FOO"); | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! = note: for more information, see issue #27970 <https://github.com/rust-lang/rust/issues/27970> -help: you can wrap the call in an `unsafe` block if you can guarantee the code is only ever called from single-threaded code +help: you can wrap the call in an `unsafe` block if you can guarantee that the environment access only happens in single-threaded code | LL + // TODO: Audit that the environment access only happens in single-threaded code. LL ~ unsafe { env::remove_var("FOO") }; diff --git a/tests/ui/sanitizer/cfi/transparent-has-regions.rs b/tests/ui/sanitizer/cfi/transparent-has-regions.rs new file mode 100644 index 00000000000..b70e1ea1791 --- /dev/null +++ b/tests/ui/sanitizer/cfi/transparent-has-regions.rs @@ -0,0 +1,18 @@ +//@ needs-sanitizer-cfi +//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ no-prefer-dynamic +//@ only-x86_64-unknown-linux-gnu +//@ build-pass + +pub trait Trait {} + +impl Trait for i32 {} + +#[repr(transparent)] +struct BoxedTrait(Box<dyn Trait + 'static>); + +fn hello(x: BoxedTrait) {} + +fn main() { + hello(BoxedTrait(Box::new(1))); +} diff --git a/tests/ui/sanitizer/thread.rs b/tests/ui/sanitizer/thread.rs index 9d9ad6ee518..566774d6b1d 100644 --- a/tests/ui/sanitizer/thread.rs +++ b/tests/ui/sanitizer/thread.rs @@ -20,7 +20,6 @@ //@ error-pattern: Location is heap block of size 4 //@ error-pattern: allocated by main thread -#![feature(raw_ref_op)] #![feature(rustc_private)] extern crate libc; diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr index e04ec8bb3bc..216b7053488 100644 --- a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr +++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr @@ -7,10 +7,10 @@ LL | async fn f(self: Pin<&Self>) -> impl Clone { self } | | opaque type defined here | hidden type `Pin<&Foo>` captures the anonymous lifetime defined here | -help: to declare that `impl Clone` captures `'_`, you can add an explicit `'_` lifetime bound +help: add a `use<...>` bound to explicitly capture `'_` | -LL | async fn f(self: Pin<&Self>) -> impl Clone + '_ { self } - | ++++ +LL | async fn f(self: Pin<&Self>) -> impl Clone + use<'_> { self } + | +++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr index a2964881d58..7a2ce110a38 100644 --- a/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr +++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_impl_trait.stderr @@ -7,10 +7,10 @@ LL | fn f(self: Pin<&Self>) -> impl Clone { self } | | opaque type defined here | hidden type `Pin<&Foo>` captures the anonymous lifetime defined here | -help: to declare that `impl Clone` captures `'_`, you can add an explicit `'_` lifetime bound +help: add a `use<...>` bound to explicitly capture `'_` | -LL | fn f(self: Pin<&Self>) -> impl Clone + '_ { self } - | ++++ +LL | fn f(self: Pin<&Self>) -> impl Clone + use<'_> { self } + | +++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/self/elision/ignore-non-reference-lifetimes.rs b/tests/ui/self/elision/ignore-non-reference-lifetimes.rs index f7f61b8c810..cedc6f0f9bc 100644 --- a/tests/ui/self/elision/ignore-non-reference-lifetimes.rs +++ b/tests/ui/self/elision/ignore-non-reference-lifetimes.rs @@ -4,9 +4,11 @@ struct Foo<'a>(&'a str); impl<'b> Foo<'b> { fn a<'a>(self: Self, a: &'a str) -> &str { + //~^ WARNING elided lifetime has a name a } fn b<'a>(self: Foo<'b>, a: &'a str) -> &str { + //~^ WARNING elided lifetime has a name a } } diff --git a/tests/ui/self/elision/ignore-non-reference-lifetimes.stderr b/tests/ui/self/elision/ignore-non-reference-lifetimes.stderr new file mode 100644 index 00000000000..4465dbae529 --- /dev/null +++ b/tests/ui/self/elision/ignore-non-reference-lifetimes.stderr @@ -0,0 +1,16 @@ +warning: elided lifetime has a name + --> $DIR/ignore-non-reference-lifetimes.rs:6:41 + | +LL | fn a<'a>(self: Self, a: &'a str) -> &str { + | -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a` + | + = note: `#[warn(elided_named_lifetimes)]` on by default + +warning: elided lifetime has a name + --> $DIR/ignore-non-reference-lifetimes.rs:10:44 + | +LL | fn b<'a>(self: Foo<'b>, a: &'a str) -> &str { + | -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a` + +warning: 2 warnings emitted + diff --git a/tests/ui/self/elision/lt-ref-self-async.fixed b/tests/ui/self/elision/lt-ref-self-async.fixed index aa1d62012da..914511641b8 100644 --- a/tests/ui/self/elision/lt-ref-self-async.fixed +++ b/tests/ui/self/elision/lt-ref-self-async.fixed @@ -1,6 +1,6 @@ //@ edition:2018 //@ run-rustfix -#![allow(non_snake_case, dead_code)] +#![allow(non_snake_case, dead_code, elided_named_lifetimes)] use std::pin::Pin; diff --git a/tests/ui/self/elision/lt-ref-self-async.rs b/tests/ui/self/elision/lt-ref-self-async.rs index 38de0fd39f0..0c11b271c35 100644 --- a/tests/ui/self/elision/lt-ref-self-async.rs +++ b/tests/ui/self/elision/lt-ref-self-async.rs @@ -1,6 +1,6 @@ //@ edition:2018 //@ run-rustfix -#![allow(non_snake_case, dead_code)] +#![allow(non_snake_case, dead_code, elided_named_lifetimes)] use std::pin::Pin; diff --git a/tests/ui/self/self_lifetime-async.rs b/tests/ui/self/self_lifetime-async.rs index 7d6eb3f5eaf..fd690207118 100644 --- a/tests/ui/self/self_lifetime-async.rs +++ b/tests/ui/self/self_lifetime-async.rs @@ -4,11 +4,13 @@ struct Foo<'a>(&'a ()); impl<'a> Foo<'a> { async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 } + //~^ WARNING elided lifetime has a name } type Alias = Foo<'static>; impl Alias { async fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg } + //~^ WARNING elided lifetime has a name } fn main() {} diff --git a/tests/ui/self/self_lifetime-async.stderr b/tests/ui/self/self_lifetime-async.stderr new file mode 100644 index 00000000000..32de3fd18c9 --- /dev/null +++ b/tests/ui/self/self_lifetime-async.stderr @@ -0,0 +1,18 @@ +warning: elided lifetime has a name + --> $DIR/self_lifetime-async.rs:6:44 + | +LL | async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 } + | -- ^ this elided lifetime gets resolved as `'b` + | | + | lifetime `'b` declared here + | + = note: `#[warn(elided_named_lifetimes)]` on by default + +warning: elided lifetime has a name + --> $DIR/self_lifetime-async.rs:12:52 + | +LL | async fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg } + | -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a` + +warning: 2 warnings emitted + diff --git a/tests/ui/self/self_lifetime.rs b/tests/ui/self/self_lifetime.rs index 3f655b960b1..0607c3b9317 100644 --- a/tests/ui/self/self_lifetime.rs +++ b/tests/ui/self/self_lifetime.rs @@ -5,11 +5,13 @@ struct Foo<'a>(&'a ()); impl<'a> Foo<'a> { fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 } + //~^ WARNING elided lifetime has a name } type Alias = Foo<'static>; impl Alias { fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg } + //~^ WARNING elided lifetime has a name } fn main() {} diff --git a/tests/ui/self/self_lifetime.stderr b/tests/ui/self/self_lifetime.stderr new file mode 100644 index 00000000000..cd8f4d8adf8 --- /dev/null +++ b/tests/ui/self/self_lifetime.stderr @@ -0,0 +1,18 @@ +warning: elided lifetime has a name + --> $DIR/self_lifetime.rs:7:38 + | +LL | fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 } + | -- ^ this elided lifetime gets resolved as `'b` + | | + | lifetime `'b` declared here + | + = note: `#[warn(elided_named_lifetimes)]` on by default + +warning: elided lifetime has a name + --> $DIR/self_lifetime.rs:13:46 + | +LL | fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg } + | -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a` + +warning: 2 warnings emitted + diff --git a/tests/ui/simd/shuffle.rs b/tests/ui/simd/shuffle.rs index 09926d95557..dc0d688284e 100644 --- a/tests/ui/simd/shuffle.rs +++ b/tests/ui/simd/shuffle.rs @@ -6,15 +6,20 @@ #![allow(incomplete_features)] #![feature(adt_const_params)] +use std::marker::ConstParamTy; + extern "rust-intrinsic" { fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U; } -#[derive(Copy, Clone)] +#[derive(Copy, Clone, ConstParamTy, PartialEq, Eq)] #[repr(simd)] struct Simd<T, const N: usize>([T; N]); -pub unsafe fn __shuffle_vector16<const IDX: [u32; 16], T, U>(x: T, y: T) -> U { +unsafe fn __shuffle_vector16<const IDX: [u32; 16], T, U>(x: T, y: T) -> U { + simd_shuffle(x, y, IDX) +} +unsafe fn __shuffle_vector16_v2<const IDX: Simd<u32, 16>, T, U>(x: T, y: T) -> U { simd_shuffle(x, y, IDX) } @@ -30,6 +35,17 @@ fn main() { let y: Simd<u8, 2> = simd_shuffle(a, b, I2); assert_eq!(y.0, [1, 5]); } + // Test that we can also use a SIMD vector instead of a normal array for the shuffle. + const I1_SIMD: Simd<u32, 4> = Simd([0, 2, 4, 6]); + const I2_SIMD: Simd<u32, 2> = Simd([1, 5]); + unsafe { + let x: Simd<u8, 4> = simd_shuffle(a, b, I1_SIMD); + assert_eq!(x.0, [0, 2, 4, 6]); + + let y: Simd<u8, 2> = simd_shuffle(a, b, I2_SIMD); + assert_eq!(y.0, [1, 5]); + } + // Test that an indirection (via an unnamed constant) // through a const generic parameter also works. // See https://github.com/rust-lang/rust/issues/113500 for details. @@ -42,4 +58,11 @@ fn main() { Simd<u8, 16>, >(a, b); } + unsafe { + __shuffle_vector16_v2::< + { Simd([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) }, + Simd<u8, 16>, + Simd<u8, 16>, + >(a, b); + } } diff --git a/tests/ui/sized/unsized-binding.stderr b/tests/ui/sized/unsized-binding.stderr index 7c3276032c2..8de236cd0b6 100644 --- a/tests/ui/sized/unsized-binding.stderr +++ b/tests/ui/sized/unsized-binding.stderr @@ -7,6 +7,11 @@ LL | let x = *""; = help: the trait `Sized` is not implemented for `str` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression + | +LL - let x = *""; +LL + let x = ""; + | error: aborting due to 1 previous error diff --git a/tests/ui/sized/unsized-str-in-return-expr-arg-and-local.rs b/tests/ui/sized/unsized-str-in-return-expr-arg-and-local.rs new file mode 100644 index 00000000000..35abbb80d99 --- /dev/null +++ b/tests/ui/sized/unsized-str-in-return-expr-arg-and-local.rs @@ -0,0 +1,30 @@ +fn foo() -> impl Sized { +//~^ ERROR the size for values of type `str` cannot be known at compilation time +//~| HELP the trait `Sized` is not implemented for `str` + *"" //~ HELP consider not dereferencing the expression +} +fn bar(_: impl Sized) {} +struct S; + +impl S { + fn baz(&self, _: impl Sized) {} +} + +fn main() { + let _ = foo(); + let x = *""; + //~^ ERROR the size for values of type `str` cannot be known at compilation time + //~| HELP consider not dereferencing the expression + //~| HELP the trait `Sized` is not implemented for `str` + //~| HELP unsized locals are gated as an unstable feature + bar(x); + S.baz(x); + bar(*""); + //~^ ERROR the size for values of type `str` cannot be known at compilation time + //~| HELP consider not dereferencing the expression + //~| HELP the trait `Sized` is not implemented for `str` + S.baz(*""); + //~^ ERROR the size for values of type `str` cannot be known at compilation time + //~| HELP consider not dereferencing the expression + //~| HELP the trait `Sized` is not implemented for `str` +} diff --git a/tests/ui/sized/unsized-str-in-return-expr-arg-and-local.stderr b/tests/ui/sized/unsized-str-in-return-expr-arg-and-local.stderr new file mode 100644 index 00000000000..9b7258aff12 --- /dev/null +++ b/tests/ui/sized/unsized-str-in-return-expr-arg-and-local.stderr @@ -0,0 +1,74 @@ +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:1:13 + | +LL | fn foo() -> impl Sized { + | ^^^^^^^^^^ doesn't have a size known at compile-time +... +LL | *"" + | --- return type was inferred to be `str` here + | + = help: the trait `Sized` is not implemented for `str` +help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression + | +LL - *"" +LL + "" + | + +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:15:9 + | +LL | let x = *""; + | ^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `str` + = note: all local variables must have a statically known size + = help: unsized locals are gated as an unstable feature +help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression + | +LL - let x = *""; +LL + let x = ""; + | + +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:22:9 + | +LL | bar(*""); + | --- ^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call + | + = help: the trait `Sized` is not implemented for `str` +note: required by a bound in `bar` + --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:6:16 + | +LL | fn bar(_: impl Sized) {} + | ^^^^^ required by this bound in `bar` +help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression + | +LL - bar(*""); +LL + bar(""); + | + +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:26:11 + | +LL | S.baz(*""); + | --- ^^^ doesn't have a size known at compile-time + | | + | required by a bound introduced by this call + | + = help: the trait `Sized` is not implemented for `str` +note: required by a bound in `S::baz` + --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:10:27 + | +LL | fn baz(&self, _: impl Sized) {} + | ^^^^^ required by this bound in `S::baz` +help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression + | +LL - S.baz(*""); +LL + S.baz(""); + | + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.rs b/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.rs index fb962ad24bf..858fba2132a 100644 --- a/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.rs +++ b/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.rs @@ -14,5 +14,6 @@ struct Wrapper<const C: <i32 as Trait>::Type> {} impl<const C: usize> Wrapper<C> {} //~^ ERROR the constant `C` is not of type `<i32 as Trait>::Type` +//~| ERROR: mismatched types fn main() {} diff --git a/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.stderr b/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.stderr index 7094ee8c67c..71d4277275f 100644 --- a/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.stderr +++ b/tests/ui/specialization/default-proj-ty-as-type-of-const-issue-125757.stderr @@ -20,5 +20,17 @@ note: required by a const generic parameter in `Wrapper` LL | struct Wrapper<const C: <i32 as Trait>::Type> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `Wrapper` -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/default-proj-ty-as-type-of-const-issue-125757.rs:15:30 + | +LL | impl<const C: usize> Wrapper<C> {} + | ^ expected associated type, found `usize` + | + = note: expected associated type `<i32 as Trait>::Type` + found type `usize` + = help: consider constraining the associated type `<i32 as Trait>::Type` to `usize` + = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs index a0ee7714417..f89a463bc58 100644 --- a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs +++ b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs @@ -6,6 +6,7 @@ struct S<const L: usize>; impl<const N: i32> Copy for S<N> {} +//~^ ERROR: mismatched types impl<const M: usize> Copy for S<M> {} //~^ ERROR: conflicting implementations of trait `Copy` for type `S<_>` diff --git a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr index 2953bc95917..1dac58e1f69 100644 --- a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr +++ b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr @@ -1,11 +1,19 @@ error[E0119]: conflicting implementations of trait `Copy` for type `S<_>` - --> $DIR/bad-const-wf-doesnt-specialize.rs:9:1 + --> $DIR/bad-const-wf-doesnt-specialize.rs:10:1 | LL | impl<const N: i32> Copy for S<N> {} | -------------------------------- first implementation here +LL | LL | impl<const M: usize> Copy for S<M> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S<_>` -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/bad-const-wf-doesnt-specialize.rs:8:31 + | +LL | impl<const N: i32> Copy for S<N> {} + | ^ expected `usize`, found `i32` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0119`. +Some errors have detailed explanations: E0119, E0308. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/static/raw-ref-extern-static.rs b/tests/ui/static/raw-ref-extern-static.rs index 95a53a8640d..81bc5990efe 100644 --- a/tests/ui/static/raw-ref-extern-static.rs +++ b/tests/ui/static/raw-ref-extern-static.rs @@ -1,5 +1,4 @@ //@ check-pass -#![feature(raw_ref_op)] use std::ptr; // see https://github.com/rust-lang/rust/issues/125833 diff --git a/tests/ui/static/raw-ref-static-mut.rs b/tests/ui/static/raw-ref-static-mut.rs index 6855cc7b050..d4159fc65ca 100644 --- a/tests/ui/static/raw-ref-static-mut.rs +++ b/tests/ui/static/raw-ref-static-mut.rs @@ -1,5 +1,4 @@ //@ check-pass -#![feature(raw_ref_op)] use std::ptr; // see https://github.com/rust-lang/rust/issues/125833 diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.rs b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.rs index 735efe89cba..daec66709b6 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.rs +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.rs @@ -64,6 +64,7 @@ mod in_path { // This must not err, as the `&` actually resolves to `'a`. fn resolved_anonymous<'a, T: 'a>(f: impl Fn(&'a str) -> &T) { + //~^ WARNING elided lifetime has a name f("f"); } diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index 61a2925f582..30f4509d49d 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -124,6 +124,14 @@ LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } LL + fn g(mut x: impl Foo<()>) -> Option<()> { x.next() } | +warning: elided lifetime has a name + --> $DIR/impl-trait-missing-lifetime-gated.rs:66:57 + | +LL | fn resolved_anonymous<'a, T: 'a>(f: impl Fn(&'a str) -> &T) { + | -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a` + | + = note: `#[warn(elided_named_lifetimes)]` on by default + error[E0658]: anonymous lifetimes in `impl Trait` are unstable --> $DIR/impl-trait-missing-lifetime-gated.rs:6:35 | @@ -244,7 +252,7 @@ help: consider introducing a named lifetime parameter LL | fn g<'a>(mut x: impl Foo<'a, ()>) -> Option<&()> { x.next() } | ++++ +++ -error: aborting due to 16 previous errors +error: aborting due to 16 previous errors; 1 warning emitted Some errors have detailed explanations: E0106, E0658. For more information about an error, try `rustc --explain E0106`. diff --git a/tests/ui/suggestions/issue-84973-blacklist.stderr b/tests/ui/suggestions/issue-84973-blacklist.stderr index 4fd063e4692..c1ef1cd428e 100644 --- a/tests/ui/suggestions/issue-84973-blacklist.stderr +++ b/tests/ui/suggestions/issue-84973-blacklist.stderr @@ -66,6 +66,11 @@ note: required by a bound in `f_sized` | LL | fn f_sized<T: Sized>(t: T) {} | ^^^^^ required by this bound in `f_sized` +help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression + | +LL - f_sized(*ref_cl); +LL + f_sized(ref_cl); + | error[E0277]: `Rc<{integer}>` cannot be sent between threads safely --> $DIR/issue-84973-blacklist.rs:27:12 diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs index b641f5941dc..b61bea16e3b 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.rs @@ -100,6 +100,7 @@ where // This also works. The `'_` isn't necessary but it's where we arrive to following the suggestions: fn ok2<'a, G: 'a, T>(g: G, dest: &'a mut T) -> impl FnOnce() + '_ + 'a +//~^ WARNING elided lifetime has a name where G: Get<T>, { diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index 64af17c830e..ea01dcd5020 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -6,6 +6,14 @@ LL | fn baz<G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ | | | help: consider introducing lifetime `'a` here: `'a,` +warning: elided lifetime has a name + --> $DIR/missing-lifetimes-in-signature.rs:102:64 + | +LL | fn ok2<'a, G: 'a, T>(g: G, dest: &'a mut T) -> impl FnOnce() + '_ + 'a + | -- lifetime `'a` declared here ^^ this elided lifetime gets resolved as `'a` + | + = note: `#[warn(elided_named_lifetimes)]` on by default + error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not appear in bounds --> $DIR/missing-lifetimes-in-signature.rs:19:5 | @@ -20,10 +28,10 @@ LL | | *dest = g.get(); LL | | } | |_____^ | -help: to declare that `impl FnOnce()` captures `'_`, you can add an explicit `'_` lifetime bound +help: add a `use<...>` bound to explicitly capture `'_` | -LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ - | ++++ +LL | fn foo<G, T>(g: G, dest: &mut T) -> impl FnOnce() + use<'_, G, T> + | +++++++++++++++ error[E0311]: the parameter type `G` may not live long enough --> $DIR/missing-lifetimes-in-signature.rs:30:5 @@ -125,7 +133,7 @@ help: consider adding an explicit lifetime bound LL | G: Get<T> + 'a, | ++++ -error: aborting due to 8 previous errors +error: aborting due to 8 previous errors; 1 warning emitted Some errors have detailed explanations: E0261, E0309, E0311, E0621, E0700. For more information about an error, try `rustc --explain E0261`. diff --git a/tests/ui/target-feature/gate.rs b/tests/ui/target-feature/gate.rs index 94d79d56c59..5c4fb847932 100644 --- a/tests/ui/target-feature/gate.rs +++ b/tests/ui/target-feature/gate.rs @@ -17,6 +17,7 @@ // gate-test-ermsb_target_feature // gate-test-bpf_target_feature // gate-test-aarch64_ver_target_feature +// gate-test-aarch64_unstable_target_feature // gate-test-csky_target_feature // gate-test-loongarch_target_feature // gate-test-lahfsahf_target_feature diff --git a/tests/ui/target-feature/gate.stderr b/tests/ui/target-feature/gate.stderr index a69020e6864..37c5ed01688 100644 --- a/tests/ui/target-feature/gate.stderr +++ b/tests/ui/target-feature/gate.stderr @@ -1,5 +1,5 @@ error[E0658]: the target feature `avx512bw` is currently unstable - --> $DIR/gate.rs:26:18 + --> $DIR/gate.rs:27:18 | LL | #[target_feature(enable = "avx512bw")] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/threads-sendsync/child-outlives-parent.rs b/tests/ui/threads-sendsync/child-outlives-parent.rs index 213fd008cd3..e965bac5713 100644 --- a/tests/ui/threads-sendsync/child-outlives-parent.rs +++ b/tests/ui/threads-sendsync/child-outlives-parent.rs @@ -6,8 +6,8 @@ use std::thread; -fn child2(_s: String) { } +fn child2(_s: String) {} pub fn main() { - let _x = thread::spawn(move|| child2("hi".to_string())); + let _x = thread::spawn(move || child2("hi".to_string())); } diff --git a/tests/ui/threads-sendsync/clone-with-exterior.rs b/tests/ui/threads-sendsync/clone-with-exterior.rs index 67790367e27..9d5ac4b16aa 100644 --- a/tests/ui/threads-sendsync/clone-with-exterior.rs +++ b/tests/ui/threads-sendsync/clone-with-exterior.rs @@ -7,14 +7,15 @@ use std::thread; struct Pair { a: isize, - b: isize + b: isize, } pub fn main() { - let z: Box<_> = Box::new(Pair { a : 10, b : 12}); + let z: Box<_> = Box::new(Pair { a: 10, b: 12 }); - thread::spawn(move|| { + thread::spawn(move || { assert_eq!(z.a, 10); assert_eq!(z.b, 12); - }).join(); + }) + .join(); } diff --git a/tests/ui/threads-sendsync/comm.rs b/tests/ui/threads-sendsync/comm.rs index 0c37fda8a39..3eb68707e78 100644 --- a/tests/ui/threads-sendsync/comm.rs +++ b/tests/ui/threads-sendsync/comm.rs @@ -2,12 +2,12 @@ #![allow(unused_must_use)] //@ needs-threads -use std::thread; use std::sync::mpsc::{channel, Sender}; +use std::thread; pub fn main() { let (tx, rx) = channel(); - let t = thread::spawn(move || { child(&tx) }); + let t = thread::spawn(move || child(&tx)); let y = rx.recv().unwrap(); println!("received"); println!("{}", y); diff --git a/tests/ui/threads-sendsync/issue-24313.rs b/tests/ui/threads-sendsync/issue-24313.rs index 1ea862f1e7d..99c6c4a5e12 100644 --- a/tests/ui/threads-sendsync/issue-24313.rs +++ b/tests/ui/threads-sendsync/issue-24313.rs @@ -2,14 +2,15 @@ //@ needs-threads //@ ignore-sgx no processes -use std::thread; -use std::env; use std::process::Command; +use std::{env, thread}; struct Handle(i32); impl Drop for Handle { - fn drop(&mut self) { panic!(); } + fn drop(&mut self) { + panic!(); + } } thread_local!(static HANDLE: Handle = Handle(0)); @@ -19,14 +20,15 @@ fn main() { if args.len() == 1 { let out = Command::new(&args[0]).arg("test").output().unwrap(); let stderr = std::str::from_utf8(&out.stderr).unwrap(); - assert!(stderr.contains("explicit panic"), - "bad failure message:\n{}\n", stderr); + assert!(stderr.contains("explicit panic"), "bad failure message:\n{}\n", stderr); } else { // TLS dtors are not always run on process exit thread::spawn(|| { HANDLE.with(|h| { println!("{}", h.0); }); - }).join().unwrap(); + }) + .join() + .unwrap(); } } diff --git a/tests/ui/threads-sendsync/issue-29488.rs b/tests/ui/threads-sendsync/issue-29488.rs index fbbd6b02a06..5ce27faed76 100644 --- a/tests/ui/threads-sendsync/issue-29488.rs +++ b/tests/ui/threads-sendsync/issue-29488.rs @@ -19,5 +19,7 @@ fn main() { thread::spawn(|| { FOO.with(|_| {}); println!("test1"); - }).join().unwrap(); + }) + .join() + .unwrap(); } diff --git a/tests/ui/threads-sendsync/issue-4446.rs b/tests/ui/threads-sendsync/issue-4446.rs index aa2de51974b..5652ad7de55 100644 --- a/tests/ui/threads-sendsync/issue-4446.rs +++ b/tests/ui/threads-sendsync/issue-4446.rs @@ -9,7 +9,10 @@ pub fn main() { tx.send("hello, world").unwrap(); - thread::spawn(move|| { + thread::spawn(move || { println!("{}", rx.recv().unwrap()); - }).join().ok().unwrap(); + }) + .join() + .ok() + .unwrap(); } diff --git a/tests/ui/threads-sendsync/issue-4448.rs b/tests/ui/threads-sendsync/issue-4448.rs index b8324a8c43f..1adebd1e252 100644 --- a/tests/ui/threads-sendsync/issue-4448.rs +++ b/tests/ui/threads-sendsync/issue-4448.rs @@ -7,7 +7,7 @@ use std::thread; pub fn main() { let (tx, rx) = channel::<&'static str>(); - let t = thread::spawn(move|| { + let t = thread::spawn(move || { assert_eq!(rx.recv().unwrap(), "hello, world"); }); diff --git a/tests/ui/threads-sendsync/issue-8827.rs b/tests/ui/threads-sendsync/issue-8827.rs index fa07a4ebc7d..57fc87db768 100644 --- a/tests/ui/threads-sendsync/issue-8827.rs +++ b/tests/ui/threads-sendsync/issue-8827.rs @@ -1,12 +1,12 @@ //@ run-pass //@ needs-threads -use std::thread; use std::sync::mpsc::{channel, Receiver}; +use std::thread; fn periodical(n: isize) -> Receiver<bool> { let (chan, port) = channel(); - thread::spawn(move|| { + thread::spawn(move || { loop { for _ in 1..n { match chan.send(false) { @@ -16,7 +16,7 @@ fn periodical(n: isize) -> Receiver<bool> { } match chan.send(true) { Ok(()) => {} - Err(..) => break + Err(..) => break, } } }); @@ -25,7 +25,7 @@ fn periodical(n: isize) -> Receiver<bool> { fn integers() -> Receiver<isize> { let (chan, port) = channel(); - thread::spawn(move|| { + thread::spawn(move || { let mut i = 1; loop { match chan.send(i) { @@ -47,7 +47,7 @@ fn main() { (_, true, true) => println!("FizzBuzz"), (_, true, false) => println!("Fizz"), (_, false, true) => println!("Buzz"), - (i, false, false) => println!("{}", i) + (i, false, false) => println!("{}", i), } } } diff --git a/tests/ui/threads-sendsync/issue-9396.rs b/tests/ui/threads-sendsync/issue-9396.rs index 6b5907e5c1d..b532ddf104d 100644 --- a/tests/ui/threads-sendsync/issue-9396.rs +++ b/tests/ui/threads-sendsync/issue-9396.rs @@ -3,12 +3,12 @@ #![allow(deprecated)] //@ needs-threads -use std::sync::mpsc::{TryRecvError, channel}; +use std::sync::mpsc::{channel, TryRecvError}; use std::thread; pub fn main() { let (tx, rx) = channel(); - let t = thread::spawn(move||{ + let t = thread::spawn(move || { thread::sleep_ms(10); tx.send(()).unwrap(); }); @@ -16,7 +16,7 @@ pub fn main() { match rx.try_recv() { Ok(()) => break, Err(TryRecvError::Empty) => {} - Err(TryRecvError::Disconnected) => unreachable!() + Err(TryRecvError::Disconnected) => unreachable!(), } } t.join(); diff --git a/tests/ui/threads-sendsync/mpsc_stress.rs b/tests/ui/threads-sendsync/mpsc_stress.rs index f5354c60bfc..fe0b47f3a84 100644 --- a/tests/ui/threads-sendsync/mpsc_stress.rs +++ b/tests/ui/threads-sendsync/mpsc_stress.rs @@ -2,18 +2,12 @@ //@ compile-flags:--test //@ needs-threads -use std::sync::mpsc::channel; -use std::sync::mpsc::TryRecvError; -use std::sync::mpsc::RecvError; -use std::sync::mpsc::RecvTimeoutError; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::mpsc::{channel, RecvError, RecvTimeoutError, TryRecvError}; use std::sync::Arc; -use std::sync::atomic::AtomicUsize; -use std::sync::atomic::Ordering; - use std::thread; use std::time::Duration; - /// Simple thread synchronization utility struct Barrier { // Not using mutex/condvar for precision @@ -42,7 +36,6 @@ impl Barrier { } } - fn shared_close_sender_does_not_lose_messages_iter() { let (tb, rb) = Barrier::new2(); @@ -71,7 +64,6 @@ fn shared_close_sender_does_not_lose_messages() { }); } - // https://github.com/rust-lang/rust/issues/39364 fn concurrent_recv_timeout_and_upgrade_iter() { // 1 us @@ -85,8 +77,8 @@ fn concurrent_recv_timeout_and_upgrade_iter() { match rx.recv_timeout(sleep) { Ok(_) => { break; - }, - Err(_) => {}, + } + Err(_) => {} } } }); @@ -105,7 +97,6 @@ fn concurrent_recv_timeout_and_upgrade() { }); } - fn concurrent_writes_iter() { const THREADS: usize = 4; const PER_THR: usize = 100; diff --git a/tests/ui/threads-sendsync/send-is-not-static-par-for.rs b/tests/ui/threads-sendsync/send-is-not-static-par-for.rs index b943b0c433d..dd02166c0fa 100644 --- a/tests/ui/threads-sendsync/send-is-not-static-par-for.rs +++ b/tests/ui/threads-sendsync/send-is-not-static-par-for.rs @@ -1,12 +1,13 @@ //@ run-pass #![allow(unused_imports)] -use std::thread; use std::sync::Mutex; +use std::thread; fn par_for<I, F>(iter: I, f: F) - where I: Iterator, - I::Item: Send, - F: Fn(I::Item) + Sync +where + I: Iterator, + I::Item: Send, + F: Fn(I::Item) + Sync, { for item in iter { f(item) @@ -15,9 +16,7 @@ fn par_for<I, F>(iter: I, f: F) fn sum(x: &[i32]) { let sum_lengths = Mutex::new(0); - par_for(x.windows(4), |x| { - *sum_lengths.lock().unwrap() += x.len() - }); + par_for(x.windows(4), |x| *sum_lengths.lock().unwrap() += x.len()); assert_eq!(*sum_lengths.lock().unwrap(), (x.len() - 3) * 4); } @@ -26,9 +25,7 @@ fn main() { let mut elements = [0; 20]; // iterators over references into this stack frame - par_for(elements.iter_mut().enumerate(), |(i, x)| { - *x = i as i32 - }); + par_for(elements.iter_mut().enumerate(), |(i, x)| *x = i as i32); sum(&elements) } diff --git a/tests/ui/threads-sendsync/send-resource.rs b/tests/ui/threads-sendsync/send-resource.rs index 3e1532b3132..c02a3717d3d 100644 --- a/tests/ui/threads-sendsync/send-resource.rs +++ b/tests/ui/threads-sendsync/send-resource.rs @@ -6,11 +6,11 @@ //@ pretty-expanded FIXME #23616 //@ needs-threads -use std::thread; use std::sync::mpsc::channel; +use std::thread; struct test { - f: isize, + f: isize, } impl Drop for test { @@ -18,15 +18,13 @@ impl Drop for test { } fn test(f: isize) -> test { - test { - f: f - } + test { f: f } } pub fn main() { let (tx, rx) = channel(); - let t = thread::spawn(move|| { + let t = thread::spawn(move || { let (tx2, rx2) = channel(); tx.send(tx2).unwrap(); diff --git a/tests/ui/threads-sendsync/send-type-inference.rs b/tests/ui/threads-sendsync/send-type-inference.rs index 287b3d567ae..7608c19b575 100644 --- a/tests/ui/threads-sendsync/send-type-inference.rs +++ b/tests/ui/threads-sendsync/send-type-inference.rs @@ -9,11 +9,11 @@ use std::sync::mpsc::{channel, Sender}; // tests that ctrl's type gets inferred properly struct Command<K, V> { key: K, - val: V + val: V, } -fn cache_server<K:Send+'static,V:Send+'static>(mut tx: Sender<Sender<Command<K, V>>>) { +fn cache_server<K: Send + 'static, V: Send + 'static>(mut tx: Sender<Sender<Command<K, V>>>) { let (tx1, _rx) = channel(); tx.send(tx1); } -pub fn main() { } +pub fn main() {} diff --git a/tests/ui/threads-sendsync/send_str_hashmap.rs b/tests/ui/threads-sendsync/send_str_hashmap.rs index 9cbb0bed447..2675b162190 100644 --- a/tests/ui/threads-sendsync/send_str_hashmap.rs +++ b/tests/ui/threads-sendsync/send_str_hashmap.rs @@ -1,9 +1,7 @@ //@ run-pass -use std::collections::HashMap; use std::borrow::Cow; - -use std::borrow::Cow::Borrowed as B; -use std::borrow::Cow::Owned as O; +use std::borrow::Cow::{Borrowed as B, Owned as O}; +use std::collections::HashMap; type SendStr = Cow<'static, str>; diff --git a/tests/ui/threads-sendsync/send_str_treemap.rs b/tests/ui/threads-sendsync/send_str_treemap.rs index cc1f560f69b..3e0eace3399 100644 --- a/tests/ui/threads-sendsync/send_str_treemap.rs +++ b/tests/ui/threads-sendsync/send_str_treemap.rs @@ -1,8 +1,7 @@ //@ run-pass -use std::collections::BTreeMap; use std::borrow::Cow; - -use std::borrow::Cow::{Owned as O, Borrowed as B}; +use std::borrow::Cow::{Borrowed as B, Owned as O}; +use std::collections::BTreeMap; type SendStr = Cow<'static, str>; @@ -51,8 +50,8 @@ fn main() { assert_eq!(map.get(&O("def".to_string())), Some(&d)); assert!(map.remove(&B("foo")).is_some()); - assert_eq!(map.into_iter().map(|(k, v)| format!("{}{}", k, v)) - .collect::<Vec<String>>() - .concat(), - "abc50bcd51cde52def53".to_string()); + assert_eq!( + map.into_iter().map(|(k, v)| format!("{}{}", k, v)).collect::<Vec<String>>().concat(), + "abc50bcd51cde52def53".to_string() + ); } diff --git a/tests/ui/threads-sendsync/sendable-class.rs b/tests/ui/threads-sendsync/sendable-class.rs index 3ee1b60a04a..8e5e76d826a 100644 --- a/tests/ui/threads-sendsync/sendable-class.rs +++ b/tests/ui/threads-sendsync/sendable-class.rs @@ -11,15 +11,12 @@ use std::sync::mpsc::channel; struct foo { - i: isize, - j: char, + i: isize, + j: char, } -fn foo(i:isize, j: char) -> foo { - foo { - i: i, - j: j - } +fn foo(i: isize, j: char) -> foo { + foo { i: i, j: j } } pub fn main() { diff --git a/tests/ui/threads-sendsync/sendfn-is-a-block.rs b/tests/ui/threads-sendsync/sendfn-is-a-block.rs index f01b440424a..9afa1c47b65 100644 --- a/tests/ui/threads-sendsync/sendfn-is-a-block.rs +++ b/tests/ui/threads-sendsync/sendfn-is-a-block.rs @@ -1,7 +1,9 @@ //@ run-pass - -fn test<F>(f: F) -> usize where F: FnOnce(usize) -> usize { +fn test<F>(f: F) -> usize +where + F: FnOnce(usize) -> usize, +{ return f(22); } diff --git a/tests/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs b/tests/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs index 63cf3ff4049..79a71e968f9 100644 --- a/tests/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs +++ b/tests/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs @@ -3,19 +3,24 @@ use std::thread; -pub fn main() { test05(); } +pub fn main() { + test05(); +} -fn test05_start<F:FnOnce(isize)>(f: F) { +fn test05_start<F: FnOnce(isize)>(f: F) { f(22); } fn test05() { let three: Box<_> = Box::new(3); - let fn_to_send = move|n:isize| { + let fn_to_send = move |n: isize| { println!("{}", *three + n); // will copy x into the closure assert_eq!(*three, 3); }; - thread::spawn(move|| { + thread::spawn(move || { test05_start(fn_to_send); - }).join().ok().unwrap(); + }) + .join() + .ok() + .unwrap(); } diff --git a/tests/ui/threads-sendsync/spawn-fn.rs b/tests/ui/threads-sendsync/spawn-fn.rs index e4d83b53f3c..558c2d515aa 100644 --- a/tests/ui/threads-sendsync/spawn-fn.rs +++ b/tests/ui/threads-sendsync/spawn-fn.rs @@ -10,9 +10,9 @@ fn x(s: String, n: isize) { } pub fn main() { - let t1 = thread::spawn(|| x("hello from first spawned fn".to_string(), 65) ); - let t2 = thread::spawn(|| x("hello from second spawned fn".to_string(), 66) ); - let t3 = thread::spawn(|| x("hello from third spawned fn".to_string(), 67) ); + let t1 = thread::spawn(|| x("hello from first spawned fn".to_string(), 65)); + let t2 = thread::spawn(|| x("hello from second spawned fn".to_string(), 66)); + let t3 = thread::spawn(|| x("hello from third spawned fn".to_string(), 67)); let mut i = 30; while i > 0 { i = i - 1; diff --git a/tests/ui/threads-sendsync/spawn-types.rs b/tests/ui/threads-sendsync/spawn-types.rs index 2a7a9e2f497..e53385aa714 100644 --- a/tests/ui/threads-sendsync/spawn-types.rs +++ b/tests/ui/threads-sendsync/spawn-types.rs @@ -4,13 +4,13 @@ //@ needs-threads /* - Make sure we can spawn tasks that take different types of - parameters. This is based on a test case for #520 provided by Rob - Arnold. - */ + Make sure we can spawn tasks that take different types of + parameters. This is based on a test case for #520 provided by Rob + Arnold. +*/ -use std::thread; use std::sync::mpsc::{channel, Sender}; +use std::thread; type ctx = Sender<isize>; @@ -20,6 +20,6 @@ fn iotask(_tx: &ctx, ip: String) { pub fn main() { let (tx, _rx) = channel::<isize>(); - let t = thread::spawn(move|| iotask(&tx, "localhost".to_string()) ); + let t = thread::spawn(move || iotask(&tx, "localhost".to_string())); t.join().ok().unwrap(); } diff --git a/tests/ui/threads-sendsync/spawn.rs b/tests/ui/threads-sendsync/spawn.rs index c7b344b9f75..c9f7c40ddb8 100644 --- a/tests/ui/threads-sendsync/spawn.rs +++ b/tests/ui/threads-sendsync/spawn.rs @@ -4,7 +4,10 @@ use std::thread; pub fn main() { - thread::spawn(move|| child(10)).join().ok().unwrap(); + thread::spawn(move || child(10)).join().ok().unwrap(); } -fn child(i: isize) { println!("{}", i); assert_eq!(i, 10); } +fn child(i: isize) { + println!("{}", i); + assert_eq!(i, 10); +} diff --git a/tests/ui/threads-sendsync/spawn2.rs b/tests/ui/threads-sendsync/spawn2.rs index 8278fec1885..02dff2a3483 100644 --- a/tests/ui/threads-sendsync/spawn2.rs +++ b/tests/ui/threads-sendsync/spawn2.rs @@ -4,7 +4,7 @@ use std::thread; pub fn main() { - let t = thread::spawn(move|| child((10, 20, 30, 40, 50, 60, 70, 80, 90)) ); + let t = thread::spawn(move || child((10, 20, 30, 40, 50, 60, 70, 80, 90))); t.join().ok().unwrap(); // forget Err value, since it doesn't implement Debug } diff --git a/tests/ui/threads-sendsync/sync-send-in-std.rs b/tests/ui/threads-sendsync/sync-send-in-std.rs index 3a97cbb0c68..ddf026236a8 100644 --- a/tests/ui/threads-sendsync/sync-send-in-std.rs +++ b/tests/ui/threads-sendsync/sync-send-in-std.rs @@ -6,8 +6,16 @@ use std::net::ToSocketAddrs; -fn is_sync<T>(_: T) where T: Sync {} -fn is_send<T>(_: T) where T: Send {} +fn is_sync<T>(_: T) +where + T: Sync, +{ +} +fn is_send<T>(_: T) +where + T: Send, +{ +} macro_rules! all_sync_send { ($ctor:expr, $($iter:ident),+) => ({ diff --git a/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs b/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs index 3b8fdb60acf..51d5e294b38 100644 --- a/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs +++ b/tests/ui/threads-sendsync/sync-send-iterators-in-libcollections.rs @@ -3,18 +3,20 @@ #![allow(warnings)] #![feature(drain, collections_bound, btree_range)] -use std::collections::BinaryHeap; -use std::collections::{BTreeMap, BTreeSet}; -use std::collections::LinkedList; -use std::collections::VecDeque; -use std::collections::HashMap; -use std::collections::HashSet; - +use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque}; use std::mem; use std::ops::Bound::Included; -fn is_sync<T>(_: T) where T: Sync {} -fn is_send<T>(_: T) where T: Send {} +fn is_sync<T>(_: T) +where + T: Sync, +{ +} +fn is_send<T>(_: T) +where + T: Send, +{ +} macro_rules! all_sync_send { ($ctor:expr, $($iter:ident),+) => ({ diff --git a/tests/ui/threads-sendsync/sync-send-iterators-in-libcore.rs b/tests/ui/threads-sendsync/sync-send-iterators-in-libcore.rs index 4c77b5d2ad8..512c81a85fc 100644 --- a/tests/ui/threads-sendsync/sync-send-iterators-in-libcore.rs +++ b/tests/ui/threads-sendsync/sync-send-iterators-in-libcore.rs @@ -5,8 +5,16 @@ use std::iter::{empty, once, repeat}; -fn is_sync<T>(_: T) where T: Sync {} -fn is_send<T>(_: T) where T: Send {} +fn is_sync<T>(_: T) +where + T: Sync, +{ +} +fn is_send<T>(_: T) +where + T: Send, +{ +} macro_rules! all_sync_send { ($ctor:expr, $iter:ident) => ({ @@ -43,12 +51,12 @@ macro_rules! all_sync_send_mutable_ref { } macro_rules! is_sync_send { - ($ctor:expr) => ({ + ($ctor:expr) => {{ let x = $ctor; is_sync(x); let y = $ctor; is_send(y); - }) + }}; } fn main() { @@ -63,24 +71,26 @@ fn main() { let a = [1]; let b = [2]; - all_sync_send!(a.iter(), - cloned, - cycle, - chain([2].iter()), - zip([2].iter()), - map(|_| 1), - filter(|_| true), - filter_map(|_| Some(1)), - enumerate, - peekable, - skip_while(|_| true), - take_while(|_| true), - skip(1), - take(1), - scan(1, |_, _| Some(1)), - flat_map(|_| b.iter()), - fuse, - inspect(|_| ())); + all_sync_send!( + a.iter(), + cloned, + cycle, + chain([2].iter()), + zip([2].iter()), + map(|_| 1), + filter(|_| true), + filter_map(|_| Some(1)), + enumerate, + peekable, + skip_while(|_| true), + take_while(|_| true), + skip(1), + take(1), + scan(1, |_, _| Some(1)), + flat_map(|_| b.iter()), + fuse, + inspect(|_| ()) + ); is_sync_send!((1..).step_by(2)); is_sync_send!((1..2).step_by(2)); diff --git a/tests/ui/threads-sendsync/task-comm-0.rs b/tests/ui/threads-sendsync/task-comm-0.rs index 50f2b591894..c4fe36e770d 100644 --- a/tests/ui/threads-sendsync/task-comm-0.rs +++ b/tests/ui/threads-sendsync/task-comm-0.rs @@ -2,12 +2,14 @@ #![allow(unused_must_use)] //@ needs-threads -use std::thread; use std::sync::mpsc::{channel, Sender}; +use std::thread; -pub fn main() { test05(); } +pub fn main() { + test05(); +} -fn test05_start(tx : &Sender<isize>) { +fn test05_start(tx: &Sender<isize>) { tx.send(10).unwrap(); println!("sent 10"); tx.send(20).unwrap(); @@ -18,7 +20,7 @@ fn test05_start(tx : &Sender<isize>) { fn test05() { let (tx, rx) = channel(); - let t = thread::spawn(move|| { test05_start(&tx) }); + let t = thread::spawn(move || test05_start(&tx)); let mut value: isize = rx.recv().unwrap(); println!("{}", value); value = rx.recv().unwrap(); diff --git a/tests/ui/threads-sendsync/task-comm-1.rs b/tests/ui/threads-sendsync/task-comm-1.rs index 41592bd916b..75d9e887cd1 100644 --- a/tests/ui/threads-sendsync/task-comm-1.rs +++ b/tests/ui/threads-sendsync/task-comm-1.rs @@ -4,11 +4,15 @@ use std::thread; -pub fn main() { test00(); } +pub fn main() { + test00(); +} -fn start() { println!("Started / Finished task."); } +fn start() { + println!("Started / Finished task."); +} fn test00() { - thread::spawn(move|| start() ).join(); + thread::spawn(move || start()).join(); println!("Completing."); } diff --git a/tests/ui/threads-sendsync/task-comm-10.rs b/tests/ui/threads-sendsync/task-comm-10.rs index 844652c0dde..44c31aeed77 100644 --- a/tests/ui/threads-sendsync/task-comm-10.rs +++ b/tests/ui/threads-sendsync/task-comm-10.rs @@ -3,8 +3,8 @@ #![allow(unused_mut)] //@ needs-threads -use std::thread; use std::sync::mpsc::{channel, Sender}; +use std::thread; fn start(tx: &Sender<Sender<String>>) { let (tx2, rx) = channel(); @@ -22,7 +22,7 @@ fn start(tx: &Sender<Sender<String>>) { pub fn main() { let (tx, rx) = channel(); - let child = thread::spawn(move|| { start(&tx) }); + let child = thread::spawn(move || start(&tx)); let mut c = rx.recv().unwrap(); c.send("A".to_string()).unwrap(); diff --git a/tests/ui/threads-sendsync/task-comm-11.rs b/tests/ui/threads-sendsync/task-comm-11.rs index 199082fda96..7c349c716fa 100644 --- a/tests/ui/threads-sendsync/task-comm-11.rs +++ b/tests/ui/threads-sendsync/task-comm-11.rs @@ -13,9 +13,7 @@ fn start(tx: &Sender<Sender<isize>>) { pub fn main() { let (tx, rx) = channel(); - let child = thread::spawn(move|| { - start(&tx) - }); + let child = thread::spawn(move || start(&tx)); let _tx = rx.recv().unwrap(); child.join(); } diff --git a/tests/ui/threads-sendsync/task-comm-12.rs b/tests/ui/threads-sendsync/task-comm-12.rs index 7be7ec4c988..95c5d5c45ef 100644 --- a/tests/ui/threads-sendsync/task-comm-12.rs +++ b/tests/ui/threads-sendsync/task-comm-12.rs @@ -5,15 +5,17 @@ use std::thread; -pub fn main() { test00(); } +pub fn main() { + test00(); +} -fn start(_task_number: isize) { println!("Started / Finished task."); } +fn start(_task_number: isize) { + println!("Started / Finished task."); +} fn test00() { let i: isize = 0; - let mut result = thread::spawn(move|| { - start(i) - }); + let mut result = thread::spawn(move || start(i)); // Sleep long enough for the thread to finish. let mut i = 0_usize; diff --git a/tests/ui/threads-sendsync/task-comm-13.rs b/tests/ui/threads-sendsync/task-comm-13.rs index 414e6e0db76..88ea3cbff08 100644 --- a/tests/ui/threads-sendsync/task-comm-13.rs +++ b/tests/ui/threads-sendsync/task-comm-13.rs @@ -7,12 +7,15 @@ use std::thread; fn start(tx: &Sender<isize>, start: isize, number_of_messages: isize) { let mut i: isize = 0; - while i< number_of_messages { tx.send(start + i).unwrap(); i += 1; } + while i < number_of_messages { + tx.send(start + i).unwrap(); + i += 1; + } } pub fn main() { println!("Check that we don't deadlock."); let (tx, rx) = channel(); - let _ = thread::spawn(move|| { start(&tx, 0, 10) }).join(); + let _ = thread::spawn(move || start(&tx, 0, 10)).join(); println!("Joined task"); } diff --git a/tests/ui/threads-sendsync/task-comm-14.rs b/tests/ui/threads-sendsync/task-comm-14.rs index 54deb221294..ff4ffd2968d 100644 --- a/tests/ui/threads-sendsync/task-comm-14.rs +++ b/tests/ui/threads-sendsync/task-comm-14.rs @@ -13,7 +13,10 @@ pub fn main() { while (i > 0) { println!("{}", i); let tx = tx.clone(); - thread::spawn({let i = i; move|| { child(i, &tx) }}); + thread::spawn({ + let i = i; + move || child(i, &tx) + }); i = i - 1; } diff --git a/tests/ui/threads-sendsync/task-comm-15.rs b/tests/ui/threads-sendsync/task-comm-15.rs index f487bf3cc84..1308446893b 100644 --- a/tests/ui/threads-sendsync/task-comm-15.rs +++ b/tests/ui/threads-sendsync/task-comm-15.rs @@ -20,9 +20,7 @@ pub fn main() { // the child's point of view the receiver may die. We should // drop messages on the floor in this case, and not crash! let (tx, rx) = channel(); - let t = thread::spawn(move|| { - start(&tx, 10) - }); + let t = thread::spawn(move || start(&tx, 10)); rx.recv(); t.join(); } diff --git a/tests/ui/threads-sendsync/task-comm-16.rs b/tests/ui/threads-sendsync/task-comm-16.rs index 3b0fec11acd..e76f7bedc93 100644 --- a/tests/ui/threads-sendsync/task-comm-16.rs +++ b/tests/ui/threads-sendsync/task-comm-16.rs @@ -3,15 +3,19 @@ #![allow(unused_parens)] #![allow(non_camel_case_types)] -use std::sync::mpsc::channel; use std::cmp; +use std::sync::mpsc::channel; // Tests of ports and channels on various types fn test_rec() { - struct R {val0: isize, val1: u8, val2: char} + struct R { + val0: isize, + val1: u8, + val2: char, + } let (tx, rx) = channel(); - let r0: R = R {val0: 0, val1: 1, val2: '2'}; + let r0: R = R { val0: 0, val1: 1, val2: '2' }; tx.send(r0).unwrap(); let mut r1: R; r1 = rx.recv().unwrap(); @@ -45,34 +49,29 @@ fn test_str() { enum t { tag1, tag2(isize), - tag3(isize, u8, char) + tag3(isize, u8, char), } impl cmp::PartialEq for t { fn eq(&self, other: &t) -> bool { match *self { - t::tag1 => { - match (*other) { - t::tag1 => true, - _ => false - } - } - t::tag2(e0a) => { - match (*other) { - t::tag2(e0b) => e0a == e0b, - _ => false - } - } - t::tag3(e0a, e1a, e2a) => { - match (*other) { - t::tag3(e0b, e1b, e2b) => - e0a == e0b && e1a == e1b && e2a == e2b, - _ => false - } - } + t::tag1 => match (*other) { + t::tag1 => true, + _ => false, + }, + t::tag2(e0a) => match (*other) { + t::tag2(e0b) => e0a == e0b, + _ => false, + }, + t::tag3(e0a, e1a, e2a) => match (*other) { + t::tag3(e0b, e1b, e2b) => e0a == e0b && e1a == e1b && e2a == e2b, + _ => false, + }, } } - fn ne(&self, other: &t) -> bool { !(*self).eq(other) } + fn ne(&self, other: &t) -> bool { + !(*self).eq(other) + } } fn test_tag() { diff --git a/tests/ui/threads-sendsync/task-comm-17.rs b/tests/ui/threads-sendsync/task-comm-17.rs index 687322d4dc9..a545beee599 100644 --- a/tests/ui/threads-sendsync/task-comm-17.rs +++ b/tests/ui/threads-sendsync/task-comm-17.rs @@ -9,9 +9,8 @@ use std::thread; -fn f() { -} +fn f() {} pub fn main() { - thread::spawn(move|| f() ).join(); + thread::spawn(move || f()).join(); } diff --git a/tests/ui/threads-sendsync/task-comm-3.rs b/tests/ui/threads-sendsync/task-comm-3.rs index 26f3eaf9dc6..565d97596c7 100644 --- a/tests/ui/threads-sendsync/task-comm-3.rs +++ b/tests/ui/threads-sendsync/task-comm-3.rs @@ -2,10 +2,13 @@ #![allow(unused_must_use)] //@ needs-threads -use std::thread; use std::sync::mpsc::{channel, Sender}; +use std::thread; -pub fn main() { println!("===== WITHOUT THREADS ====="); test00(); } +pub fn main() { + println!("===== WITHOUT THREADS ====="); + test00(); +} fn test00_start(ch: &Sender<isize>, message: isize, count: isize) { println!("Starting test00_start"); @@ -34,9 +37,7 @@ fn test00() { let tx = tx.clone(); results.push(thread::spawn({ let i = i; - move|| { - test00_start(&tx, i, number_of_messages) - } + move || test00_start(&tx, i, number_of_messages) })); i = i + 1; } @@ -53,7 +54,9 @@ fn test00() { } // Join spawned threads... - for r in results { r.join(); } + for r in results { + r.join(); + } println!("Completed: Final number is: "); println!("{}", sum); diff --git a/tests/ui/threads-sendsync/task-comm-4.rs b/tests/ui/threads-sendsync/task-comm-4.rs index 1210cee5582..6223f6a1ded 100644 --- a/tests/ui/threads-sendsync/task-comm-4.rs +++ b/tests/ui/threads-sendsync/task-comm-4.rs @@ -3,7 +3,9 @@ use std::sync::mpsc::channel; -pub fn main() { test00(); } +pub fn main() { + test00(); +} fn test00() { let mut r: isize = 0; diff --git a/tests/ui/threads-sendsync/task-comm-5.rs b/tests/ui/threads-sendsync/task-comm-5.rs index e07aa18c24d..e008b28f56c 100644 --- a/tests/ui/threads-sendsync/task-comm-5.rs +++ b/tests/ui/threads-sendsync/task-comm-5.rs @@ -2,7 +2,9 @@ use std::sync::mpsc::channel; -pub fn main() { test00(); } +pub fn main() { + test00(); +} fn test00() { let _r: isize = 0; @@ -10,8 +12,14 @@ fn test00() { let (tx, rx) = channel(); let number_of_messages: isize = 1000; let mut i: isize = 0; - while i < number_of_messages { tx.send(i + 0).unwrap(); i += 1; } + while i < number_of_messages { + tx.send(i + 0).unwrap(); + i += 1; + } i = 0; - while i < number_of_messages { sum += rx.recv().unwrap(); i += 1; } + while i < number_of_messages { + sum += rx.recv().unwrap(); + i += 1; + } assert_eq!(sum, number_of_messages * (number_of_messages - 1) / 2); } diff --git a/tests/ui/threads-sendsync/task-comm-6.rs b/tests/ui/threads-sendsync/task-comm-6.rs index 6a7dea63993..60697c908af 100644 --- a/tests/ui/threads-sendsync/task-comm-6.rs +++ b/tests/ui/threads-sendsync/task-comm-6.rs @@ -4,7 +4,9 @@ use std::sync::mpsc::channel; -pub fn main() { test00(); } +pub fn main() { + test00(); +} fn test00() { let mut r: isize = 0; @@ -38,5 +40,4 @@ fn test00() { assert_eq!(sum, 1998000); // assert (sum == 4 * ((number_of_messages * // (number_of_messages - 1)) / 2)); - } diff --git a/tests/ui/threads-sendsync/task-comm-7.rs b/tests/ui/threads-sendsync/task-comm-7.rs index d9b322daa66..bb59e4b4a72 100644 --- a/tests/ui/threads-sendsync/task-comm-7.rs +++ b/tests/ui/threads-sendsync/task-comm-7.rs @@ -6,12 +6,16 @@ use std::sync::mpsc::{channel, Sender}; use std::thread; -pub fn main() { test00(); } +pub fn main() { + test00(); +} -fn test00_start(c: &Sender<isize>, start: isize, - number_of_messages: isize) { +fn test00_start(c: &Sender<isize>, start: isize, number_of_messages: isize) { let mut i: isize = 0; - while i < number_of_messages { c.send(start + i).unwrap(); i += 1; } + while i < number_of_messages { + c.send(start + i).unwrap(); + i += 1; + } } fn test00() { @@ -21,19 +25,19 @@ fn test00() { let number_of_messages: isize = 10; let tx2 = tx.clone(); - let t1 = thread::spawn(move|| { + let t1 = thread::spawn(move || { test00_start(&tx2, number_of_messages * 0, number_of_messages); }); let tx2 = tx.clone(); - let t2 = thread::spawn(move|| { + let t2 = thread::spawn(move || { test00_start(&tx2, number_of_messages * 1, number_of_messages); }); let tx2 = tx.clone(); - let t3 = thread::spawn(move|| { + let t3 = thread::spawn(move || { test00_start(&tx2, number_of_messages * 2, number_of_messages); }); let tx2 = tx.clone(); - let t4 = thread::spawn(move|| { + let t4 = thread::spawn(move || { test00_start(&tx2, number_of_messages * 3, number_of_messages); }); diff --git a/tests/ui/threads-sendsync/task-comm-9.rs b/tests/ui/threads-sendsync/task-comm-9.rs index 3e617e4a40c..2e1f3cb673a 100644 --- a/tests/ui/threads-sendsync/task-comm-9.rs +++ b/tests/ui/threads-sendsync/task-comm-9.rs @@ -2,14 +2,19 @@ #![allow(unused_must_use)] //@ needs-threads -use std::thread; use std::sync::mpsc::{channel, Sender}; +use std::thread; -pub fn main() { test00(); } +pub fn main() { + test00(); +} fn test00_start(c: &Sender<isize>, number_of_messages: isize) { let mut i: isize = 0; - while i < number_of_messages { c.send(i + 0).unwrap(); i += 1; } + while i < number_of_messages { + c.send(i + 0).unwrap(); + i += 1; + } } fn test00() { @@ -18,7 +23,7 @@ fn test00() { let (tx, rx) = channel(); let number_of_messages: isize = 10; - let result = thread::spawn(move|| { + let result = thread::spawn(move || { test00_start(&tx, number_of_messages); }); diff --git a/tests/ui/threads-sendsync/task-life-0.rs b/tests/ui/threads-sendsync/task-life-0.rs index d3eca5d371f..f08a281e76c 100644 --- a/tests/ui/threads-sendsync/task-life-0.rs +++ b/tests/ui/threads-sendsync/task-life-0.rs @@ -6,9 +6,7 @@ use std::thread; pub fn main() { - thread::spawn(move|| child("Hello".to_string()) ).join(); + thread::spawn(move || child("Hello".to_string())).join(); } -fn child(_s: String) { - -} +fn child(_s: String) {} diff --git a/tests/ui/threads-sendsync/task-spawn-move-and-copy.rs b/tests/ui/threads-sendsync/task-spawn-move-and-copy.rs index ea1c6a9b108..07d1a3d5c36 100644 --- a/tests/ui/threads-sendsync/task-spawn-move-and-copy.rs +++ b/tests/ui/threads-sendsync/task-spawn-move-and-copy.rs @@ -2,8 +2,8 @@ #![allow(unused_must_use)] //@ needs-threads -use std::thread; use std::sync::mpsc::channel; +use std::thread; pub fn main() { let (tx, rx) = channel::<usize>(); diff --git a/tests/ui/threads-sendsync/task-stderr.rs b/tests/ui/threads-sendsync/task-stderr.rs index cad10c7a792..3934084e02a 100644 --- a/tests/ui/threads-sendsync/task-stderr.rs +++ b/tests/ui/threads-sendsync/task-stderr.rs @@ -4,20 +4,21 @@ #![feature(internal_output_capture)] -use std::io; -use std::str; use std::sync::{Arc, Mutex}; -use std::thread; +use std::{io, str, thread}; fn main() { let data = Arc::new(Mutex::new(Vec::new())); - let res = thread::Builder::new().spawn({ - let data = data.clone(); - move || { - io::set_output_capture(Some(data)); - panic!("Hello, world!") - } - }).unwrap().join(); + let res = thread::Builder::new() + .spawn({ + let data = data.clone(); + move || { + io::set_output_capture(Some(data)); + panic!("Hello, world!") + } + }) + .unwrap() + .join(); assert!(res.is_err()); let output = data.lock().unwrap(); diff --git a/tests/ui/threads-sendsync/tcp-stress.rs b/tests/ui/threads-sendsync/tcp-stress.rs index 429a4657314..b2f76a55fb9 100644 --- a/tests/ui/threads-sendsync/tcp-stress.rs +++ b/tests/ui/threads-sendsync/tcp-stress.rs @@ -8,14 +8,14 @@ use std::io::prelude::*; use std::net::{TcpListener, TcpStream}; use std::process; use std::sync::mpsc::channel; -use std::time::Duration; use std::thread::{self, Builder}; +use std::time::Duration; const TARGET_CNT: usize = 200; fn main() { // This test has a chance to time out, try to not let it time out - thread::spawn(move|| -> () { + thread::spawn(move || -> () { thread::sleep(Duration::from_secs(30)); process::exit(1); }); @@ -38,12 +38,12 @@ fn main() { let mut spawned_cnt = 0; for _ in 0..TARGET_CNT { let tx = tx.clone(); - let res = Builder::new().stack_size(64 * 1024).spawn(move|| { + let res = Builder::new().stack_size(64 * 1024).spawn(move || { match TcpStream::connect(addr) { Ok(mut stream) => { let _ = stream.write(&[1]); let _ = stream.read(&mut [0]); - }, + } Err(..) => {} } tx.send(()).unwrap(); diff --git a/tests/ui/threads-sendsync/threads.rs b/tests/ui/threads-sendsync/threads.rs index f3ed7890364..ad4e4774ea0 100644 --- a/tests/ui/threads-sendsync/threads.rs +++ b/tests/ui/threads-sendsync/threads.rs @@ -7,10 +7,16 @@ use std::thread; pub fn main() { let mut i = 10; while i > 0 { - thread::spawn({let i = i; move|| child(i)}).join(); + thread::spawn({ + let i = i; + move || child(i) + }) + .join(); i = i - 1; } println!("main thread exiting"); } -fn child(x: isize) { println!("{}", x); } +fn child(x: isize) { + println!("{}", x); +} diff --git a/tests/ui/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs b/tests/ui/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs index 84176659412..983028681cd 100644 --- a/tests/ui/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs +++ b/tests/ui/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs @@ -8,7 +8,9 @@ struct Foo; impl Drop for Foo { fn drop(&mut self) { - unsafe { HIT = true; } + unsafe { + HIT = true; + } } } @@ -17,6 +19,8 @@ thread_local!(static FOO: Foo = Foo); fn main() { std::thread::spawn(|| { FOO.with(|_| {}); - }).join().unwrap(); + }) + .join() + .unwrap(); assert!(unsafe { HIT }); } diff --git a/tests/ui/threads-sendsync/tls-init-on-init.rs b/tests/ui/threads-sendsync/tls-init-on-init.rs index fd764669e7f..1cae19aae86 100644 --- a/tests/ui/threads-sendsync/tls-init-on-init.rs +++ b/tests/ui/threads-sendsync/tls-init-on-init.rs @@ -1,14 +1,14 @@ //@ run-pass #![allow(stable_features)] - //@ needs-threads - #![feature(thread_local_try_with)] -use std::thread; use std::sync::atomic::{AtomicUsize, Ordering}; +use std::thread; -struct Foo { cnt: usize } +struct Foo { + cnt: usize, +} thread_local!(static FOO: Foo = Foo::init()); @@ -40,5 +40,7 @@ impl Drop for Foo { fn main() { thread::spawn(|| { FOO.with(|_| {}); - }).join().unwrap(); + }) + .join() + .unwrap(); } diff --git a/tests/ui/threads-sendsync/tls-try-with.rs b/tests/ui/threads-sendsync/tls-try-with.rs index 72cee219a0a..04071e77daa 100644 --- a/tests/ui/threads-sendsync/tls-try-with.rs +++ b/tests/ui/threads-sendsync/tls-try-with.rs @@ -1,8 +1,6 @@ //@ run-pass #![allow(stable_features)] - //@ needs-threads - #![feature(thread_local_try_with)] use std::thread; @@ -16,15 +14,17 @@ thread_local!(static FOO: Foo = Foo {}); impl Drop for Foo { fn drop(&mut self) { assert!(FOO.try_with(|_| panic!("`try_with` closure run")).is_err()); - unsafe { DROP_RUN = true; } + unsafe { + DROP_RUN = true; + } } } fn main() { thread::spawn(|| { - assert_eq!(FOO.try_with(|_| { - 132 - }).expect("`try_with` failed"), 132); - }).join().unwrap(); + assert_eq!(FOO.try_with(|_| { 132 }).expect("`try_with` failed"), 132); + }) + .join() + .unwrap(); assert!(unsafe { DROP_RUN }); } diff --git a/tests/ui/threads-sendsync/trivial-message.rs b/tests/ui/threads-sendsync/trivial-message.rs index 81657373643..d76ba0009dc 100644 --- a/tests/ui/threads-sendsync/trivial-message.rs +++ b/tests/ui/threads-sendsync/trivial-message.rs @@ -2,9 +2,9 @@ #![allow(unused_must_use)] /* - This is about the simplest program that can successfully send a - message. - */ + This is about the simplest program that can successfully send a + message. +*/ use std::sync::mpsc::channel; diff --git a/tests/ui/threads-sendsync/unwind-resource.rs b/tests/ui/threads-sendsync/unwind-resource.rs index 3b1ab57b46e..ec27a1846fe 100644 --- a/tests/ui/threads-sendsync/unwind-resource.rs +++ b/tests/ui/threads-sendsync/unwind-resource.rs @@ -21,9 +21,7 @@ impl Drop for complainer { fn complainer(tx: Sender<bool>) -> complainer { println!("Hello!"); - complainer { - tx: tx - } + complainer { tx: tx } } fn f(tx: Sender<bool>) { @@ -33,7 +31,7 @@ fn f(tx: Sender<bool>) { pub fn main() { let (tx, rx) = channel(); - let t = thread::spawn(move|| f(tx.clone())); + let t = thread::spawn(move || f(tx.clone())); println!("hiiiiiiiii"); assert!(rx.recv().unwrap()); drop(t.join()); diff --git a/tests/ui/threads-sendsync/yield.rs b/tests/ui/threads-sendsync/yield.rs index 99d14bd92ea..c2b10b901cf 100644 --- a/tests/ui/threads-sendsync/yield.rs +++ b/tests/ui/threads-sendsync/yield.rs @@ -17,5 +17,9 @@ pub fn main() { } fn child() { - println!("4"); thread::yield_now(); println!("5"); thread::yield_now(); println!("6"); + println!("4"); + thread::yield_now(); + println!("5"); + thread::yield_now(); + println!("6"); } diff --git a/tests/ui/threads-sendsync/yield1.rs b/tests/ui/threads-sendsync/yield1.rs index c965d2fc303..441e93ecf90 100644 --- a/tests/ui/threads-sendsync/yield1.rs +++ b/tests/ui/threads-sendsync/yield1.rs @@ -13,4 +13,6 @@ pub fn main() { result.join(); } -fn child() { println!("2"); } +fn child() { + println!("2"); +} diff --git a/tests/ui/threads-sendsync/yield2.rs b/tests/ui/threads-sendsync/yield2.rs index 9502f0d33da..2c24df44af2 100644 --- a/tests/ui/threads-sendsync/yield2.rs +++ b/tests/ui/threads-sendsync/yield2.rs @@ -4,5 +4,9 @@ use std::thread; pub fn main() { let mut i: isize = 0; - while i < 100 { i = i + 1; println!("{}", i); thread::yield_now(); } + while i < 100 { + i = i + 1; + println!("{}", i); + thread::yield_now(); + } } diff --git a/tests/ui/traits/next-solver/alias-bound-unsound.rs b/tests/ui/traits/next-solver/alias-bound-unsound.rs index a5bd3e7afa8..272e5db3b7a 100644 --- a/tests/ui/traits/next-solver/alias-bound-unsound.rs +++ b/tests/ui/traits/next-solver/alias-bound-unsound.rs @@ -27,5 +27,6 @@ fn main() { //~| ERROR overflow evaluating the requirement `&<() as Foo>::Item well-formed` //~| ERROR overflow evaluating the requirement `<() as Foo>::Item == _` //~| ERROR overflow evaluating the requirement `<() as Foo>::Item == _` + //~| ERROR overflow evaluating the requirement `<() as Foo>::Item == _` println!("{x}"); } diff --git a/tests/ui/traits/next-solver/alias-bound-unsound.stderr b/tests/ui/traits/next-solver/alias-bound-unsound.stderr index a5c2f215134..e5cf5b6bc3d 100644 --- a/tests/ui/traits/next-solver/alias-bound-unsound.stderr +++ b/tests/ui/traits/next-solver/alias-bound-unsound.stderr @@ -44,6 +44,12 @@ LL | drop(<() as Foo>::copy_me(&x)); | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 6 previous errors +error[E0275]: overflow evaluating the requirement `<() as Foo>::Item == _` + --> $DIR/alias-bound-unsound.rs:24:31 + | +LL | drop(<() as Foo>::copy_me(&x)); + | ^^ + +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/object/pretty.rs b/tests/ui/traits/object/pretty.rs index 8958871ed5d..6660ff040f7 100644 --- a/tests/ui/traits/object/pretty.rs +++ b/tests/ui/traits/object/pretty.rs @@ -18,6 +18,10 @@ trait FixedHrtb: for<'a> SuperGeneric<'a, Assoc2 = &'a u8> {} trait AnyDifferentBinders: for<'a> SuperGeneric<'a, Assoc2 = &'a u8> + Super {} trait FixedDifferentBinders: for<'a> SuperGeneric<'a, Assoc2 = &'a u8> + Super<Assoc = u8> {} +trait HasGat<Outer> { + type Assoc<Inner> where Self: Sized; +} + fn dyn_super(x: &dyn Super<Assoc = u8>) { x } //~ERROR mismatched types fn dyn_any(x: &dyn Any<Assoc = u8>) { x } //~ERROR mismatched types fn dyn_fixed(x: &dyn Fixed) { x } //~ERROR mismatched types @@ -34,4 +38,7 @@ fn dyn_fixed_hrtb(x: &dyn FixedHrtb) { x } //~ERROR mismatched types fn dyn_any_different_binders(x: &dyn AnyDifferentBinders<Assoc = u8>) { x } //~ERROR mismatched types fn dyn_fixed_different_binders(x: &dyn FixedDifferentBinders) { x } //~ERROR mismatched types +fn dyn_has_gat(x: &dyn HasGat<u8, Assoc<bool> = ()>) { x } //~ERROR mismatched types +//~^ WARN unnecessary associated type bound + fn main() {} diff --git a/tests/ui/traits/object/pretty.stderr b/tests/ui/traits/object/pretty.stderr index bc645e5f967..6964d97c08e 100644 --- a/tests/ui/traits/object/pretty.stderr +++ b/tests/ui/traits/object/pretty.stderr @@ -1,5 +1,14 @@ +warning: unnecessary associated type bound for not object safe associated type + --> $DIR/pretty.rs:41:35 + | +LL | fn dyn_has_gat(x: &dyn HasGat<u8, Assoc<bool> = ()>) { x } + | ^^^^^^^^^^^^^^^^ help: remove this bound + | + = note: this associated type has a `where Self: Sized` bound, and while the associated type can be specified, it cannot be used because trait objects are never `Sized` + = note: `#[warn(unused_associated_type_bounds)]` on by default + error[E0308]: mismatched types - --> $DIR/pretty.rs:21:43 + --> $DIR/pretty.rs:25:43 | LL | fn dyn_super(x: &dyn Super<Assoc = u8>) { x } | - ^ expected `()`, found `&dyn Super<Assoc = u8>` @@ -10,7 +19,7 @@ LL | fn dyn_super(x: &dyn Super<Assoc = u8>) { x } found reference `&dyn Super<Assoc = u8>` error[E0308]: mismatched types - --> $DIR/pretty.rs:22:39 + --> $DIR/pretty.rs:26:39 | LL | fn dyn_any(x: &dyn Any<Assoc = u8>) { x } | - ^ expected `()`, found `&dyn Any<Assoc = u8>` @@ -21,7 +30,7 @@ LL | fn dyn_any(x: &dyn Any<Assoc = u8>) { x } found reference `&dyn Any<Assoc = u8>` error[E0308]: mismatched types - --> $DIR/pretty.rs:23:31 + --> $DIR/pretty.rs:27:31 | LL | fn dyn_fixed(x: &dyn Fixed) { x } | - ^ expected `()`, found `&dyn Fixed` @@ -32,7 +41,7 @@ LL | fn dyn_fixed(x: &dyn Fixed) { x } found reference `&dyn Fixed` error[E0308]: mismatched types - --> $DIR/pretty.rs:24:50 + --> $DIR/pretty.rs:28:50 | LL | fn dyn_fixed_multi(x: &dyn Fixed<Assoc = u16>) { x } | - ^ expected `()`, found `&dyn Fixed<Assoc = u16>` @@ -43,7 +52,7 @@ LL | fn dyn_fixed_multi(x: &dyn Fixed<Assoc = u16>) { x } found reference `&dyn Fixed<Assoc = u16>` error[E0308]: mismatched types - --> $DIR/pretty.rs:25:38 + --> $DIR/pretty.rs:29:38 | LL | fn dyn_fixed_sub(x: &dyn FixedSub) { x } | - ^ expected `()`, found `&dyn FixedSub` @@ -54,7 +63,7 @@ LL | fn dyn_fixed_sub(x: &dyn FixedSub) { x } found reference `&dyn FixedSub` error[E0308]: mismatched types - --> $DIR/pretty.rs:26:44 + --> $DIR/pretty.rs:30:44 | LL | fn dyn_fixed_static(x: &dyn FixedStatic) { x } | - ^ expected `()`, found `&dyn FixedStatic` @@ -65,7 +74,7 @@ LL | fn dyn_fixed_static(x: &dyn FixedStatic) { x } found reference `&dyn FixedStatic` error[E0308]: mismatched types - --> $DIR/pretty.rs:28:75 + --> $DIR/pretty.rs:32:75 | LL | fn dyn_super_generic(x: &dyn for<'a> SuperGeneric<'a, Assoc2 = &'a u8>) { x } | - ^ expected `()`, found `&dyn SuperGeneric<'a, Assoc2 = &u8>` @@ -76,7 +85,7 @@ LL | fn dyn_super_generic(x: &dyn for<'a> SuperGeneric<'a, Assoc2 = &'a u8>) { x found reference `&dyn for<'a> SuperGeneric<'a, Assoc2 = &'a u8>` error[E0308]: mismatched types - --> $DIR/pretty.rs:29:71 + --> $DIR/pretty.rs:33:71 | LL | fn dyn_any_generic(x: &dyn for<'a> AnyGeneric<'a, Assoc2 = &'a u8>) { x } | - ^ expected `()`, found `&dyn AnyGeneric<'a, Assoc2 = &u8>` @@ -87,7 +96,7 @@ LL | fn dyn_any_generic(x: &dyn for<'a> AnyGeneric<'a, Assoc2 = &'a u8>) { x } found reference `&dyn for<'a> AnyGeneric<'a, Assoc2 = &'a u8>` error[E0308]: mismatched types - --> $DIR/pretty.rs:30:60 + --> $DIR/pretty.rs:34:60 | LL | fn dyn_fixed_generic1(x: &dyn for<'a> FixedGeneric1<'a>) { x } | - ^ expected `()`, found `&dyn FixedGeneric1<'a>` @@ -98,7 +107,7 @@ LL | fn dyn_fixed_generic1(x: &dyn for<'a> FixedGeneric1<'a>) { x } found reference `&dyn for<'a> FixedGeneric1<'a>` error[E0308]: mismatched types - --> $DIR/pretty.rs:31:60 + --> $DIR/pretty.rs:35:60 | LL | fn dyn_fixed_generic2(x: &dyn for<'a> FixedGeneric2<'a>) { x } | - ^ expected `()`, found `&dyn FixedGeneric2<'a>` @@ -109,7 +118,7 @@ LL | fn dyn_fixed_generic2(x: &dyn for<'a> FixedGeneric2<'a>) { x } found reference `&dyn for<'a> FixedGeneric2<'a>` error[E0308]: mismatched types - --> $DIR/pretty.rs:32:79 + --> $DIR/pretty.rs:36:79 | LL | fn dyn_fixed_generic_multi(x: &dyn for<'a> FixedGeneric1<'a, Assoc2 = &u8>) { x } | - ^ expected `()`, found `&dyn FixedGeneric1<'a, Assoc2 = ...>` @@ -120,7 +129,7 @@ LL | fn dyn_fixed_generic_multi(x: &dyn for<'a> FixedGeneric1<'a, Assoc2 = &u8>) found reference `&dyn for<'a> FixedGeneric1<'a, Assoc2 = &u8>` error[E0308]: mismatched types - --> $DIR/pretty.rs:33:40 + --> $DIR/pretty.rs:37:40 | LL | fn dyn_fixed_hrtb(x: &dyn FixedHrtb) { x } | - ^ expected `()`, found `&dyn FixedHrtb` @@ -131,7 +140,7 @@ LL | fn dyn_fixed_hrtb(x: &dyn FixedHrtb) { x } found reference `&dyn FixedHrtb` error[E0308]: mismatched types - --> $DIR/pretty.rs:34:73 + --> $DIR/pretty.rs:38:73 | LL | fn dyn_any_different_binders(x: &dyn AnyDifferentBinders<Assoc = u8>) { x } | - ^ expected `()`, found `&dyn AnyDifferentBinders<Assoc = ...>` @@ -142,7 +151,7 @@ LL | fn dyn_any_different_binders(x: &dyn AnyDifferentBinders<Assoc = u8>) { x } found reference `&dyn AnyDifferentBinders<Assoc = u8>` error[E0308]: mismatched types - --> $DIR/pretty.rs:35:65 + --> $DIR/pretty.rs:39:65 | LL | fn dyn_fixed_different_binders(x: &dyn FixedDifferentBinders) { x } | - ^ expected `()`, found `&dyn FixedDifferentBinders` @@ -152,6 +161,17 @@ LL | fn dyn_fixed_different_binders(x: &dyn FixedDifferentBinders) { x } = note: expected unit type `()` found reference `&dyn FixedDifferentBinders` -error: aborting due to 14 previous errors +error[E0308]: mismatched types + --> $DIR/pretty.rs:41:56 + | +LL | fn dyn_has_gat(x: &dyn HasGat<u8, Assoc<bool> = ()>) { x } + | - ^ expected `()`, found `&dyn HasGat<u8, Assoc<bool> = ()>` + | | + | help: try adding a return type: `-> &dyn HasGat<u8, Assoc<bool> = ()>` + | + = note: expected unit type `()` + found reference `&dyn HasGat<u8, Assoc<bool> = ()>` + +error: aborting due to 15 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/transmutability/abstraction/abstracted_assume.rs b/tests/ui/transmutability/abstraction/abstracted_assume.rs index 897e1b4b50a..7fd91e31a04 100644 --- a/tests/ui/transmutability/abstraction/abstracted_assume.rs +++ b/tests/ui/transmutability/abstraction/abstracted_assume.rs @@ -8,7 +8,7 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable< Src, @@ -16,7 +16,7 @@ mod assert { const ASSUME: std::mem::Assume, >() where - Dst: BikeshedIntrinsicFrom< + Dst: TransmuteFrom< Src, ASSUME, >, diff --git a/tests/ui/transmutability/abstraction/const_generic_fn.rs b/tests/ui/transmutability/abstraction/const_generic_fn.rs index 0a5f0de0214..1ea978ce1ba 100644 --- a/tests/ui/transmutability/abstraction/const_generic_fn.rs +++ b/tests/ui/transmutability/abstraction/const_generic_fn.rs @@ -6,12 +6,12 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn array_like<T, E, const N: usize>() where - T: BikeshedIntrinsicFrom<[E; N], { Assume::SAFETY }>, - [E; N]: BikeshedIntrinsicFrom<T, { Assume::SAFETY }> + T: TransmuteFrom<[E; N], { Assume::SAFETY }>, + [E; N]: TransmuteFrom<T, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/alignment/align-fail.rs b/tests/ui/transmutability/alignment/align-fail.rs index d88f1285c11..4c1a69b0128 100644 --- a/tests/ui/transmutability/alignment/align-fail.rs +++ b/tests/ui/transmutability/alignment/align-fail.rs @@ -2,11 +2,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: false, lifetimes: true, diff --git a/tests/ui/transmutability/alignment/align-fail.stderr b/tests/ui/transmutability/alignment/align-fail.stderr index f05e55fb024..b9801e511b2 100644 --- a/tests/ui/transmutability/alignment/align-fail.stderr +++ b/tests/ui/transmutability/alignment/align-fail.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: false, diff --git a/tests/ui/transmutability/alignment/align-pass.rs b/tests/ui/transmutability/alignment/align-pass.rs index aecf7b02d62..feecf5edaa1 100644 --- a/tests/ui/transmutability/alignment/align-pass.rs +++ b/tests/ui/transmutability/alignment/align-pass.rs @@ -2,11 +2,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: false, lifetimes: false, diff --git a/tests/ui/transmutability/arrays/huge-len.rs b/tests/ui/transmutability/arrays/huge-len.rs index 3fe254ebef4..dec24a559d3 100644 --- a/tests/ui/transmutability/arrays/huge-len.rs +++ b/tests/ui/transmutability/arrays/huge-len.rs @@ -1,11 +1,11 @@ #![crate_type = "lib"] #![feature(transmutability)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src>, + Dst: TransmuteFrom<Src>, { } } diff --git a/tests/ui/transmutability/arrays/huge-len.stderr b/tests/ui/transmutability/arrays/huge-len.stderr index 3fc652f47c1..1fa16c649d4 100644 --- a/tests/ui/transmutability/arrays/huge-len.stderr +++ b/tests/ui/transmutability/arrays/huge-len.stderr @@ -2,7 +2,7 @@ error[E0277]: `()` cannot be safely transmuted into `ExplicitlyPadded` --> $DIR/huge-len.rs:21:41 | LL | assert::is_maybe_transmutable::<(), ExplicitlyPadded>(); - | ^^^^^^^^^^^^^^^^ analyzing the transmutability of `ExplicitlyPadded` is not yet supported + | ^^^^^^^^^^^^^^^^ values of the type `ExplicitlyPadded` are too big for the current architecture | note: required by a bound in `is_maybe_transmutable` --> $DIR/huge-len.rs:8:14 @@ -10,14 +10,14 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: TransmuteFrom<Src>, + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error[E0277]: `ExplicitlyPadded` cannot be safely transmuted into `()` --> $DIR/huge-len.rs:24:55 | LL | assert::is_maybe_transmutable::<ExplicitlyPadded, ()>(); - | ^^ analyzing the transmutability of `ExplicitlyPadded` is not yet supported + | ^^ values of the type `ExplicitlyPadded` are too big for the current architecture | note: required by a bound in `is_maybe_transmutable` --> $DIR/huge-len.rs:8:14 @@ -25,8 +25,8 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: TransmuteFrom<Src>, + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error: aborting due to 2 previous errors diff --git a/tests/ui/transmutability/arrays/issue-103783-array-length.rs b/tests/ui/transmutability/arrays/issue-103783-array-length.rs index 7fcbcc01075..3537a39259c 100644 --- a/tests/ui/transmutability/arrays/issue-103783-array-length.rs +++ b/tests/ui/transmutability/arrays/issue-103783-array-length.rs @@ -3,11 +3,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom< + Dst: TransmuteFrom< Src, { Assume { alignment: true, lifetimes: true, safety: true, validity: true } }, >, diff --git a/tests/ui/transmutability/arrays/should_have_correct_length.rs b/tests/ui/transmutability/arrays/should_have_correct_length.rs index 747897d49d7..00c0c1122ef 100644 --- a/tests/ui/transmutability/arrays/should_have_correct_length.rs +++ b/tests/ui/transmutability/arrays/should_have_correct_length.rs @@ -6,11 +6,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> + Dst: TransmuteFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> {} } diff --git a/tests/ui/transmutability/arrays/should_inherit_alignment.rs b/tests/ui/transmutability/arrays/should_inherit_alignment.rs index d95c51e3361..70d2f07c449 100644 --- a/tests/ui/transmutability/arrays/should_inherit_alignment.rs +++ b/tests/ui/transmutability/arrays/should_inherit_alignment.rs @@ -6,11 +6,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/arrays/should_require_well_defined_layout.rs b/tests/ui/transmutability/arrays/should_require_well_defined_layout.rs index 5345b199f6e..29e8ad136ee 100644 --- a/tests/ui/transmutability/arrays/should_require_well_defined_layout.rs +++ b/tests/ui/transmutability/arrays/should_require_well_defined_layout.rs @@ -5,11 +5,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr index b4cd70142c4..e9420cd393e 100644 --- a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) @@ -31,7 +31,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) @@ -52,7 +52,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) @@ -73,7 +73,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) @@ -94,7 +94,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) @@ -115,7 +115,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/enums/niche_optimization.rs b/tests/ui/transmutability/enums/niche_optimization.rs index 23f57ecad75..802d1747568 100644 --- a/tests/ui/transmutability/enums/niche_optimization.rs +++ b/tests/ui/transmutability/enums/niche_optimization.rs @@ -5,11 +5,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: false, lifetimes: false, @@ -21,7 +21,7 @@ mod assert { pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: false, lifetimes: false, diff --git a/tests/ui/transmutability/enums/repr/padding_differences.rs b/tests/ui/transmutability/enums/repr/padding_differences.rs index d0e1502b5e2..9d2380c613e 100644 --- a/tests/ui/transmutability/enums/repr/padding_differences.rs +++ b/tests/ui/transmutability/enums/repr/padding_differences.rs @@ -7,11 +7,11 @@ use std::mem::MaybeUninit; mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: false, lifetimes: false, @@ -23,7 +23,7 @@ mod assert { pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: false, lifetimes: false, diff --git a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs index d3d463e7929..a8f4cccc73e 100644 --- a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs +++ b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs @@ -5,11 +5,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr index 6c88bf4ff96..c975ff276c8 100644 --- a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr +++ b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -32,7 +32,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -54,7 +54,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -76,7 +76,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -98,7 +98,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -120,7 +120,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -142,7 +142,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -164,7 +164,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -186,7 +186,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -208,7 +208,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -230,7 +230,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -252,7 +252,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -274,7 +274,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -296,7 +296,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -318,7 +318,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -340,7 +340,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -362,7 +362,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -384,7 +384,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -406,7 +406,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -428,7 +428,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/enums/repr/should_handle_all.rs b/tests/ui/transmutability/enums/repr/should_handle_all.rs index a8ec86fa40d..dec0126f22d 100644 --- a/tests/ui/transmutability/enums/repr/should_handle_all.rs +++ b/tests/ui/transmutability/enums/repr/should_handle_all.rs @@ -5,11 +5,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/enums/should_order_correctly.rs b/tests/ui/transmutability/enums/should_order_correctly.rs index d51a033f1a6..cea2055e148 100644 --- a/tests/ui/transmutability/enums/should_order_correctly.rs +++ b/tests/ui/transmutability/enums/should_order_correctly.rs @@ -6,11 +6,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/enums/should_pad_variants.rs b/tests/ui/transmutability/enums/should_pad_variants.rs index 81ef9e8a567..82bafe85415 100644 --- a/tests/ui/transmutability/enums/should_pad_variants.rs +++ b/tests/ui/transmutability/enums/should_pad_variants.rs @@ -6,11 +6,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/enums/should_pad_variants.stderr b/tests/ui/transmutability/enums/should_pad_variants.stderr index da4294bdbce..bb26281c2f0 100644 --- a/tests/ui/transmutability/enums/should_pad_variants.stderr +++ b/tests/ui/transmutability/enums/should_pad_variants.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/enums/should_respect_endianness.rs b/tests/ui/transmutability/enums/should_respect_endianness.rs index 8e52274710a..9cf4de06ad2 100644 --- a/tests/ui/transmutability/enums/should_respect_endianness.rs +++ b/tests/ui/transmutability/enums/should_respect_endianness.rs @@ -6,11 +6,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/enums/should_respect_endianness.stderr b/tests/ui/transmutability/enums/should_respect_endianness.stderr index 9f88bb06813..1b9099b297b 100644 --- a/tests/ui/transmutability/enums/should_respect_endianness.stderr +++ b/tests/ui/transmutability/enums/should_respect_endianness.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/enums/uninhabited_optimization.rs b/tests/ui/transmutability/enums/uninhabited_optimization.rs index c2d5b67ab2c..5b9de3a3963 100644 --- a/tests/ui/transmutability/enums/uninhabited_optimization.rs +++ b/tests/ui/transmutability/enums/uninhabited_optimization.rs @@ -4,7 +4,7 @@ fn assert_transmutable<T>() where - (): std::mem::BikeshedIntrinsicFrom<T> + (): std::mem::TransmuteFrom<T> {} enum Uninhabited {} diff --git a/tests/ui/transmutability/issue-101739-1.rs b/tests/ui/transmutability/issue-101739-1.rs index 20bd7917e53..fcc1db073ee 100644 --- a/tests/ui/transmutability/issue-101739-1.rs +++ b/tests/ui/transmutability/issue-101739-1.rs @@ -1,12 +1,13 @@ #![feature(transmutability)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable<Src, const ASSUME_ALIGNMENT: bool>() where - Dst: BikeshedIntrinsicFrom<Src, ASSUME_ALIGNMENT>, //~ ERROR cannot find type `Dst` in this scope - //~^ the constant `ASSUME_ALIGNMENT` is not of type `Assume` + Dst: TransmuteFrom<Src, ASSUME_ALIGNMENT>, //~ ERROR cannot find type `Dst` in this scope + //~| the constant `ASSUME_ALIGNMENT` is not of type `Assume` + //~| ERROR: mismatched types { } } diff --git a/tests/ui/transmutability/issue-101739-1.stderr b/tests/ui/transmutability/issue-101739-1.stderr index ba18a980f4d..3687631dc51 100644 --- a/tests/ui/transmutability/issue-101739-1.stderr +++ b/tests/ui/transmutability/issue-101739-1.stderr @@ -1,18 +1,25 @@ error[E0412]: cannot find type `Dst` in this scope --> $DIR/issue-101739-1.rs:8:9 | -LL | Dst: BikeshedIntrinsicFrom<Src, ASSUME_ALIGNMENT>, +LL | Dst: TransmuteFrom<Src, ASSUME_ALIGNMENT>, | ^^^ not found in this scope error: the constant `ASSUME_ALIGNMENT` is not of type `Assume` --> $DIR/issue-101739-1.rs:8:14 | -LL | Dst: BikeshedIntrinsicFrom<Src, ASSUME_ALIGNMENT>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` +LL | Dst: TransmuteFrom<Src, ASSUME_ALIGNMENT>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` | -note: required by a const generic parameter in `BikeshedIntrinsicFrom` +note: required by a const generic parameter in `TransmuteFrom` --> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/issue-101739-1.rs:8:33 + | +LL | Dst: TransmuteFrom<Src, ASSUME_ALIGNMENT>, + | ^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0412`. +Some errors have detailed explanations: E0308, E0412. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/transmutability/issue-101739-2.rs b/tests/ui/transmutability/issue-101739-2.rs index 8b36bf3dcb1..02aa4669e05 100644 --- a/tests/ui/transmutability/issue-101739-2.rs +++ b/tests/ui/transmutability/issue-101739-2.rs @@ -3,7 +3,7 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable< Src, @@ -14,19 +14,23 @@ mod assert { const ASSUME_VISIBILITY: bool, >() where - Dst: BikeshedIntrinsicFrom< //~ ERROR trait takes at most 2 generic arguments but 5 generic arguments were supplied - Src, - ASSUME_ALIGNMENT, - ASSUME_LIFETIMES, - ASSUME_VALIDITY, - ASSUME_VISIBILITY, - >, - {} + Dst: TransmuteFrom< + //~^ ERROR trait takes at most 2 generic arguments but 5 generic arguments were supplied + Src, + ASSUME_ALIGNMENT, //~ ERROR: mismatched types + ASSUME_LIFETIMES, + ASSUME_VALIDITY, + ASSUME_VISIBILITY, + >, + { + } } fn via_const() { - #[repr(C)] struct Src; - #[repr(C)] struct Dst; + #[repr(C)] + struct Src; + #[repr(C)] + struct Dst; const FALSE: bool = false; diff --git a/tests/ui/transmutability/issue-101739-2.stderr b/tests/ui/transmutability/issue-101739-2.stderr index 6b0a36a414b..526fcabe14e 100644 --- a/tests/ui/transmutability/issue-101739-2.stderr +++ b/tests/ui/transmutability/issue-101739-2.stderr @@ -1,16 +1,23 @@ error[E0107]: trait takes at most 2 generic arguments but 5 generic arguments were supplied --> $DIR/issue-101739-2.rs:17:14 | -LL | Dst: BikeshedIntrinsicFrom< - | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments -LL | Src, -LL | ASSUME_ALIGNMENT, - | _____________________________- -LL | | ASSUME_LIFETIMES, -LL | | ASSUME_VALIDITY, -LL | | ASSUME_VISIBILITY, - | |_____________________________- help: remove the unnecessary generic arguments +LL | Dst: TransmuteFrom< + | ^^^^^^^^^^^^^ expected at most 2 generic arguments +... +LL | ASSUME_ALIGNMENT, + | _________________________________- +LL | | ASSUME_LIFETIMES, +LL | | ASSUME_VALIDITY, +LL | | ASSUME_VISIBILITY, + | |_________________________________- help: remove the unnecessary generic arguments -error: aborting due to 1 previous error +error[E0308]: mismatched types + --> $DIR/issue-101739-2.rs:20:17 + | +LL | ASSUME_ALIGNMENT, + | ^^^^^^^^^^^^^^^^ expected `Assume`, found `bool` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0107`. +Some errors have detailed explanations: E0107, E0308. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/transmutability/issue-110467.rs b/tests/ui/transmutability/issue-110467.rs index 1f9e521c24b..4acea5f766d 100644 --- a/tests/ui/transmutability/issue-110467.rs +++ b/tests/ui/transmutability/issue-110467.rs @@ -1,11 +1,11 @@ //@ check-pass #![crate_type = "lib"] #![feature(transmutability)] -use std::mem::BikeshedIntrinsicFrom; +use std::mem::TransmuteFrom; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src>, + Dst: TransmuteFrom<Src>, { } diff --git a/tests/ui/transmutability/issue-110892.rs b/tests/ui/transmutability/issue-110892.rs index 9713684c959..ad1b9e7af10 100644 --- a/tests/ui/transmutability/issue-110892.rs +++ b/tests/ui/transmutability/issue-110892.rs @@ -3,7 +3,7 @@ #![allow(incomplete_features)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable< Src, @@ -14,7 +14,7 @@ mod assert { const ASSUME_VALIDITY: bool, >() where - Dst: BikeshedIntrinsicFrom< + Dst: TransmuteFrom< Src, { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } >, diff --git a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs index 30c381745d0..07133aa5614 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.rs @@ -2,7 +2,7 @@ #![crate_type = "lib"] -use std::mem::BikeshedIntrinsicFrom; +use std::mem::TransmuteFrom; //~^ ERROR use of unstable library feature 'transmutability' [E0658] use std::mem::Assume; diff --git a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr index 9f221907172..a2096cd53e5 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr +++ b/tests/ui/transmutability/malformed-program-gracefulness/feature-missing.stderr @@ -1,8 +1,8 @@ error[E0658]: use of unstable library feature 'transmutability' --> $DIR/feature-missing.rs:5:5 | -LL | use std::mem::BikeshedIntrinsicFrom; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | use std::mem::TransmuteFrom; + | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information = help: add `#![feature(transmutability)]` to the crate attributes to enable diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs index bcfbc1430a8..b8828c59d35 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs @@ -5,11 +5,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src> + Dst: TransmuteFrom<Src> {} } diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst_field.rs b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst_field.rs new file mode 100644 index 00000000000..2285d2f532e --- /dev/null +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst_field.rs @@ -0,0 +1,26 @@ +// An unknown destination type should be gracefully handled. + +#![crate_type = "lib"] +#![feature(transmutability)] +#![allow(incomplete_features)] + +mod assert { + use std::mem::TransmuteFrom; + + pub fn is_transmutable<Src, Dst>() + where + Dst: TransmuteFrom<Src> + {} +} + +fn should_gracefully_handle_unknown_dst_field() { + #[repr(C)] struct Src; + #[repr(C)] struct Dst(Missing); //~ cannot find type + assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted +} + +fn should_gracefully_handle_unknown_dst_ref_field() { + #[repr(C)] struct Src(&'static Src); + #[repr(C)] struct Dst(&'static Missing); //~ cannot find type + assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted +} diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst_field.stderr b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst_field.stderr new file mode 100644 index 00000000000..564aee687a5 --- /dev/null +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_dst_field.stderr @@ -0,0 +1,46 @@ +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/unknown_dst_field.rs:18:27 + | +LL | #[repr(C)] struct Dst(Missing); + | ^^^^^^^ not found in this scope + +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/unknown_dst_field.rs:24:36 + | +LL | #[repr(C)] struct Dst(&'static Missing); + | ^^^^^^^ not found in this scope + +error[E0277]: `should_gracefully_handle_unknown_dst_field::Src` cannot be safely transmuted into `should_gracefully_handle_unknown_dst_field::Dst` + --> $DIR/unknown_dst_field.rs:19:36 + | +LL | assert::is_transmutable::<Src, Dst>(); + | ^^^ `should_gracefully_handle_unknown_dst_field::Dst` has an unknown layout + | +note: required by a bound in `is_transmutable` + --> $DIR/unknown_dst_field.rs:12:14 + | +LL | pub fn is_transmutable<Src, Dst>() + | --------------- required by a bound in this function +LL | where +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `should_gracefully_handle_unknown_dst_ref_field::Src` cannot be safely transmuted into `should_gracefully_handle_unknown_dst_ref_field::Dst` + --> $DIR/unknown_dst_field.rs:25:36 + | +LL | assert::is_transmutable::<Src, Dst>(); + | ^^^ `should_gracefully_handle_unknown_dst_ref_field::Dst` has an unknown layout + | +note: required by a bound in `is_transmutable` + --> $DIR/unknown_dst_field.rs:12:14 + | +LL | pub fn is_transmutable<Src, Dst>() + | --------------- required by a bound in this function +LL | where +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0277, E0412. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs index bd7c3fc7fb5..10ba7a61b87 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src.rs @@ -5,11 +5,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src> + Dst: TransmuteFrom<Src> {} } diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs index 58c16d773e1..598e04971e2 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs @@ -5,16 +5,22 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src> + Dst: TransmuteFrom<Src> {} } -fn should_gracefully_handle_unknown_dst_field() { - #[repr(C)] struct Src; - #[repr(C)] struct Dst(Missing); //~ cannot find type +fn should_gracefully_handle_unknown_src_field() { + #[repr(C)] struct Src(Missing); //~ cannot find type + #[repr(C)] struct Dst(); + assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted +} + +fn should_gracefully_handle_unknown_src_ref_field() { + #[repr(C)] struct Src(&'static Missing); //~ cannot find type + #[repr(C)] struct Dst(&'static Dst); assert::is_transmutable::<Src, Dst>(); //~ ERROR cannot be safely transmuted } diff --git a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.stderr b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.stderr index cabc7bcfef7..1156391c301 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.stderr +++ b/tests/ui/transmutability/malformed-program-gracefulness/unknown_src_field.stderr @@ -1,14 +1,35 @@ error[E0412]: cannot find type `Missing` in this scope - --> $DIR/unknown_src_field.rs:18:27 + --> $DIR/unknown_src_field.rs:17:27 | -LL | #[repr(C)] struct Dst(Missing); +LL | #[repr(C)] struct Src(Missing); | ^^^^^^^ not found in this scope -error[E0277]: `Src` cannot be safely transmuted into `Dst` +error[E0412]: cannot find type `Missing` in this scope + --> $DIR/unknown_src_field.rs:23:36 + | +LL | #[repr(C)] struct Src(&'static Missing); + | ^^^^^^^ not found in this scope + +error[E0277]: `should_gracefully_handle_unknown_src_field::Src` cannot be safely transmuted into `should_gracefully_handle_unknown_src_field::Dst` --> $DIR/unknown_src_field.rs:19:36 | LL | assert::is_transmutable::<Src, Dst>(); - | ^^^ analyzing the transmutability of `Dst` is not yet supported + | ^^^ `should_gracefully_handle_unknown_src_field::Src` has an unknown layout + | +note: required by a bound in `is_transmutable` + --> $DIR/unknown_src_field.rs:12:14 + | +LL | pub fn is_transmutable<Src, Dst>() + | --------------- required by a bound in this function +LL | where +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` + +error[E0277]: `should_gracefully_handle_unknown_src_ref_field::Src` cannot be safely transmuted into `should_gracefully_handle_unknown_src_ref_field::Dst` + --> $DIR/unknown_src_field.rs:25:36 + | +LL | assert::is_transmutable::<Src, Dst>(); + | ^^^ `should_gracefully_handle_unknown_src_ref_field::Src` has an unknown layout | note: required by a bound in `is_transmutable` --> $DIR/unknown_src_field.rs:12:14 @@ -16,10 +37,10 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0277, E0412. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs b/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs index 608366fa089..df925975bad 100644 --- a/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs +++ b/tests/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs @@ -8,7 +8,7 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable< Src, @@ -19,7 +19,7 @@ mod assert { const ASSUME_VALIDITY: bool, >() where - Dst: BikeshedIntrinsicFrom< + Dst: TransmuteFrom< Src, { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } >, diff --git a/tests/ui/transmutability/maybeuninit.rs b/tests/ui/transmutability/maybeuninit.rs index 77c3381c774..7b60785b7e0 100644 --- a/tests/ui/transmutability/maybeuninit.rs +++ b/tests/ui/transmutability/maybeuninit.rs @@ -5,11 +5,11 @@ use std::mem::MaybeUninit; mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + Dst: TransmuteFrom<Src, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/maybeuninit.stderr b/tests/ui/transmutability/maybeuninit.stderr index be7dcaf35ea..897c2df10a8 100644 --- a/tests/ui/transmutability/maybeuninit.stderr +++ b/tests/ui/transmutability/maybeuninit.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/primitives/bool-mut.rs b/tests/ui/transmutability/primitives/bool-mut.rs index 09b6d582d87..0a7dad37aaf 100644 --- a/tests/ui/transmutability/primitives/bool-mut.rs +++ b/tests/ui/transmutability/primitives/bool-mut.rs @@ -2,11 +2,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + Dst: TransmuteFrom<Src, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/primitives/bool-mut.stderr b/tests/ui/transmutability/primitives/bool-mut.stderr index a6cf146659e..fcf60bc979c 100644 --- a/tests/ui/transmutability/primitives/bool-mut.stderr +++ b/tests/ui/transmutability/primitives/bool-mut.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/primitives/bool.current.stderr b/tests/ui/transmutability/primitives/bool.current.stderr index da6a4a44e95..2945cdaad40 100644 --- a/tests/ui/transmutability/primitives/bool.current.stderr +++ b/tests/ui/transmutability/primitives/bool.current.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/primitives/bool.next.stderr b/tests/ui/transmutability/primitives/bool.next.stderr index da6a4a44e95..2945cdaad40 100644 --- a/tests/ui/transmutability/primitives/bool.next.stderr +++ b/tests/ui/transmutability/primitives/bool.next.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/primitives/bool.rs b/tests/ui/transmutability/primitives/bool.rs index 19236a1ae2e..6fac8ba1ad1 100644 --- a/tests/ui/transmutability/primitives/bool.rs +++ b/tests/ui/transmutability/primitives/bool.rs @@ -4,16 +4,16 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + Dst: TransmuteFrom<Src, { Assume::SAFETY }> {} pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> + Dst: TransmuteFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> {} } diff --git a/tests/ui/transmutability/primitives/numbers.current.stderr b/tests/ui/transmutability/primitives/numbers.current.stderr index 0a9b9d182f8..efb2ce8c772 100644 --- a/tests/ui/transmutability/primitives/numbers.current.stderr +++ b/tests/ui/transmutability/primitives/numbers.current.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u16` --> $DIR/numbers.rs:65:40 @@ -25,8 +25,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:66:40 @@ -40,8 +40,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:67:40 @@ -55,8 +55,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:68:40 @@ -70,8 +70,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:69:40 @@ -85,8 +85,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:70:40 @@ -100,8 +100,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:71:40 @@ -115,8 +115,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:72:39 @@ -130,8 +130,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:73:39 @@ -145,8 +145,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i16` --> $DIR/numbers.rs:75:40 @@ -160,8 +160,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u16` --> $DIR/numbers.rs:76:40 @@ -175,8 +175,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:77:40 @@ -190,8 +190,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:78:40 @@ -205,8 +205,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:79:40 @@ -220,8 +220,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:80:40 @@ -235,8 +235,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:81:40 @@ -250,8 +250,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:82:40 @@ -265,8 +265,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:83:39 @@ -280,8 +280,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:84:39 @@ -295,8 +295,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:86:40 @@ -310,8 +310,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:87:40 @@ -325,8 +325,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:88:40 @@ -340,8 +340,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:89:40 @@ -355,8 +355,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:90:40 @@ -370,8 +370,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:91:40 @@ -385,8 +385,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:92:39 @@ -400,8 +400,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:93:39 @@ -415,8 +415,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:95:40 @@ -430,8 +430,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:96:40 @@ -445,8 +445,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:97:40 @@ -460,8 +460,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:98:40 @@ -475,8 +475,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:99:40 @@ -490,8 +490,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:100:40 @@ -505,8 +505,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:101:39 @@ -520,8 +520,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:102:39 @@ -535,8 +535,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:104:40 @@ -550,8 +550,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:105:40 @@ -565,8 +565,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:106:40 @@ -580,8 +580,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:107:39 @@ -595,8 +595,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:108:39 @@ -610,8 +610,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:110:40 @@ -625,8 +625,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:111:40 @@ -640,8 +640,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:112:40 @@ -655,8 +655,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:113:39 @@ -670,8 +670,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:114:39 @@ -685,8 +685,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:116:40 @@ -700,8 +700,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:117:40 @@ -715,8 +715,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:118:40 @@ -730,8 +730,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:119:39 @@ -745,8 +745,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:120:39 @@ -760,8 +760,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:122:39 @@ -775,8 +775,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:123:39 @@ -790,8 +790,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:125:39 @@ -805,8 +805,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:126:39 @@ -820,8 +820,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:128:39 @@ -835,8 +835,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:129:39 @@ -850,8 +850,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 57 previous errors diff --git a/tests/ui/transmutability/primitives/numbers.next.stderr b/tests/ui/transmutability/primitives/numbers.next.stderr index 0a9b9d182f8..efb2ce8c772 100644 --- a/tests/ui/transmutability/primitives/numbers.next.stderr +++ b/tests/ui/transmutability/primitives/numbers.next.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u16` --> $DIR/numbers.rs:65:40 @@ -25,8 +25,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:66:40 @@ -40,8 +40,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:67:40 @@ -55,8 +55,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:68:40 @@ -70,8 +70,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:69:40 @@ -85,8 +85,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:70:40 @@ -100,8 +100,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:71:40 @@ -115,8 +115,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:72:39 @@ -130,8 +130,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i8` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:73:39 @@ -145,8 +145,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i16` --> $DIR/numbers.rs:75:40 @@ -160,8 +160,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u16` --> $DIR/numbers.rs:76:40 @@ -175,8 +175,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:77:40 @@ -190,8 +190,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:78:40 @@ -205,8 +205,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:79:40 @@ -220,8 +220,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:80:40 @@ -235,8 +235,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:81:40 @@ -250,8 +250,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:82:40 @@ -265,8 +265,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:83:39 @@ -280,8 +280,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u8` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:84:39 @@ -295,8 +295,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:86:40 @@ -310,8 +310,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:87:40 @@ -325,8 +325,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:88:40 @@ -340,8 +340,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:89:40 @@ -355,8 +355,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:90:40 @@ -370,8 +370,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:91:40 @@ -385,8 +385,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:92:39 @@ -400,8 +400,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i16` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:93:39 @@ -415,8 +415,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `i32` --> $DIR/numbers.rs:95:40 @@ -430,8 +430,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `f32` --> $DIR/numbers.rs:96:40 @@ -445,8 +445,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `u32` --> $DIR/numbers.rs:97:40 @@ -460,8 +460,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:98:40 @@ -475,8 +475,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:99:40 @@ -490,8 +490,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:100:40 @@ -505,8 +505,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:101:39 @@ -520,8 +520,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u16` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:102:39 @@ -535,8 +535,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:104:40 @@ -550,8 +550,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:105:40 @@ -565,8 +565,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:106:40 @@ -580,8 +580,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:107:39 @@ -595,8 +595,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:108:39 @@ -610,8 +610,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:110:40 @@ -625,8 +625,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:111:40 @@ -640,8 +640,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:112:40 @@ -655,8 +655,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:113:39 @@ -670,8 +670,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:114:39 @@ -685,8 +685,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `u64` --> $DIR/numbers.rs:116:40 @@ -700,8 +700,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `i64` --> $DIR/numbers.rs:117:40 @@ -715,8 +715,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `f64` --> $DIR/numbers.rs:118:40 @@ -730,8 +730,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:119:39 @@ -745,8 +745,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u32` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:120:39 @@ -760,8 +760,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:122:39 @@ -775,8 +775,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `u64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:123:39 @@ -790,8 +790,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:125:39 @@ -805,8 +805,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `i64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:126:39 @@ -820,8 +820,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f64` cannot be safely transmuted into `u128` --> $DIR/numbers.rs:128:39 @@ -835,8 +835,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `f64` cannot be safely transmuted into `i128` --> $DIR/numbers.rs:129:39 @@ -850,8 +850,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 57 previous errors diff --git a/tests/ui/transmutability/primitives/numbers.rs b/tests/ui/transmutability/primitives/numbers.rs index 401502474cf..b5c21c992b6 100644 --- a/tests/ui/transmutability/primitives/numbers.rs +++ b/tests/ui/transmutability/primitives/numbers.rs @@ -7,11 +7,11 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src> + Dst: TransmuteFrom<Src> {} } diff --git a/tests/ui/transmutability/primitives/unit.current.stderr b/tests/ui/transmutability/primitives/unit.current.stderr index 52b708d680e..4bfb229832b 100644 --- a/tests/ui/transmutability/primitives/unit.current.stderr +++ b/tests/ui/transmutability/primitives/unit.current.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/primitives/unit.next.stderr b/tests/ui/transmutability/primitives/unit.next.stderr index 52b708d680e..4bfb229832b 100644 --- a/tests/ui/transmutability/primitives/unit.next.stderr +++ b/tests/ui/transmutability/primitives/unit.next.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/primitives/unit.rs b/tests/ui/transmutability/primitives/unit.rs index 44216950f55..93b21e0b586 100644 --- a/tests/ui/transmutability/primitives/unit.rs +++ b/tests/ui/transmutability/primitives/unit.rs @@ -9,11 +9,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/references/accept_assume_lifetime_extension.rs b/tests/ui/transmutability/references/accept_assume_lifetime_extension.rs new file mode 100644 index 00000000000..edad02fc96d --- /dev/null +++ b/tests/ui/transmutability/references/accept_assume_lifetime_extension.rs @@ -0,0 +1,91 @@ +//@ check-pass + +//! Accept lifetime extensions with `Assume::LIFETIMES`. + +#![feature(transmutability, core_intrinsics)] + +use std::mem::{Assume, TransmuteFrom}; + +unsafe fn transmute<Src, Dst>(src: Src) -> Dst +where + Dst: TransmuteFrom<Src, { Assume::SAFETY.and(Assume::LIFETIMES) }>, +{ + core::intrinsics::transmute_unchecked(src) +} + +mod bare { + use super::*; + + fn extend_bare<'a>(src: &'a u8) -> &'static u8 { + unsafe { transmute(src) } + } +} + +mod nested { + use super::*; + + fn extend_nested<'a>(src: &'a &'a u8) -> &'a &'static u8 { + unsafe { transmute(src) } + } +} + +mod tuple { + use super::*; + + fn extend_unit<'a>(src: (&'a u8,)) -> (&'static u8,) { + unsafe { transmute(src) } + } + + fn extend_pair<'a>(src: (&'a u8, u8)) -> (&'static u8, u8) { + unsafe { transmute(src) } + } +} + +mod r#struct { + use super::*; + + struct Struct<'a>(&'a u8); + + fn extend_struct<'a>(src: Struct<'a>) -> Struct<'static> { + unsafe { transmute(src) } + } +} + +mod r#enum { + use super::*; + + enum Single<'a> { + A(&'a u8), + } + + fn extend_single<'a>(src: Single<'a>) -> Single<'static> { + unsafe { transmute(src) } + } + + enum Multi<'a> { + A(&'a u8), + B, + C, + } + + fn extend_multi<'a>(src: Multi<'a>) -> Multi<'static> { + unsafe { transmute(src) } + } +} + +mod hrtb { + use super::*; + + fn call_extend_hrtb<'a>(src: &'a u8) -> &'static u8 { + unsafe { extend_hrtb(src) } + } + + unsafe fn extend_hrtb<'a>(src: &'a u8) -> &'static u8 + where + for<'b> &'b u8: TransmuteFrom<&'a u8, { Assume::LIFETIMES }>, + { + core::intrinsics::transmute_unchecked(src) + } +} + +fn main() {} diff --git a/tests/ui/transmutability/references/accept_unexercised_lifetime_extension.rs b/tests/ui/transmutability/references/accept_unexercised_lifetime_extension.rs new file mode 100644 index 00000000000..5734575e90b --- /dev/null +++ b/tests/ui/transmutability/references/accept_unexercised_lifetime_extension.rs @@ -0,0 +1,68 @@ +//@ check-pass + +//! Accept lifetime extensions of un-exercised lifetimes. + +#![feature(transmutability, core_intrinsics)] + +use std::mem::{Assume, TransmuteFrom}; + +unsafe fn transmute<Src, Dst>(src: Src) -> Dst +where + Dst: TransmuteFrom<Src, { Assume::SAFETY }>, +{ + core::intrinsics::transmute_unchecked(src) +} + +enum Void {} + +mod phantom { + use super::*; + use std::marker::PhantomData; + + fn extend_bare<'a>(src: PhantomData<&'a u8>) -> PhantomData<&'static u8> { + unsafe { transmute(src) } + } +} + + +mod tuple { + use super::*; + + fn extend_pair<'a>(src: (&'a u8, Void)) -> (&'static u8, Void) { + unsafe { transmute(src) } + } +} + +mod r#struct { + use super::*; + + struct Struct<'a>(&'a u8, Void); + + fn extend_struct<'a>(src: Struct<'a>) -> Struct<'static> { + unsafe { transmute(src) } + } +} + +mod r#enum { + use super::*; + + enum Single<'a> { + A(&'a u8, Void), + } + + fn extend_single<'a>(src: Single<'a>) -> Single<'static> { + unsafe { transmute(src) } + } + + enum Multi<'a> { + A(&'a u8, Void), + B, + C, + } + + fn extend_multi<'a>(src: Multi<'a>) -> Multi<'static> { + unsafe { transmute(src) } + } +} + +fn main() {} diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs index ba2db755e3b..92068ee0d4f 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs @@ -2,11 +2,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: false, diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.stderr b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.stderr index 4b2866dc4f0..1698021d554 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.stderr +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs index cd70c278285..8e2da3518a9 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs @@ -2,11 +2,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: false, diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.rs b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.rs index 2f264e8339e..01b176cc3c1 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.rs @@ -2,11 +2,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: false, diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr index 2b7cab1660d..dbd3e39b365 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr +++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-incompatible.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/references/recursive-wrapper-types.rs b/tests/ui/transmutability/references/recursive-wrapper-types.rs index 28f4d6661cb..53dedeb6388 100644 --- a/tests/ui/transmutability/references/recursive-wrapper-types.rs +++ b/tests/ui/transmutability/references/recursive-wrapper-types.rs @@ -2,11 +2,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: false, diff --git a/tests/ui/transmutability/references/reject_extension.rs b/tests/ui/transmutability/references/reject_extension.rs index 161da5772e8..dd02e5c01c4 100644 --- a/tests/ui/transmutability/references/reject_extension.rs +++ b/tests/ui/transmutability/references/reject_extension.rs @@ -6,11 +6,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom< + Dst: TransmuteFrom< Src, { Assume { diff --git a/tests/ui/transmutability/references/reject_extension.stderr b/tests/ui/transmutability/references/reject_extension.stderr index 88dd0313e3c..182106acf12 100644 --- a/tests/ui/transmutability/references/reject_extension.stderr +++ b/tests/ui/transmutability/references/reject_extension.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom< +LL | Dst: TransmuteFrom< | ______________^ LL | | Src, LL | | { diff --git a/tests/ui/transmutability/references/reject_lifetime_extension.rs b/tests/ui/transmutability/references/reject_lifetime_extension.rs new file mode 100644 index 00000000000..ff9290c34af --- /dev/null +++ b/tests/ui/transmutability/references/reject_lifetime_extension.rs @@ -0,0 +1,91 @@ +//@ check-fail + +//! Reject lifetime extensions. + +#![feature(transmutability, core_intrinsics)] + +use std::mem::{Assume, TransmuteFrom}; + +unsafe fn transmute<Src, Dst>(src: Src) -> Dst +where + Dst: TransmuteFrom<Src, { Assume::SAFETY }>, +{ + core::intrinsics::transmute_unchecked(src) +} + +mod bare { + use super::*; + + fn extend_bare<'a>(src: &'a u8) -> &'static u8 { + unsafe { transmute(src) } //~ ERROR lifetime may not live long enough + } +} + +mod nested { + use super::*; + + fn extend_nested<'a>(src: &'a &'a u8) -> &'a &'static u8 { + unsafe { transmute(src) } //~ ERROR lifetime may not live long enough + } +} + +mod tuple { + use super::*; + + fn extend_unit<'a>(src: (&'a u8,)) -> (&'static u8,) { + unsafe { transmute(src) } //~ ERROR lifetime may not live long enough + } + + fn extend_pair<'a>(src: (&'a u8, u8)) -> (&'static u8, u8) { + unsafe { transmute(src) } //~ ERROR lifetime may not live long enough + } +} + +mod r#struct { + use super::*; + + struct Struct<'a>(&'a u8); + + fn extend_struct<'a>(src: Struct<'a>) -> Struct<'static> { + unsafe { transmute(src) } //~ ERROR lifetime may not live long enough + } +} + +mod r#enum { + use super::*; + + enum Single<'a> { + A(&'a u8), + } + + fn extend_single<'a>(src: Single<'a>) -> Single<'static> { + unsafe { transmute(src) } //~ ERROR lifetime may not live long enough + } + + enum Multi<'a> { + A(&'a u8), + B, + C, + } + + fn extend_multi<'a>(src: Multi<'a>) -> Multi<'static> { + unsafe { transmute(src) } //~ ERROR lifetime may not live long enough + } +} + +mod hrtb { + use super::*; + + fn call_extend_hrtb<'a>(src: &'a u8) -> &'static u8 { + unsafe { extend_hrtb(src) } //~ ERROR borrowed data escapes outside of function + } + + unsafe fn extend_hrtb<'a>(src: &'a u8) -> &'static u8 + where + for<'b> &'b u8: TransmuteFrom<&'a u8>, + { + core::intrinsics::transmute_unchecked(src) + } +} + +fn main() {} diff --git a/tests/ui/transmutability/references/reject_lifetime_extension.stderr b/tests/ui/transmutability/references/reject_lifetime_extension.stderr new file mode 100644 index 00000000000..a597041c6ca --- /dev/null +++ b/tests/ui/transmutability/references/reject_lifetime_extension.stderr @@ -0,0 +1,78 @@ +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:20:18 + | +LL | fn extend_bare<'a>(src: &'a u8) -> &'static u8 { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:28:18 + | +LL | fn extend_nested<'a>(src: &'a &'a u8) -> &'a &'static u8 { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:36:18 + | +LL | fn extend_unit<'a>(src: (&'a u8,)) -> (&'static u8,) { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:40:18 + | +LL | fn extend_pair<'a>(src: (&'a u8, u8)) -> (&'static u8, u8) { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:50:18 + | +LL | fn extend_struct<'a>(src: Struct<'a>) -> Struct<'static> { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:62:18 + | +LL | fn extend_single<'a>(src: Single<'a>) -> Single<'static> { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/reject_lifetime_extension.rs:72:18 + | +LL | fn extend_multi<'a>(src: Multi<'a>) -> Multi<'static> { + | -- lifetime `'a` defined here +LL | unsafe { transmute(src) } + | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` + +error[E0521]: borrowed data escapes outside of function + --> $DIR/reject_lifetime_extension.rs:80:18 + | +LL | fn call_extend_hrtb<'a>(src: &'a u8) -> &'static u8 { + | -- --- `src` is a reference that is only valid in the function body + | | + | lifetime `'a` defined here +LL | unsafe { extend_hrtb(src) } + | ^^^^^^^^^^^^^^^^ + | | + | `src` escapes the function body here + | argument requires that `'a` must outlive `'static` + | +note: due to current limitations in the borrow checker, this implies a `'static` lifetime + --> $DIR/reject_lifetime_extension.rs:85:25 + | +LL | for<'b> &'b u8: TransmuteFrom<&'a u8>, + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0521`. diff --git a/tests/ui/transmutability/references/u8-to-unit.rs b/tests/ui/transmutability/references/u8-to-unit.rs index 017b73d9595..98deb6457cb 100644 --- a/tests/ui/transmutability/references/u8-to-unit.rs +++ b/tests/ui/transmutability/references/u8-to-unit.rs @@ -2,11 +2,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: false, lifetimes: true, diff --git a/tests/ui/transmutability/references/unit-to-itself.rs b/tests/ui/transmutability/references/unit-to-itself.rs index 40aec8418fe..789455c03ea 100644 --- a/tests/ui/transmutability/references/unit-to-itself.rs +++ b/tests/ui/transmutability/references/unit-to-itself.rs @@ -2,11 +2,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: false, diff --git a/tests/ui/transmutability/references/unit-to-u8.rs b/tests/ui/transmutability/references/unit-to-u8.rs index 973d3206c12..575a40e3622 100644 --- a/tests/ui/transmutability/references/unit-to-u8.rs +++ b/tests/ui/transmutability/references/unit-to-u8.rs @@ -2,11 +2,11 @@ #![feature(transmutability)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/references/unit-to-u8.stderr b/tests/ui/transmutability/references/unit-to-u8.stderr index 5d73dfdc8eb..b5a79b1917f 100644 --- a/tests/ui/transmutability/references/unit-to-u8.stderr +++ b/tests/ui/transmutability/references/unit-to-u8.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/references/unsafecell.rs b/tests/ui/transmutability/references/unsafecell.rs index a8a1f969fb4..4001f139770 100644 --- a/tests/ui/transmutability/references/unsafecell.rs +++ b/tests/ui/transmutability/references/unsafecell.rs @@ -5,11 +5,11 @@ use std::cell::UnsafeCell; mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + Dst: TransmuteFrom<Src, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/references/unsafecell.stderr b/tests/ui/transmutability/references/unsafecell.stderr index 8bb32359355..6664d8a7d6f 100644 --- a/tests/ui/transmutability/references/unsafecell.stderr +++ b/tests/ui/transmutability/references/unsafecell.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error[E0277]: `&UnsafeCell<u8>` cannot be safely transmuted into `&UnsafeCell<u8>` --> $DIR/unsafecell.rs:29:62 @@ -25,8 +25,8 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error: aborting due to 2 previous errors diff --git a/tests/ui/transmutability/region-infer.rs b/tests/ui/transmutability/region-infer.rs index 0632bc53176..c164f35c447 100644 --- a/tests/ui/transmutability/region-infer.rs +++ b/tests/ui/transmutability/region-infer.rs @@ -1,13 +1,13 @@ #![feature(transmutability)] -use std::mem::{Assume, BikeshedIntrinsicFrom}; +use std::mem::{Assume, TransmuteFrom}; #[repr(C)] struct W<'a>(&'a ()); fn test<'a>() where - W<'a>: BikeshedIntrinsicFrom< + W<'a>: TransmuteFrom< (), { Assume { alignment: true, lifetimes: true, safety: true, validity: true } }, >, diff --git a/tests/ui/transmutability/region-infer.stderr b/tests/ui/transmutability/region-infer.stderr index 03c46823838..09ecf484bc8 100644 --- a/tests/ui/transmutability/region-infer.stderr +++ b/tests/ui/transmutability/region-infer.stderr @@ -10,7 +10,7 @@ note: required by a bound in `test` LL | fn test<'a>() | ---- required by a bound in this function LL | where -LL | W<'a>: BikeshedIntrinsicFrom< +LL | W<'a>: TransmuteFrom< | ____________^ LL | | (), LL | | { Assume { alignment: true, lifetimes: true, safety: true, validity: true } }, diff --git a/tests/ui/transmutability/safety/assume/should_accept_if_dst_has_safety_invariant.rs b/tests/ui/transmutability/safety/assume/should_accept_if_dst_has_safety_invariant.rs index cb3c1cdf46c..0113049f51e 100644 --- a/tests/ui/transmutability/safety/assume/should_accept_if_dst_has_safety_invariant.rs +++ b/tests/ui/transmutability/safety/assume/should_accept_if_dst_has_safety_invariant.rs @@ -8,11 +8,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + Dst: TransmuteFrom<Src, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs index b12c4a10d12..eca7a06559d 100644 --- a/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs +++ b/tests/ui/transmutability/safety/assume/should_accept_if_ref_src_has_safety_invariant.rs @@ -8,11 +8,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + Dst: TransmuteFrom<Src, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/safety/assume/should_accept_if_src_has_safety_invariant.rs b/tests/ui/transmutability/safety/assume/should_accept_if_src_has_safety_invariant.rs index ff01462ffec..46e84b48044 100644 --- a/tests/ui/transmutability/safety/assume/should_accept_if_src_has_safety_invariant.rs +++ b/tests/ui/transmutability/safety/assume/should_accept_if_src_has_safety_invariant.rs @@ -8,11 +8,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + Dst: TransmuteFrom<Src, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/safety/should_accept_if_src_has_safety_invariant.rs b/tests/ui/transmutability/safety/should_accept_if_src_has_safety_invariant.rs index d516e9a7da5..aaba6febde4 100644 --- a/tests/ui/transmutability/safety/should_accept_if_src_has_safety_invariant.rs +++ b/tests/ui/transmutability/safety/should_accept_if_src_has_safety_invariant.rs @@ -8,11 +8,11 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src> // safety is NOT assumed + Dst: TransmuteFrom<Src> // safety is NOT assumed {} } diff --git a/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.rs b/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.rs index 4f0aee31548..6f8e383db1f 100644 --- a/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.rs +++ b/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.rs @@ -6,11 +6,11 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src> // safety is NOT assumed + Dst: TransmuteFrom<Src> // safety is NOT assumed {} } diff --git a/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.stderr b/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.stderr index 2339c268326..6445b1e146e 100644 --- a/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.stderr +++ b/tests/ui/transmutability/safety/should_reject_if_dst_has_safety_invariant.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> // safety is NOT assumed - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> // safety is NOT assumed + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.rs b/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.rs index 126059dd7b7..16d163d5420 100644 --- a/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.rs +++ b/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.rs @@ -6,11 +6,11 @@ #![allow(dead_code)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::TransmuteFrom; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src> // safety is NOT assumed + Dst: TransmuteFrom<Src> // safety is NOT assumed {} } diff --git a/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.stderr b/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.stderr index 99feebe9211..38ef829f064 100644 --- a/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.stderr +++ b/tests/ui/transmutability/safety/should_reject_if_ref_src_has_safety_invariant.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src> // safety is NOT assumed - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src> // safety is NOT assumed + | ^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/structs/repr/should_handle_align.rs b/tests/ui/transmutability/structs/repr/should_handle_align.rs index 0c207766045..03065298b50 100644 --- a/tests/ui/transmutability/structs/repr/should_handle_align.rs +++ b/tests/ui/transmutability/structs/repr/should_handle_align.rs @@ -6,11 +6,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/structs/repr/should_handle_all.rs b/tests/ui/transmutability/structs/repr/should_handle_all.rs index 52c24eecf12..e5ca37e68ec 100644 --- a/tests/ui/transmutability/structs/repr/should_handle_all.rs +++ b/tests/ui/transmutability/structs/repr/should_handle_all.rs @@ -6,11 +6,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/structs/repr/should_handle_packed.rs b/tests/ui/transmutability/structs/repr/should_handle_packed.rs index 4af32d6e84e..c9be32d7b2a 100644 --- a/tests/ui/transmutability/structs/repr/should_handle_packed.rs +++ b/tests/ui/transmutability/structs/repr/should_handle_packed.rs @@ -6,11 +6,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.rs b/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.rs index 64110753832..8d291054365 100644 --- a/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.rs +++ b/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.rs @@ -7,11 +7,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src>, + Dst: TransmuteFrom<Src>, { } } @@ -22,5 +22,4 @@ fn should_pad_explicitly_packed_field() { //~^ ERROR: recursive type assert::is_maybe_transmutable::<ExplicitlyPadded, ()>(); - //~^ ERROR: cannot be safely transmuted } diff --git a/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.stderr b/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.stderr index ebfb5361143..bdf2d3b6a58 100644 --- a/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.stderr +++ b/tests/ui/transmutability/structs/repr/transmute_infinitely_recursive_type.stderr @@ -12,25 +12,10 @@ LL | struct ExplicitlyPadded(Box<ExplicitlyPadded>); error[E0391]: cycle detected when computing layout of `should_pad_explicitly_packed_field::ExplicitlyPadded` | = note: ...which immediately requires computing layout of `should_pad_explicitly_packed_field::ExplicitlyPadded` again - = note: cycle used when evaluating trait selection obligation `(): core::mem::transmutability::BikeshedIntrinsicFrom<should_pad_explicitly_packed_field::ExplicitlyPadded, core::mem::transmutability::Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` + = note: cycle used when evaluating trait selection obligation `(): core::mem::transmutability::TransmuteFrom<should_pad_explicitly_packed_field::ExplicitlyPadded, core::mem::transmutability::Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error[E0277]: `ExplicitlyPadded` cannot be safely transmuted into `()` - --> $DIR/transmute_infinitely_recursive_type.rs:24:55 - | -LL | assert::is_maybe_transmutable::<ExplicitlyPadded, ()>(); - | ^^ analyzing the transmutability of `ExplicitlyPadded` is not yet supported - | -note: required by a bound in `is_maybe_transmutable` - --> $DIR/transmute_infinitely_recursive_type.rs:14:14 - | -LL | pub fn is_maybe_transmutable<Src, Dst>() - | --------------------- required by a bound in this function -LL | where -LL | Dst: BikeshedIntrinsicFrom<Src>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0072, E0277, E0391. +Some errors have detailed explanations: E0072, E0391. For more information about an error, try `rustc --explain E0072`. diff --git a/tests/ui/transmutability/structs/should_order_fields_correctly.rs b/tests/ui/transmutability/structs/should_order_fields_correctly.rs index 3675e4330ec..aa9ca39eff2 100644 --- a/tests/ui/transmutability/structs/should_order_fields_correctly.rs +++ b/tests/ui/transmutability/structs/should_order_fields_correctly.rs @@ -6,11 +6,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/transmute-padding-ice.rs b/tests/ui/transmutability/transmute-padding-ice.rs index f5935a0009e..133241c89cb 100644 --- a/tests/ui/transmutability/transmute-padding-ice.rs +++ b/tests/ui/transmutability/transmute-padding-ice.rs @@ -9,11 +9,11 @@ use std::mem::size_of; mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom< + Dst: TransmuteFrom< Src, { Assume { alignment: true, lifetimes: true, safety: true, validity: true } }, >, diff --git a/tests/ui/transmutability/uninhabited.rs b/tests/ui/transmutability/uninhabited.rs index 7524922c16a..74f7a1a2e89 100644 --- a/tests/ui/transmutability/uninhabited.rs +++ b/tests/ui/transmutability/uninhabited.rs @@ -3,11 +3,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/uninhabited.stderr b/tests/ui/transmutability/uninhabited.stderr index 88a98c798fc..3fa02f0867c 100644 --- a/tests/ui/transmutability/uninhabited.stderr +++ b/tests/ui/transmutability/uninhabited.stderr @@ -34,7 +34,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -56,7 +56,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -78,7 +78,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, @@ -100,7 +100,7 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume { LL | | alignment: true, diff --git a/tests/ui/transmutability/unions/boolish.rs b/tests/ui/transmutability/unions/boolish.rs index c829f83149e..838643defd5 100644 --- a/tests/ui/transmutability/unions/boolish.rs +++ b/tests/ui/transmutability/unions/boolish.rs @@ -6,11 +6,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + Dst: TransmuteFrom<Src, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/unions/repr/should_handle_align.rs b/tests/ui/transmutability/unions/repr/should_handle_align.rs index ba4e904e161..0605651bd7b 100644 --- a/tests/ui/transmutability/unions/repr/should_handle_align.rs +++ b/tests/ui/transmutability/unions/repr/should_handle_align.rs @@ -6,11 +6,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/unions/repr/should_handle_all.rs b/tests/ui/transmutability/unions/repr/should_handle_all.rs index 85d48dd9b7f..8505c7f9123 100644 --- a/tests/ui/transmutability/unions/repr/should_handle_all.rs +++ b/tests/ui/transmutability/unions/repr/should_handle_all.rs @@ -5,11 +5,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/unions/repr/should_handle_packed.rs b/tests/ui/transmutability/unions/repr/should_handle_packed.rs index fc06eba4353..5e9851ab0c9 100644 --- a/tests/ui/transmutability/unions/repr/should_handle_packed.rs +++ b/tests/ui/transmutability/unions/repr/should_handle_packed.rs @@ -6,11 +6,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume { alignment: true, lifetimes: true, diff --git a/tests/ui/transmutability/unions/should_pad_variants.rs b/tests/ui/transmutability/unions/should_pad_variants.rs index 1e4d2db8f74..986c7fafb85 100644 --- a/tests/ui/transmutability/unions/should_pad_variants.rs +++ b/tests/ui/transmutability/unions/should_pad_variants.rs @@ -6,11 +6,11 @@ #![allow(dead_code)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { + Dst: TransmuteFrom<Src, { Assume::ALIGNMENT .and(Assume::LIFETIMES) .and(Assume::SAFETY) diff --git a/tests/ui/transmutability/unions/should_pad_variants.stderr b/tests/ui/transmutability/unions/should_pad_variants.stderr index da4294bdbce..bb26281c2f0 100644 --- a/tests/ui/transmutability/unions/should_pad_variants.stderr +++ b/tests/ui/transmutability/unions/should_pad_variants.stderr @@ -10,7 +10,7 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { +LL | Dst: TransmuteFrom<Src, { | ______________^ LL | | Assume::ALIGNMENT LL | | .and(Assume::LIFETIMES) diff --git a/tests/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs b/tests/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs index 7efe9ac70f1..359ba515439 100644 --- a/tests/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs +++ b/tests/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs @@ -7,11 +7,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> + Dst: TransmuteFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> {} } diff --git a/tests/ui/transmutability/unions/should_reject_contraction.rs b/tests/ui/transmutability/unions/should_reject_contraction.rs index 62a0ee92919..87398328fc7 100644 --- a/tests/ui/transmutability/unions/should_reject_contraction.rs +++ b/tests/ui/transmutability/unions/should_reject_contraction.rs @@ -5,11 +5,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + Dst: TransmuteFrom<Src, { Assume::SAFETY }> {} } diff --git a/tests/ui/transmutability/unions/should_reject_contraction.stderr b/tests/ui/transmutability/unions/should_reject_contraction.stderr index 20eaa3a6b09..ea68de14efc 100644 --- a/tests/ui/transmutability/unions/should_reject_contraction.stderr +++ b/tests/ui/transmutability/unions/should_reject_contraction.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 1 previous error diff --git a/tests/ui/transmutability/unions/should_reject_disjoint.rs b/tests/ui/transmutability/unions/should_reject_disjoint.rs index 732f92e8160..0427e3c44a2 100644 --- a/tests/ui/transmutability/unions/should_reject_disjoint.rs +++ b/tests/ui/transmutability/unions/should_reject_disjoint.rs @@ -5,11 +5,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_maybe_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> + Dst: TransmuteFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> {} } diff --git a/tests/ui/transmutability/unions/should_reject_disjoint.stderr b/tests/ui/transmutability/unions/should_reject_disjoint.stderr index ea47797c970..d55abbe0817 100644 --- a/tests/ui/transmutability/unions/should_reject_disjoint.stderr +++ b/tests/ui/transmutability/unions/should_reject_disjoint.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: TransmuteFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error[E0277]: `B` cannot be safely transmuted into `A` --> $DIR/should_reject_disjoint.rs:33:40 @@ -25,8 +25,8 @@ note: required by a bound in `is_maybe_transmutable` LL | pub fn is_maybe_transmutable<Src, Dst>() | --------------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` +LL | Dst: TransmuteFrom<Src, { Assume::SAFETY.and(Assume::VALIDITY) }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` error: aborting due to 2 previous errors diff --git a/tests/ui/transmutability/unions/should_reject_intersecting.rs b/tests/ui/transmutability/unions/should_reject_intersecting.rs index 752a606c861..9b3b18919f5 100644 --- a/tests/ui/transmutability/unions/should_reject_intersecting.rs +++ b/tests/ui/transmutability/unions/should_reject_intersecting.rs @@ -6,11 +6,11 @@ #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; + use std::mem::{Assume, TransmuteFrom}; pub fn is_transmutable<Src, Dst>() where - Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> + Dst: TransmuteFrom<Src, { Assume::SAFETY }> // validity is NOT assumed -----^^^^^^^^^^^^^^^^^^ {} } diff --git a/tests/ui/transmutability/unions/should_reject_intersecting.stderr b/tests/ui/transmutability/unions/should_reject_intersecting.stderr index 79dec659d9d..522681d7d15 100644 --- a/tests/ui/transmutability/unions/should_reject_intersecting.stderr +++ b/tests/ui/transmutability/unions/should_reject_intersecting.stderr @@ -10,8 +10,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error[E0277]: `B` cannot be safely transmuted into `A` --> $DIR/should_reject_intersecting.rs:36:34 @@ -25,8 +25,8 @@ note: required by a bound in `is_transmutable` LL | pub fn is_transmutable<Src, Dst>() | --------------- required by a bound in this function LL | where -LL | Dst: BikeshedIntrinsicFrom<Src, { Assume::SAFETY }> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` +LL | Dst: TransmuteFrom<Src, { Assume::SAFETY }> + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` error: aborting due to 2 previous errors diff --git a/tests/ui/try-trait/bad-interconversion.stderr b/tests/ui/try-trait/bad-interconversion.stderr index 642a93d64e2..9aab2cf6ab8 100644 --- a/tests/ui/try-trait/bad-interconversion.stderr +++ b/tests/ui/try-trait/bad-interconversion.stderr @@ -45,7 +45,7 @@ LL | Some(Err("hello")?) | ^ use `.ok()?` if you want to discard the `Result<Infallible, &str>` error information | = help: the trait `FromResidual<Result<Infallible, &str>>` is not implemented for `Option<u16>` - = help: the trait `FromResidual` is implemented for `Option<T>` + = help: the trait `FromResidual<Option<Infallible>>` is implemented for `Option<T>` error[E0277]: the `?` operator can only be used on `Option`s in a function that returns `Option` --> $DIR/bad-interconversion.rs:27:33 @@ -56,7 +56,7 @@ LL | Some(ControlFlow::Break(123)?) | ^ this `?` produces `ControlFlow<{integer}, Infallible>`, which is incompatible with `Option<u64>` | = help: the trait `FromResidual<ControlFlow<{integer}, Infallible>>` is not implemented for `Option<u64>` - = help: the trait `FromResidual` is implemented for `Option<T>` + = help: the trait `FromResidual<Option<Infallible>>` is implemented for `Option<T>` error[E0277]: the `?` operator can only be used on `ControlFlow`s in a function that returns `ControlFlow` --> $DIR/bad-interconversion.rs:32:39 diff --git a/tests/ui/try-trait/option-to-result.stderr b/tests/ui/try-trait/option-to-result.stderr index 8055b2a0b04..1a5a925f92f 100644 --- a/tests/ui/try-trait/option-to-result.stderr +++ b/tests/ui/try-trait/option-to-result.stderr @@ -20,7 +20,7 @@ LL | a?; | ^ use `.ok()?` if you want to discard the `Result<Infallible, i32>` error information | = help: the trait `FromResidual<Result<Infallible, i32>>` is not implemented for `Option<i32>` - = help: the trait `FromResidual` is implemented for `Option<T>` + = help: the trait `FromResidual<Option<Infallible>>` is implemented for `Option<T>` error: aborting due to 2 previous errors diff --git a/tests/ui/try-trait/try-operator-on-main.stderr b/tests/ui/try-trait/try-operator-on-main.stderr index d22117165c1..311e8076ed4 100644 --- a/tests/ui/try-trait/try-operator-on-main.stderr +++ b/tests/ui/try-trait/try-operator-on-main.stderr @@ -14,9 +14,7 @@ LL ~ fn main() -> Result<(), Box<dyn std::error::Error>> { LL | // error for a `Try` type on a non-`Try` fn ... LL | try_trait_generic::<()>(); -LL + LL + Ok(()) -LL + } | error[E0277]: the `?` operator can only be applied to values that implement `Try` diff --git a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr index 1104c2c498a..213272f5f34 100644 --- a/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr +++ b/tests/ui/type-alias-impl-trait/different_args_considered_equal2.stderr @@ -9,11 +9,6 @@ LL | fn get_one<'a>(a: *mut &'a str) -> impl IntoIterator<Item = Opaque<'a>> { ... LL | None::<Opaque<'static>> | ^^^^^^^^^^^^^^^^^^^^^^^ - | -help: to declare that `impl IntoIterator<Item = Opaque<'a>>` captures `'a`, you can add an explicit `'a` lifetime bound - | -LL | fn get_one<'a>(a: *mut &'a str) -> impl IntoIterator<Item = Opaque<'a>> + 'a { - | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr index 9bffa94fda1..0bf9dccfad8 100644 --- a/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr +++ b/tests/ui/type-alias-impl-trait/imply_bounds_from_bounds_param.stderr @@ -8,10 +8,10 @@ LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne { LL | <&'a mut i32 as Callable>::call(y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: to declare that `impl PlusOne` captures `'a`, you can add an explicit `'a` lifetime bound +help: add a `use<...>` bound to explicitly capture `'a` | -LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne + 'a { - | ++++ +LL | fn test<'a>(y: &'a mut i32) -> impl PlusOne + use<'a> { + | +++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs index c584a58cb32..c178fcf5a91 100644 --- a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs +++ b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.rs @@ -2,7 +2,7 @@ type Opaque2<T> = impl Sized; type Opaque<'a, T> = Opaque2<T>; -fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x } +fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x } //~ WARNING elided lifetime has a name //~^ ERROR: hidden type for `Opaque2<T>` captures lifetime that does not appear in bounds fn main() {} diff --git a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr index 03cc943d509..e2c21f1636b 100644 --- a/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr +++ b/tests/ui/type-alias-impl-trait/missing_lifetime_bound.stderr @@ -1,3 +1,13 @@ +warning: elided lifetime has a name + --> $DIR/missing_lifetime_bound.rs:5:41 + | +LL | fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x } + | -- ^ this elided lifetime gets resolved as `'a` + | | + | lifetime `'a` declared here + | + = note: `#[warn(elided_named_lifetimes)]` on by default + error[E0700]: hidden type for `Opaque2<T>` captures lifetime that does not appear in bounds --> $DIR/missing_lifetime_bound.rs:5:47 | @@ -9,6 +19,6 @@ LL | fn defining<'a, T>(x: &'a i32) -> Opaque<T> { x } | | | hidden type `&'a i32` captures the lifetime `'a` as defined here -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted For more information about this error, try `rustc --explain E0700`. diff --git a/tests/ui/type-alias-impl-trait/variance.rs b/tests/ui/type-alias-impl-trait/variance.rs index ba52eaa0359..113f6a4cc44 100644 --- a/tests/ui/type-alias-impl-trait/variance.rs +++ b/tests/ui/type-alias-impl-trait/variance.rs @@ -5,21 +5,21 @@ trait Captures<'a> {} impl<T> Captures<'_> for T {} -type NotCapturedEarly<'a> = impl Sized; //~ [*, o] +type NotCapturedEarly<'a> = impl Sized; //~ ['a: *, 'a: o] //~^ ERROR: unconstrained opaque type -type CapturedEarly<'a> = impl Sized + Captures<'a>; //~ [*, o] +type CapturedEarly<'a> = impl Sized + Captures<'a>; //~ ['a: *, 'a: o] //~^ ERROR: unconstrained opaque type -type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; //~ [*, o, o] +type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; //~ ['a: *, 'b: o, 'a: o] //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type //~| ERROR: unconstrained opaque type -type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; //~ [*, o, o] +type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; //~ ['a: *, 'b: o, 'a: o] //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from `dyn` type //~| ERROR: unconstrained opaque type -type Bar<'a, 'b: 'b, T> = impl Sized; //~ ERROR [*, *, o, o, o] +type Bar<'a, 'b: 'b, T> = impl Sized; //~ ERROR ['a: *, 'b: *, T: o, 'a: o, 'b: o] //~^ ERROR: unconstrained opaque type trait Foo<'i> { @@ -31,24 +31,24 @@ trait Foo<'i> { } impl<'i> Foo<'i> for &'i () { - type ImplicitCapture<'a> = impl Sized; //~ [*, *, o, o] + type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'a: o, 'i: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ [*, *, o, o] + type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'a: o, 'i: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ [*, *, o, o] + type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'a: o, 'i: o] //~^ ERROR: unconstrained opaque type } impl<'i> Foo<'i> for () { - type ImplicitCapture<'a> = impl Sized; //~ [*, *, o, o] + type ImplicitCapture<'a> = impl Sized; //~ ['i: *, 'a: *, 'a: o, 'i: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ [*, *, o, o] + type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; //~ ['i: *, 'a: *, 'a: o, 'i: o] //~^ ERROR: unconstrained opaque type - type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ [*, *, o, o] + type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; //~ ['i: *, 'a: *, 'a: o, 'i: o] //~^ ERROR: unconstrained opaque type } @@ -59,15 +59,15 @@ impl<'a> Nesting<'a> for &'a () { type Output = &'a (); } type NestedDeeply<'a> = - impl Nesting< //~ [*, o] + impl Nesting< //~ ['a: *, 'a: o] 'a, - Output = impl Nesting< //~ [*, o] + Output = impl Nesting< //~ ['a: *, 'a: o] 'a, - Output = impl Nesting< //~ [*, o] + Output = impl Nesting< //~ ['a: *, 'a: o] 'a, - Output = impl Nesting< //~ [*, o] + Output = impl Nesting< //~ ['a: *, 'a: o] 'a, - Output = impl Nesting<'a> //~ [*, o] + Output = impl Nesting<'a> //~ ['a: *, 'a: o] > >, >, diff --git a/tests/ui/type-alias-impl-trait/variance.stderr b/tests/ui/type-alias-impl-trait/variance.stderr index e5ced7a4981..489dfe03d44 100644 --- a/tests/ui/type-alias-impl-trait/variance.stderr +++ b/tests/ui/type-alias-impl-trait/variance.stderr @@ -110,73 +110,73 @@ LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; | = note: `ExplicitCaptureFromGat` must be used in combination with a concrete type within the same impl -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:8:29 | LL | type NotCapturedEarly<'a> = impl Sized; | ^^^^^^^^^^ -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:11:26 | LL | type CapturedEarly<'a> = impl Sized + Captures<'a>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [*, o, o] +error: ['a: *, 'b: o, 'a: o] --> $DIR/variance.rs:14:56 | LL | type NotCapturedLate<'a> = dyn for<'b> Iterator<Item = impl Sized>; | ^^^^^^^^^^ -error: [*, o, o] +error: ['a: *, 'b: o, 'a: o] --> $DIR/variance.rs:18:49 | LL | type Captured<'a> = dyn for<'b> Iterator<Item = impl Sized + Captures<'a>>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [*, *, o, o, o] +error: ['a: *, 'b: *, T: o, 'a: o, 'b: o] --> $DIR/variance.rs:22:27 | LL | type Bar<'a, 'b: 'b, T> = impl Sized; | ^^^^^^^^^^ -error: [*, *, o, o] +error: ['i: *, 'a: *, 'a: o, 'i: o] --> $DIR/variance.rs:34:32 | LL | type ImplicitCapture<'a> = impl Sized; | ^^^^^^^^^^ -error: [*, *, o, o] +error: ['i: *, 'a: *, 'a: o, 'i: o] --> $DIR/variance.rs:37:42 | LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [*, *, o, o] +error: ['i: *, 'a: *, 'a: o, 'i: o] --> $DIR/variance.rs:40:39 | LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [*, *, o, o] +error: ['i: *, 'a: *, 'a: o, 'i: o] --> $DIR/variance.rs:45:32 | LL | type ImplicitCapture<'a> = impl Sized; | ^^^^^^^^^^ -error: [*, *, o, o] +error: ['i: *, 'a: *, 'a: o, 'i: o] --> $DIR/variance.rs:48:42 | LL | type ExplicitCaptureFromHeader<'a> = impl Sized + Captures<'i>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [*, *, o, o] +error: ['i: *, 'a: *, 'a: o, 'i: o] --> $DIR/variance.rs:51:39 | LL | type ExplicitCaptureFromGat<'a> = impl Sized + Captures<'a>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:62:5 | LL | / impl Nesting< @@ -188,7 +188,7 @@ LL | | >, LL | | >; | |_____^ -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:64:18 | LL | Output = impl Nesting< @@ -201,7 +201,7 @@ LL | | >, LL | | >, | |_________^ -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:66:22 | LL | Output = impl Nesting< @@ -214,7 +214,7 @@ LL | | > LL | | >, | |_____________^ -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:68:26 | LL | Output = impl Nesting< @@ -224,7 +224,7 @@ LL | | Output = impl Nesting<'a> LL | | > | |_________________^ -error: [*, o] +error: ['a: *, 'a: o] --> $DIR/variance.rs:70:30 | LL | Output = impl Nesting<'a> diff --git a/tests/ui/typeck/const-in-fn-call-generics.rs b/tests/ui/typeck/const-in-fn-call-generics.rs new file mode 100644 index 00000000000..675dbcc3054 --- /dev/null +++ b/tests/ui/typeck/const-in-fn-call-generics.rs @@ -0,0 +1,16 @@ +fn generic<const N: u32>() {} + +trait Collate<const A: u32> { + type Pass; + fn collate(self) -> Self::Pass; +} + +impl<const B: u32> Collate<B> for i32 { + type Pass = (); + fn collate(self) -> Self::Pass { + generic::<{ true }>() + //~^ ERROR: mismatched types + } +} + +fn main() {} diff --git a/tests/ui/typeck/const-in-fn-call-generics.stderr b/tests/ui/typeck/const-in-fn-call-generics.stderr new file mode 100644 index 00000000000..12dd454188c --- /dev/null +++ b/tests/ui/typeck/const-in-fn-call-generics.stderr @@ -0,0 +1,9 @@ +error[E0308]: mismatched types + --> $DIR/const-in-fn-call-generics.rs:11:21 + | +LL | generic::<{ true }>() + | ^^^^ expected `u32`, found `bool` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs index 9fc249198d0..92c1999e154 100644 --- a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs +++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs @@ -3,16 +3,18 @@ // of an impl fn produces a type mismatch error instead of triggering // a const eval cycle - trait Trait { - fn func<const N: u32>() -> [ (); N ]; //~ ERROR the constant `N` is not of type `usize` + fn func<const N: u32>() -> [(); N]; + //~^ ERROR: the constant `N` is not of type `usize` + //~| ERROR: mismatched types } struct S {} #[allow(unused_braces)] impl Trait for S { - fn func<const N: u32>() -> [ (); { () }] { //~ ERROR mismatched types + fn func<const N: u32>() -> [(); { () }] { + //~^ ERROR mismatched types N } } diff --git a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr index bff926a2081..bb8025d47a1 100644 --- a/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr +++ b/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.stderr @@ -1,15 +1,21 @@ error[E0308]: mismatched types - --> $DIR/const-in-impl-fn-return-type.rs:15:40 + --> $DIR/const-in-impl-fn-return-type.rs:16:39 | -LL | fn func<const N: u32>() -> [ (); { () }] { - | ^^ expected `usize`, found `()` +LL | fn func<const N: u32>() -> [(); { () }] { + | ^^ expected `usize`, found `()` error: the constant `N` is not of type `usize` - --> $DIR/const-in-impl-fn-return-type.rs:8:32 + --> $DIR/const-in-impl-fn-return-type.rs:7:32 | -LL | fn func<const N: u32>() -> [ (); N ]; - | ^^^^^^^^^ expected `usize`, found `u32` +LL | fn func<const N: u32>() -> [(); N]; + | ^^^^^^^ expected `usize`, found `u32` -error: aborting due to 2 previous errors +error[E0308]: mismatched types + --> $DIR/const-in-impl-fn-return-type.rs:7:37 + | +LL | fn func<const N: u32>() -> [(); N]; + | ^ expected `usize`, found `u32` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/uninhabited/uninhabited-patterns.stderr b/tests/ui/uninhabited/uninhabited-patterns.stderr index 4e4aaa93f80..0e1c9d31a73 100644 --- a/tests/ui/uninhabited/uninhabited-patterns.stderr +++ b/tests/ui/uninhabited/uninhabited-patterns.stderr @@ -2,9 +2,9 @@ error: unreachable pattern --> $DIR/uninhabited-patterns.rs:29:9 | LL | Ok(box _) => (), - | ^^^^^^^^^ + | ^^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited | - = note: this pattern matches no values because `NotSoSecretlyEmpty` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here --> $DIR/uninhabited-patterns.rs:3:9 | @@ -15,17 +15,17 @@ error: unreachable pattern --> $DIR/uninhabited-patterns.rs:38:9 | LL | Err(Ok(_y)) => (), - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited | - = note: this pattern matches no values because `NotSoSecretlyEmpty` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern --> $DIR/uninhabited-patterns.rs:41:15 | LL | while let Some(_y) = foo() { - | ^^^^^^^^ + | ^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited | - = note: this pattern matches no values because `NotSoSecretlyEmpty` is uninhabited + = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: aborting due to 3 previous errors diff --git a/tests/ui/unpretty/expanded-exhaustive.rs b/tests/ui/unpretty/expanded-exhaustive.rs index 29472df897a..279d723a26c 100644 --- a/tests/ui/unpretty/expanded-exhaustive.rs +++ b/tests/ui/unpretty/expanded-exhaustive.rs @@ -19,7 +19,6 @@ #![feature(never_type)] #![feature(pattern_types)] #![feature(prelude_import)] -#![feature(raw_ref_op)] #![feature(specialization)] #![feature(trace_macros)] #![feature(trait_alias)] diff --git a/tests/ui/unpretty/expanded-exhaustive.stdout b/tests/ui/unpretty/expanded-exhaustive.stdout index cf2f6f8cbaa..149659693ae 100644 --- a/tests/ui/unpretty/expanded-exhaustive.stdout +++ b/tests/ui/unpretty/expanded-exhaustive.stdout @@ -20,7 +20,6 @@ #![feature(never_type)] #![feature(pattern_types)] #![feature(prelude_import)] -#![feature(raw_ref_op)] #![feature(specialization)] #![feature(trace_macros)] #![feature(trait_alias)] diff --git a/tests/ui/unsized/unsized6.stderr b/tests/ui/unsized/unsized6.stderr index 56e7f60f9ff..d406120efc5 100644 --- a/tests/ui/unsized/unsized6.stderr +++ b/tests/ui/unsized/unsized6.stderr @@ -123,6 +123,11 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` LL - fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { LL + fn f3<X>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { | +help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression + | +LL - let y = *x2; +LL + let y = x2; + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:26:10 @@ -177,6 +182,11 @@ help: consider removing the `?Sized` bound to make the type parameter `Sized` LL - fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { LL + fn f4<X: T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) { | +help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression + | +LL - let y = *x2; +LL + let y = x2; + | error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:34:10 diff --git a/tests/ui/variance/variance-associated-consts.rs b/tests/ui/variance/variance-associated-consts.rs index 6a44a94df3f..97edb7e266a 100644 --- a/tests/ui/variance/variance-associated-consts.rs +++ b/tests/ui/variance/variance-associated-consts.rs @@ -10,7 +10,7 @@ trait Trait { } #[rustc_variance] -struct Foo<T: Trait> { //~ ERROR [o] +struct Foo<T: Trait> { //~ ERROR [T: o] field: [u8; <T as Trait>::Const] //~^ ERROR: unconstrained generic constant } diff --git a/tests/ui/variance/variance-associated-consts.stderr b/tests/ui/variance/variance-associated-consts.stderr index b955a7686c2..5c3ed93464a 100644 --- a/tests/ui/variance/variance-associated-consts.stderr +++ b/tests/ui/variance/variance-associated-consts.stderr @@ -9,7 +9,7 @@ help: try adding a `where` bound LL | struct Foo<T: Trait> where [(); <T as Trait>::Const]: { | ++++++++++++++++++++++++++++++++ -error: [o] +error: [T: o] --> $DIR/variance-associated-consts.rs:13:1 | LL | struct Foo<T: Trait> { diff --git a/tests/ui/variance/variance-associated-types.rs b/tests/ui/variance/variance-associated-types.rs index ecb0821827d..07ff41062e8 100644 --- a/tests/ui/variance/variance-associated-types.rs +++ b/tests/ui/variance/variance-associated-types.rs @@ -10,12 +10,12 @@ trait Trait<'a> { } #[rustc_variance] -struct Foo<'a, T : Trait<'a>> { //~ ERROR [+, +] +struct Foo<'a, T : Trait<'a>> { //~ ERROR ['a: +, T: +] field: (T, &'a ()) } #[rustc_variance] -struct Bar<'a, T : Trait<'a>> { //~ ERROR [o, o] +struct Bar<'a, T : Trait<'a>> { //~ ERROR ['a: o, T: o] field: <T as Trait<'a>>::Type } diff --git a/tests/ui/variance/variance-associated-types.stderr b/tests/ui/variance/variance-associated-types.stderr index 70cb246f6e9..ca010b7e7ef 100644 --- a/tests/ui/variance/variance-associated-types.stderr +++ b/tests/ui/variance/variance-associated-types.stderr @@ -1,10 +1,10 @@ -error: [+, +] +error: ['a: +, T: +] --> $DIR/variance-associated-types.rs:13:1 | LL | struct Foo<'a, T : Trait<'a>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [o, o] +error: ['a: o, T: o] --> $DIR/variance-associated-types.rs:18:1 | LL | struct Bar<'a, T : Trait<'a>> { diff --git a/tests/ui/variance/variance-object-types.rs b/tests/ui/variance/variance-object-types.rs index 6ded24cd1e9..fd03dec9824 100644 --- a/tests/ui/variance/variance-object-types.rs +++ b/tests/ui/variance/variance-object-types.rs @@ -4,7 +4,7 @@ // For better or worse, associated types are invariant, and hence we // get an invariant result for `'a`. #[rustc_variance] -struct Foo<'a> { //~ ERROR [o] +struct Foo<'a> { //~ ERROR ['a: o] x: Box<dyn Fn(i32) -> &'a i32 + 'static> } diff --git a/tests/ui/variance/variance-object-types.stderr b/tests/ui/variance/variance-object-types.stderr index 963f3454e1b..a6fb9b2403a 100644 --- a/tests/ui/variance/variance-object-types.stderr +++ b/tests/ui/variance/variance-object-types.stderr @@ -1,4 +1,4 @@ -error: [o] +error: ['a: o] --> $DIR/variance-object-types.rs:7:1 | LL | struct Foo<'a> { diff --git a/tests/ui/variance/variance-regions-direct.rs b/tests/ui/variance/variance-regions-direct.rs index f1763c403f1..2bcacec33ea 100644 --- a/tests/ui/variance/variance-regions-direct.rs +++ b/tests/ui/variance/variance-regions-direct.rs @@ -6,7 +6,7 @@ // Regions that just appear in normal spots are contravariant: #[rustc_variance] -struct Test2<'a, 'b, 'c> { //~ ERROR [+, +, +] +struct Test2<'a, 'b, 'c> { //~ ERROR ['a: +, 'b: +, 'c: +] x: &'a isize, y: &'b [isize], c: &'c str @@ -15,7 +15,7 @@ struct Test2<'a, 'b, 'c> { //~ ERROR [+, +, +] // Those same annotations in function arguments become covariant: #[rustc_variance] -struct Test3<'a, 'b, 'c> { //~ ERROR [-, -, -] +struct Test3<'a, 'b, 'c> { //~ ERROR ['a: -, 'b: -, 'c: -] x: extern "Rust" fn(&'a isize), y: extern "Rust" fn(&'b [isize]), c: extern "Rust" fn(&'c str), @@ -24,7 +24,7 @@ struct Test3<'a, 'b, 'c> { //~ ERROR [-, -, -] // Mutability induces invariance: #[rustc_variance] -struct Test4<'a, 'b:'a> { //~ ERROR [+, o] +struct Test4<'a, 'b:'a> { //~ ERROR ['a: +, 'b: o] x: &'a mut &'b isize, } @@ -32,7 +32,7 @@ struct Test4<'a, 'b:'a> { //~ ERROR [+, o] // contravariant context: #[rustc_variance] -struct Test5<'a, 'b:'a> { //~ ERROR [-, o] +struct Test5<'a, 'b:'a> { //~ ERROR ['a: -, 'b: o] x: extern "Rust" fn(&'a mut &'b isize), } @@ -42,14 +42,14 @@ struct Test5<'a, 'b:'a> { //~ ERROR [-, o] // argument list occurs in an invariant context. #[rustc_variance] -struct Test6<'a, 'b:'a> { //~ ERROR [+, o] +struct Test6<'a, 'b:'a> { //~ ERROR ['a: +, 'b: o] x: &'a mut extern "Rust" fn(&'b isize), } // No uses at all is bivariant: #[rustc_variance] -struct Test7<'a> { //~ ERROR [*] +struct Test7<'a> { //~ ERROR ['a: *] //~^ ERROR: `'a` is never used x: isize } @@ -57,7 +57,7 @@ struct Test7<'a> { //~ ERROR [*] // Try enums too. #[rustc_variance] -enum Test8<'a, 'b, 'c:'b> { //~ ERROR [-, +, o] +enum Test8<'a, 'b, 'c:'b> { //~ ERROR ['a: -, 'b: +, 'c: o] Test8A(extern "Rust" fn(&'a isize)), Test8B(&'b [isize]), Test8C(&'b mut &'c str), diff --git a/tests/ui/variance/variance-regions-direct.stderr b/tests/ui/variance/variance-regions-direct.stderr index edfc888f656..45ce0303fb2 100644 --- a/tests/ui/variance/variance-regions-direct.stderr +++ b/tests/ui/variance/variance-regions-direct.stderr @@ -6,43 +6,43 @@ LL | struct Test7<'a> { | = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` -error: [+, +, +] +error: ['a: +, 'b: +, 'c: +] --> $DIR/variance-regions-direct.rs:9:1 | LL | struct Test2<'a, 'b, 'c> { | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: [-, -, -] +error: ['a: -, 'b: -, 'c: -] --> $DIR/variance-regions-direct.rs:18:1 | LL | struct Test3<'a, 'b, 'c> { | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: [+, o] +error: ['a: +, 'b: o] --> $DIR/variance-regions-direct.rs:27:1 | LL | struct Test4<'a, 'b:'a> { | ^^^^^^^^^^^^^^^^^^^^^^^ -error: [-, o] +error: ['a: -, 'b: o] --> $DIR/variance-regions-direct.rs:35:1 | LL | struct Test5<'a, 'b:'a> { | ^^^^^^^^^^^^^^^^^^^^^^^ -error: [+, o] +error: ['a: +, 'b: o] --> $DIR/variance-regions-direct.rs:45:1 | LL | struct Test6<'a, 'b:'a> { | ^^^^^^^^^^^^^^^^^^^^^^^ -error: [*] +error: ['a: *] --> $DIR/variance-regions-direct.rs:52:1 | LL | struct Test7<'a> { | ^^^^^^^^^^^^^^^^ -error: [-, +, o] +error: ['a: -, 'b: +, 'c: o] --> $DIR/variance-regions-direct.rs:60:1 | LL | enum Test8<'a, 'b, 'c:'b> { diff --git a/tests/ui/variance/variance-regions-indirect.rs b/tests/ui/variance/variance-regions-indirect.rs index 31e25641d8c..aaa4d3f8779 100644 --- a/tests/ui/variance/variance-regions-indirect.rs +++ b/tests/ui/variance/variance-regions-indirect.rs @@ -5,7 +5,7 @@ #![feature(rustc_attrs)] #[rustc_variance] -enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR [-, +, o, *] +enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR ['a: -, 'b: +, 'c: o, 'd: *] //~^ ERROR: `'d` is never used Test8A(extern "Rust" fn(&'a isize)), Test8B(&'b [isize]), @@ -13,25 +13,25 @@ enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR [-, +, o, *] } #[rustc_variance] -struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR [*, o, +, -] +struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR ['w: *, 'x: o, 'y: +, 'z: -] //~^ ERROR: `'w` is never used f: Base<'z, 'y, 'x, 'w> } #[rustc_variance] // Combine - and + to yield o -struct Derived2<'a, 'b:'a, 'c> { //~ ERROR [o, o, *] +struct Derived2<'a, 'b:'a, 'c> { //~ ERROR ['a: o, 'b: o, 'c: *] //~^ ERROR: `'c` is never used f: Base<'a, 'a, 'b, 'c> } #[rustc_variance] // Combine + and o to yield o (just pay attention to 'a here) -struct Derived3<'a:'b, 'b, 'c> { //~ ERROR [o, +, *] +struct Derived3<'a:'b, 'b, 'c> { //~ ERROR ['a: o, 'b: +, 'c: *] //~^ ERROR: `'c` is never used f: Base<'a, 'b, 'a, 'c> } #[rustc_variance] // Combine + and * to yield + (just pay attention to 'a here) -struct Derived4<'a, 'b, 'c:'b> { //~ ERROR [-, +, o] +struct Derived4<'a, 'b, 'c:'b> { //~ ERROR ['a: -, 'b: +, 'c: o] f: Base<'a, 'b, 'c, 'a> } diff --git a/tests/ui/variance/variance-regions-indirect.stderr b/tests/ui/variance/variance-regions-indirect.stderr index 901ec0c6a76..ed839b32350 100644 --- a/tests/ui/variance/variance-regions-indirect.stderr +++ b/tests/ui/variance/variance-regions-indirect.stderr @@ -30,31 +30,31 @@ LL | struct Derived3<'a:'b, 'b, 'c> { | = help: consider removing `'c`, referring to it in a field, or using a marker such as `PhantomData` -error: [-, +, o, *] +error: ['a: -, 'b: +, 'c: o, 'd: *] --> $DIR/variance-regions-indirect.rs:8:1 | LL | enum Base<'a, 'b, 'c:'b, 'd> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [*, o, +, -] +error: ['w: *, 'x: o, 'y: +, 'z: -] --> $DIR/variance-regions-indirect.rs:16:1 | LL | struct Derived1<'w, 'x:'y, 'y, 'z> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [o, o, *] +error: ['a: o, 'b: o, 'c: *] --> $DIR/variance-regions-indirect.rs:22:1 | LL | struct Derived2<'a, 'b:'a, 'c> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [o, +, *] +error: ['a: o, 'b: +, 'c: *] --> $DIR/variance-regions-indirect.rs:28:1 | LL | struct Derived3<'a:'b, 'b, 'c> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [-, +, o] +error: ['a: -, 'b: +, 'c: o] --> $DIR/variance-regions-indirect.rs:34:1 | LL | struct Derived4<'a, 'b, 'c:'b> { diff --git a/tests/ui/variance/variance-trait-bounds.rs b/tests/ui/variance/variance-trait-bounds.rs index 25a01b160dd..f86fa2bbef7 100644 --- a/tests/ui/variance/variance-trait-bounds.rs +++ b/tests/ui/variance/variance-trait-bounds.rs @@ -13,24 +13,24 @@ trait Setter<T> { } #[rustc_variance] -struct TestStruct<U,T:Setter<U>> { //~ ERROR [+, +] +struct TestStruct<U,T:Setter<U>> { //~ ERROR [U: +, T: +] t: T, u: U } #[rustc_variance] -enum TestEnum<U,T:Setter<U>> { //~ ERROR [*, +] +enum TestEnum<U,T:Setter<U>> { //~ ERROR [U: *, T: +] //~^ ERROR: `U` is never used Foo(T) } #[rustc_variance] -struct TestContraStruct<U,T:Setter<U>> { //~ ERROR [*, +] +struct TestContraStruct<U,T:Setter<U>> { //~ ERROR [U: *, T: +] //~^ ERROR: `U` is never used t: T } #[rustc_variance] -struct TestBox<U,T:Getter<U>+Setter<U>> { //~ ERROR [*, +] +struct TestBox<U,T:Getter<U>+Setter<U>> { //~ ERROR [U: *, T: +] //~^ ERROR: `U` is never used t: T } diff --git a/tests/ui/variance/variance-trait-bounds.stderr b/tests/ui/variance/variance-trait-bounds.stderr index 95ed18c1ad2..49cee3cbeca 100644 --- a/tests/ui/variance/variance-trait-bounds.stderr +++ b/tests/ui/variance/variance-trait-bounds.stderr @@ -25,25 +25,25 @@ LL | struct TestBox<U,T:Getter<U>+Setter<U>> { = help: consider removing `U`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `U` to be a const parameter, use `const U: /* Type */` instead -error: [+, +] +error: [U: +, T: +] --> $DIR/variance-trait-bounds.rs:16:1 | LL | struct TestStruct<U,T:Setter<U>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [*, +] +error: [U: *, T: +] --> $DIR/variance-trait-bounds.rs:21:1 | LL | enum TestEnum<U,T:Setter<U>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [*, +] +error: [U: *, T: +] --> $DIR/variance-trait-bounds.rs:27:1 | LL | struct TestContraStruct<U,T:Setter<U>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [*, +] +error: [U: *, T: +] --> $DIR/variance-trait-bounds.rs:33:1 | LL | struct TestBox<U,T:Getter<U>+Setter<U>> { diff --git a/tests/ui/variance/variance-trait-object-bound.rs b/tests/ui/variance/variance-trait-object-bound.rs index 11303c46520..ca80c6b6dce 100644 --- a/tests/ui/variance/variance-trait-object-bound.rs +++ b/tests/ui/variance/variance-trait-object-bound.rs @@ -11,7 +11,7 @@ use std::mem; trait T { fn foo(&self); } #[rustc_variance] -struct TOption<'a> { //~ ERROR [+] +struct TOption<'a> { //~ ERROR ['a: +] v: Option<Box<dyn T + 'a>>, } diff --git a/tests/ui/variance/variance-trait-object-bound.stderr b/tests/ui/variance/variance-trait-object-bound.stderr index f0471a34619..0af21ec12cc 100644 --- a/tests/ui/variance/variance-trait-object-bound.stderr +++ b/tests/ui/variance/variance-trait-object-bound.stderr @@ -1,4 +1,4 @@ -error: [+] +error: ['a: +] --> $DIR/variance-trait-object-bound.rs:14:1 | LL | struct TOption<'a> { diff --git a/tests/ui/variance/variance-types-bounds.rs b/tests/ui/variance/variance-types-bounds.rs index d1814dd97a0..f4738a2dae1 100644 --- a/tests/ui/variance/variance-types-bounds.rs +++ b/tests/ui/variance/variance-types-bounds.rs @@ -4,24 +4,24 @@ #![feature(rustc_attrs)] #[rustc_variance] -struct TestImm<A, B> { //~ ERROR [+, +] +struct TestImm<A, B> { //~ ERROR [A: +, B: +] x: A, y: B, } #[rustc_variance] -struct TestMut<A, B:'static> { //~ ERROR [+, o] +struct TestMut<A, B:'static> { //~ ERROR [A: +, B: o] x: A, y: &'static mut B, } #[rustc_variance] -struct TestIndirect<A:'static, B:'static> { //~ ERROR [+, o] +struct TestIndirect<A:'static, B:'static> { //~ ERROR [A: +, B: o] m: TestMut<A, B> } #[rustc_variance] -struct TestIndirect2<A:'static, B:'static> { //~ ERROR [o, o] +struct TestIndirect2<A:'static, B:'static> { //~ ERROR [A: o, B: o] n: TestMut<A, B>, m: TestMut<B, A> } @@ -35,7 +35,7 @@ trait Setter<A> { } #[rustc_variance] -struct TestObject<A, R> { //~ ERROR [o, o] +struct TestObject<A, R> { //~ ERROR [A: o, R: o] n: Box<dyn Setter<A>+Send>, m: Box<dyn Getter<R>+Send>, } diff --git a/tests/ui/variance/variance-types-bounds.stderr b/tests/ui/variance/variance-types-bounds.stderr index bb816443476..408c2ae8d36 100644 --- a/tests/ui/variance/variance-types-bounds.stderr +++ b/tests/ui/variance/variance-types-bounds.stderr @@ -1,28 +1,28 @@ -error: [+, +] +error: [A: +, B: +] --> $DIR/variance-types-bounds.rs:7:1 | LL | struct TestImm<A, B> { | ^^^^^^^^^^^^^^^^^^^^ -error: [+, o] +error: [A: +, B: o] --> $DIR/variance-types-bounds.rs:13:1 | LL | struct TestMut<A, B:'static> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [+, o] +error: [A: +, B: o] --> $DIR/variance-types-bounds.rs:19:1 | LL | struct TestIndirect<A:'static, B:'static> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [o, o] +error: [A: o, B: o] --> $DIR/variance-types-bounds.rs:24:1 | LL | struct TestIndirect2<A:'static, B:'static> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [o, o] +error: [A: o, R: o] --> $DIR/variance-types-bounds.rs:38:1 | LL | struct TestObject<A, R> { diff --git a/tests/ui/variance/variance-types.rs b/tests/ui/variance/variance-types.rs index cfc03b75473..aa336d1b424 100644 --- a/tests/ui/variance/variance-types.rs +++ b/tests/ui/variance/variance-types.rs @@ -7,32 +7,32 @@ use std::cell::Cell; // not considered bivariant. #[rustc_variance] -struct InvariantMut<'a,A:'a,B:'a> { //~ ERROR [+, o, o] +struct InvariantMut<'a,A:'a,B:'a> { //~ ERROR ['a: +, A: o, B: o] t: &'a mut (A,B) } #[rustc_variance] -struct InvariantCell<A> { //~ ERROR [o] +struct InvariantCell<A> { //~ ERROR [A: o] t: Cell<A> } #[rustc_variance] -struct InvariantIndirect<A> { //~ ERROR [o] +struct InvariantIndirect<A> { //~ ERROR [A: o] t: InvariantCell<A> } #[rustc_variance] -struct Covariant<A> { //~ ERROR [+] +struct Covariant<A> { //~ ERROR [A: +] t: A, u: fn() -> A } #[rustc_variance] -struct Contravariant<A> { //~ ERROR [-] +struct Contravariant<A> { //~ ERROR [A: -] t: fn(A) } #[rustc_variance] -enum Enum<A,B,C> { //~ ERROR [+, -, o] +enum Enum<A,B,C> { //~ ERROR [A: +, B: -, C: o] Foo(Covariant<A>), Bar(Contravariant<B>), Zed(Covariant<C>,Contravariant<C>) diff --git a/tests/ui/variance/variance-types.stderr b/tests/ui/variance/variance-types.stderr index 0fda4b8036e..f2a67949425 100644 --- a/tests/ui/variance/variance-types.stderr +++ b/tests/ui/variance/variance-types.stderr @@ -1,34 +1,34 @@ -error: [+, o, o] +error: ['a: +, A: o, B: o] --> $DIR/variance-types.rs:10:1 | LL | struct InvariantMut<'a,A:'a,B:'a> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [o] +error: [A: o] --> $DIR/variance-types.rs:15:1 | LL | struct InvariantCell<A> { | ^^^^^^^^^^^^^^^^^^^^^^^ -error: [o] +error: [A: o] --> $DIR/variance-types.rs:20:1 | LL | struct InvariantIndirect<A> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: [+] +error: [A: +] --> $DIR/variance-types.rs:25:1 | LL | struct Covariant<A> { | ^^^^^^^^^^^^^^^^^^^ -error: [-] +error: [A: -] --> $DIR/variance-types.rs:30:1 | LL | struct Contravariant<A> { | ^^^^^^^^^^^^^^^^^^^^^^^ -error: [+, -, o] +error: [A: +, B: -, C: o] --> $DIR/variance-types.rs:35:1 | LL | enum Enum<A,B,C> { |
