diff options
Diffstat (limited to 'tests')
89 files changed, 952 insertions, 961 deletions
diff --git a/tests/codegen/iter-repeat-n-trivial-drop.rs b/tests/codegen/iter-repeat-n-trivial-drop.rs index 24059f190ac..65a0f7e7ffb 100644 --- a/tests/codegen/iter-repeat-n-trivial-drop.rs +++ b/tests/codegen/iter-repeat-n-trivial-drop.rs @@ -33,7 +33,7 @@ pub fn iter_repeat_n_next(it: &mut std::iter::RepeatN<NotCopy>) -> Option<NotCop // CHECK: [[EMPTY]]: // CHECK-NOT: br - // CHECK: phi i16 [ undef, %start ], [ %[[VAL]], %[[NOT_EMPTY]] ] + // CHECK: phi i16 [ %[[VAL]], %[[NOT_EMPTY]] ], [ undef, %start ] // CHECK-NOT: br // CHECK: ret diff --git a/tests/codegen/slice-init.rs b/tests/codegen/slice-init.rs index 794b773a776..d80628cb1d4 100644 --- a/tests/codegen/slice-init.rs +++ b/tests/codegen/slice-init.rs @@ -8,7 +8,7 @@ pub fn zero_sized_elem() { // CHECK-NOT: br label %repeat_loop_header{{.*}} // CHECK-NOT: call void @llvm.memset.p0 let x = [(); 4]; - drop(&x); + opaque(&x); } // CHECK-LABEL: @zero_len_array @@ -17,7 +17,7 @@ pub fn zero_len_array() { // CHECK-NOT: br label %repeat_loop_header{{.*}} // CHECK-NOT: call void @llvm.memset.p0 let x = [4; 0]; - drop(&x); + opaque(&x); } // CHECK-LABEL: @byte_array @@ -26,7 +26,7 @@ pub fn byte_array() { // CHECK: call void @llvm.memset.{{.+}}({{i8\*|ptr}} {{.*}}, i8 7, i{{[0-9]+}} 4 // CHECK-NOT: br label %repeat_loop_header{{.*}} let x = [7u8; 4]; - drop(&x); + opaque(&x); } #[allow(dead_code)] @@ -42,7 +42,7 @@ pub fn byte_enum_array() { // CHECK: call void @llvm.memset.{{.+}}({{i8\*|ptr}} {{.*}}, i8 {{.*}}, i{{[0-9]+}} 4 // CHECK-NOT: br label %repeat_loop_header{{.*}} let x = [Init::Memset; 4]; - drop(&x); + opaque(&x); } // CHECK-LABEL: @zeroed_integer_array @@ -51,7 +51,7 @@ pub fn zeroed_integer_array() { // CHECK: call void @llvm.memset.{{.+}}({{i8\*|ptr}} {{.*}}, i8 0, i{{[0-9]+}} 16 // CHECK-NOT: br label %repeat_loop_header{{.*}} let x = [0u32; 4]; - drop(&x); + opaque(&x); } // CHECK-LABEL: @nonzero_integer_array @@ -60,5 +60,9 @@ pub fn nonzero_integer_array() { // CHECK: br label %repeat_loop_header{{.*}} // CHECK-NOT: call void @llvm.memset.p0 let x = [0x1a_2b_3c_4d_u32; 4]; - drop(&x); + opaque(&x); } + +// Use an opaque function to prevent rustc from removing useless drops. +#[inline(never)] +pub fn opaque(_: impl Sized) {} diff --git a/tests/codegen/slice-ref-equality.rs b/tests/codegen/slice-ref-equality.rs index 8f0adab35e7..c91e5bc3cd0 100644 --- a/tests/codegen/slice-ref-equality.rs +++ b/tests/codegen/slice-ref-equality.rs @@ -44,48 +44,48 @@ pub fn is_zero_array(data: &[u8; 4]) -> bool { // equality for non-byte types also just emit a `bcmp`, not a loop. // CHECK-LABEL: @eq_slice_of_nested_u8( -// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %1 -// CHECK-SAME: [[USIZE]] noundef %3 +// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %x.1 +// CHECK-SAME: [[USIZE]] noundef %y.1 #[no_mangle] fn eq_slice_of_nested_u8(x: &[[u8; 3]], y: &[[u8; 3]]) -> bool { - // CHECK: icmp eq [[USIZE]] %1, %3 - // CHECK: %[[BYTES:.+]] = mul nsw [[USIZE]] %1, 3 + // CHECK: icmp eq [[USIZE]] %x.1, %y.1 + // CHECK: %[[BYTES:.+]] = mul nsw [[USIZE]] %x.1, 3 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}({{i8\*|ptr}} // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y } // CHECK-LABEL: @eq_slice_of_i32( -// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %1 -// CHECK-SAME: [[USIZE]] noundef %3 +// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %x.1 +// CHECK-SAME: [[USIZE]] noundef %y.1 #[no_mangle] fn eq_slice_of_i32(x: &[i32], y: &[i32]) -> bool { - // CHECK: icmp eq [[USIZE]] %1, %3 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %1, 2 + // CHECK: icmp eq [[USIZE]] %x.1, %y.1 + // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %x.1, 2 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}({{i32\*|ptr}} // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y } // CHECK-LABEL: @eq_slice_of_nonzero( -// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %1 -// CHECK-SAME: [[USIZE]] noundef %3 +// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %x.1 +// CHECK-SAME: [[USIZE]] noundef %y.1 #[no_mangle] fn eq_slice_of_nonzero(x: &[NonZeroU32], y: &[NonZeroU32]) -> bool { - // CHECK: icmp eq [[USIZE]] %1, %3 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %1, 2 + // CHECK: icmp eq [[USIZE]] %x.1, %y.1 + // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %x.1, 2 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}({{i32\*|ptr}} // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y } // CHECK-LABEL: @eq_slice_of_option_of_nonzero( -// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %1 -// CHECK-SAME: [[USIZE]] noundef %3 +// CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %x.1 +// CHECK-SAME: [[USIZE]] noundef %y.1 #[no_mangle] fn eq_slice_of_option_of_nonzero(x: &[Option<NonZeroI16>], y: &[Option<NonZeroI16>]) -> bool { - // CHECK: icmp eq [[USIZE]] %1, %3 - // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %1, 1 + // CHECK: icmp eq [[USIZE]] %x.1, %y.1 + // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %x.1, 1 // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}({{i16\*|ptr}} // CHECK-SAME: , [[USIZE]]{{( noundef)?}} %[[BYTES]]) x == y diff --git a/tests/incremental/hashes/call_expressions.rs b/tests/incremental/hashes/call_expressions.rs index 65df2e8292a..a42cf6aa477 100644 --- a/tests/incremental/hashes/call_expressions.rs +++ b/tests/incremental/hashes/call_expressions.rs @@ -162,7 +162,7 @@ pub fn change_to_ufcs() { } #[cfg(not(any(cfail1,cfail4)))] -#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")] +#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,typeck")] #[rustc_clean(cfg="cfail3")] #[rustc_clean(cfg="cfail5", except="hir_owner_nodes,optimized_mir,typeck")] #[rustc_clean(cfg="cfail6")] diff --git a/tests/mir-opt/casts.redundant.InstSimplify.diff b/tests/mir-opt/casts.redundant.InstSimplify.diff index ff6d11c4596..f5ea78aecbe 100644 --- a/tests/mir-opt/casts.redundant.InstSimplify.diff +++ b/tests/mir-opt/casts.redundant.InstSimplify.diff @@ -7,7 +7,7 @@ let mut _2: *const &u8; let mut _3: *const &u8; scope 1 (inlined generic_cast::<&u8, &u8>) { - debug x => _3; + debug x => _1; } bb0: { diff --git a/tests/mir-opt/copy-prop/mutate_through_pointer.rs b/tests/mir-opt/copy-prop/mutate_through_pointer.rs index da142e33948..753787089b5 100644 --- a/tests/mir-opt/copy-prop/mutate_through_pointer.rs +++ b/tests/mir-opt/copy-prop/mutate_through_pointer.rs @@ -1,3 +1,5 @@ +// unit-test: CopyProp +// // This attempts to mutate `a` via a pointer derived from `addr_of!(a)`. That is UB // according to Miri. However, the decision to make this UB - and to allow // rustc to rely on that fact for the purpose of optimizations - has not been 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 e3c57347392..486f276b21c 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 @@ -7,8 +7,7 @@ let mut _2: std::option::Option<T>; + scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) { + debug self => _2; -+ let mut _3: &std::option::Option<T>; -+ let mut _4: isize; ++ let mut _3: isize; + scope 2 { + debug val => _0; + } @@ -21,7 +20,7 @@ + } + } + scope 4 (inlined Option::<T>::is_some) { -+ debug self => _3; ++ debug self => &_2; + } + } @@ -29,9 +28,8 @@ StorageLive(_2); _2 = move _1; - _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind unreachable]; -+ StorageLive(_3); -+ _4 = discriminant(_2); -+ switchInt(move _4) -> [1: bb2, otherwise: bb1]; ++ _3 = discriminant(_2); ++ switchInt(move _3) -> [1: bb2, otherwise: bb1]; } bb1: { @@ -40,7 +38,6 @@ + + bb2: { + _0 = move ((_2 as Some).0: T); -+ StorageDead(_3); StorageDead(_2); return; } 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 fc638cb3ace..1c3aa537946 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 @@ -7,8 +7,7 @@ let mut _2: std::option::Option<T>; + scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) { + debug self => _2; -+ let mut _3: &std::option::Option<T>; -+ let mut _4: isize; ++ let mut _3: isize; + scope 2 { + debug val => _0; + } @@ -21,7 +20,7 @@ + } + } + scope 4 (inlined Option::<T>::is_some) { -+ debug self => _3; ++ debug self => &_2; + } + } @@ -29,9 +28,8 @@ StorageLive(_2); _2 = move _1; - _0 = Option::<T>::unwrap_unchecked(move _2) -> [return: bb1, unwind: bb2]; -+ StorageLive(_3); -+ _4 = discriminant(_2); -+ switchInt(move _4) -> [1: bb2, otherwise: bb1]; ++ _3 = discriminant(_2); ++ switchInt(move _3) -> [1: bb2, otherwise: bb1]; } bb1: { @@ -44,7 +42,6 @@ - resume; + bb2: { + _0 = move ((_2 as Some).0: T); -+ StorageDead(_3); + StorageDead(_2); + return; } 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 fcc4d43ced6..82238626798 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 @@ -6,7 +6,6 @@ fn unwrap_unchecked(_1: Option<T>) -> T { scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) { debug self => _1; let mut _2: isize; - let mut _3: &std::option::Option<T>; scope 2 { debug val => _0; } @@ -19,19 +18,17 @@ fn unwrap_unchecked(_1: Option<T>) -> T { } } scope 4 (inlined Option::<T>::is_some) { - debug self => _3; + debug self => &_1; } } bb0: { - StorageLive(_3); _2 = discriminant(_1); switchInt(move _2) -> [1: bb1, otherwise: bb2]; } bb1: { _0 = move ((_1 as Some).0: T); - StorageDead(_3); 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 fcc4d43ced6..82238626798 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 @@ -6,7 +6,6 @@ fn unwrap_unchecked(_1: Option<T>) -> T { scope 1 (inlined #[track_caller] Option::<T>::unwrap_unchecked) { debug self => _1; let mut _2: isize; - let mut _3: &std::option::Option<T>; scope 2 { debug val => _0; } @@ -19,19 +18,17 @@ fn unwrap_unchecked(_1: Option<T>) -> T { } } scope 4 (inlined Option::<T>::is_some) { - debug self => _3; + debug self => &_1; } } bb0: { - StorageLive(_3); _2 = discriminant(_1); switchInt(move _2) -> [1: bb1, otherwise: bb2]; } bb1: { _0 = move ((_1 as Some).0: T); - StorageDead(_3); return; } 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 1cc44ce06cf..b647455aeec 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-abort.diff @@ -6,20 +6,16 @@ let mut _0: (); let _2: &[T]; let mut _3: &[T; 3]; - let _4: &[T; 3]; - let _5: [T; 3]; + let _4: [T; 3]; + let mut _5: T; let mut _6: T; let mut _7: T; - let mut _8: T; + let mut _8: usize; let mut _9: usize; - let mut _10: usize; - let mut _11: bool; - let mut _15: !; + let mut _10: bool; + let mut _11: !; scope 1 { debug v => _2; - let _12: &T; - let _13: &T; - let _14: &T; scope 2 { debug v1 => &(*_2)[0 of 3]; debug v2 => &(*_2)[1 of 3]; @@ -28,26 +24,26 @@ } bb0: { - StorageLive(_2); - StorageLive(_5); - _5 = [_1, _1, _1]; - _4 = &_5; - _2 = _4 as &[T] (PointerCoercion(Unsize)); - _9 = Len((*_2)); - _10 = const 3_usize; -- _11 = Eq(move _9, const 3_usize); -- switchInt(move _11) -> [0: bb1, otherwise: bb2]; + StorageLive(_3); + StorageLive(_4); + _4 = [_1, _1, _1]; + _3 = &_4; + _2 = move _3 as &[T] (PointerCoercion(Unsize)); + StorageDead(_3); + _8 = Len((*_2)); + _9 = const 3_usize; +- _10 = Eq(move _8, const 3_usize); +- switchInt(move _10) -> [0: bb1, otherwise: bb2]; + nop; -+ switchInt(move _9) -> [3: bb2, otherwise: bb1]; ++ switchInt(move _8) -> [3: bb2, otherwise: bb1]; } bb1: { - _15 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable; + _11 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind unreachable; } bb2: { - StorageDead(_5); - StorageDead(_2); + StorageDead(_4); return; } } 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 b708f667438..b02be61d031 100644 --- a/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff +++ b/tests/mir-opt/issue_76432.test.SimplifyComparisonIntegral.panic-unwind.diff @@ -6,20 +6,16 @@ let mut _0: (); let _2: &[T]; let mut _3: &[T; 3]; - let _4: &[T; 3]; - let _5: [T; 3]; + let _4: [T; 3]; + let mut _5: T; let mut _6: T; let mut _7: T; - let mut _8: T; + let mut _8: usize; let mut _9: usize; - let mut _10: usize; - let mut _11: bool; - let mut _15: !; + let mut _10: bool; + let mut _11: !; scope 1 { debug v => _2; - let _12: &T; - let _13: &T; - let _14: &T; scope 2 { debug v1 => &(*_2)[0 of 3]; debug v2 => &(*_2)[1 of 3]; @@ -28,26 +24,26 @@ } bb0: { - StorageLive(_2); - StorageLive(_5); - _5 = [_1, _1, _1]; - _4 = &_5; - _2 = _4 as &[T] (PointerCoercion(Unsize)); - _9 = Len((*_2)); - _10 = const 3_usize; -- _11 = Eq(move _9, const 3_usize); -- switchInt(move _11) -> [0: bb1, otherwise: bb2]; + StorageLive(_3); + StorageLive(_4); + _4 = [_1, _1, _1]; + _3 = &_4; + _2 = move _3 as &[T] (PointerCoercion(Unsize)); + StorageDead(_3); + _8 = Len((*_2)); + _9 = const 3_usize; +- _10 = Eq(move _8, const 3_usize); +- switchInt(move _10) -> [0: bb1, otherwise: bb2]; + nop; -+ switchInt(move _9) -> [3: bb2, otherwise: bb1]; ++ switchInt(move _8) -> [3: bb2, otherwise: bb1]; } bb1: { - _15 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue; + _11 = core::panicking::panic(const "internal error: entered unreachable code") -> unwind continue; } bb2: { - StorageDead(_5); - StorageDead(_2); + StorageDead(_4); return; } } diff --git a/tests/mir-opt/issue_99325.main.built.after.mir b/tests/mir-opt/issue_99325.main.built.after.mir index 0fe66d3fb70..aef89c7f9f7 100644 --- a/tests/mir-opt/issue_99325.main.built.after.mir +++ b/tests/mir-opt/issue_99325.main.built.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)]) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} -| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserSubsts { substs: [Const { ty: &'static [u8; 4], kind: UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), substs: [] } }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 0: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [Const { ty: &'static [u8; 4], kind: Branch([Leaf(0x41), Leaf(0x41), Leaf(0x41), Leaf(0x41)]) }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:10:16: 10:46, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} +| 1: user_ty: Canonical { value: TypeOf(DefId(0:3 ~ issue_99325[22bb]::function_with_bytes), UserArgs { args: [Const { ty: &'static [u8; 4], kind: UnevaluatedConst { def: DefId(0:8 ~ issue_99325[22bb]::main::{constant#1}), args: [] } }], user_self_ty: None }), max_universe: U0, variables: [] }, span: $DIR/issue_99325.rs:11:16: 11:68, inferred_ty: fn() -> &'static [u8] {function_with_bytes::<&*b"AAAA">} | fn main() -> () { let mut _0: (); 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 787f9ee095f..9743e192462 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 @@ -3,57 +3,53 @@ fn num_to_digit(_1: char) -> u32 { debug num => _1; let mut _0: u32; - let mut _5: std::option::Option<u32>; + let mut _4: std::option::Option<u32>; scope 1 (inlined char::methods::<impl char>::is_digit) { debug self => _1; debug radix => const 8_u32; let _2: std::option::Option<u32>; - let mut _3: &std::option::Option<u32>; scope 2 (inlined Option::<u32>::is_some) { - debug self => _3; - let mut _4: isize; + debug self => &_2; + let mut _3: isize; } } scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { - debug self => _5; - let mut _6: isize; - let mut _7: !; + debug self => _4; + let mut _5: isize; + let mut _6: !; scope 4 { debug val => _0; } } bb0: { - StorageLive(_3); StorageLive(_2); _2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind unreachable]; } bb1: { - _3 = &_2; - _4 = discriminant((*_3)); - StorageDead(_3); + _3 = discriminant(_2); StorageDead(_2); - switchInt(move _4) -> [1: bb2, otherwise: bb7]; + switchInt(move _3) -> [1: bb2, otherwise: bb7]; } bb2: { - StorageLive(_5); - _5 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb3, unwind unreachable]; + StorageLive(_4); + _4 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb3, unwind unreachable]; } bb3: { - _6 = discriminant(_5); - switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6]; + _5 = discriminant(_4); + switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6]; } bb4: { - _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable; + _6 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable; } bb5: { - _0 = move ((_5 as Some).0: u32); - StorageDead(_5); + _0 = move ((_4 as Some).0: u32); + StorageDead(_4); goto -> bb8; } 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 43a1a1eed20..e89d6eb4d50 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 @@ -3,57 +3,53 @@ fn num_to_digit(_1: char) -> u32 { debug num => _1; let mut _0: u32; - let mut _5: std::option::Option<u32>; + let mut _4: std::option::Option<u32>; scope 1 (inlined char::methods::<impl char>::is_digit) { debug self => _1; debug radix => const 8_u32; let _2: std::option::Option<u32>; - let mut _3: &std::option::Option<u32>; scope 2 (inlined Option::<u32>::is_some) { - debug self => _3; - let mut _4: isize; + debug self => &_2; + let mut _3: isize; } } scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { - debug self => _5; - let mut _6: isize; - let mut _7: !; + debug self => _4; + let mut _5: isize; + let mut _6: !; scope 4 { debug val => _0; } } bb0: { - StorageLive(_3); StorageLive(_2); _2 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb1, unwind continue]; } bb1: { - _3 = &_2; - _4 = discriminant((*_3)); - StorageDead(_3); + _3 = discriminant(_2); StorageDead(_2); - switchInt(move _4) -> [1: bb2, otherwise: bb7]; + switchInt(move _3) -> [1: bb2, otherwise: bb7]; } bb2: { - StorageLive(_5); - _5 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb3, unwind continue]; + StorageLive(_4); + _4 = char::methods::<impl char>::to_digit(_1, const 8_u32) -> [return: bb3, unwind continue]; } bb3: { - _6 = discriminant(_5); - switchInt(move _6) -> [0: bb4, 1: bb5, otherwise: bb6]; + _5 = discriminant(_4); + switchInt(move _5) -> [0: bb4, 1: bb5, otherwise: bb6]; } bb4: { - _7 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue; + _6 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue; } bb5: { - _0 = move ((_5 as Some).0: u32); - StorageDead(_5); + _0 = move ((_4 as Some).0: u32); + StorageDead(_4); goto -> bb8; } diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir index 98c267e8e71..9be41bff3ca 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir @@ -8,42 +8,38 @@ fn step_forward(_1: u32, _2: usize) -> u32 { debug start => _1; debug n => _2; let _3: std::option::Option<u32>; - let mut _4: &std::option::Option<u32>; - let mut _7: bool; - let mut _8: u32; + let mut _6: bool; + let mut _7: u32; scope 2 { } scope 3 (inlined Option::<u32>::is_none) { - debug self => _4; - let mut _6: bool; + debug self => &_3; + let mut _5: bool; scope 4 (inlined Option::<u32>::is_some) { - debug self => _4; - let mut _5: isize; + debug self => &_3; + let mut _4: isize; } } scope 5 (inlined core::num::<impl u32>::wrapping_add) { debug self => _1; - debug rhs => _8; + debug rhs => _7; } } bb0: { - StorageLive(_7); - StorageLive(_4); + StorageLive(_6); StorageLive(_3); _3 = <u32 as Step>::forward_checked(_1, _2) -> [return: bb1, unwind continue]; } bb1: { - _4 = &_3; - StorageLive(_6); - _5 = discriminant((*_4)); - _6 = Eq(_5, const 1_isize); - _7 = Not(move _6); - StorageDead(_6); + StorageLive(_5); + _4 = discriminant(_3); + _5 = Eq(_4, const 1_isize); + _6 = Not(move _5); + StorageDead(_5); StorageDead(_3); - StorageDead(_4); - switchInt(move _7) -> [0: bb3, otherwise: bb2]; + switchInt(move _6) -> [0: bb3, otherwise: bb2]; } bb2: { @@ -51,11 +47,11 @@ fn step_forward(_1: u32, _2: usize) -> u32 { } bb3: { + StorageDead(_6); + StorageLive(_7); + _7 = _2 as u32 (IntToInt); + _0 = Add(_1, _7); StorageDead(_7); - StorageLive(_8); - _8 = _2 as u32 (IntToInt); - _0 = Add(_1, _8); - StorageDead(_8); return; } } 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 3b49cb711b7..07a57a7b578 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 @@ -7,20 +7,19 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () let mut _3: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; let mut _4: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; let mut _5: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; - let mut _6: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>; - let mut _9: std::option::Option<U>; - let mut _10: isize; - let _12: (); + let mut _8: std::option::Option<U>; + let mut _9: isize; + let _11: (); scope 1 { debug iter => _5; - let _11: U; + let _10: U; scope 2 { - debug x => _11; + debug x => _10; } scope 4 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as Iterator>::next) { - debug self => _6; - let mut _7: &mut impl Iterator<Item = T>; - let mut _8: &mut impl Fn(T) -> Option<U>; + debug self => &_5; + let mut _6: &mut impl Iterator<Item = T>; + let mut _7: &mut impl Fn(T) -> Option<U>; } } scope 3 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as IntoIterator>::into_iter) { @@ -42,24 +41,23 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () } bb2: { - StorageLive(_9); - _6 = &mut _5; - StorageLive(_7); - _7 = &mut ((*_6).0: impl Iterator<Item = T>); StorageLive(_8); - _8 = &mut ((*_6).1: impl Fn(T) -> Option<U>); - _9 = <impl Iterator<Item = T> as Iterator>::find_map::<U, &mut impl Fn(T) -> Option<U>>(move _7, move _8) -> [return: bb3, unwind: bb9]; + StorageLive(_6); + _6 = &mut (_5.0: impl Iterator<Item = T>); + StorageLive(_7); + _7 = &mut (_5.1: impl Fn(T) -> Option<U>); + _8 = <impl Iterator<Item = T> as Iterator>::find_map::<U, &mut impl Fn(T) -> Option<U>>(move _6, move _7) -> [return: bb3, unwind: bb9]; } bb3: { - StorageDead(_8); StorageDead(_7); - _10 = discriminant(_9); - switchInt(move _10) -> [0: bb4, 1: bb6, otherwise: bb8]; + StorageDead(_6); + _9 = discriminant(_8); + switchInt(move _9) -> [0: bb4, 1: bb6, otherwise: bb8]; } bb4: { - StorageDead(_9); + StorageDead(_8); drop(_5) -> [return: bb5, unwind continue]; } @@ -70,12 +68,12 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> () } bb6: { - _11 = move ((_9 as Some).0: U); - _12 = opaque::<U>(move _11) -> [return: bb7, unwind: bb9]; + _10 = move ((_8 as Some).0: U); + _11 = opaque::<U>(move _10) -> [return: bb7, unwind: bb9]; } bb7: { - StorageDead(_9); + StorageDead(_8); 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 40bb3a37c58..99dc9600e41 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 @@ -4,111 +4,95 @@ fn int_range(_1: usize, _2: usize) -> () { debug start => _1; debug end => _2; let mut _0: (); - let mut _3: std::ops::Range<usize>; - let mut _4: std::ops::Range<usize>; - let mut _5: &mut std::ops::Range<usize>; - let mut _11: std::option::Option<usize>; - let mut _14: isize; - let _16: (); + let mut _3: usize; + let mut _6: std::option::Option<usize>; + let mut _9: isize; + let _11: (); scope 1 { - debug iter => _4; - let _15: usize; + debug iter => std::ops::Range<usize>{ .0 => _3, .1 => _2, }; + let _10: usize; scope 2 { - debug i => _15; + debug i => _10; } scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) { - debug self => _5; + debug self => &std::ops::Range<usize>{ .0 => _3, .1 => _2, }; scope 5 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _5; - let mut _6: &usize; - let mut _7: &usize; - let mut _10: bool; - let _12: usize; - let mut _13: usize; + debug self => &std::ops::Range<usize>{ .0 => _3, .1 => _2, }; + let mut _5: bool; + let _7: usize; + let mut _8: usize; scope 6 { - debug old => _12; + debug old => _7; scope 7 { } } scope 8 (inlined cmp::impls::<impl PartialOrd for usize>::lt) { - debug self => _6; - debug other => _7; - let mut _8: usize; - let mut _9: usize; + debug self => &_3; + debug other => &_2; + let mut _4: usize; } } } } scope 3 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) { - debug self => _3; + debug self => std::ops::Range<usize>{ .0 => _1, .1 => _2, }; } bb0: { - _3 = std::ops::Range::<usize> { start: _1, end: _2 }; - StorageLive(_4); - _4 = move _3; + StorageLive(_3); + _3 = _1; goto -> bb1; } bb1: { - StorageLive(_11); - _5 = &mut _4; - StorageLive(_12); - StorageLive(_10); StorageLive(_6); - _6 = &((*_5).0: usize); StorageLive(_7); - _7 = &((*_5).1: usize); - StorageLive(_8); - _8 = (*_6); - StorageLive(_9); - _9 = (*_7); - _10 = Lt(move _8, move _9); - StorageDead(_9); - StorageDead(_8); - StorageDead(_7); - StorageDead(_6); - switchInt(move _10) -> [0: bb2, otherwise: bb3]; + StorageLive(_5); + StorageLive(_4); + _4 = _3; + _5 = Lt(move _4, _2); + StorageDead(_4); + switchInt(move _5) -> [0: bb2, otherwise: bb3]; } bb2: { - _11 = Option::<usize>::None; + _6 = Option::<usize>::None; goto -> bb5; } bb3: { - _12 = ((*_5).0: usize); - StorageLive(_13); - _13 = <usize as Step>::forward_unchecked(_12, const 1_usize) -> [return: bb4, unwind continue]; + _7 = _3; + StorageLive(_8); + _8 = <usize as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb4, unwind continue]; } bb4: { - ((*_5).0: usize) = move _13; - StorageDead(_13); - _11 = Option::<usize>::Some(_12); + _3 = move _8; + StorageDead(_8); + _6 = Option::<usize>::Some(_7); goto -> bb5; } bb5: { - StorageDead(_10); - StorageDead(_12); - _14 = discriminant(_11); - switchInt(move _14) -> [0: bb6, 1: bb7, otherwise: bb9]; + StorageDead(_5); + StorageDead(_7); + _9 = discriminant(_6); + switchInt(move _9) -> [0: bb6, 1: bb7, otherwise: bb9]; } bb6: { - StorageDead(_11); - StorageDead(_4); + StorageDead(_6); + StorageDead(_3); return; } bb7: { - _15 = ((_11 as Some).0: usize); - _16 = opaque::<usize>(_15) -> [return: bb8, unwind continue]; + _10 = ((_6 as Some).0: usize); + _11 = opaque::<usize>(_10) -> [return: bb8, unwind continue]; } bb8: { - StorageDead(_11); + StorageDead(_6); goto -> bb1; } 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 e4e1d052e73..2614160363e 100644 --- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir @@ -38,11 +38,13 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () { bb2: { StorageLive(_7); + StorageLive(_6); _6 = &mut _5; - _7 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(_6) -> [return: bb3, unwind: bb9]; + _7 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(move _6) -> [return: bb3, unwind: bb9]; } bb3: { + StorageDead(_6); _8 = discriminant(_7); switchInt(move _8) -> [0: bb4, 1: bb6, otherwise: bb8]; } diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir index 1b5f2a0884b..8eff46fb931 100644 --- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir @@ -30,11 +30,13 @@ fn vec_move(_1: Vec<impl Sized>) -> () { bb2: { StorageLive(_5); + StorageLive(_4); _4 = &mut _3; - _5 = <std::vec::IntoIter<impl Sized> as Iterator>::next(_4) -> [return: bb3, unwind: bb9]; + _5 = <std::vec::IntoIter<impl Sized> as Iterator>::next(move _4) -> [return: bb3, unwind: bb9]; } bb3: { + StorageDead(_4); _6 = discriminant(_5); switchInt(move _6) -> [0: bb4, 1: bb6, otherwise: bb8]; } diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir index dde7a618881..eeb2e3a1b03 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir @@ -7,26 +7,24 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { scope 1 (inlined std::mem::replace::<u32>) { debug dest => _1; debug src => _2; - let mut _3: *const u32; - let mut _4: *mut u32; scope 2 { scope 3 { debug result => _0; scope 7 (inlined std::ptr::write::<u32>) { - debug dst => _4; + debug dst => _1; debug src => _2; scope 8 { scope 9 (inlined std::ptr::write::runtime::<u32>) { - debug dst => _4; + debug dst => _1; } } } } scope 4 (inlined std::ptr::read::<u32>) { - debug src => _3; + debug src => _1; scope 5 { scope 6 (inlined std::ptr::read::runtime::<u32>) { - debug src => _3; + debug src => _1; } } } @@ -34,14 +32,8 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { } bb0: { - StorageLive(_3); - _3 = &raw const (*_1); - _0 = (*_3); - StorageDead(_3); - StorageLive(_4); - _4 = &raw mut (*_1); - (*_4) = _2; - StorageDead(_4); + _0 = (*_1); + (*_1) = _2; 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 2344a3c0f83..cdaa3cfc995 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 @@ -5,103 +5,87 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { debug end => _2; debug f => _3; let mut _0: (); - let mut _4: std::ops::Range<u32>; - let mut _5: std::ops::Range<u32>; - let mut _6: &mut std::ops::Range<u32>; - let mut _12: std::option::Option<u32>; - let mut _15: isize; - let mut _17: &impl Fn(u32); - let mut _18: (u32,); - let _19: (); + let mut _4: u32; + let mut _7: std::option::Option<u32>; + let mut _10: isize; + let mut _12: &impl Fn(u32); + let mut _13: (u32,); + let _14: (); scope 1 { - debug iter => _5; - let _16: u32; + debug iter => std::ops::Range<u32>{ .0 => _4, .1 => _2, }; + let _11: u32; scope 2 { - debug x => _16; + debug x => _11; } scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) { - debug self => _6; + debug self => &std::ops::Range<u32>{ .0 => _4, .1 => _2, }; scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &u32; - let mut _8: &u32; - let mut _11: bool; - let _13: u32; - let mut _14: u32; + debug self => &std::ops::Range<u32>{ .0 => _4, .1 => _2, }; + let mut _6: bool; + let _8: u32; + let mut _9: u32; scope 6 { - debug old => _13; + debug old => _8; scope 7 { } } scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) { - debug self => _7; - debug other => _8; - let mut _9: u32; - let mut _10: u32; + debug self => &_4; + debug other => &_2; + let mut _5: u32; } } } } scope 3 (inlined <std::ops::Range<u32> as IntoIterator>::into_iter) { - debug self => _4; + debug self => std::ops::Range<u32>{ .0 => _1, .1 => _2, }; } bb0: { - _4 = std::ops::Range::<u32> { start: _1, end: _2 }; - StorageLive(_5); - _5 = move _4; + StorageLive(_4); + _4 = _1; goto -> bb1; } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); StorageLive(_7); - _7 = &((*_6).0: u32); StorageLive(_8); - _8 = &((*_6).1: u32); - StorageLive(_9); - _9 = (*_7); - StorageLive(_10); - _10 = (*_8); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - StorageDead(_8); - StorageDead(_7); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageLive(_6); + StorageLive(_5); + _5 = _4; + _6 = Lt(move _5, _2); + StorageDead(_5); + switchInt(move _6) -> [0: bb2, otherwise: bb3]; } bb2: { - _12 = Option::<u32>::None; + _7 = Option::<u32>::None; goto -> bb5; } bb3: { - _13 = ((*_6).0: u32); - StorageLive(_14); - _14 = <u32 as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable]; + _8 = _4; + StorageLive(_9); + _9 = <u32 as Step>::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind unreachable]; } bb4: { - ((*_6).0: u32) = move _14; - StorageDead(_14); - _12 = Option::<u32>::Some(_13); + _4 = move _9; + StorageDead(_9); + _7 = Option::<u32>::Some(_8); goto -> bb5; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_6); + StorageDead(_8); + _10 = discriminant(_7); + switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_12); - StorageDead(_5); + StorageDead(_7); + StorageDead(_4); drop(_3) -> [return: bb7, unwind unreachable]; } @@ -110,18 +94,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb8: { - _16 = ((_12 as Some).0: u32); - StorageLive(_17); - _17 = &_3; - StorageLive(_18); - _18 = (_16,); - _19 = <impl Fn(u32) as Fn<(u32,)>>::call(move _17, move _18) -> [return: bb9, unwind unreachable]; + _11 = ((_7 as Some).0: u32); + StorageLive(_12); + _12 = &_3; + StorageLive(_13); + _13 = (_11,); + _14 = <impl Fn(u32) as Fn<(u32,)>>::call(move _12, move _13) -> [return: bb9, unwind unreachable]; } bb9: { - StorageDead(_18); - StorageDead(_17); + StorageDead(_13); StorageDead(_12); + StorageDead(_7); goto -> bb1; } 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 fbe16dc3cd4..c4e56ea3b23 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 @@ -5,103 +5,87 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { debug end => _2; debug f => _3; let mut _0: (); - let mut _4: std::ops::Range<u32>; - let mut _5: std::ops::Range<u32>; - let mut _6: &mut std::ops::Range<u32>; - let mut _12: std::option::Option<u32>; - let mut _15: isize; - let mut _17: &impl Fn(u32); - let mut _18: (u32,); - let _19: (); + let mut _4: u32; + let mut _7: std::option::Option<u32>; + let mut _10: isize; + let mut _12: &impl Fn(u32); + let mut _13: (u32,); + let _14: (); scope 1 { - debug iter => _5; - let _16: u32; + debug iter => std::ops::Range<u32>{ .0 => _4, .1 => _2, }; + let _11: u32; scope 2 { - debug x => _16; + debug x => _11; } scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) { - debug self => _6; + debug self => &std::ops::Range<u32>{ .0 => _4, .1 => _2, }; scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &u32; - let mut _8: &u32; - let mut _11: bool; - let _13: u32; - let mut _14: u32; + debug self => &std::ops::Range<u32>{ .0 => _4, .1 => _2, }; + let mut _6: bool; + let _8: u32; + let mut _9: u32; scope 6 { - debug old => _13; + debug old => _8; scope 7 { } } scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) { - debug self => _7; - debug other => _8; - let mut _9: u32; - let mut _10: u32; + debug self => &_4; + debug other => &_2; + let mut _5: u32; } } } } scope 3 (inlined <std::ops::Range<u32> as IntoIterator>::into_iter) { - debug self => _4; + debug self => std::ops::Range<u32>{ .0 => _1, .1 => _2, }; } bb0: { - _4 = std::ops::Range::<u32> { start: _1, end: _2 }; - StorageLive(_5); - _5 = move _4; + StorageLive(_4); + _4 = _1; goto -> bb1; } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); StorageLive(_7); - _7 = &((*_6).0: u32); StorageLive(_8); - _8 = &((*_6).1: u32); - StorageLive(_9); - _9 = (*_7); - StorageLive(_10); - _10 = (*_8); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - StorageDead(_8); - StorageDead(_7); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageLive(_6); + StorageLive(_5); + _5 = _4; + _6 = Lt(move _5, _2); + StorageDead(_5); + switchInt(move _6) -> [0: bb2, otherwise: bb3]; } bb2: { - _12 = Option::<u32>::None; + _7 = Option::<u32>::None; goto -> bb5; } bb3: { - _13 = ((*_6).0: u32); - StorageLive(_14); - _14 = <u32 as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb11]; + _8 = _4; + StorageLive(_9); + _9 = <u32 as Step>::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind: bb11]; } bb4: { - ((*_6).0: u32) = move _14; - StorageDead(_14); - _12 = Option::<u32>::Some(_13); + _4 = move _9; + StorageDead(_9); + _7 = Option::<u32>::Some(_8); goto -> bb5; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_6); + StorageDead(_8); + _10 = discriminant(_7); + switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_12); - StorageDead(_5); + StorageDead(_7); + StorageDead(_4); drop(_3) -> [return: bb7, unwind continue]; } @@ -110,18 +94,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { } bb8: { - _16 = ((_12 as Some).0: u32); - StorageLive(_17); - _17 = &_3; - StorageLive(_18); - _18 = (_16,); - _19 = <impl Fn(u32) as Fn<(u32,)>>::call(move _17, move _18) -> [return: bb9, unwind: bb11]; + _11 = ((_7 as Some).0: u32); + StorageLive(_12); + _12 = &_3; + StorageLive(_13); + _13 = (_11,); + _14 = <impl Fn(u32) as Fn<(u32,)>>::call(move _12, move _13) -> [return: bb9, unwind: bb11]; } bb9: { - StorageDead(_18); - StorageDead(_17); + StorageDead(_13); StorageDead(_12); + StorageDead(_7); goto -> bb1; } 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 9737c9a87c7..8d306858b43 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 @@ -40,11 +40,13 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); + StorageLive(_6); _6 = &mut _5; _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_6) -> [return: bb2, unwind unreachable]; } bb2: { + StorageDead(_6); _8 = discriminant(_7); switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7]; } 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 04d6da1d9bd..e92c054c838 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 @@ -40,11 +40,13 @@ fn inclusive_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () { bb1: { StorageLive(_7); + StorageLive(_6); _6 = &mut _5; _7 = <RangeInclusive<u32> as iter::range::RangeInclusiveIteratorImpl>::spec_next(_6) -> [return: bb2, unwind: bb8]; } bb2: { + StorageDead(_6); _8 = discriminant(_7); switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb7]; } 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 1dfd00bf314..14fd049ede8 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 @@ -7,42 +7,34 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { debug self => _1; scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) { debug self => _1; - let mut _2: &u32; - let mut _3: &u32; - let mut _6: bool; - let _7: u32; - let mut _8: u32; + let mut _4: bool; + let _5: u32; + let mut _6: u32; scope 3 { - debug old => _7; + debug old => _5; scope 4 { } } scope 5 (inlined cmp::impls::<impl PartialOrd for u32>::lt) { - debug self => _2; - debug other => _3; - let mut _4: u32; - let mut _5: u32; + debug self => &((*_1).0: u32); + debug other => &((*_1).1: u32); + let mut _2: u32; + let mut _3: u32; } } } bb0: { - StorageLive(_7); - StorageLive(_6); + StorageLive(_5); + StorageLive(_4); StorageLive(_2); - _2 = &((*_1).0: u32); + _2 = ((*_1).0: u32); StorageLive(_3); - _3 = &((*_1).1: u32); - StorageLive(_4); - _4 = (*_2); - StorageLive(_5); - _5 = (*_3); - _6 = Lt(move _4, move _5); - StorageDead(_5); - StorageDead(_4); + _3 = ((*_1).1: u32); + _4 = Lt(move _2, move _3); StorageDead(_3); StorageDead(_2); - switchInt(move _6) -> [0: bb1, otherwise: bb2]; + switchInt(move _4) -> [0: bb1, otherwise: bb2]; } bb1: { @@ -51,21 +43,21 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { } bb2: { - _7 = ((*_1).0: u32); - StorageLive(_8); - _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind unreachable]; + _5 = ((*_1).0: u32); + StorageLive(_6); + _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind unreachable]; } bb3: { - ((*_1).0: u32) = move _8; - StorageDead(_8); - _0 = Option::<u32>::Some(_7); + ((*_1).0: u32) = move _6; + StorageDead(_6); + _0 = Option::<u32>::Some(_5); goto -> bb4; } bb4: { - StorageDead(_6); - StorageDead(_7); + StorageDead(_4); + StorageDead(_5); return; } } 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 65870f693c0..668a2ac1e20 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 @@ -7,42 +7,34 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { debug self => _1; scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) { debug self => _1; - let mut _2: &u32; - let mut _3: &u32; - let mut _6: bool; - let _7: u32; - let mut _8: u32; + let mut _4: bool; + let _5: u32; + let mut _6: u32; scope 3 { - debug old => _7; + debug old => _5; scope 4 { } } scope 5 (inlined cmp::impls::<impl PartialOrd for u32>::lt) { - debug self => _2; - debug other => _3; - let mut _4: u32; - let mut _5: u32; + debug self => &((*_1).0: u32); + debug other => &((*_1).1: u32); + let mut _2: u32; + let mut _3: u32; } } } bb0: { - StorageLive(_7); - StorageLive(_6); + StorageLive(_5); + StorageLive(_4); StorageLive(_2); - _2 = &((*_1).0: u32); + _2 = ((*_1).0: u32); StorageLive(_3); - _3 = &((*_1).1: u32); - StorageLive(_4); - _4 = (*_2); - StorageLive(_5); - _5 = (*_3); - _6 = Lt(move _4, move _5); - StorageDead(_5); - StorageDead(_4); + _3 = ((*_1).1: u32); + _4 = Lt(move _2, move _3); StorageDead(_3); StorageDead(_2); - switchInt(move _6) -> [0: bb1, otherwise: bb2]; + switchInt(move _4) -> [0: bb1, otherwise: bb2]; } bb1: { @@ -51,21 +43,21 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> { } bb2: { - _7 = ((*_1).0: u32); - StorageLive(_8); - _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind continue]; + _5 = ((*_1).0: u32); + StorageLive(_6); + _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind continue]; } bb3: { - ((*_1).0: u32) = move _8; - StorageDead(_8); - _0 = Option::<u32>::Some(_7); + ((*_1).0: u32) = move _6; + StorageDead(_6); + _0 = Option::<u32>::Some(_5); goto -> bb4; } bb4: { - StorageDead(_6); - StorageDead(_7); + StorageDead(_4); + StorageDead(_5); return; } } 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 499bee2ae40..f9b0c85c852 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 @@ -3,214 +3,138 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2: &&(usize, usize, usize, usize)) -> bool { let mut _0: bool; let mut _3: &(usize, usize, usize, usize); - let _4: &usize; + let mut _4: &(usize, usize, usize, usize); let mut _5: &(usize, usize, usize, usize); - let _6: &usize; - let mut _7: &(usize, usize, usize, usize); - let _8: &usize; - let mut _9: &(usize, usize, usize, usize); - let _10: &usize; - let mut _11: &&usize; - let _12: &usize; - let mut _13: &&usize; - let mut _18: bool; - let mut _19: bool; - let mut _20: &&usize; - let _21: &usize; - let mut _22: &&usize; - let mut _27: bool; - let mut _28: &&usize; - let _29: &usize; - let mut _30: &&usize; - let mut _35: bool; - let mut _36: bool; - let mut _37: &&usize; - let _38: &usize; - let mut _39: &&usize; - let mut _44: bool; + let mut _6: &(usize, usize, usize, usize); + let mut _9: bool; + let mut _10: bool; + let mut _13: bool; + let mut _16: bool; + let mut _17: bool; + let mut _20: bool; scope 1 { - debug a => _4; - debug b => _6; - debug c => _8; - debug d => _10; + debug a => &((*_3).0: usize); + debug b => &((*_4).1: usize); + debug c => &((*_5).2: usize); + debug d => &((*_6).3: usize); scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { - debug self => _11; - debug other => _13; - let mut _14: &usize; - let mut _15: &usize; + debug self => &&((*_3).0: usize); + debug other => &&((*_5).2: usize); scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) { - debug self => _14; - debug other => _15; - let mut _16: usize; - let mut _17: usize; + debug self => &((*_3).0: usize); + debug other => &((*_5).2: usize); + let mut _7: usize; + let mut _8: usize; } } scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { - debug self => _28; - debug other => _30; - let mut _31: &usize; - let mut _32: &usize; + debug self => &&((*_5).2: usize); + debug other => &&((*_3).0: usize); scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) { - debug self => _31; - debug other => _32; - let mut _33: usize; - let mut _34: usize; + debug self => &((*_5).2: usize); + debug other => &((*_3).0: usize); + let mut _14: usize; + let mut _15: usize; } } scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { - debug self => _20; - debug other => _22; - let mut _23: &usize; - let mut _24: &usize; + debug self => &&((*_6).3: usize); + debug other => &&((*_4).1: usize); scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) { - debug self => _23; - debug other => _24; - let mut _25: usize; - let mut _26: usize; + debug self => &((*_6).3: usize); + debug other => &((*_4).1: usize); + let mut _11: usize; + let mut _12: usize; } } scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) { - debug self => _37; - debug other => _39; - let mut _40: &usize; - let mut _41: &usize; + debug self => &&((*_4).1: usize); + debug other => &&((*_6).3: usize); scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) { - debug self => _40; - debug other => _41; - let mut _42: usize; - let mut _43: usize; + debug self => &((*_4).1: usize); + debug other => &((*_6).3: usize); + let mut _18: usize; + let mut _19: usize; } } } bb0: { - StorageLive(_4); _3 = deref_copy (*_2); - _4 = &((*_3).0: usize); - StorageLive(_6); + _4 = deref_copy (*_2); _5 = deref_copy (*_2); - _6 = &((*_5).1: usize); - StorageLive(_8); - _7 = deref_copy (*_2); - _8 = &((*_7).2: usize); + _6 = deref_copy (*_2); StorageLive(_10); - _9 = deref_copy (*_2); - _10 = &((*_9).3: usize); - StorageLive(_19); - StorageLive(_18); - StorageLive(_11); - _11 = &_4; - StorageLive(_13); - StorageLive(_12); - _12 = _8; - _13 = &_12; - _14 = deref_copy (*_11); - _15 = deref_copy (*_13); - StorageLive(_16); - _16 = (*_14); - StorageLive(_17); - _17 = (*_15); - _18 = Le(move _16, move _17); - StorageDead(_17); - StorageDead(_16); - StorageDead(_12); - StorageDead(_13); - StorageDead(_11); - switchInt(move _18) -> [0: bb1, otherwise: bb2]; + StorageLive(_9); + StorageLive(_7); + _7 = ((*_3).0: usize); + StorageLive(_8); + _8 = ((*_5).2: usize); + _9 = Le(move _7, move _8); + StorageDead(_8); + StorageDead(_7); + switchInt(move _9) -> [0: bb1, otherwise: bb2]; } bb1: { - _19 = const false; + _10 = const false; goto -> bb3; } bb2: { - StorageLive(_27); - StorageLive(_20); - _20 = &_10; - StorageLive(_22); - StorageLive(_21); - _21 = _6; - _22 = &_21; - _23 = deref_copy (*_20); - _24 = deref_copy (*_22); - StorageLive(_25); - _25 = (*_23); - StorageLive(_26); - _26 = (*_24); - _27 = Le(move _25, move _26); - StorageDead(_26); - StorageDead(_25); - StorageDead(_21); - StorageDead(_22); - StorageDead(_20); - _19 = move _27; + StorageLive(_13); + StorageLive(_11); + _11 = ((*_6).3: usize); + StorageLive(_12); + _12 = ((*_4).1: usize); + _13 = Le(move _11, move _12); + StorageDead(_12); + StorageDead(_11); + _10 = move _13; goto -> bb3; } bb3: { - StorageDead(_27); - StorageDead(_18); - switchInt(move _19) -> [0: bb4, otherwise: bb8]; + StorageDead(_13); + StorageDead(_9); + switchInt(move _10) -> [0: bb4, otherwise: bb8]; } bb4: { - StorageLive(_36); - StorageLive(_35); - StorageLive(_28); - _28 = &_8; - StorageLive(_30); - StorageLive(_29); - _29 = _4; - _30 = &_29; - _31 = deref_copy (*_28); - _32 = deref_copy (*_30); - StorageLive(_33); - _33 = (*_31); - StorageLive(_34); - _34 = (*_32); - _35 = Le(move _33, move _34); - StorageDead(_34); - StorageDead(_33); - StorageDead(_29); - StorageDead(_30); - StorageDead(_28); - switchInt(move _35) -> [0: bb5, otherwise: bb6]; + StorageLive(_17); + StorageLive(_16); + StorageLive(_14); + _14 = ((*_5).2: usize); + StorageLive(_15); + _15 = ((*_3).0: usize); + _16 = Le(move _14, move _15); + StorageDead(_15); + StorageDead(_14); + switchInt(move _16) -> [0: bb5, otherwise: bb6]; } bb5: { - _36 = const false; + _17 = const false; goto -> bb7; } bb6: { - StorageLive(_44); - StorageLive(_37); - _37 = &_6; - StorageLive(_39); - StorageLive(_38); - _38 = _10; - _39 = &_38; - _40 = deref_copy (*_37); - _41 = deref_copy (*_39); - StorageLive(_42); - _42 = (*_40); - StorageLive(_43); - _43 = (*_41); - _44 = Le(move _42, move _43); - StorageDead(_43); - StorageDead(_42); - StorageDead(_38); - StorageDead(_39); - StorageDead(_37); - _36 = move _44; + StorageLive(_20); + StorageLive(_18); + _18 = ((*_4).1: usize); + StorageLive(_19); + _19 = ((*_6).3: usize); + _20 = Le(move _18, move _19); + StorageDead(_19); + StorageDead(_18); + _17 = move _20; goto -> bb7; } bb7: { - StorageDead(_44); - StorageDead(_35); - _0 = move _36; + StorageDead(_20); + StorageDead(_16); + _0 = move _17; goto -> bb9; } @@ -220,12 +144,8 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2 } bb9: { - StorageDead(_36); - StorageDead(_19); + StorageDead(_17); StorageDead(_10); - StorageDead(_8); - StorageDead(_6); - StorageDead(_4); return; } } 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 65416d09053..07a58309ee4 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 @@ -10,38 +10,37 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { scope 2 (inlined <usize as SliceIndex<[u32]>>::get_mut) { debug self => _2; debug slice => _1; - let mut _3: &[u32]; - let mut _4: usize; - let mut _5: bool; - let mut _6: *mut [u32]; - let mut _8: *mut u32; - let mut _9: &mut u32; + let mut _3: usize; + let mut _4: bool; + let mut _5: *mut [u32]; + let mut _7: *mut u32; + let mut _8: &mut u32; scope 3 { scope 4 (inlined <usize as SliceIndex<[u32]>>::get_unchecked_mut) { debug self => _2; - debug slice => _6; - let mut _7: *mut u32; + debug slice => _5; + let mut _6: *mut u32; scope 5 { debug this => _2; scope 6 { scope 7 (inlined <usize as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) { debug this => _2; - debug slice => _6; + debug slice => _5; scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) { - debug self => _6; - let mut _10: *const [u32]; + debug self => _5; + let mut _9: *const [u32]; scope 9 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _10; + debug ptr => _9; scope 10 { } } } } scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { - debug self => _6; + debug self => _5; } scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) { - debug self => _7; + debug self => _6; debug count => _2; scope 13 { } @@ -54,16 +53,13 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb0: { - StorageLive(_9); - StorageLive(_5); + StorageLive(_7); StorageLive(_4); StorageLive(_3); - _3 = &(*_1); - _4 = Len((*_3)); + _3 = Len((*_1)); + _4 = Lt(_2, move _3); StorageDead(_3); - _5 = Lt(_2, move _4); - StorageDead(_4); - switchInt(move _5) -> [0: bb1, otherwise: bb2]; + switchInt(move _4) -> [0: bb1, otherwise: bb2]; } bb1: { @@ -73,24 +69,24 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb2: { StorageLive(_8); + StorageLive(_5); + _5 = &raw mut (*_1); + StorageLive(_9); StorageLive(_6); - _6 = &raw mut (*_1); - StorageLive(_10); - StorageLive(_7); - _7 = _6 as *mut u32 (PtrToPtr); - _8 = Offset(_7, _2); - StorageDead(_7); - StorageDead(_10); + _6 = _5 as *mut u32 (PtrToPtr); + _7 = Offset(_6, _2); StorageDead(_6); - _9 = &mut (*_8); - _0 = Option::<&mut u32>::Some(_9); + StorageDead(_9); + StorageDead(_5); + _8 = &mut (*_7); + _0 = Option::<&mut u32>::Some(move _8); StorageDead(_8); goto -> bb3; } bb3: { - StorageDead(_5); - StorageDead(_9); + StorageDead(_4); + StorageDead(_7); return; } } 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 65416d09053..07a58309ee4 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 @@ -10,38 +10,37 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { scope 2 (inlined <usize as SliceIndex<[u32]>>::get_mut) { debug self => _2; debug slice => _1; - let mut _3: &[u32]; - let mut _4: usize; - let mut _5: bool; - let mut _6: *mut [u32]; - let mut _8: *mut u32; - let mut _9: &mut u32; + let mut _3: usize; + let mut _4: bool; + let mut _5: *mut [u32]; + let mut _7: *mut u32; + let mut _8: &mut u32; scope 3 { scope 4 (inlined <usize as SliceIndex<[u32]>>::get_unchecked_mut) { debug self => _2; - debug slice => _6; - let mut _7: *mut u32; + debug slice => _5; + let mut _6: *mut u32; scope 5 { debug this => _2; scope 6 { scope 7 (inlined <usize as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) { debug this => _2; - debug slice => _6; + debug slice => _5; scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) { - debug self => _6; - let mut _10: *const [u32]; + debug self => _5; + let mut _9: *const [u32]; scope 9 (inlined std::ptr::metadata::<[u32]>) { - debug ptr => _10; + debug ptr => _9; scope 10 { } } } } scope 11 (inlined ptr::mut_ptr::<impl *mut [u32]>::as_mut_ptr) { - debug self => _6; + debug self => _5; } scope 12 (inlined ptr::mut_ptr::<impl *mut u32>::add) { - debug self => _7; + debug self => _6; debug count => _2; scope 13 { } @@ -54,16 +53,13 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { } bb0: { - StorageLive(_9); - StorageLive(_5); + StorageLive(_7); StorageLive(_4); StorageLive(_3); - _3 = &(*_1); - _4 = Len((*_3)); + _3 = Len((*_1)); + _4 = Lt(_2, move _3); StorageDead(_3); - _5 = Lt(_2, move _4); - StorageDead(_4); - switchInt(move _5) -> [0: bb1, otherwise: bb2]; + switchInt(move _4) -> [0: bb1, otherwise: bb2]; } bb1: { @@ -73,24 +69,24 @@ fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> { bb2: { StorageLive(_8); + StorageLive(_5); + _5 = &raw mut (*_1); + StorageLive(_9); StorageLive(_6); - _6 = &raw mut (*_1); - StorageLive(_10); - StorageLive(_7); - _7 = _6 as *mut u32 (PtrToPtr); - _8 = Offset(_7, _2); - StorageDead(_7); - StorageDead(_10); + _6 = _5 as *mut u32 (PtrToPtr); + _7 = Offset(_6, _2); StorageDead(_6); - _9 = &mut (*_8); - _0 = Option::<&mut u32>::Some(_9); + StorageDead(_9); + StorageDead(_5); + _8 = &mut (*_7); + _0 = Option::<&mut u32>::Some(move _8); StorageDead(_8); goto -> bb3; } bb3: { - StorageDead(_5); - StorageDead(_9); + StorageDead(_4); + StorageDead(_7); return; } } 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 e07e2bb7bfe..2f5d356a26d 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 @@ -61,7 +61,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> bb0: { _3 = move (_2.0: usize); _4 = move (_2.1: usize); - StorageLive(_13); StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_14); @@ -92,7 +91,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> StorageDead(_15); StorageDead(_5); _0 = &mut (*_13); - StorageDead(_13); return; } } 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 e07e2bb7bfe..2f5d356a26d 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 @@ -61,7 +61,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> bb0: { _3 = move (_2.0: usize); _4 = move (_2.1: usize); - StorageLive(_13); StorageLive(_5); _5 = &raw mut (*_1); StorageLive(_14); @@ -92,7 +91,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) -> StorageDead(_15); StorageDead(_5); _0 = &mut (*_13); - StorageDead(_13); 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 d1ab16697a6..2cf81d86267 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 @@ -152,11 +152,13 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb4: { StorageLive(_17); + StorageLive(_16); _16 = &mut _15; - _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(_16) -> [return: bb5, unwind unreachable]; + _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _16) -> [return: bb5, unwind unreachable]; } bb5: { + StorageDead(_16); _18 = discriminant(_17); switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; } 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 03751f7fdf7..6985806ec93 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 @@ -152,11 +152,13 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { bb4: { StorageLive(_17); + StorageLive(_16); _16 = &mut _15; - _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(_16) -> [return: bb5, unwind: bb11]; + _17 = <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next(move _16) -> [return: bb5, unwind: bb11]; } bb5: { + StorageDead(_16); _18 = discriminant(_17); switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; } 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 db971e10f32..a4b8460e98e 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 @@ -140,11 +140,13 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb4: { StorageLive(_16); + StorageLive(_15); _15 = &mut _14; - _16 = <std::slice::Iter<'_, T> as Iterator>::next(_15) -> [return: bb5, unwind unreachable]; + _16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind unreachable]; } bb5: { + StorageDead(_15); _17 = discriminant(_16); switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10]; } 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 74597799168..58f312b1aac 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 @@ -140,11 +140,13 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { bb4: { StorageLive(_16); + StorageLive(_15); _15 = &mut _14; - _16 = <std::slice::Iter<'_, T> as Iterator>::next(_15) -> [return: bb5, unwind: bb11]; + _16 = <std::slice::Iter<'_, T> as Iterator>::next(move _15) -> [return: bb5, unwind: bb11]; } bb5: { + StorageDead(_15); _17 = discriminant(_16); switchInt(move _17) -> [0: bb6, 1: bb8, otherwise: bb10]; } 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 00177033bbf..901381f070b 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 @@ -5,112 +5,95 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug f => _2; let mut _0: (); let mut _3: usize; - let mut _4: std::ops::Range<usize>; - let mut _5: std::ops::Range<usize>; - let mut _6: &mut std::ops::Range<usize>; - let mut _12: std::option::Option<usize>; - let mut _15: isize; - let mut _17: usize; - let mut _18: bool; - let mut _20: &impl Fn(usize, &T); - let mut _21: (usize, &T); - let _22: (); + let mut _4: usize; + let mut _7: std::option::Option<usize>; + let mut _10: isize; + let mut _12: usize; + let mut _13: bool; + let mut _15: &impl Fn(usize, &T); + let mut _16: (usize, &T); + let _17: (); + let mut _18: usize; scope 1 { - debug iter => _5; - let _16: usize; + debug iter => std::ops::Range<usize>{ .0 => _4, .1 => _3, }; + let _11: usize; scope 2 { - debug i => _16; - let _19: &T; + debug i => _11; + let _14: &T; scope 3 { - debug x => _19; + debug x => _14; } } scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) { - debug self => _6; + debug self => &std::ops::Range<usize>{ .0 => _4, .1 => _3, }; scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &usize; - let mut _8: &usize; - let mut _11: bool; - let _13: usize; - let mut _14: usize; + debug self => &std::ops::Range<usize>{ .0 => _4, .1 => _3, }; + let mut _6: bool; + let _8: usize; + let mut _9: usize; scope 7 { - debug old => _13; + debug old => _8; scope 8 { } } scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) { - debug self => _7; - debug other => _8; - let mut _9: usize; - let mut _10: usize; + debug self => &_4; + debug other => &_3; + let mut _5: usize; } } } } scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) { - debug self => _4; + debug self => std::ops::Range<usize>{ .0 => _18, .1 => _3, }; } bb0: { - StorageLive(_3); _3 = Len((*_1)); - _4 = std::ops::Range::<usize> { start: const 0_usize, end: move _3 }; - StorageDead(_3); - StorageLive(_5); - _5 = move _4; + StorageLive(_4); + _4 = const 0_usize; goto -> bb1; } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); StorageLive(_7); - _7 = &((*_6).0: usize); StorageLive(_8); - _8 = &((*_6).1: usize); - StorageLive(_9); - _9 = (*_7); - StorageLive(_10); - _10 = (*_8); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - StorageDead(_8); - StorageDead(_7); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageLive(_6); + StorageLive(_5); + _5 = _4; + _6 = Lt(move _5, _3); + StorageDead(_5); + switchInt(move _6) -> [0: bb2, otherwise: bb3]; } bb2: { - _12 = Option::<usize>::None; + _7 = Option::<usize>::None; goto -> bb5; } bb3: { - _13 = ((*_6).0: usize); - StorageLive(_14); - _14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable]; + _8 = _4; + StorageLive(_9); + _9 = <usize as Step>::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind unreachable]; } bb4: { - ((*_6).0: usize) = move _14; - StorageDead(_14); - _12 = Option::<usize>::Some(_13); + _4 = move _9; + StorageDead(_9); + _7 = Option::<usize>::Some(_8); goto -> bb5; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11]; + StorageDead(_6); + StorageDead(_8); + _10 = discriminant(_7); + switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb11]; } bb6: { - StorageDead(_12); - StorageDead(_5); + StorageDead(_7); + StorageDead(_4); drop(_2) -> [return: bb7, unwind unreachable]; } @@ -119,25 +102,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb8: { - _16 = ((_12 as Some).0: 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: bb9, unwind unreachable]; + _11 = ((_7 as Some).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: bb9, unwind unreachable]; } bb9: { - _19 = &(*_1)[_16]; - StorageLive(_20); - _20 = &_2; - StorageLive(_21); - _21 = (_16, _19); - _22 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _20, move _21) -> [return: bb10, unwind unreachable]; + _14 = &(*_1)[_11]; + StorageLive(_15); + _15 = &_2; + StorageLive(_16); + _16 = (_11, _14); + _17 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _15, move _16) -> [return: bb10, unwind unreachable]; } bb10: { - StorageDead(_21); - StorageDead(_20); - StorageDead(_12); + StorageDead(_16); + StorageDead(_15); + StorageDead(_7); goto -> bb1; } 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 3423c5d865d..a47a73395cf 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 @@ -5,112 +5,95 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug f => _2; let mut _0: (); let mut _3: usize; - let mut _4: std::ops::Range<usize>; - let mut _5: std::ops::Range<usize>; - let mut _6: &mut std::ops::Range<usize>; - let mut _12: std::option::Option<usize>; - let mut _15: isize; - let mut _17: usize; - let mut _18: bool; - let mut _20: &impl Fn(usize, &T); - let mut _21: (usize, &T); - let _22: (); + let mut _4: usize; + let mut _7: std::option::Option<usize>; + let mut _10: isize; + let mut _12: usize; + let mut _13: bool; + let mut _15: &impl Fn(usize, &T); + let mut _16: (usize, &T); + let _17: (); + let mut _18: usize; scope 1 { - debug iter => _5; - let _16: usize; + debug iter => std::ops::Range<usize>{ .0 => _4, .1 => _3, }; + let _11: usize; scope 2 { - debug i => _16; - let _19: &T; + debug i => _11; + let _14: &T; scope 3 { - debug x => _19; + debug x => _14; } } scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) { - debug self => _6; + debug self => &std::ops::Range<usize>{ .0 => _4, .1 => _3, }; scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) { - debug self => _6; - let mut _7: &usize; - let mut _8: &usize; - let mut _11: bool; - let _13: usize; - let mut _14: usize; + debug self => &std::ops::Range<usize>{ .0 => _4, .1 => _3, }; + let mut _6: bool; + let _8: usize; + let mut _9: usize; scope 7 { - debug old => _13; + debug old => _8; scope 8 { } } scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) { - debug self => _7; - debug other => _8; - let mut _9: usize; - let mut _10: usize; + debug self => &_4; + debug other => &_3; + let mut _5: usize; } } } } scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) { - debug self => _4; + debug self => std::ops::Range<usize>{ .0 => _18, .1 => _3, }; } bb0: { - StorageLive(_3); _3 = Len((*_1)); - _4 = std::ops::Range::<usize> { start: const 0_usize, end: move _3 }; - StorageDead(_3); - StorageLive(_5); - _5 = move _4; + StorageLive(_4); + _4 = const 0_usize; goto -> bb1; } bb1: { - StorageLive(_12); - _6 = &mut _5; - StorageLive(_13); - StorageLive(_11); StorageLive(_7); - _7 = &((*_6).0: usize); StorageLive(_8); - _8 = &((*_6).1: usize); - StorageLive(_9); - _9 = (*_7); - StorageLive(_10); - _10 = (*_8); - _11 = Lt(move _9, move _10); - StorageDead(_10); - StorageDead(_9); - StorageDead(_8); - StorageDead(_7); - switchInt(move _11) -> [0: bb2, otherwise: bb3]; + StorageLive(_6); + StorageLive(_5); + _5 = _4; + _6 = Lt(move _5, _3); + StorageDead(_5); + switchInt(move _6) -> [0: bb2, otherwise: bb3]; } bb2: { - _12 = Option::<usize>::None; + _7 = Option::<usize>::None; goto -> bb5; } bb3: { - _13 = ((*_6).0: usize); - StorageLive(_14); - _14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb12]; + _8 = _4; + StorageLive(_9); + _9 = <usize as Step>::forward_unchecked(_8, const 1_usize) -> [return: bb4, unwind: bb12]; } bb4: { - ((*_6).0: usize) = move _14; - StorageDead(_14); - _12 = Option::<usize>::Some(_13); + _4 = move _9; + StorageDead(_9); + _7 = Option::<usize>::Some(_8); goto -> bb5; } bb5: { - StorageDead(_11); - StorageDead(_13); - _15 = discriminant(_12); - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11]; + StorageDead(_6); + StorageDead(_8); + _10 = discriminant(_7); + switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb11]; } bb6: { - StorageDead(_12); - StorageDead(_5); + StorageDead(_7); + StorageDead(_4); drop(_2) -> [return: bb7, unwind continue]; } @@ -119,25 +102,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb8: { - _16 = ((_12 as Some).0: 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: bb9, unwind: bb12]; + _11 = ((_7 as Some).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: bb9, unwind: bb12]; } bb9: { - _19 = &(*_1)[_16]; - StorageLive(_20); - _20 = &_2; - StorageLive(_21); - _21 = (_16, _19); - _22 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _20, move _21) -> [return: bb10, unwind: bb12]; + _14 = &(*_1)[_11]; + StorageLive(_15); + _15 = &_2; + StorageLive(_16); + _16 = (_11, _14); + _17 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _15, move _16) -> [return: bb10, unwind: bb12]; } bb10: { - StorageDead(_21); - StorageDead(_20); - StorageDead(_12); + StorageDead(_16); + StorageDead(_15); + StorageDead(_7); goto -> bb1; } 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 e546140e0c1..b550711aa41 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 @@ -7,21 +7,20 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _13: std::slice::Iter<'_, T>; let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>; let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>; - let mut _16: &mut std::iter::Rev<std::slice::Iter<'_, T>>; - let mut _18: std::option::Option<&T>; - let mut _19: isize; - let mut _21: &impl Fn(&T); - let mut _22: (&T,); - let _23: (); + let mut _17: std::option::Option<&T>; + let mut _18: isize; + let mut _20: &impl Fn(&T); + let mut _21: (&T,); + let _22: (); scope 1 { debug iter => _15; - let _20: &T; + let _19: &T; scope 2 { - debug x => _20; + debug x => _19; } scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { - debug self => _16; - let mut _17: &mut std::slice::Iter<'_, T>; + debug self => &_15; + let mut _16: &mut std::slice::Iter<'_, T>; } } scope 3 (inlined core::slice::<impl [T]>::iter) { @@ -49,15 +48,15 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug ptr => _9; scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { debug self => _9; - let mut _24: *mut u8; + let mut _23: *mut u8; scope 17 { scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { - debug ptr => _24; + debug ptr => _23; scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { - debug self => _24; + debug self => _23; scope 20 { scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { - debug self => _24; + debug self => _23; } } } @@ -132,10 +131,10 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_9); _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_24); + StorageLive(_23); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull::<T> { pointer: _10 }; - StorageDead(_24); + StorageDead(_23); StorageDead(_10); StorageDead(_9); StorageLive(_12); @@ -153,21 +152,20 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb4: { - StorageLive(_18); - _16 = &mut _15; StorageLive(_17); - _17 = &mut ((*_16).0: std::slice::Iter<'_, T>); - _18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind unreachable]; + StorageLive(_16); + _16 = &mut (_15.0: std::slice::Iter<'_, T>); + _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_17); - _19 = discriminant(_18); - switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_16); + _18 = discriminant(_17); + switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_18); + StorageDead(_17); StorageDead(_15); drop(_2) -> [return: bb7, unwind unreachable]; } @@ -177,18 +175,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _20 = ((_18 as Some).0: &T); + _19 = ((_17 as Some).0: &T); + StorageLive(_20); + _20 = &_2; StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_20,); - _23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind unreachable]; + _21 = (_19,); + _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind unreachable]; } bb9: { - StorageDead(_22); StorageDead(_21); - StorageDead(_18); + StorageDead(_20); + StorageDead(_17); goto -> bb4; } 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 551cac46bdf..23444241cd2 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 @@ -7,21 +7,20 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { let mut _13: std::slice::Iter<'_, T>; let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>; let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>; - let mut _16: &mut std::iter::Rev<std::slice::Iter<'_, T>>; - let mut _18: std::option::Option<&T>; - let mut _19: isize; - let mut _21: &impl Fn(&T); - let mut _22: (&T,); - let _23: (); + let mut _17: std::option::Option<&T>; + let mut _18: isize; + let mut _20: &impl Fn(&T); + let mut _21: (&T,); + let _22: (); scope 1 { debug iter => _15; - let _20: &T; + let _19: &T; scope 2 { - debug x => _20; + debug x => _19; } scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { - debug self => _16; - let mut _17: &mut std::slice::Iter<'_, T>; + debug self => &_15; + let mut _16: &mut std::slice::Iter<'_, T>; } } scope 3 (inlined core::slice::<impl [T]>::iter) { @@ -49,15 +48,15 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { debug ptr => _9; scope 16 (inlined ptr::mut_ptr::<impl *mut T>::is_null) { debug self => _9; - let mut _24: *mut u8; + let mut _23: *mut u8; scope 17 { scope 18 (inlined ptr::mut_ptr::<impl *mut T>::is_null::runtime_impl) { - debug ptr => _24; + debug ptr => _23; scope 19 (inlined ptr::mut_ptr::<impl *mut u8>::addr) { - debug self => _24; + debug self => _23; scope 20 { scope 21 (inlined ptr::mut_ptr::<impl *mut u8>::cast::<()>) { - debug self => _24; + debug self => _23; } } } @@ -132,10 +131,10 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { StorageLive(_9); _9 = _4 as *mut T (PtrToPtr); StorageLive(_10); - StorageLive(_24); + StorageLive(_23); _10 = _9 as *const T (PointerCoercion(MutToConstPointer)); _11 = NonNull::<T> { pointer: _10 }; - StorageDead(_24); + StorageDead(_23); StorageDead(_10); StorageDead(_9); StorageLive(_12); @@ -153,21 +152,20 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb4: { - StorageLive(_18); - _16 = &mut _15; StorageLive(_17); - _17 = &mut ((*_16).0: std::slice::Iter<'_, T>); - _18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind: bb11]; + StorageLive(_16); + _16 = &mut (_15.0: std::slice::Iter<'_, T>); + _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind: bb11]; } bb5: { - StorageDead(_17); - _19 = discriminant(_18); - switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10]; + StorageDead(_16); + _18 = discriminant(_17); + switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; } bb6: { - StorageDead(_18); + StorageDead(_17); StorageDead(_15); drop(_2) -> [return: bb7, unwind continue]; } @@ -177,18 +175,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } bb8: { - _20 = ((_18 as Some).0: &T); + _19 = ((_17 as Some).0: &T); + StorageLive(_20); + _20 = &_2; StorageLive(_21); - _21 = &_2; - StorageLive(_22); - _22 = (_20,); - _23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11]; + _21 = (_19,); + _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind: bb11]; } bb9: { - StorageDead(_22); StorageDead(_21); - StorageDead(_18); + StorageDead(_20); + StorageDead(_17); goto -> bb4; } 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 b9329520bab..ed7107e53ef 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 @@ -3,17 +3,19 @@ fn outer(_1: u8) -> u8 { debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 - let _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 bb0: { + StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 - _0 = inner(_2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/spans.rs:11:5: 11:14 + _0 = inner(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/spans.rs:11:5: 11:14 // mir::Constant // + span: $DIR/spans.rs:11:5: 11:10 // + literal: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(<ZST>) } } bb1: { + StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 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 1e20b1be56b..dc436dc2650 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 @@ -3,17 +3,19 @@ fn outer(_1: u8) -> u8 { debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15 let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26 - let _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 + let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13 bb0: { + StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13 _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13 - _0 = inner(_2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:11:5: 11:14 + _0 = inner(move _2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:11:5: 11:14 // mir::Constant // + span: $DIR/spans.rs:11:5: 11:10 // + literal: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(<ZST>) } } bb1: { + StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14 return; // scope 0 at $DIR/spans.rs:12:2: 12:2 } } diff --git a/tests/run-coverage/partial_eq.coverage b/tests/run-coverage/partial_eq.coverage index a77175af663..be4f23ec0ba 100644 --- a/tests/run-coverage/partial_eq.coverage +++ b/tests/run-coverage/partial_eq.coverage @@ -36,7 +36,7 @@ 35| | did: DefId(0:101 ~ autocfg[c44a]::version::{impl#2}::partial_cmp), 36| | const_param_did: None 37| | }), - 38| | substs: [] + 38| | args: [] 39| | }' 40| |The `PartialOrd` derived by `Version` happened to generate a MIR that generated coverage 41| |without a code region associated with any `Counter`. Code regions were associated with at least diff --git a/tests/run-coverage/partial_eq.rs b/tests/run-coverage/partial_eq.rs index 4ceaba9b111..dd8b42c18ce 100644 --- a/tests/run-coverage/partial_eq.rs +++ b/tests/run-coverage/partial_eq.rs @@ -35,7 +35,7 @@ thread 'rustc' panicked at 'No counters provided the source_hash for function: did: DefId(0:101 ~ autocfg[c44a]::version::{impl#2}::partial_cmp), const_param_did: None }), - substs: [] + args: [] }' The `PartialOrd` derived by `Version` happened to generate a MIR that generated coverage without a code region associated with any `Counter`. Code regions were associated with at least diff --git a/tests/rustdoc-json/traits/private_supertrait.rs b/tests/rustdoc-json/traits/private_supertrait.rs new file mode 100644 index 00000000000..49238e5e88b --- /dev/null +++ b/tests/rustdoc-json/traits/private_supertrait.rs @@ -0,0 +1,15 @@ +// ignore-tidy-linelength + +#![feature(no_core)] +#![no_core] + + +// @!has "$.index[*][?(@.name == 'sealed')]" +mod sealed { + // @set sealed_id = "$.index[*][?(@.name=='Sealed')].id" + pub trait Sealed {} +} + +// @count "$.index[*][?(@.name=='Trait')].inner.trait.bounds[*]" 1 +// @is "$.index[*][?(@.name=='Trait')].inner.trait.bounds[0].trait_bound.trait.id" $sealed_id +pub trait Trait: sealed::Sealed {} diff --git a/tests/ui/borrowck/copy-suggestion-region-vid.rs b/tests/ui/borrowck/copy-suggestion-region-vid.rs index dff95283459..3c5b887ce17 100644 --- a/tests/ui/borrowck/copy-suggestion-region-vid.rs +++ b/tests/ui/borrowck/copy-suggestion-region-vid.rs @@ -1,3 +1,4 @@ +//@run-rustfix pub struct DataStruct(); pub struct HelperStruct<'n> { diff --git a/tests/ui/borrowck/copy-suggestion-region-vid.stderr b/tests/ui/borrowck/copy-suggestion-region-vid.stderr index 40b8ab182f3..b344aa66405 100644 --- a/tests/ui/borrowck/copy-suggestion-region-vid.stderr +++ b/tests/ui/borrowck/copy-suggestion-region-vid.stderr @@ -1,5 +1,5 @@ error[E0382]: borrow of moved value: `helpers` - --> $DIR/copy-suggestion-region-vid.rs:12:43 + --> $DIR/copy-suggestion-region-vid.rs:13:43 | LL | let helpers = [vec![], vec![]]; | ------- move occurs because `helpers` has type `[Vec<&i64>; 2]`, which does not implement the `Copy` trait @@ -8,6 +8,11 @@ LL | HelperStruct { helpers, is_empty: helpers[0].is_empty() } | ------- ^^^^^^^^^^ value borrowed here after move | | | value moved here + | +help: consider cloning the value if the performance cost is acceptable + | +LL | HelperStruct { helpers: helpers.clone(), is_empty: helpers[0].is_empty() } + | +++++++++++++++++ error: aborting due to previous error diff --git a/tests/ui/borrowck/issue-85765-closure.rs b/tests/ui/borrowck/issue-85765-closure.rs new file mode 100644 index 00000000000..f2d1dd0fbc3 --- /dev/null +++ b/tests/ui/borrowck/issue-85765-closure.rs @@ -0,0 +1,31 @@ +fn main() { + let _ = || { + let mut test = Vec::new(); + let rofl: &Vec<Vec<i32>> = &mut test; + //~^ HELP consider changing this binding's type + rofl.push(Vec::new()); + //~^ ERROR cannot borrow `*rofl` as mutable, as it is behind a `&` reference + //~| NOTE `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable + + let mut mutvar = 42; + let r = &mutvar; + //~^ HELP consider changing this to be a mutable reference + *r = 0; + //~^ ERROR cannot assign to `*r`, which is behind a `&` reference + //~| NOTE `r` is a `&` reference, so the data it refers to cannot be written + + #[rustfmt::skip] + let x: &usize = &mut{0}; + //~^ HELP consider changing this binding's type + *x = 1; + //~^ ERROR cannot assign to `*x`, which is behind a `&` reference + //~| NOTE `x` is a `&` reference, so the data it refers to cannot be written + + #[rustfmt::skip] + let y: &usize = &mut(0); + //~^ HELP consider changing this binding's type + *y = 1; + //~^ ERROR cannot assign to `*y`, which is behind a `&` reference + //~| NOTE `y` is a `&` reference, so the data it refers to cannot be written + }; +} diff --git a/tests/ui/borrowck/issue-85765-closure.stderr b/tests/ui/borrowck/issue-85765-closure.stderr new file mode 100644 index 00000000000..936ddd67bcd --- /dev/null +++ b/tests/ui/borrowck/issue-85765-closure.stderr @@ -0,0 +1,48 @@ +error[E0596]: cannot borrow `*rofl` as mutable, as it is behind a `&` reference + --> $DIR/issue-85765-closure.rs:6:9 + | +LL | rofl.push(Vec::new()); + | ^^^^ `rofl` is a `&` reference, so the data it refers to cannot be borrowed as mutable + | +help: consider changing this binding's type + | +LL | let rofl: &mut Vec<Vec<i32>> = &mut test; + | ~~~~~~~~~~~~~~~~~~ + +error[E0594]: cannot assign to `*r`, which is behind a `&` reference + --> $DIR/issue-85765-closure.rs:13:9 + | +LL | *r = 0; + | ^^^^^^ `r` is a `&` reference, so the data it refers to cannot be written + | +help: consider changing this to be a mutable reference + | +LL | let r = &mut mutvar; + | +++ + +error[E0594]: cannot assign to `*x`, which is behind a `&` reference + --> $DIR/issue-85765-closure.rs:20:9 + | +LL | *x = 1; + | ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written + | +help: consider changing this binding's type + | +LL | let x: &mut usize = &mut{0}; + | ~~~~~~~~~~ + +error[E0594]: cannot assign to `*y`, which is behind a `&` reference + --> $DIR/issue-85765-closure.rs:27:9 + | +LL | *y = 1; + | ^^^^^^ `y` is a `&` reference, so the data it refers to cannot be written + | +help: consider changing this binding's type + | +LL | let y: &mut usize = &mut(0); + | ~~~~~~~~~~ + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0594, E0596. +For more information about an error, try `rustc --explain E0594`. diff --git a/tests/ui/btreemap/btreemap-index-mut-2.rs b/tests/ui/btreemap/btreemap-index-mut-2.rs new file mode 100644 index 00000000000..fe676210a1b --- /dev/null +++ b/tests/ui/btreemap/btreemap-index-mut-2.rs @@ -0,0 +1,8 @@ +use std::collections::BTreeMap; + +fn main() { + let _ = || { + let mut map = BTreeMap::<u32, u32>::new(); + map[&0] = 1; //~ ERROR cannot assign + }; +} diff --git a/tests/ui/btreemap/btreemap-index-mut-2.stderr b/tests/ui/btreemap/btreemap-index-mut-2.stderr new file mode 100644 index 00000000000..c8d4fd59550 --- /dev/null +++ b/tests/ui/btreemap/btreemap-index-mut-2.stderr @@ -0,0 +1,19 @@ +error[E0594]: cannot assign to data in an index of `BTreeMap<u32, u32>` + --> $DIR/btreemap-index-mut-2.rs:6:9 + | +LL | map[&0] = 1; + | ^^^^^^^^^^^ cannot assign + | + = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `BTreeMap<u32, u32>` +help: to modify a `BTreeMap<u32, u32>`, use `.get_mut()`, `.insert()` or the entry API + | +LL | map.insert(&0, 1); + | ~~~~~~~~ ~ + +LL | map.get_mut(&0).map(|val| { *val = 1; }); + | ~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ ++++ +LL | let val = map.entry(&0).or_insert(1); + | +++++++++ ~~~~~~~ ~~~~~~~~~~~~ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/closures/binder/nested-closures-regions.stderr b/tests/ui/closures/binder/nested-closures-regions.stderr index 381aadb1564..a30339ac67b 100644 --- a/tests/ui/closures/binder/nested-closures-regions.stderr +++ b/tests/ui/closures/binder/nested-closures-regions.stderr @@ -4,7 +4,7 @@ note: external requirements LL | for<'a> || -> () { for<'c> |_: &'a ()| -> () {}; }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: main::{closure#0}::{closure#0} with closure substs [ + = note: defining type: main::{closure#0}::{closure#0} with closure args [ i8, extern "rust-call" fn((&(),)), (), @@ -21,7 +21,7 @@ note: no external requirements LL | for<'a> || -> () { for<'c> |_: &'a ()| -> () {}; }; | ^^^^^^^^^^^^^^^^ | - = note: defining type: main::{closure#0} with closure substs [ + = note: defining type: main::{closure#0} with closure args [ i8, extern "rust-call" fn(()), (), diff --git a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr index 381bb0c084a..49453b0538b 100644 --- a/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr +++ b/tests/ui/closures/print/closure-print-generic-trim-off-verbose-2.stderr @@ -9,7 +9,7 @@ LL | let c1 : () = c; | expected due to this | = note: expected unit type `()` - found closure `[mod1::f<T>::{closure#0} closure_substs=(unavailable) substs=[T, ?16t, extern "rust-call" fn(()), ?15t]]` + found closure `[mod1::f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]]` help: use parentheses to call this closure | LL | let c1 : () = c(); diff --git a/tests/ui/closures/print/closure-print-generic-verbose-2.stderr b/tests/ui/closures/print/closure-print-generic-verbose-2.stderr index 2a4d16c48dc..d2deba3dd84 100644 --- a/tests/ui/closures/print/closure-print-generic-verbose-2.stderr +++ b/tests/ui/closures/print/closure-print-generic-verbose-2.stderr @@ -9,7 +9,7 @@ LL | let c1 : () = c; | expected due to this | = note: expected unit type `()` - found closure `[f<T>::{closure#0} closure_substs=(unavailable) substs=[T, ?16t, extern "rust-call" fn(()), ?15t]]` + found closure `[f<T>::{closure#0} closure_args=(unavailable) args=[T, ?16t, extern "rust-call" fn(()), ?15t]]` help: use parentheses to call this closure | LL | let c1 : () = c(); diff --git a/tests/ui/closures/print/closure-print-verbose.stderr b/tests/ui/closures/print/closure-print-verbose.stderr index 9e219435e5c..acc81f5e466 100644 --- a/tests/ui/closures/print/closure-print-verbose.stderr +++ b/tests/ui/closures/print/closure-print-verbose.stderr @@ -7,7 +7,7 @@ LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a }; | expected due to this | = note: expected fn pointer `fn(u8) -> u8` - found closure `[main::{closure#0} closure_substs=(unavailable) substs=[i8, extern "rust-call" fn((u8,)) -> u8, ?6t]]` + found closure `[main::{closure#0} closure_args=(unavailable) args=[i8, extern "rust-call" fn((u8,)) -> u8, ?6t]]` note: closures can only be coerced to `fn` types if they do not capture any variables --> $DIR/closure-print-verbose.rs:10:39 | diff --git a/tests/ui/dyn-star/llvm-old-style-ptrs.rs b/tests/ui/dyn-star/llvm-old-style-ptrs.rs index d35519632be..4c042a53979 100644 --- a/tests/ui/dyn-star/llvm-old-style-ptrs.rs +++ b/tests/ui/dyn-star/llvm-old-style-ptrs.rs @@ -3,6 +3,8 @@ // (opaque-pointers flag is called force-opaque-pointers in LLVM 13...) // min-llvm-version: 14.0 +// (the ability to disable opaque pointers has been removed in LLVM 17) +// ignore-llvm-version: 17 - 99 // This test can be removed once non-opaque pointers are gone from LLVM, maybe. diff --git a/tests/ui/liveness/liveness-move-call-arg-2.rs b/tests/ui/liveness/liveness-move-call-arg-2.rs new file mode 100644 index 00000000000..b93535c89b1 --- /dev/null +++ b/tests/ui/liveness/liveness-move-call-arg-2.rs @@ -0,0 +1,12 @@ +fn take(_x: Box<isize>) {} + + +fn main() { + let _ = || { + let x: Box<isize> = Box::new(25); + + loop { + take(x); //~ ERROR use of moved value: `x` + } + }; +} diff --git a/tests/ui/liveness/liveness-move-call-arg-2.stderr b/tests/ui/liveness/liveness-move-call-arg-2.stderr new file mode 100644 index 00000000000..479a086a80c --- /dev/null +++ b/tests/ui/liveness/liveness-move-call-arg-2.stderr @@ -0,0 +1,26 @@ +error[E0382]: use of moved value: `x` + --> $DIR/liveness-move-call-arg-2.rs:9:18 + | +LL | let x: Box<isize> = Box::new(25); + | - move occurs because `x` has type `Box<isize>`, which does not implement the `Copy` trait +LL | +LL | loop { + | ---- inside of this loop +LL | take(x); + | ^ value moved here, in previous iteration of loop + | +note: consider changing this parameter type in function `take` to borrow instead if owning the value isn't necessary + --> $DIR/liveness-move-call-arg-2.rs:1:13 + | +LL | fn take(_x: Box<isize>) {} + | ---- ^^^^^^^^^^ this parameter takes ownership of the value + | | + | in this function +help: consider cloning the value if the performance cost is acceptable + | +LL | take(x.clone()); + | ++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/nll/closure-requirements/escape-argument-callee.stderr b/tests/ui/nll/closure-requirements/escape-argument-callee.stderr index 61233fd8407..1e3a5328d3d 100644 --- a/tests/ui/nll/closure-requirements/escape-argument-callee.stderr +++ b/tests/ui/nll/closure-requirements/escape-argument-callee.stderr @@ -4,7 +4,7 @@ note: no external requirements LL | let mut closure = expect_sig(|p, y| *p = y); | ^^^^^^ | - = note: defining type: test::{closure#0} with closure substs [ + = note: defining type: test::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) i32)), (), diff --git a/tests/ui/nll/closure-requirements/escape-argument.stderr b/tests/ui/nll/closure-requirements/escape-argument.stderr index 61e2a1ea6f0..bc4ba93f884 100644 --- a/tests/ui/nll/closure-requirements/escape-argument.stderr +++ b/tests/ui/nll/closure-requirements/escape-argument.stderr @@ -4,7 +4,7 @@ note: no external requirements LL | let mut closure = expect_sig(|p, y| *p = y); | ^^^^^^ | - = note: defining type: test::{closure#0} with closure substs [ + = note: defining type: test::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32)), (), diff --git a/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr b/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr index c00a31ef8e1..727df1cf890 100644 --- a/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr +++ b/tests/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -4,7 +4,7 @@ note: external requirements LL | let mut closure1 = || p = &y; | ^^ | - = note: defining type: test::{closure#0}::{closure#0} with closure substs [ + = note: defining type: test::{closure#0}::{closure#0} with closure args [ i16, extern "rust-call" fn(()), (&'?1 mut &'?2 i32, &'?3 i32), @@ -18,7 +18,7 @@ note: external requirements LL | let mut closure = || { | ^^ | - = note: defining type: test::{closure#0} with closure substs [ + = note: defining type: test::{closure#0} with closure args [ i16, extern "rust-call" fn(()), (&'?1 mut &'?2 i32, &'?3 i32), diff --git a/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr b/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr index 2d67e6e7d72..ff638f2a1ec 100644 --- a/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr +++ b/tests/ui/nll/closure-requirements/escape-upvar-ref.stderr @@ -4,7 +4,7 @@ note: external requirements LL | let mut closure = || p = &y; | ^^ | - = note: defining type: test::{closure#0} with closure substs [ + = note: defining type: test::{closure#0} with closure args [ i16, extern "rust-call" fn(()), (&'?1 mut &'?2 i32, &'?3 i32), diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr index ba42576d403..f8383cc42a2 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -4,7 +4,7 @@ note: no external requirements LL | |_outlives1, _outlives2, _outlives3, x, y| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: supply::{closure#0} with closure substs [ + = note: defining type: supply::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?3 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)), (), diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 9dd6e02081f..113173d8f76 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -4,7 +4,7 @@ note: external requirements LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: supply::{closure#0} with closure substs [ + = note: defining type: supply::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)), (), diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index e2f5576d395..ba15199ab5a 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -4,7 +4,7 @@ note: no external requirements LL | foo(cell, |cell_a, cell_x| { | ^^^^^^^^^^^^^^^^ | - = note: defining type: case1::{closure#0} with closure substs [ + = note: defining type: case1::{closure#0} with closure args [ i32, for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)), (), @@ -34,7 +34,7 @@ note: external requirements LL | foo(cell, |cell_a, cell_x| { | ^^^^^^^^^^^^^^^^ | - = note: defining type: case2::{closure#0} with closure substs [ + = note: defining type: case2::{closure#0} with closure args [ i32, for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)), (), diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index 383fb471ad3..f2bf83c6c59 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -4,7 +4,7 @@ note: external requirements LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | ^^^^^^^^^^^^^^^^^ | - = note: defining type: supply::{closure#0} with closure substs [ + = note: defining type: supply::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) u32>)), (), diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index ac346c0b110..2734326ed64 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -4,7 +4,7 @@ note: external requirements LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: supply::{closure#0} with closure substs [ + = note: defining type: supply::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)), (), diff --git a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr index b217ae19773..5ab321eb666 100644 --- a/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/tests/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -4,7 +4,7 @@ note: external requirements LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: test::{closure#0} with closure substs [ + = note: defining type: test::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?2 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)), (), diff --git a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr index f31478b6d1c..595fd5ff565 100644 --- a/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr +++ b/tests/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr @@ -4,7 +4,7 @@ note: external requirements LL | |_outlives1, _outlives2, x, y| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: supply::{closure#0} with closure substs [ + = note: defining type: supply::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?2 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)), (), diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr index 1509ade87fa..62b0e3eed85 100644 --- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr +++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -4,7 +4,7 @@ note: no external requirements LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | ^^^^^^^^^^^^^^^^^ | - = note: defining type: supply::{closure#0} with closure substs [ + = note: defining type: supply::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)), (), diff --git a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr index c85a9872e21..6f2044d621e 100644 --- a/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr +++ b/tests/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -4,7 +4,7 @@ note: no external requirements LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: defining type: supply::{closure#0} with closure substs [ + = note: defining type: supply::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)), (), diff --git a/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr index 05e274ab220..1aa7de1e137 100644 --- a/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr +++ b/tests/ui/nll/closure-requirements/propagate-from-trait-match.stderr @@ -4,7 +4,7 @@ note: external requirements LL | establish_relationships(value, |value| { | ^^^^^^^ | - = note: defining type: supply::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: supply::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((T,)), (), diff --git a/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr index 4e34ba51659..7635f2ede0a 100644 --- a/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr +++ b/tests/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -4,7 +4,7 @@ note: no external requirements LL | expect_sig(|a, b| b); // ought to return `a` | ^^^^^^ | - = note: defining type: test::{closure#0} with closure substs [ + = note: defining type: test::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) i32, (), diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 4eefb180ee5..433024c30bb 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -4,7 +4,7 @@ note: external requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ | - = note: defining type: no_region::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: no_region::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?2)>, (), @@ -37,7 +37,7 @@ note: external requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ | - = note: defining type: correct_region::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: correct_region::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?2)>, (), @@ -61,7 +61,7 @@ note: external requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ | - = note: defining type: wrong_region::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: wrong_region::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?3)>, (), @@ -94,7 +94,7 @@ note: external requirements LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^ | - = note: defining type: outlives_region::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: outlives_region::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '?3)>, (), diff --git a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr index 986c2bd2182..ebdce7bc108 100644 --- a/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -4,7 +4,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)), (), @@ -54,7 +54,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), @@ -104,7 +104,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), @@ -129,7 +129,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), diff --git a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 25cc60d8141..52040663e00 100644 --- a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -4,7 +4,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)), (), @@ -42,7 +42,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), @@ -80,7 +80,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), @@ -105,7 +105,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), @@ -130,7 +130,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: one_region::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: one_region::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)), (), diff --git a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr index 5a092d7b849..97be61b77a8 100644 --- a/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr @@ -4,7 +4,7 @@ note: no external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: no_relationships_late::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)), (), @@ -27,7 +27,7 @@ note: no external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: no_relationships_early::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), @@ -50,7 +50,7 @@ note: no external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: projection_outlives::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), @@ -73,7 +73,7 @@ note: no external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: elements_outlive::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), @@ -96,7 +96,7 @@ note: no external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: one_region::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: one_region::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)), (), diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 51283aa8828..dbad8e47846 100644 --- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -4,7 +4,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: no_relationships_late::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: no_relationships_late::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), @@ -38,7 +38,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: no_relationships_early::<'?1, '?2, '?3, T>::{closure#0} with closure substs [ + = note: defining type: no_relationships_early::<'?1, '?2, '?3, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)), (), @@ -72,7 +72,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: projection_outlives::<'?1, '?2, '?3, T>::{closure#0} with closure substs [ + = note: defining type: projection_outlives::<'?1, '?2, '?3, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)), (), @@ -97,7 +97,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: elements_outlive1::<'?1, '?2, '?3, T>::{closure#0} with closure substs [ + = note: defining type: elements_outlive1::<'?1, '?2, '?3, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)), (), @@ -122,7 +122,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: elements_outlive2::<'?1, '?2, '?3, T>::{closure#0} with closure substs [ + = note: defining type: elements_outlive2::<'?1, '?2, '?3, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)), (), @@ -147,7 +147,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: two_regions::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: two_regions::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)), (), @@ -188,7 +188,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: two_regions_outlive::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: two_regions_outlive::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), @@ -213,7 +213,7 @@ note: external requirements LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^ | - = note: defining type: one_region::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: one_region::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)), (), diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr index 04616f9b702..660211fe21a 100644 --- a/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ b/tests/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -4,7 +4,7 @@ note: external requirements LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^ | - = note: defining type: generic::<T>::{closure#0} with closure substs [ + = note: defining type: generic::<T>::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)), (), @@ -26,7 +26,7 @@ note: external requirements LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^ | - = note: defining type: generic_fail::<T>::{closure#0} with closure substs [ + = note: defining type: generic_fail::<T>::{closure#0} with closure args [ i16, for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)), (), diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index d580774ff8c..ddad1d205e7 100644 --- a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -4,7 +4,7 @@ note: external requirements LL | with_signature(x, |y| y) | ^^^ | - = note: defining type: no_region::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: no_region::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn std::fmt::Debug + '?2)>, (), diff --git a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr index 3d4c11a3c54..bb455e9aed0 100644 --- a/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ b/tests/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -4,7 +4,7 @@ note: external requirements LL | with_signature(a, b, |x, y| { | ^^^^^^ | - = note: defining type: no_region::<T>::{closure#0} with closure substs [ + = note: defining type: no_region::<T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?1 ()>, T)), (), @@ -38,7 +38,7 @@ note: external requirements LL | with_signature(a, b, |x, y| { | ^^^^^^ | - = note: defining type: correct_region::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: correct_region::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)), (), @@ -62,7 +62,7 @@ note: external requirements LL | with_signature(a, b, |x, y| { | ^^^^^^ | - = note: defining type: wrong_region::<'?1, T>::{closure#0} with closure substs [ + = note: defining type: wrong_region::<'?1, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)), (), @@ -98,7 +98,7 @@ note: external requirements LL | with_signature(a, b, |x, y| { | ^^^^^^ | - = note: defining type: outlives_region::<'?1, '?2, T>::{closure#0} with closure substs [ + = note: defining type: outlives_region::<'?1, '?2, T>::{closure#0} with closure args [ i32, extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)), (), diff --git a/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs b/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs index ccda9129dab..1d0b0d55af6 100644 --- a/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs +++ b/tests/ui/nll/user-annotations/dump-adt-brace-struct.rs @@ -8,7 +8,7 @@ struct SomeStruct<T> { t: T } -#[rustc_dump_user_substs] +#[rustc_dump_user_args] fn main() { SomeStruct { t: 22 }; // Nothing given, no annotation. diff --git a/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr b/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr index 5860621909c..7809b2470fe 100644 --- a/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr +++ b/tests/ui/nll/user-annotations/dump-adt-brace-struct.stderr @@ -1,4 +1,4 @@ -error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None } +error: user args: UserArgs { args: [&ReStatic u32], user_self_ty: None } --> $DIR/dump-adt-brace-struct.rs:19:5 | LL | SomeStruct::<&'static u32> { t: &22 }; diff --git a/tests/ui/nll/user-annotations/dump-fn-method.rs b/tests/ui/nll/user-annotations/dump-fn-method.rs index 148d63d848f..9bdbbc37caa 100644 --- a/tests/ui/nll/user-annotations/dump-fn-method.rs +++ b/tests/ui/nll/user-annotations/dump-fn-method.rs @@ -15,7 +15,7 @@ impl<S, T> Bazoom<T> for S { fn foo<'a, T>(_: T) { } -#[rustc_dump_user_substs] +#[rustc_dump_user_args] fn main() { // Here: nothing is given, so we don't have any annotation. let x = foo; diff --git a/tests/ui/nll/user-annotations/dump-fn-method.stderr b/tests/ui/nll/user-annotations/dump-fn-method.stderr index d139efa888f..1daf4982511 100644 --- a/tests/ui/nll/user-annotations/dump-fn-method.stderr +++ b/tests/ui/nll/user-annotations/dump-fn-method.stderr @@ -1,22 +1,22 @@ -error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None } +error: user args: UserArgs { args: [&ReStatic u32], user_self_ty: None } --> $DIR/dump-fn-method.rs:29:13 | LL | let x = foo::<&'static u32>; | ^^^^^^^^^^^^^^^^^^^ -error: user substs: UserSubsts { substs: [^0, u32, ^1], user_self_ty: None } +error: user args: UserArgs { args: [^0, u32, ^1], user_self_ty: None } --> $DIR/dump-fn-method.rs:35:13 | LL | let x = <_ as Bazoom<u32>>::method::<_>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: user substs: UserSubsts { substs: [u8, &ReStatic u16, u32], user_self_ty: None } +error: user args: UserArgs { args: [u8, &ReStatic u16, u32], user_self_ty: None } --> $DIR/dump-fn-method.rs:44:13 | LL | let x = <u8 as Bazoom<&'static u16>>::method::<u32>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: user substs: UserSubsts { substs: [^0, ^1, u32], user_self_ty: None } +error: user args: UserArgs { args: [^0, ^1, u32], user_self_ty: None } --> $DIR/dump-fn-method.rs:52:5 | LL | y.method::<u32>(44, 66); diff --git a/tests/ui/suggestions/suggest-mut-method-for-loop-closure.rs b/tests/ui/suggestions/suggest-mut-method-for-loop-closure.rs new file mode 100644 index 00000000000..e4721ba0193 --- /dev/null +++ b/tests/ui/suggestions/suggest-mut-method-for-loop-closure.rs @@ -0,0 +1,19 @@ +use std::collections::HashMap; +struct X(usize); +struct Y { + v: u32, +} + +fn main() { + let _ = || { + let mut buzz = HashMap::new(); + buzz.insert("a", Y { v: 0 }); + + for mut t in buzz.values() { + //~^ HELP + //~| SUGGESTION values_mut() + t.v += 1; + //~^ ERROR cannot assign + } + }; +} diff --git a/tests/ui/suggestions/suggest-mut-method-for-loop-closure.stderr b/tests/ui/suggestions/suggest-mut-method-for-loop-closure.stderr new file mode 100644 index 00000000000..8a2df8d7cc1 --- /dev/null +++ b/tests/ui/suggestions/suggest-mut-method-for-loop-closure.stderr @@ -0,0 +1,15 @@ +error[E0594]: cannot assign to `t.v`, which is behind a `&` reference + --> $DIR/suggest-mut-method-for-loop-closure.rs:15:13 + | +LL | for mut t in buzz.values() { + | ------------- + | | | + | | help: use mutable method: `values_mut()` + | this iterator yields `&` references +... +LL | t.v += 1; + | ^^^^^^^^ `t` is a `&` reference, so the data it refers to cannot be written + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0594`. diff --git a/tests/ui/thir-print/thir-flat-const-variant.stdout b/tests/ui/thir-print/thir-flat-const-variant.stdout index 1b76f07c318..7bddc925996 100644 --- a/tests/ui/thir-print/thir-flat-const-variant.stdout +++ b/tests/ui/thir-print/thir-flat-const-variant.stdout @@ -35,7 +35,7 @@ Thir { AdtExpr { adt_def: Foo, variant_index: 0, - substs: [], + args: [], user_ty: None, fields: [ FieldExpr { @@ -120,7 +120,7 @@ Thir { AdtExpr { adt_def: Foo, variant_index: 0, - substs: [], + args: [], user_ty: None, fields: [ FieldExpr { @@ -205,7 +205,7 @@ Thir { AdtExpr { adt_def: Foo, variant_index: 0, - substs: [], + args: [], user_ty: None, fields: [ FieldExpr { @@ -290,7 +290,7 @@ Thir { AdtExpr { adt_def: Foo, variant_index: 0, - substs: [], + args: [], user_ty: None, fields: [ FieldExpr { diff --git a/tests/ui/thir-print/thir-tree-match.stdout b/tests/ui/thir-print/thir-tree-match.stdout index eea04c0951d..3fc130f0176 100644 --- a/tests/ui/thir-print/thir-tree-match.stdout +++ b/tests/ui/thir-print/thir-tree-match.stdout @@ -106,7 +106,7 @@ body: variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] flags: IS_ENUM repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 } - substs: [] + args: [] variant_index: 0 subpatterns: [ Pat: { @@ -120,7 +120,7 @@ body: variants: [VariantDef { def_id: DefId(0:4 ~ thir_tree_match[fcf8]::Bar::First), ctor: Some((Const, DefId(0:5 ~ thir_tree_match[fcf8]::Bar::First::{constructor#0}))), name: "First", discr: Relative(0), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:6 ~ thir_tree_match[fcf8]::Bar::Second), ctor: Some((Const, DefId(0:7 ~ thir_tree_match[fcf8]::Bar::Second::{constructor#0}))), name: "Second", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:8 ~ thir_tree_match[fcf8]::Bar::Third), ctor: Some((Const, DefId(0:9 ~ thir_tree_match[fcf8]::Bar::Third::{constructor#0}))), name: "Third", discr: Relative(2), fields: [], flags: NO_VARIANT_FLAGS }] flags: IS_ENUM repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 10333377570083945360 } - substs: [] + args: [] variant_index: 0 subpatterns: [] } @@ -179,7 +179,7 @@ body: variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] flags: IS_ENUM repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 } - substs: [] + args: [] variant_index: 0 subpatterns: [ Pat: { @@ -242,7 +242,7 @@ body: variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }] flags: IS_ENUM repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 } - substs: [] + args: [] variant_index: 1 subpatterns: [] } |
