From 12660997425e3d2c9ace188531eff02e52ad7262 Mon Sep 17 00:00:00 2001 From: Stovent Date: Thu, 10 Feb 2022 00:24:12 -0500 Subject: [PATCH 01/10] Implement carrying_add and borrowing_sub on signed numbers --- library/core/src/num/int_macros.rs | 80 +++++++++++++++++++++++++++ library/core/tests/lib.rs | 1 + library/core/tests/num/int_macros.rs | 26 +++++++++ library/core/tests/num/uint_macros.rs | 22 ++++++++ 4 files changed, 129 insertions(+) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 1f435784be14c..4e51b90b835cf 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1512,6 +1512,53 @@ macro_rules! int_impl { (a as Self, b) } + /// Calculates `self + rhs + carry` without the ability to overflow. + /// + /// Performs "ternary addition" which takes in an extra bit to add, and may return an + /// additional bit of overflow. This allows for chaining together multiple additions + /// to create "big integers" which represent larger values. + /// + #[doc = concat!("This can be thought of as a ", stringify!($BITS), "-bit \"full adder\", in the electronics sense.")] + /// + /// # Examples + /// + /// Basic usage + /// + /// ``` + /// #![feature(bigint_helper_methods)] + #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".carrying_add(2, false), (7, false));")] + #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".carrying_add(2, true), (8, false));")] + #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(1, false), (", stringify!($SelfT), "::MIN, true));")] + #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(0, true), (", stringify!($SelfT), "::MIN, true));")] + #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(1, true), (", stringify!($SelfT), "::MIN + 1, true));")] + #[doc = concat!("assert_eq!(", + stringify!($SelfT), "::MAX.carrying_add(", stringify!($SelfT), "::MAX, true), ", + "(-1, true));" + )] + #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.carrying_add(-1, true), (", stringify!($SelfT), "::MIN, false));")] + #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".carrying_add(", stringify!($SelfT), "::MAX, true), (", stringify!($SelfT), "::MIN, true));")] + /// ``` + /// + /// If `carry` is false, this method is equivalent to [`overflowing_add`](Self::overflowing_add): + /// + /// ``` + /// #![feature(bigint_helper_methods)] + #[doc = concat!("assert_eq!(5_", stringify!($SelfT), ".carrying_add(2, false), 5_", stringify!($SelfT), ".overflowing_add(2));")] + #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(1, false), ", stringify!($SelfT), "::MAX.overflowing_add(1));")] + /// ``` + #[unstable(feature = "bigint_helper_methods", issue = "85532")] + #[rustc_const_unstable(feature = "const_bigint_helper_methods", issue = "85532")] + #[must_use = "this returns the result of the operation, \ + without modifying the original"] + #[inline] + pub const fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool) { + // note: longer-term this should be done via an intrinsic. + // note: no intermediate overflow is required (https://github.com/rust-lang/rust/issues/85532#issuecomment-1032214946). + let (a, b) = self.overflowing_add(rhs); + let (c, d) = a.overflowing_add(carry as $SelfT); + (c, b != d) + } + /// Calculates `self` + `rhs` with an unsigned `rhs` /// /// Returns a tuple of the addition along with a boolean indicating @@ -1563,6 +1610,39 @@ macro_rules! int_impl { (a as Self, b) } + /// Calculates `self - rhs - borrow` without the ability to overflow. + /// + /// Performs "ternary subtraction" which takes in an extra bit to subtract, and may return + /// an additional bit of overflow. This allows for chaining together multiple subtractions + /// to create "big integers" which represent larger values. + /// + /// # Examples + /// + /// Basic usage + /// + /// ``` + /// #![feature(bigint_helper_methods)] + #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".borrowing_sub(2, false), (3, false));")] + #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".borrowing_sub(2, true), (2, false));")] + #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".borrowing_sub(1, false), (-1, false));")] + #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".borrowing_sub(1, true), (-2, false));")] + #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.borrowing_sub(1, true), (", stringify!($SelfT), "::MAX - 1, true));")] + #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.borrowing_sub(-1, false), (", stringify!($SelfT), "::MIN, true));")] + #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.borrowing_sub(-1, true), (", stringify!($SelfT), "::MAX, false));")] + /// ``` + #[unstable(feature = "bigint_helper_methods", issue = "85532")] + #[rustc_const_unstable(feature = "const_bigint_helper_methods", issue = "85532")] + #[must_use = "this returns the result of the operation, \ + without modifying the original"] + #[inline] + pub const fn borrowing_sub(self, rhs: Self, borrow: bool) -> (Self, bool) { + // note: longer-term this should be done via an intrinsic. + // note: no intermediate overflow is required (https://github.com/rust-lang/rust/issues/85532#issuecomment-1032214946). + let (a, b) = self.overflowing_sub(rhs); + let (c, d) = a.overflowing_sub(borrow as $SelfT); + (c, b != d) + } + /// Calculates `self` - `rhs` with an unsigned `rhs` /// /// Returns a tuple of the subtraction along with a boolean indicating diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 7e9d7d2710180..3132d8adb3620 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -3,6 +3,7 @@ #![feature(array_methods)] #![feature(array_windows)] #![feature(bench_black_box)] +#![feature(bigint_helper_methods)] #![feature(cell_update)] #![feature(const_assume)] #![feature(const_black_box)] diff --git a/library/core/tests/num/int_macros.rs b/library/core/tests/num/int_macros.rs index 8b84a78e6be08..18c55e43aac81 100644 --- a/library/core/tests/num/int_macros.rs +++ b/library/core/tests/num/int_macros.rs @@ -338,6 +338,32 @@ macro_rules! int_module { assert_eq!(MIN.checked_next_multiple_of(-3), None); assert_eq!(MIN.checked_next_multiple_of(-1), Some(MIN)); } + + #[test] + fn test_carrying_add() { + assert_eq!($T::MAX.carrying_add(1, false), ($T::MIN, true)); + assert_eq!($T::MAX.carrying_add(0, true), ($T::MIN, true)); + assert_eq!($T::MAX.carrying_add(1, true), ($T::MIN + 1, true)); + assert_eq!($T::MAX.carrying_add(-1, false), ($T::MAX - 1, false)); + assert_eq!($T::MAX.carrying_add(-1, true), ($T::MAX, false)); // no intermediate overflow + assert_eq!($T::MIN.carrying_add(-1, false), ($T::MAX, true)); + assert_eq!($T::MIN.carrying_add(-1, true), ($T::MIN, false)); // no intermediate overflow + assert_eq!((0 as $T).carrying_add($T::MAX, true), ($T::MIN, true)); + assert_eq!((0 as $T).carrying_add($T::MIN, true), ($T::MIN + 1, false)); + } + + #[test] + fn test_borrowing_sub() { + assert_eq!($T::MIN.borrowing_sub(1, false), ($T::MAX, true)); + assert_eq!($T::MIN.borrowing_sub(0, true), ($T::MAX, true)); + assert_eq!($T::MIN.borrowing_sub(1, true), ($T::MAX - 1, true)); + assert_eq!($T::MIN.borrowing_sub(-1, false), ($T::MIN + 1, false)); + assert_eq!($T::MIN.borrowing_sub(-1, true), ($T::MIN, false)); // no intermediate overflow + assert_eq!($T::MAX.borrowing_sub(-1, false), ($T::MIN, true)); + assert_eq!($T::MAX.borrowing_sub(-1, true), ($T::MAX, false)); // no intermediate overflow + assert_eq!((0 as $T).borrowing_sub($T::MIN, false), ($T::MIN, true)); + assert_eq!((0 as $T).borrowing_sub($T::MIN, true), ($T::MAX, false)); + } } }; } diff --git a/library/core/tests/num/uint_macros.rs b/library/core/tests/num/uint_macros.rs index 93ae620c23302..15ae9f2324f6c 100644 --- a/library/core/tests/num/uint_macros.rs +++ b/library/core/tests/num/uint_macros.rs @@ -230,6 +230,28 @@ macro_rules! uint_module { assert_eq!((1 as $T).checked_next_multiple_of(0), None); assert_eq!(MAX.checked_next_multiple_of(2), None); } + + #[test] + fn test_carrying_add() { + assert_eq!($T::MAX.carrying_add(1, false), (0, true)); + assert_eq!($T::MAX.carrying_add(0, true), (0, true)); + assert_eq!($T::MAX.carrying_add(1, true), (1, true)); + + assert_eq!($T::MIN.carrying_add($T::MAX, false), ($T::MAX, false)); + assert_eq!($T::MIN.carrying_add(0, true), (1, false)); + assert_eq!($T::MIN.carrying_add($T::MAX, true), (0, true)); + } + + #[test] + fn test_borrowing_sub() { + assert_eq!($T::MIN.borrowing_sub(1, false), ($T::MAX, true)); + assert_eq!($T::MIN.borrowing_sub(0, true), ($T::MAX, true)); + assert_eq!($T::MIN.borrowing_sub(1, true), ($T::MAX - 1, true)); + + assert_eq!($T::MAX.borrowing_sub($T::MAX, false), (0, false)); + assert_eq!($T::MAX.borrowing_sub(0, true), ($T::MAX - 1, false)); + assert_eq!($T::MAX.borrowing_sub($T::MAX, true), ($T::MAX, true)); + } } }; } From 5c690555f226909786a43b4bf0dc58f8bffa7a6b Mon Sep 17 00:00:00 2001 From: Stovent Date: Fri, 11 Feb 2022 15:25:51 -0500 Subject: [PATCH 02/10] Correct signed bit int documentation --- library/core/src/num/int_macros.rs | 74 ++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 10 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 4e51b90b835cf..0cd64753f9b2e 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1514,15 +1514,41 @@ macro_rules! int_impl { /// Calculates `self + rhs + carry` without the ability to overflow. /// - /// Performs "ternary addition" which takes in an extra bit to add, and may return an - /// additional bit of overflow. This allows for chaining together multiple additions - /// to create "big integers" which represent larger values. - /// - #[doc = concat!("This can be thought of as a ", stringify!($BITS), "-bit \"full adder\", in the electronics sense.")] + /// Performs "signed ternary addition" which takes in an extra bit to add, and may return an + /// additional bit of overflow. This signed function is used only on the highest-ordered data, + /// for which the signed overflow result indicates whether the big integer overflowed or not. /// /// # Examples /// - /// Basic usage + /// Standard signed bit integer implementation + /// + /// ```rs + /// #![feature(bigint_helper_methods)] + /// struct I16 { + /// pub low: u8, // Low-order bytes has to be unsigned. + /// /// Most Significant Data has to be of the same signedness as the desired type. + /// /// So u8 to implement U16, i8 to implement I16. + /// pub high: i8, + /// } + /// + /// impl I16 { + /// /// Adds `rhs` to `self` and returns true if signed overflow occurs, false otherwise. + /// pub fn overflowing_add(&mut self, rhs: Self) -> bool { + /// let (low_res, low_carry) = self.low.carrying_add(rhs.low, false); + /// + /// // The signed `carrying_add` method is used to detect signed overflow. + /// let (high_res, high_carry) = self.high.carrying_add(rhs.high, low_carry); + /// + /// self.low = low_res; + /// self.high = high_res; + /// high_carry + /// } + /// } + /// + /// fn main() {} + /// ``` + /// + /// General behavior /// /// ``` /// #![feature(bigint_helper_methods)] @@ -1612,13 +1638,41 @@ macro_rules! int_impl { /// Calculates `self - rhs - borrow` without the ability to overflow. /// - /// Performs "ternary subtraction" which takes in an extra bit to subtract, and may return - /// an additional bit of overflow. This allows for chaining together multiple subtractions - /// to create "big integers" which represent larger values. + /// Performs "signed ternary subtraction" which takes in an extra bit to subtract, and may return an + /// additional bit of overflow. This signed function is used only on the highest-ordered data, + /// for which the signed overflow result indicates whether the big integer overflowed or not. /// /// # Examples /// - /// Basic usage + /// Standard signed bit integer implementation + /// + /// ```rs + /// #![feature(bigint_helper_methods)] + /// struct I16 { + /// pub low: u8, // Low-order bytes has to be unsigned. + /// /// Most Significant Data has to be of the same signedness as the desired type. + /// /// So u8 to implement U16, i8 to implement I16. + /// pub high: i8, + /// } + /// + /// impl I16 { + /// /// Subtracts `rhs` from `self` and returns true if signed overflow occurs, false otherwise. + /// pub fn overflowing_sub(&mut self, rhs: Self) -> bool { + /// let (low_res, low_carry) = self.low.borrowing_sub(rhs.low, false); + /// + /// // The signed `borrowing_sub` method is used to detect signed overflow. + /// let (high_res, high_carry) = self.high.borrowing_sub(rhs.high, low_carry); + /// + /// self.low = low_res; + /// self.high = high_res; + /// high_carry + /// } + /// } + /// + /// fn main() {} + /// ``` + /// + /// General behavior /// /// ``` /// #![feature(bigint_helper_methods)] From b998d82d8d098ee0e5127123543f5720965c6648 Mon Sep 17 00:00:00 2001 From: Stovent Date: Fri, 11 Feb 2022 15:47:37 -0500 Subject: [PATCH 03/10] Remove too long example --- library/core/src/num/int_macros.rs | 60 +----------------------------- 1 file changed, 2 insertions(+), 58 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 0cd64753f9b2e..2d97fa62accd6 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -1520,35 +1520,7 @@ macro_rules! int_impl { /// /// # Examples /// - /// Standard signed bit integer implementation - /// - /// ```rs - /// #![feature(bigint_helper_methods)] - /// struct I16 { - /// pub low: u8, // Low-order bytes has to be unsigned. - /// /// Most Significant Data has to be of the same signedness as the desired type. - /// /// So u8 to implement U16, i8 to implement I16. - /// pub high: i8, - /// } - /// - /// impl I16 { - /// /// Adds `rhs` to `self` and returns true if signed overflow occurs, false otherwise. - /// pub fn overflowing_add(&mut self, rhs: Self) -> bool { - /// let (low_res, low_carry) = self.low.carrying_add(rhs.low, false); - /// - /// // The signed `carrying_add` method is used to detect signed overflow. - /// let (high_res, high_carry) = self.high.carrying_add(rhs.high, low_carry); - /// - /// self.low = low_res; - /// self.high = high_res; - /// high_carry - /// } - /// } - /// - /// fn main() {} - /// ``` - /// - /// General behavior + /// Basic usage: /// /// ``` /// #![feature(bigint_helper_methods)] @@ -1644,35 +1616,7 @@ macro_rules! int_impl { /// /// # Examples /// - /// Standard signed bit integer implementation - /// - /// ```rs - /// #![feature(bigint_helper_methods)] - /// struct I16 { - /// pub low: u8, // Low-order bytes has to be unsigned. - /// /// Most Significant Data has to be of the same signedness as the desired type. - /// /// So u8 to implement U16, i8 to implement I16. - /// pub high: i8, - /// } - /// - /// impl I16 { - /// /// Subtracts `rhs` from `self` and returns true if signed overflow occurs, false otherwise. - /// pub fn overflowing_sub(&mut self, rhs: Self) -> bool { - /// let (low_res, low_carry) = self.low.borrowing_sub(rhs.low, false); - /// - /// // The signed `borrowing_sub` method is used to detect signed overflow. - /// let (high_res, high_carry) = self.high.borrowing_sub(rhs.high, low_carry); - /// - /// self.low = low_res; - /// self.high = high_res; - /// high_carry - /// } - /// } - /// - /// fn main() {} - /// ``` - /// - /// General behavior + /// Basic usage: /// /// ``` /// #![feature(bigint_helper_methods)] From 46130a1d182c23dc967b6fc211019ce882f312b4 Mon Sep 17 00:00:00 2001 From: Jakob Degen Date: Sun, 4 Sep 2022 22:35:47 -0700 Subject: [PATCH 04/10] Remove unnecessary `EMIT_MIR_FOR_EACH_BITWIDTH --- src/test/mir-opt/array-index-is-temporary.rs | 2 +- ...implifyCfg-elaborate-drops.after.64bit.mir | 64 ------- ...ain.SimplifyCfg-elaborate-drops.after.mir} | 0 .../mir-opt/inline/inline-into-box-place.rs | 2 +- ...line_into_box_place.main.Inline.64bit.diff | 82 --------- ...=> inline_into_box_place.main.Inline.diff} | 0 src/test/mir-opt/issue-41697.rs | 2 +- src/test/mir-opt/issue-72181.rs | 4 +- src/test/mir-opt/issue-73223.rs | 2 +- ...SimplifyCfg-promote-consts.after.64bit.mir | 20 --- ...t#0}.SimplifyCfg-promote-consts.after.mir} | 0 .../issue_72181.bar.mir_map.0.64bit.mir | 17 -- ...2bit.mir => issue_72181.bar.mir_map.0.mir} | 0 .../issue_72181.foo.mir_map.0.64bit.mir | 27 --- ...2bit.mir => issue_72181.foo.mir_map.0.mir} | 0 .../issue_72181.main.mir_map.0.64bit.mir | 62 ------- ...bit.mir => issue_72181.main.mir_map.0.mir} | 0 ..._73223.main.SimplifyArmIdentity.64bit.diff | 161 ------------------ ...issue_73223.main.SimplifyArmIdentity.diff} | 0 ...s.bar.MatchBranchSimplification.64bit.diff | 88 ---------- ...anches.bar.MatchBranchSimplification.diff} | 0 ...s.foo.MatchBranchSimplification.64bit.diff | 55 ------ ...anches.foo.MatchBranchSimplification.diff} | 0 ...ed_if.MatchBranchSimplification.64bit.diff | 113 ------------ ..._nested_if.MatchBranchSimplification.diff} | 0 src/test/mir-opt/matches_reduce_branches.rs | 2 +- ...match.MatchBranchSimplification.64bit.diff | 32 ---- ...tive_match.MatchBranchSimplification.diff} | 0 ...ch_i8.MatchBranchSimplification.64bit.diff | 32 ---- ...e_match_i8.MatchBranchSimplification.diff} | 0 src/test/mir-opt/matches_u8.rs | 2 +- .../mir-opt/packed-struct-drop-aligned.rs | 2 +- ...implifyCfg-elaborate-drops.after.64bit.mir | 60 ------- ...ain.SimplifyCfg-elaborate-drops.after.mir} | 0 ...arate_const_switch.identity.ConstProp.diff | 146 ---------------- ...const_switch.identity.PreCodegen.after.mir | 124 -------------- ...te_const_switch.too_complex.ConstProp.diff | 103 ----------- ...st_switch.too_complex.PreCodegen.after.mir | 73 -------- src/test/mir-opt/simple-match.rs | 2 +- ...imple_match.match_bool.mir_map.0.64bit.mir | 29 ---- ... => simple_match.match_bool.mir_map.0.mir} | 0 ...ocals-removes-unused-discriminant-reads.rs | 1 - ...minant_reads.map.SimplifyLocals.64bit.diff | 52 ------ ...iscriminant_reads.map.SimplifyLocals.diff} | 0 src/test/mir-opt/slice-drop-shim.rs | 2 +- ...g].AddMovesForPackedDrops.before.64bit.mir | 101 ----------- ...String].AddMovesForPackedDrops.before.mir} | 0 src/test/mir-opt/unusual-item-types.rs | 2 +- ...types.E-V-{constant#0}.mir_map.0.64bit.mir | 10 -- ...item_types.E-V-{constant#0}.mir_map.0.mir} | 0 ...Test-X-{constructor#0}.mir_map.0.64bit.mir | 12 -- ...ypes.Test-X-{constructor#0}.mir_map.0.mir} | 0 ...2_.AddMovesForPackedDrops.before.64bit.mir | 39 ----- ...ec_i32_.AddMovesForPackedDrops.before.mir} | 0 ...0}-ASSOCIATED_CONSTANT.mir_map.0.64bit.mir | 10 -- ...impl#0}-ASSOCIATED_CONSTANT.mir_map.0.mir} | 0 ...oops.change_loop_body.ConstProp.64bit.diff | 55 ------ ...let_loops.change_loop_body.ConstProp.diff} | 0 ...hange_loop_body.PreCodegen.after.64bit.mir | 17 -- ...ops.change_loop_body.PreCodegen.after.mir} | 0 src/test/mir-opt/while_let_loops.rs | 1 - 61 files changed, 12 insertions(+), 1598 deletions(-) delete mode 100644 src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.64bit.mir rename src/test/mir-opt/{array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.32bit.mir => array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir} (100%) delete mode 100644 src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff rename src/test/mir-opt/inline/{inline_into_box_place.main.Inline.32bit.diff => inline_into_box_place.main.Inline.diff} (100%) delete mode 100644 src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.64bit.mir rename src/test/mir-opt/{issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.32bit.mir => issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir} (100%) delete mode 100644 src/test/mir-opt/issue_72181.bar.mir_map.0.64bit.mir rename src/test/mir-opt/{issue_72181.bar.mir_map.0.32bit.mir => issue_72181.bar.mir_map.0.mir} (100%) delete mode 100644 src/test/mir-opt/issue_72181.foo.mir_map.0.64bit.mir rename src/test/mir-opt/{issue_72181.foo.mir_map.0.32bit.mir => issue_72181.foo.mir_map.0.mir} (100%) delete mode 100644 src/test/mir-opt/issue_72181.main.mir_map.0.64bit.mir rename src/test/mir-opt/{issue_72181.main.mir_map.0.32bit.mir => issue_72181.main.mir_map.0.mir} (100%) delete mode 100644 src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff rename src/test/mir-opt/{issue_73223.main.SimplifyArmIdentity.32bit.diff => issue_73223.main.SimplifyArmIdentity.diff} (100%) delete mode 100644 src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.64bit.diff rename src/test/mir-opt/{matches_reduce_branches.bar.MatchBranchSimplification.32bit.diff => matches_reduce_branches.bar.MatchBranchSimplification.diff} (100%) delete mode 100644 src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff rename src/test/mir-opt/{matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff => matches_reduce_branches.foo.MatchBranchSimplification.diff} (100%) delete mode 100644 src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff rename src/test/mir-opt/{matches_reduce_branches.match_nested_if.MatchBranchSimplification.32bit.diff => matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff} (100%) delete mode 100644 src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.64bit.diff rename src/test/mir-opt/{matches_u8.exhaustive_match.MatchBranchSimplification.32bit.diff => matches_u8.exhaustive_match.MatchBranchSimplification.diff} (100%) delete mode 100644 src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.64bit.diff rename src/test/mir-opt/{matches_u8.exhaustive_match_i8.MatchBranchSimplification.32bit.diff => matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff} (100%) delete mode 100644 src/test/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.64bit.mir rename src/test/mir-opt/{packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.32bit.mir => packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir} (100%) delete mode 100644 src/test/mir-opt/separate_const_switch.identity.ConstProp.diff delete mode 100644 src/test/mir-opt/separate_const_switch.identity.PreCodegen.after.mir delete mode 100644 src/test/mir-opt/separate_const_switch.too_complex.ConstProp.diff delete mode 100644 src/test/mir-opt/separate_const_switch.too_complex.PreCodegen.after.mir delete mode 100644 src/test/mir-opt/simple_match.match_bool.mir_map.0.64bit.mir rename src/test/mir-opt/{simple_match.match_bool.mir_map.0.32bit.mir => simple_match.match_bool.mir_map.0.mir} (100%) delete mode 100644 src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff rename src/test/mir-opt/{simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff => simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff} (100%) delete mode 100644 src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.64bit.mir rename src/test/mir-opt/{slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.32bit.mir => slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir} (100%) delete mode 100644 src/test/mir-opt/unusual_item_types.E-V-{constant#0}.mir_map.0.64bit.mir rename src/test/mir-opt/{unusual_item_types.E-V-{constant#0}.mir_map.0.32bit.mir => unusual_item_types.E-V-{constant#0}.mir_map.0.mir} (100%) delete mode 100644 src/test/mir-opt/unusual_item_types.Test-X-{constructor#0}.mir_map.0.64bit.mir rename src/test/mir-opt/{unusual_item_types.Test-X-{constructor#0}.mir_map.0.32bit.mir => unusual_item_types.Test-X-{constructor#0}.mir_map.0.mir} (100%) delete mode 100644 src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.64bit.mir rename src/test/mir-opt/{unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.32bit.mir => unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir} (100%) delete mode 100644 src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.64bit.mir rename src/test/mir-opt/{unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.32bit.mir => unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.mir} (100%) delete mode 100644 src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff rename src/test/mir-opt/{while_let_loops.change_loop_body.ConstProp.32bit.diff => while_let_loops.change_loop_body.ConstProp.diff} (100%) delete mode 100644 src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir rename src/test/mir-opt/{while_let_loops.change_loop_body.PreCodegen.after.32bit.mir => while_let_loops.change_loop_body.PreCodegen.after.mir} (100%) diff --git a/src/test/mir-opt/array-index-is-temporary.rs b/src/test/mir-opt/array-index-is-temporary.rs index 0e4c486e4640f..e7bde81d4ca36 100644 --- a/src/test/mir-opt/array-index-is-temporary.rs +++ b/src/test/mir-opt/array-index-is-temporary.rs @@ -7,7 +7,7 @@ unsafe fn foo(z: *mut usize) -> u32 { 99 } -// EMIT_MIR_FOR_EACH_BIT_WIDTH + // EMIT_MIR array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir fn main() { let mut x = [42, 43, 44]; diff --git a/src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.64bit.mir b/src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.64bit.mir deleted file mode 100644 index 27f883ed321ae..0000000000000 --- a/src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.64bit.mir +++ /dev/null @@ -1,64 +0,0 @@ -// MIR for `main` after SimplifyCfg-elaborate-drops - -fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/array-index-is-temporary.rs:+0:11: +0:11 - let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:+1:9: +1:14 - let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:+3:25: +3:31 - let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:+4:12: +4:29 - let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:+4:25: +4:26 - let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:+4:7: +4:8 - let mut _8: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:+4:5: +4:9 - let mut _9: bool; // in scope 0 at $DIR/array-index-is-temporary.rs:+4:5: +4:9 - scope 1 { - debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:+1:9: +1:14 - let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:+2:9: +2:14 - scope 2 { - debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:+2:9: +2:14 - let _3: *mut usize; // in scope 2 at $DIR/array-index-is-temporary.rs:+3:9: +3:10 - scope 3 { - debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:+3:9: +3:10 - scope 4 { - } - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/array-index-is-temporary.rs:+1:9: +1:14 - _1 = [const 42_u32, const 43_u32, const 44_u32]; // scope 0 at $DIR/array-index-is-temporary.rs:+1:17: +1:29 - StorageLive(_2); // scope 1 at $DIR/array-index-is-temporary.rs:+2:9: +2:14 - _2 = const 1_usize; // scope 1 at $DIR/array-index-is-temporary.rs:+2:17: +2:18 - StorageLive(_3); // scope 2 at $DIR/array-index-is-temporary.rs:+3:9: +3:10 - StorageLive(_4); // scope 2 at $DIR/array-index-is-temporary.rs:+3:25: +3:31 - _4 = &mut _2; // scope 2 at $DIR/array-index-is-temporary.rs:+3:25: +3:31 - _3 = &raw mut (*_4); // scope 2 at $DIR/array-index-is-temporary.rs:+3:25: +3:31 - StorageDead(_4); // scope 2 at $DIR/array-index-is-temporary.rs:+3:31: +3:32 - StorageLive(_5); // scope 3 at $DIR/array-index-is-temporary.rs:+4:12: +4:29 - StorageLive(_6); // scope 4 at $DIR/array-index-is-temporary.rs:+4:25: +4:26 - _6 = _3; // scope 4 at $DIR/array-index-is-temporary.rs:+4:25: +4:26 - _5 = foo(move _6) -> bb1; // scope 4 at $DIR/array-index-is-temporary.rs:+4:21: +4:27 - // mir::Constant - // + span: $DIR/array-index-is-temporary.rs:16:21: 16:24 - // + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value() } - } - - bb1: { - StorageDead(_6); // scope 4 at $DIR/array-index-is-temporary.rs:+4:26: +4:27 - StorageLive(_7); // scope 3 at $DIR/array-index-is-temporary.rs:+4:7: +4:8 - _7 = _2; // scope 3 at $DIR/array-index-is-temporary.rs:+4:7: +4:8 - _8 = Len(_1); // scope 3 at $DIR/array-index-is-temporary.rs:+4:5: +4:9 - _9 = Lt(_7, _8); // scope 3 at $DIR/array-index-is-temporary.rs:+4:5: +4:9 - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; // scope 3 at $DIR/array-index-is-temporary.rs:+4:5: +4:9 - } - - bb2: { - _1[_7] = move _5; // scope 3 at $DIR/array-index-is-temporary.rs:+4:5: +4:29 - StorageDead(_5); // scope 3 at $DIR/array-index-is-temporary.rs:+4:28: +4:29 - StorageDead(_7); // scope 3 at $DIR/array-index-is-temporary.rs:+4:29: +4:30 - _0 = const (); // scope 0 at $DIR/array-index-is-temporary.rs:+0:11: +5:2 - StorageDead(_3); // scope 2 at $DIR/array-index-is-temporary.rs:+5:1: +5:2 - StorageDead(_2); // scope 1 at $DIR/array-index-is-temporary.rs:+5:1: +5:2 - StorageDead(_1); // scope 0 at $DIR/array-index-is-temporary.rs:+5:1: +5:2 - return; // scope 0 at $DIR/array-index-is-temporary.rs:+5:2: +5:2 - } -} diff --git a/src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.32bit.mir b/src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir similarity index 100% rename from src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.32bit.mir rename to src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir diff --git a/src/test/mir-opt/inline/inline-into-box-place.rs b/src/test/mir-opt/inline/inline-into-box-place.rs index 049a97816f68b..232bcc7b27d46 100644 --- a/src/test/mir-opt/inline/inline-into-box-place.rs +++ b/src/test/mir-opt/inline/inline-into-box-place.rs @@ -1,7 +1,7 @@ // ignore-endian-big // ignore-wasm32-bare compiled with panic=abort by default // compile-flags: -Z mir-opt-level=4 -// EMIT_MIR_FOR_EACH_BIT_WIDTH + #![feature(box_syntax)] // EMIT_MIR inline_into_box_place.main.Inline.diff fn main() { diff --git a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff deleted file mode 100644 index 7017413ad38a6..0000000000000 --- a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff +++ /dev/null @@ -1,82 +0,0 @@ -- // MIR for `main` before Inline -+ // MIR for `main` after Inline - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/inline-into-box-place.rs:+0:11: +0:11 - let _1: std::boxed::Box>; // in scope 0 at $DIR/inline-into-box-place.rs:+1:9: +1:11 - let mut _2: usize; // in scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - let mut _3: usize; // in scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - let mut _4: *mut u8; // in scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - let mut _5: std::boxed::Box>; // in scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - let mut _6: (); // in scope 0 at $DIR/inline-into-box-place.rs:+1:42: +1:43 - let mut _7: *const std::vec::Vec; // in scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 -+ let mut _8: &mut std::vec::Vec; // in scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 - scope 1 { - debug _x => _1; // in scope 1 at $DIR/inline-into-box-place.rs:+1:9: +1:11 - } - scope 2 { - } -+ scope 3 (inlined Vec::::new) { // at $DIR/inline-into-box-place.rs:8:33: 8:43 -+ let mut _9: alloc::raw_vec::RawVec; // in scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/inline-into-box-place.rs:+1:9: +1:11 - _2 = SizeOf(std::vec::Vec); // scope 2 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - _3 = AlignOf(std::vec::Vec); // scope 2 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 2 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - // mir::Constant - // + span: $DIR/inline-into-box-place.rs:8:29: 8:43 - // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value() } - } - - bb1: { - StorageLive(_5); // scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - _5 = ShallowInitBox(move _4, std::vec::Vec); // scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - _7 = (((_5.0: std::ptr::Unique>).0: std::ptr::NonNull>).0: *const std::vec::Vec); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 -- (*_7) = Vec::::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 -+ StorageLive(_8); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 -+ _8 = &mut (*_7); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 -+ StorageLive(_9); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ _9 = const alloc::raw_vec::RawVec::::NEW; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - // mir::Constant -- // + span: $DIR/inline-into-box-place.rs:8:33: 8:41 -- // + user_ty: UserType(1) -- // + literal: Const { ty: fn() -> Vec {Vec::::new}, val: Value() } -- } -- -- bb2: { -+ // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ // + user_ty: UserType(0) -+ // + literal: Const { ty: alloc::raw_vec::RawVec, val: Unevaluated(alloc::raw_vec::RawVec::::NEW, [u32], None) } -+ Deinit((*_8)); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ ((*_8).0: alloc::raw_vec::RawVec) = move _9; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ ((*_8).1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ StorageDead(_9); // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL -+ StorageDead(_8); // scope 0 at $DIR/inline-into-box-place.rs:+1:33: +1:43 - _1 = move _5; // scope 0 at $DIR/inline-into-box-place.rs:+1:29: +1:43 - StorageDead(_5); // scope 0 at $DIR/inline-into-box-place.rs:+1:42: +1:43 - _0 = const (); // scope 0 at $DIR/inline-into-box-place.rs:+0:11: +2:2 -- drop(_1) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:+2:1: +2:2 -+ drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/inline-into-box-place.rs:+2:1: +2:2 - } - -- bb3: { -+ bb2: { - StorageDead(_1); // scope 0 at $DIR/inline-into-box-place.rs:+2:1: +2:2 - return; // scope 0 at $DIR/inline-into-box-place.rs:+2:2: +2:2 - } - -- bb4 (cleanup): { -+ bb3 (cleanup): { - resume; // scope 0 at $DIR/inline-into-box-place.rs:+0:1: +2:2 -- } -- -- bb5 (cleanup): { -- _6 = alloc::alloc::box_free::, std::alloc::Global>(move (_5.0: std::ptr::Unique>), move (_5.1: std::alloc::Global)) -> bb4; // scope 0 at $DIR/inline-into-box-place.rs:+1:42: +1:43 -- // mir::Constant -- // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 -- // + literal: Const { ty: unsafe fn(Unique>, std::alloc::Global) {alloc::alloc::box_free::, std::alloc::Global>}, val: Value() } - } - } - diff --git a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.diff similarity index 100% rename from src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff rename to src/test/mir-opt/inline/inline_into_box_place.main.Inline.diff diff --git a/src/test/mir-opt/issue-41697.rs b/src/test/mir-opt/issue-41697.rs index 5c34d8e68d0c0..cbd8633a345c7 100644 --- a/src/test/mir-opt/issue-41697.rs +++ b/src/test/mir-opt/issue-41697.rs @@ -13,7 +13,7 @@ trait Foo { fn get(&self) -> [u8; 2]; } -// EMIT_MIR_FOR_EACH_BIT_WIDTH + // EMIT_MIR issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir impl Foo for [u8; 1+1] { fn get(&self) -> [u8; 2] { diff --git a/src/test/mir-opt/issue-72181.rs b/src/test/mir-opt/issue-72181.rs index 844d53a4b2bce..ebb5f5042fccb 100644 --- a/src/test/mir-opt/issue-72181.rs +++ b/src/test/mir-opt/issue-72181.rs @@ -11,14 +11,14 @@ union Foo { b: Never } -// EMIT_MIR_FOR_EACH_BIT_WIDTH + // EMIT_MIR issue_72181.foo.mir_map.0.mir fn foo(xs: [(Never, u32); 1]) -> u32 { xs[0].1 } // EMIT_MIR issue_72181.bar.mir_map.0.mir fn bar([(_, x)]: [(Never, u32); 1]) -> u32 { x } -// EMIT_MIR_FOR_EACH_BIT_WIDTH + // EMIT_MIR issue_72181.main.mir_map.0.mir fn main() { let _ = mem::size_of::(); diff --git a/src/test/mir-opt/issue-73223.rs b/src/test/mir-opt/issue-73223.rs index 9e731c4090879..be114cab719c0 100644 --- a/src/test/mir-opt/issue-73223.rs +++ b/src/test/mir-opt/issue-73223.rs @@ -8,5 +8,5 @@ fn main() { assert_eq!(split, 1); } -// EMIT_MIR_FOR_EACH_BIT_WIDTH + // EMIT_MIR issue_73223.main.SimplifyArmIdentity.diff diff --git a/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.64bit.mir b/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.64bit.mir deleted file mode 100644 index 047b24db46643..0000000000000 --- a/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.64bit.mir +++ /dev/null @@ -1,20 +0,0 @@ -// MIR for `::{constant#0}` after SimplifyCfg-promote-consts - -::{constant#0}: usize = { - let mut _0: usize; // return place in scope 0 at $DIR/issue-41697.rs:+0:19: +0:22 - let mut _1: (usize, bool); // in scope 0 at $DIR/issue-41697.rs:+0:19: +0:22 - - bb0: { - _1 = CheckedAdd(const 1_usize, const 1_usize); // scope 0 at $DIR/issue-41697.rs:+0:19: +0:22 - assert(!move (_1.1: bool), "attempt to compute `{} + {}`, which would overflow", const 1_usize, const 1_usize) -> [success: bb1, unwind: bb2]; // scope 0 at $DIR/issue-41697.rs:+0:19: +0:22 - } - - bb1: { - _0 = move (_1.0: usize); // scope 0 at $DIR/issue-41697.rs:+0:19: +0:22 - return; // scope 0 at $DIR/issue-41697.rs:+0:19: +0:22 - } - - bb2 (cleanup): { - resume; // scope 0 at $DIR/issue-41697.rs:+0:19: +0:22 - } -} diff --git a/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.32bit.mir b/src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir similarity index 100% rename from src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.32bit.mir rename to src/test/mir-opt/issue_41697.{impl#0}-{constant#0}.SimplifyCfg-promote-consts.after.mir diff --git a/src/test/mir-opt/issue_72181.bar.mir_map.0.64bit.mir b/src/test/mir-opt/issue_72181.bar.mir_map.0.64bit.mir deleted file mode 100644 index 972ce1d507854..0000000000000 --- a/src/test/mir-opt/issue_72181.bar.mir_map.0.64bit.mir +++ /dev/null @@ -1,17 +0,0 @@ -// MIR for `bar` 0 mir_map - -fn bar(_1: [(Never, u32); 1]) -> u32 { - let mut _0: u32; // return place in scope 0 at $DIR/issue-72181.rs:+0:40: +0:43 - let _2: u32; // in scope 0 at $DIR/issue-72181.rs:+0:13: +0:14 - scope 1 { - debug x => _2; // in scope 1 at $DIR/issue-72181.rs:+0:13: +0:14 - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/issue-72181.rs:+0:13: +0:14 - _2 = (_1[0 of 1].1: u32); // scope 0 at $DIR/issue-72181.rs:+0:13: +0:14 - _0 = _2; // scope 1 at $DIR/issue-72181.rs:+0:46: +0:47 - StorageDead(_2); // scope 0 at $DIR/issue-72181.rs:+0:48: +0:49 - return; // scope 0 at $DIR/issue-72181.rs:+0:49: +0:49 - } -} diff --git a/src/test/mir-opt/issue_72181.bar.mir_map.0.32bit.mir b/src/test/mir-opt/issue_72181.bar.mir_map.0.mir similarity index 100% rename from src/test/mir-opt/issue_72181.bar.mir_map.0.32bit.mir rename to src/test/mir-opt/issue_72181.bar.mir_map.0.mir diff --git a/src/test/mir-opt/issue_72181.foo.mir_map.0.64bit.mir b/src/test/mir-opt/issue_72181.foo.mir_map.0.64bit.mir deleted file mode 100644 index 534f131ea936b..0000000000000 --- a/src/test/mir-opt/issue_72181.foo.mir_map.0.64bit.mir +++ /dev/null @@ -1,27 +0,0 @@ -// MIR for `foo` 0 mir_map - -fn foo(_1: [(Never, u32); 1]) -> u32 { - debug xs => _1; // in scope 0 at $DIR/issue-72181.rs:+0:8: +0:10 - let mut _0: u32; // return place in scope 0 at $DIR/issue-72181.rs:+0:34: +0:37 - let _2: usize; // in scope 0 at $DIR/issue-72181.rs:+0:43: +0:44 - let mut _3: usize; // in scope 0 at $DIR/issue-72181.rs:+0:40: +0:45 - let mut _4: bool; // in scope 0 at $DIR/issue-72181.rs:+0:40: +0:45 - - bb0: { - StorageLive(_2); // scope 0 at $DIR/issue-72181.rs:+0:43: +0:44 - _2 = const 0_usize; // scope 0 at $DIR/issue-72181.rs:+0:43: +0:44 - _3 = Len(_1); // scope 0 at $DIR/issue-72181.rs:+0:40: +0:45 - _4 = Lt(_2, _3); // scope 0 at $DIR/issue-72181.rs:+0:40: +0:45 - assert(move _4, "index out of bounds: the length is {} but the index is {}", move _3, _2) -> [success: bb1, unwind: bb2]; // scope 0 at $DIR/issue-72181.rs:+0:40: +0:45 - } - - bb1: { - _0 = (_1[_2].1: u32); // scope 0 at $DIR/issue-72181.rs:+0:40: +0:47 - StorageDead(_2); // scope 0 at $DIR/issue-72181.rs:+0:48: +0:49 - return; // scope 0 at $DIR/issue-72181.rs:+0:49: +0:49 - } - - bb2 (cleanup): { - resume; // scope 0 at $DIR/issue-72181.rs:+0:1: +0:49 - } -} diff --git a/src/test/mir-opt/issue_72181.foo.mir_map.0.32bit.mir b/src/test/mir-opt/issue_72181.foo.mir_map.0.mir similarity index 100% rename from src/test/mir-opt/issue_72181.foo.mir_map.0.32bit.mir rename to src/test/mir-opt/issue_72181.foo.mir_map.0.mir diff --git a/src/test/mir-opt/issue_72181.main.mir_map.0.64bit.mir b/src/test/mir-opt/issue_72181.main.mir_map.0.64bit.mir deleted file mode 100644 index 425906f84fcd6..0000000000000 --- a/src/test/mir-opt/issue_72181.main.mir_map.0.64bit.mir +++ /dev/null @@ -1,62 +0,0 @@ -// MIR for `main` 0 mir_map - -fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-72181.rs:+0:11: +0:11 - let mut _1: usize; // in scope 0 at $DIR/issue-72181.rs:+1:13: +1:34 - let mut _3: Foo; // in scope 0 at $DIR/issue-72181.rs:+3:14: +3:27 - let mut _4: Foo; // in scope 0 at $DIR/issue-72181.rs:+3:29: +3:42 - let mut _5: u64; // in scope 0 at $DIR/issue-72181.rs:+4:13: +4:30 - let _6: usize; // in scope 0 at $DIR/issue-72181.rs:+4:24: +4:25 - let mut _7: usize; // in scope 0 at $DIR/issue-72181.rs:+4:22: +4:26 - let mut _8: bool; // in scope 0 at $DIR/issue-72181.rs:+4:22: +4:26 - scope 1 { - let _2: [Foo; 2]; // in scope 1 at $DIR/issue-72181.rs:+3:9: +3:10 - scope 2 { - debug f => _2; // in scope 2 at $DIR/issue-72181.rs:+3:9: +3:10 - scope 3 { - } - scope 4 { - } - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/issue-72181.rs:+1:13: +1:34 - _1 = std::mem::size_of::() -> [return: bb1, unwind: bb3]; // scope 0 at $DIR/issue-72181.rs:+1:13: +1:34 - // mir::Constant - // + span: $DIR/issue-72181.rs:24:13: 24:32 - // + literal: Const { ty: fn() -> usize {std::mem::size_of::}, val: Value() } - } - - bb1: { - StorageDead(_1); // scope 0 at $DIR/issue-72181.rs:+1:34: +1:35 - StorageLive(_2); // scope 1 at $DIR/issue-72181.rs:+3:9: +3:10 - StorageLive(_3); // scope 1 at $DIR/issue-72181.rs:+3:14: +3:27 - _3 = Foo { a: const 42_u64 }; // scope 1 at $DIR/issue-72181.rs:+3:14: +3:27 - StorageLive(_4); // scope 1 at $DIR/issue-72181.rs:+3:29: +3:42 - _4 = Foo { a: const 10_u64 }; // scope 1 at $DIR/issue-72181.rs:+3:29: +3:42 - _2 = [move _3, move _4]; // scope 1 at $DIR/issue-72181.rs:+3:13: +3:43 - StorageDead(_4); // scope 1 at $DIR/issue-72181.rs:+3:42: +3:43 - StorageDead(_3); // scope 1 at $DIR/issue-72181.rs:+3:42: +3:43 - FakeRead(ForLet(None), _2); // scope 1 at $DIR/issue-72181.rs:+3:9: +3:10 - StorageLive(_5); // scope 2 at $DIR/issue-72181.rs:+4:13: +4:30 - StorageLive(_6); // scope 4 at $DIR/issue-72181.rs:+4:24: +4:25 - _6 = const 0_usize; // scope 4 at $DIR/issue-72181.rs:+4:24: +4:25 - _7 = Len(_2); // scope 4 at $DIR/issue-72181.rs:+4:22: +4:26 - _8 = Lt(_6, _7); // scope 4 at $DIR/issue-72181.rs:+4:22: +4:26 - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb2, unwind: bb3]; // scope 4 at $DIR/issue-72181.rs:+4:22: +4:26 - } - - bb2: { - _5 = (_2[_6].0: u64); // scope 4 at $DIR/issue-72181.rs:+4:22: +4:28 - StorageDead(_6); // scope 2 at $DIR/issue-72181.rs:+4:30: +4:31 - StorageDead(_5); // scope 2 at $DIR/issue-72181.rs:+4:30: +4:31 - _0 = const (); // scope 0 at $DIR/issue-72181.rs:+0:11: +5:2 - StorageDead(_2); // scope 1 at $DIR/issue-72181.rs:+5:1: +5:2 - return; // scope 0 at $DIR/issue-72181.rs:+5:2: +5:2 - } - - bb3 (cleanup): { - resume; // scope 0 at $DIR/issue-72181.rs:+0:1: +5:2 - } -} diff --git a/src/test/mir-opt/issue_72181.main.mir_map.0.32bit.mir b/src/test/mir-opt/issue_72181.main.mir_map.0.mir similarity index 100% rename from src/test/mir-opt/issue_72181.main.mir_map.0.32bit.mir rename to src/test/mir-opt/issue_72181.main.mir_map.0.mir diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff deleted file mode 100644 index ac7fe31f3b39c..0000000000000 --- a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.64bit.diff +++ /dev/null @@ -1,161 +0,0 @@ -- // MIR for `main` before SimplifyArmIdentity -+ // MIR for `main` after SimplifyArmIdentity - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/issue-73223.rs:+0:11: +0:11 - let _1: i32; // in scope 0 at $DIR/issue-73223.rs:+1:9: +1:14 - let mut _2: std::option::Option; // in scope 0 at $DIR/issue-73223.rs:+1:23: +1:30 - let mut _3: isize; // in scope 0 at $DIR/issue-73223.rs:+2:9: +2:16 - let _4: i32; // in scope 0 at $DIR/issue-73223.rs:+2:14: +2:15 - let mut _5: !; // in scope 0 at $DIR/issue-73223.rs:+3:17: +3:23 - let mut _7: i32; // in scope 0 at $DIR/issue-73223.rs:+6:22: +6:27 - let _8: (); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _9: (&i32, &i32); // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _10: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _11: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _12: i32; // in scope 0 at $DIR/issue-73223.rs:+7:23: +7:24 - let mut _15: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _16: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _17: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _18: i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _19: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _21: !; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _22: core::panicking::AssertKind; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _23: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _24: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _25: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _26: &i32; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _27: std::option::Option; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 1 { - debug split => _1; // in scope 1 at $DIR/issue-73223.rs:+1:9: +1:14 - let _6: std::option::Option; // in scope 1 at $DIR/issue-73223.rs:+6:9: +6:14 - scope 3 { - debug _prev => _6; // in scope 3 at $DIR/issue-73223.rs:+6:9: +6:14 - let _13: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _14: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _28: &i32; // in scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 4 { - debug left_val => _13; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - debug right_val => _14; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let _20: core::panicking::AssertKind; // in scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - scope 5 { - debug kind => _20; // in scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - } - } - } - scope 2 { - debug v => _4; // in scope 2 at $DIR/issue-73223.rs:+2:14: +2:15 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/issue-73223.rs:+1:9: +1:14 - StorageLive(_2); // scope 0 at $DIR/issue-73223.rs:+1:23: +1:30 - Deinit(_2); // scope 0 at $DIR/issue-73223.rs:+1:23: +1:30 - ((_2 as Some).0: i32) = const 1_i32; // scope 0 at $DIR/issue-73223.rs:+1:23: +1:30 - discriminant(_2) = 1; // scope 0 at $DIR/issue-73223.rs:+1:23: +1:30 - _3 = const 1_isize; // scope 0 at $DIR/issue-73223.rs:+1:23: +1:30 - goto -> bb3; // scope 0 at $DIR/issue-73223.rs:+1:17: +1:30 - } - - bb1: { - nop; // scope 0 at $DIR/issue-73223.rs:+3:17: +3:23 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:+4:6: +4:7 - StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:+8:1: +8:2 - return; // scope 0 at $DIR/issue-73223.rs:+8:2: +8:2 - } - - bb2: { - unreachable; // scope 0 at $DIR/issue-73223.rs:+1:23: +1:30 - } - - bb3: { - StorageLive(_4); // scope 0 at $DIR/issue-73223.rs:+2:14: +2:15 - _4 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:+2:14: +2:15 - _1 = _4; // scope 2 at $DIR/issue-73223.rs:+2:20: +2:21 - StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:+2:20: +2:21 - StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:+4:6: +4:7 - StorageLive(_6); // scope 1 at $DIR/issue-73223.rs:+6:9: +6:14 - StorageLive(_7); // scope 1 at $DIR/issue-73223.rs:+6:22: +6:27 - _7 = _1; // scope 1 at $DIR/issue-73223.rs:+6:22: +6:27 - Deinit(_6); // scope 1 at $DIR/issue-73223.rs:+6:17: +6:28 - ((_6 as Some).0: i32) = move _7; // scope 1 at $DIR/issue-73223.rs:+6:17: +6:28 - discriminant(_6) = 1; // scope 1 at $DIR/issue-73223.rs:+6:17: +6:28 - StorageDead(_7); // scope 1 at $DIR/issue-73223.rs:+6:27: +6:28 - StorageLive(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _10 = &_1; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _28 = const main::promoted[0]; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: &i32, val: Unevaluated(main, [], Some(promoted[0])) } - _11 = _28; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_9.0: &i32) = move _10; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - (_9.1: &i32) = move _11; // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_11); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_13); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _13 = (_9.0: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_14); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _14 = (_9.1: &i32); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _17 = (*_13); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _18 = const 1_i32; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _16 = Eq(move _17, const 1_i32); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_18); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _15 = Not(move _16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - switchInt(move _15) -> [false: bb5, otherwise: bb4]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb4: { - StorageLive(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_20); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_20) = 0; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_21); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_22); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _22 = const core::panicking::AssertKind::Eq; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } - StorageLive(_23); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_24); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _24 = _13; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _23 = _24; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_25); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_26); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _26 = _14; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _25 = _26; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageLive(_27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - Deinit(_27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - discriminant(_27) = 0; // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _21 = core::panicking::assert_failed::(const core::panicking::AssertKind::Eq, move _23, move _25, move _27); // scope 5 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: for<'r, 's, 't0> fn(core::panicking::AssertKind, &'r i32, &'s i32, Option>) -> ! {core::panicking::assert_failed::}, val: Value() } - // mir::Constant - // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL - // + literal: Const { ty: core::panicking::AssertKind, val: Value(Scalar(0x00)) } - } - - bb5: { - nop; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_14); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_13); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - StorageDead(_8); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - nop; // scope 0 at $DIR/issue-73223.rs:+0:11: +8:2 - StorageDead(_6); // scope 1 at $DIR/issue-73223.rs:+8:1: +8:2 - StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:+8:1: +8:2 - return; // scope 0 at $DIR/issue-73223.rs:+8:2: +8:2 - } - } - diff --git a/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff b/src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff similarity index 100% rename from src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.32bit.diff rename to src/test/mir-opt/issue_73223.main.SimplifyArmIdentity.diff diff --git a/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.64bit.diff deleted file mode 100644 index f9eeb1ea5b960..0000000000000 --- a/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.64bit.diff +++ /dev/null @@ -1,88 +0,0 @@ -- // MIR for `bar` before MatchBranchSimplification -+ // MIR for `bar` after MatchBranchSimplification - - fn bar(_1: i32) -> (bool, bool, bool, bool) { - debug i => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:+0:8: +0:9 - let mut _0: (bool, bool, bool, bool); // return place in scope 0 at $DIR/matches_reduce_branches.rs:+0:19: +0:43 - let _2: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+1:9: +1:10 - let _6: (); // in scope 0 at $DIR/matches_reduce_branches.rs:+6:5: +21:6 - let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+23:6: +23:7 - let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+23:9: +23:10 - let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+23:12: +23:13 - let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+23:15: +23:16 -+ let mut _11: i32; // in scope 0 at $DIR/matches_reduce_branches.rs:+6:5: +6:12 - scope 1 { - debug a => _2; // in scope 1 at $DIR/matches_reduce_branches.rs:+1:9: +1:10 - let _3: bool; // in scope 1 at $DIR/matches_reduce_branches.rs:+2:9: +2:10 - scope 2 { - debug b => _3; // in scope 2 at $DIR/matches_reduce_branches.rs:+2:9: +2:10 - let _4: bool; // in scope 2 at $DIR/matches_reduce_branches.rs:+3:9: +3:10 - scope 3 { - debug c => _4; // in scope 3 at $DIR/matches_reduce_branches.rs:+3:9: +3:10 - let _5: bool; // in scope 3 at $DIR/matches_reduce_branches.rs:+4:9: +4:10 - scope 4 { - debug d => _5; // in scope 4 at $DIR/matches_reduce_branches.rs:+4:9: +4:10 - } - } - } - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:+1:9: +1:10 - StorageLive(_3); // scope 1 at $DIR/matches_reduce_branches.rs:+2:9: +2:10 - StorageLive(_4); // scope 2 at $DIR/matches_reduce_branches.rs:+3:9: +3:10 - StorageLive(_5); // scope 3 at $DIR/matches_reduce_branches.rs:+4:9: +4:10 - StorageLive(_6); // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +21:6 -- switchInt(_1) -> [7_i32: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +6:12 -- } -- -- bb1: { -- _2 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:+15:13: +15:21 -- _3 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:+16:13: +16:22 -- _4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:+17:13: +17:22 -- _5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:+18:13: +18:21 -- Deinit(_6); // scope 4 at $DIR/matches_reduce_branches.rs:+19:13: +19:15 -- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:+19:13: +19:15 -- } -- -- bb2: { -- _2 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:+8:13: +8:22 -- _3 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:+9:13: +9:21 -+ StorageLive(_11); // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +6:12 -+ _11 = _1; // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +6:12 -+ _2 = Ne(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:+8:13: +8:22 -+ _3 = Eq(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:+9:13: +9:21 - _4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:+10:13: +10:22 - _5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:+11:13: +11:21 - Deinit(_6); // scope 4 at $DIR/matches_reduce_branches.rs:+12:13: +12:15 -- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:+12:13: +12:15 -- } -- -- bb3: { -+ StorageDead(_11); // scope 4 at $DIR/matches_reduce_branches.rs:+6:5: +6:12 - StorageDead(_6); // scope 4 at $DIR/matches_reduce_branches.rs:+21:6: +21:7 - StorageLive(_7); // scope 4 at $DIR/matches_reduce_branches.rs:+23:6: +23:7 - _7 = _2; // scope 4 at $DIR/matches_reduce_branches.rs:+23:6: +23:7 - StorageLive(_8); // scope 4 at $DIR/matches_reduce_branches.rs:+23:9: +23:10 - _8 = _3; // scope 4 at $DIR/matches_reduce_branches.rs:+23:9: +23:10 - StorageLive(_9); // scope 4 at $DIR/matches_reduce_branches.rs:+23:12: +23:13 - _9 = _4; // scope 4 at $DIR/matches_reduce_branches.rs:+23:12: +23:13 - StorageLive(_10); // scope 4 at $DIR/matches_reduce_branches.rs:+23:15: +23:16 - _10 = _5; // scope 4 at $DIR/matches_reduce_branches.rs:+23:15: +23:16 - Deinit(_0); // scope 4 at $DIR/matches_reduce_branches.rs:+23:5: +23:17 - (_0.0: bool) = move _7; // scope 4 at $DIR/matches_reduce_branches.rs:+23:5: +23:17 - (_0.1: bool) = move _8; // scope 4 at $DIR/matches_reduce_branches.rs:+23:5: +23:17 - (_0.2: bool) = move _9; // scope 4 at $DIR/matches_reduce_branches.rs:+23:5: +23:17 - (_0.3: bool) = move _10; // scope 4 at $DIR/matches_reduce_branches.rs:+23:5: +23:17 - StorageDead(_10); // scope 4 at $DIR/matches_reduce_branches.rs:+23:16: +23:17 - StorageDead(_9); // scope 4 at $DIR/matches_reduce_branches.rs:+23:16: +23:17 - StorageDead(_8); // scope 4 at $DIR/matches_reduce_branches.rs:+23:16: +23:17 - StorageDead(_7); // scope 4 at $DIR/matches_reduce_branches.rs:+23:16: +23:17 - StorageDead(_5); // scope 3 at $DIR/matches_reduce_branches.rs:+24:1: +24:2 - StorageDead(_4); // scope 2 at $DIR/matches_reduce_branches.rs:+24:1: +24:2 - StorageDead(_3); // scope 1 at $DIR/matches_reduce_branches.rs:+24:1: +24:2 - StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:+24:1: +24:2 - return; // scope 0 at $DIR/matches_reduce_branches.rs:+24:2: +24:2 - } - } - diff --git a/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.32bit.diff b/src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff similarity index 100% rename from src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.32bit.diff rename to src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.diff diff --git a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff deleted file mode 100644 index 0b40b3be8bdd4..0000000000000 --- a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff +++ /dev/null @@ -1,55 +0,0 @@ -- // MIR for `foo` before MatchBranchSimplification -+ // MIR for `foo` after MatchBranchSimplification - - fn foo(_1: Option<()>) -> () { - debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:+0:8: +0:11 - let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:+0:25: +0:25 - let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _3: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:+1:22: +1:26 -+ let mut _4: isize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - - bb0: { - StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _3 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:+1:17: +1:20 -- switchInt(move _3) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ StorageLive(_4); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ _4 = move _3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ _2 = Eq(_4, const 0_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ StorageDead(_4); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb1: { -- _2 = const false; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -- } -- -- bb2: { -- _2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -- } -- -- bb3: { -- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -- } -- -- bb4: { - Deinit(_0); // scope 0 at $DIR/matches_reduce_branches.rs:+2:9: +2:11 -- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:+1:5: +3:6 -+ goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:+1:5: +3:6 - } - -- bb5: { -+ bb2: { - _0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:+3:6: +3:6 -- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:+1:5: +3:6 -+ goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:+1:5: +3:6 - } - -- bb6: { -+ bb3: { - StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:+3:5: +3:6 - return; // scope 0 at $DIR/matches_reduce_branches.rs:+4:2: +4:2 - } - } - diff --git a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff similarity index 100% rename from src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff rename to src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff diff --git a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff deleted file mode 100644 index b8c7722cd3713..0000000000000 --- a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff +++ /dev/null @@ -1,113 +0,0 @@ -- // MIR for `match_nested_if` before MatchBranchSimplification -+ // MIR for `match_nested_if` after MatchBranchSimplification - - fn match_nested_if() -> bool { - let mut _0: bool; // return place in scope 0 at $DIR/matches_reduce_branches.rs:+0:25: +0:29 - let _1: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+1:9: +1:12 - let mut _2: (); // in scope 0 at $DIR/matches_reduce_branches.rs:+1:21: +1:23 - let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 - let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 - let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 - let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 -+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 -+ let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 -+ let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 -+ let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 - scope 1 { - debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:+1:9: +1:12 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:+1:9: +1:12 - StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:+1:21: +1:23 - Deinit(_2); // scope 0 at $DIR/matches_reduce_branches.rs:+1:21: +1:23 - StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 - StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 - StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 - StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 - _6 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 -- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 -- } -- -- bb1: { -- _5 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+2:31: +2:35 -- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 -- } -- -- bb2: { -- _5 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:+2:45: +2:50 -- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 -- } -- -- bb3: { -+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 -+ _7 = move _6; // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 -+ _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+2:45: +2:50 -+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:+2:24: +2:28 - StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:+2:51: +2:52 -- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 -- } -- -- bb4: { -- _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+2:55: +2:59 -- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 -- } -- -- bb5: { -- _4 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:+2:69: +2:74 -- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 -- } -- -- bb6: { -+ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 -+ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 -+ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+2:69: +2:74 -+ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:+2:21: +2:52 - StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:+2:75: +2:76 -- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 -- } -- -- bb7: { -- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+3:13: +3:17 -- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 -- } -- -- bb8: { -- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:+5:13: +5:18 -- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 -- } -- -- bb9: { -- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 -- } -- -- bb10: { -+ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 -+ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 -+ _3 = Ne(_9, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+5:13: +5:18 -+ StorageDead(_9); // scope 0 at $DIR/matches_reduce_branches.rs:+2:18: +2:76 -+ StorageLive(_10); // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 -+ _10 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 - StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:+6:9: +6:10 - StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:+6:9: +6:10 -- _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:+8:13: +8:17 -- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:+8:13: +8:17 -- } -- -- bb11: { -- StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:+6:9: +6:10 -- StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:+6:9: +6:10 -- _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:+10:14: +10:19 -- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:+10:14: +10:19 -- } -- -- bb12: { -+ _1 = Ne(_10, const false); // scope 0 at $DIR/matches_reduce_branches.rs:+10:14: +10:19 -+ StorageDead(_10); // scope 0 at $DIR/matches_reduce_branches.rs:+2:15: +6:10 - StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:+11:6: +11:7 - _0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:+12:5: +12:8 - StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:+13:1: +13:2 - return; // scope 0 at $DIR/matches_reduce_branches.rs:+13:2: +13:2 - } - } - diff --git a/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.32bit.diff b/src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff similarity index 100% rename from src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.32bit.diff rename to src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff diff --git a/src/test/mir-opt/matches_reduce_branches.rs b/src/test/mir-opt/matches_reduce_branches.rs index c122b4c69d15a..a81d5f7b4e8bc 100644 --- a/src/test/mir-opt/matches_reduce_branches.rs +++ b/src/test/mir-opt/matches_reduce_branches.rs @@ -1,6 +1,6 @@ // unit-test: MatchBranchSimplification -// EMIT_MIR_FOR_EACH_BIT_WIDTH + // EMIT_MIR matches_reduce_branches.foo.MatchBranchSimplification.diff // EMIT_MIR matches_reduce_branches.bar.MatchBranchSimplification.diff // EMIT_MIR matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff diff --git a/src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.64bit.diff deleted file mode 100644 index 1b4dddc1d43a0..0000000000000 --- a/src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.64bit.diff +++ /dev/null @@ -1,32 +0,0 @@ -- // MIR for `exhaustive_match` before MatchBranchSimplification -+ // MIR for `exhaustive_match` after MatchBranchSimplification - - fn exhaustive_match(_1: E) -> u8 { - debug e => _1; // in scope 0 at $DIR/matches_u8.rs:+0:25: +0:26 - let mut _0: u8; // return place in scope 0 at $DIR/matches_u8.rs:+0:34: +0:36 - let mut _2: isize; // in scope 0 at $DIR/matches_u8.rs:+2:9: +2:13 - - bb0: { - _2 = discriminant(_1); // scope 0 at $DIR/matches_u8.rs:+1:11: +1:12 - switchInt(move _2) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_u8.rs:+1:5: +1:12 - } - - bb1: { - _0 = const 1_u8; // scope 0 at $DIR/matches_u8.rs:+3:17: +3:18 - goto -> bb4; // scope 0 at $DIR/matches_u8.rs:+3:17: +3:18 - } - - bb2: { - unreachable; // scope 0 at $DIR/matches_u8.rs:+1:11: +1:12 - } - - bb3: { - _0 = const 0_u8; // scope 0 at $DIR/matches_u8.rs:+2:17: +2:18 - goto -> bb4; // scope 0 at $DIR/matches_u8.rs:+2:17: +2:18 - } - - bb4: { - return; // scope 0 at $DIR/matches_u8.rs:+5:2: +5:2 - } - } - diff --git a/src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.32bit.diff b/src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff similarity index 100% rename from src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.32bit.diff rename to src/test/mir-opt/matches_u8.exhaustive_match.MatchBranchSimplification.diff diff --git a/src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.64bit.diff b/src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.64bit.diff deleted file mode 100644 index 6e734852e1af4..0000000000000 --- a/src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.64bit.diff +++ /dev/null @@ -1,32 +0,0 @@ -- // MIR for `exhaustive_match_i8` before MatchBranchSimplification -+ // MIR for `exhaustive_match_i8` after MatchBranchSimplification - - fn exhaustive_match_i8(_1: E) -> i8 { - debug e => _1; // in scope 0 at $DIR/matches_u8.rs:+0:28: +0:29 - let mut _0: i8; // return place in scope 0 at $DIR/matches_u8.rs:+0:37: +0:39 - let mut _2: isize; // in scope 0 at $DIR/matches_u8.rs:+2:9: +2:13 - - bb0: { - _2 = discriminant(_1); // scope 0 at $DIR/matches_u8.rs:+1:11: +1:12 - switchInt(move _2) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_u8.rs:+1:5: +1:12 - } - - bb1: { - _0 = const 1_i8; // scope 0 at $DIR/matches_u8.rs:+3:17: +3:18 - goto -> bb4; // scope 0 at $DIR/matches_u8.rs:+3:17: +3:18 - } - - bb2: { - unreachable; // scope 0 at $DIR/matches_u8.rs:+1:11: +1:12 - } - - bb3: { - _0 = const 0_i8; // scope 0 at $DIR/matches_u8.rs:+2:17: +2:18 - goto -> bb4; // scope 0 at $DIR/matches_u8.rs:+2:17: +2:18 - } - - bb4: { - return; // scope 0 at $DIR/matches_u8.rs:+5:2: +5:2 - } - } - diff --git a/src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.32bit.diff b/src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff similarity index 100% rename from src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.32bit.diff rename to src/test/mir-opt/matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff diff --git a/src/test/mir-opt/matches_u8.rs b/src/test/mir-opt/matches_u8.rs index 2c748b02a8b76..422c3a95e8efa 100644 --- a/src/test/mir-opt/matches_u8.rs +++ b/src/test/mir-opt/matches_u8.rs @@ -1,6 +1,6 @@ // unit-test: MatchBranchSimplification -// EMIT_MIR_FOR_EACH_BIT_WIDTH + // EMIT_MIR matches_u8.exhaustive_match.MatchBranchSimplification.diff // EMIT_MIR matches_u8.exhaustive_match_i8.MatchBranchSimplification.diff diff --git a/src/test/mir-opt/packed-struct-drop-aligned.rs b/src/test/mir-opt/packed-struct-drop-aligned.rs index 6c2e265d51469..cb65242609086 100644 --- a/src/test/mir-opt/packed-struct-drop-aligned.rs +++ b/src/test/mir-opt/packed-struct-drop-aligned.rs @@ -1,6 +1,6 @@ // ignore-wasm32-bare compiled with panic=abort by default -// EMIT_MIR_FOR_EACH_BIT_WIDTH + // EMIT_MIR packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir fn main() { let mut x = Packed(Aligned(Droppy(0))); diff --git a/src/test/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.64bit.mir b/src/test/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.64bit.mir deleted file mode 100644 index f9ed1036f0060..0000000000000 --- a/src/test/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.64bit.mir +++ /dev/null @@ -1,60 +0,0 @@ -// MIR for `main` after SimplifyCfg-elaborate-drops - -fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/packed-struct-drop-aligned.rs:+0:11: +0:11 - let mut _1: Packed; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:9: +1:14 - let mut _2: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:24: +1:42 - let mut _3: Droppy; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:32: +1:41 - let mut _4: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:+2:11: +2:29 - let mut _5: Droppy; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:+2:19: +2:28 - let mut _6: Aligned; // in scope 0 at $DIR/packed-struct-drop-aligned.rs:+2:5: +2:8 - scope 1 { - debug x => _1; // in scope 1 at $DIR/packed-struct-drop-aligned.rs:+1:9: +1:14 - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:9: +1:14 - StorageLive(_2); // scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:24: +1:42 - StorageLive(_3); // scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:32: +1:41 - Deinit(_3); // scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:32: +1:41 - (_3.0: usize) = const 0_usize; // scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:32: +1:41 - Deinit(_2); // scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:24: +1:42 - (_2.0: Droppy) = move _3; // scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:24: +1:42 - StorageDead(_3); // scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:41: +1:42 - Deinit(_1); // scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:17: +1:43 - (_1.0: Aligned) = move _2; // scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:17: +1:43 - StorageDead(_2); // scope 0 at $DIR/packed-struct-drop-aligned.rs:+1:42: +1:43 - StorageLive(_4); // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:11: +2:29 - StorageLive(_5); // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:19: +2:28 - Deinit(_5); // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:19: +2:28 - (_5.0: usize) = const 0_usize; // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:19: +2:28 - Deinit(_4); // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:11: +2:29 - (_4.0: Droppy) = move _5; // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:11: +2:29 - StorageDead(_5); // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:28: +2:29 - StorageLive(_6); // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:5: +2:8 - _6 = move (_1.0: Aligned); // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:5: +2:8 - drop(_6) -> [return: bb4, unwind: bb3]; // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:5: +2:8 - } - - bb1: { - StorageDead(_1); // scope 0 at $DIR/packed-struct-drop-aligned.rs:+3:1: +3:2 - return; // scope 0 at $DIR/packed-struct-drop-aligned.rs:+3:2: +3:2 - } - - bb2 (cleanup): { - resume; // scope 0 at $DIR/packed-struct-drop-aligned.rs:+0:1: +3:2 - } - - bb3 (cleanup): { - (_1.0: Aligned) = move _4; // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:5: +2:8 - drop(_1) -> bb2; // scope 0 at $DIR/packed-struct-drop-aligned.rs:+3:1: +3:2 - } - - bb4: { - StorageDead(_6); // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:5: +2:8 - (_1.0: Aligned) = move _4; // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:5: +2:8 - StorageDead(_4); // scope 1 at $DIR/packed-struct-drop-aligned.rs:+2:28: +2:29 - _0 = const (); // scope 0 at $DIR/packed-struct-drop-aligned.rs:+0:11: +3:2 - drop(_1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/packed-struct-drop-aligned.rs:+3:1: +3:2 - } -} diff --git a/src/test/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.32bit.mir b/src/test/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir similarity index 100% rename from src/test/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.32bit.mir rename to src/test/mir-opt/packed_struct_drop_aligned.main.SimplifyCfg-elaborate-drops.after.mir diff --git a/src/test/mir-opt/separate_const_switch.identity.ConstProp.diff b/src/test/mir-opt/separate_const_switch.identity.ConstProp.diff deleted file mode 100644 index 28536dc28a722..0000000000000 --- a/src/test/mir-opt/separate_const_switch.identity.ConstProp.diff +++ /dev/null @@ -1,146 +0,0 @@ -- // MIR for `identity` before ConstProp -+ // MIR for `identity` after ConstProp - - fn identity(_1: Result) -> Result { - debug x => _1; // in scope 0 at $DIR/separate_const_switch.rs:+0:13: +0:14 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/separate_const_switch.rs:+0:37: +0:53 - let mut _2: i32; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - let mut _3: std::ops::ControlFlow, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - let mut _4: std::result::Result; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 - let mut _5: isize; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - let _6: std::result::Result; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - let mut _7: !; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - let mut _8: std::result::Result; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - let _9: i32; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - scope 1 { - debug residual => _6; // in scope 1 at $DIR/separate_const_switch.rs:+1:9: +1:10 - scope 2 { - scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { // at $DIR/separate_const_switch.rs:29:8: 29:10 - debug residual => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let _16: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _17: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _18: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - scope 9 { - debug e => _16; // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - scope 10 (inlined >::from) { // at $SRC_DIR/core/src/result.rs:LL:COL - debug t => _18; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - } - } - } - } - } - scope 3 { - debug val => _9; // in scope 3 at $DIR/separate_const_switch.rs:+1:8: +1:10 - scope 4 { - } - } - scope 5 (inlined as Try>::branch) { // at $DIR/separate_const_switch.rs:29:8: 29:10 - debug self => _4; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _10: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _12: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let _13: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _14: std::result::Result; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _15: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - scope 6 { - debug v => _11; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - } - scope 7 { - debug e => _13; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - StorageLive(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 - _4 = _1; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 - _10 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - switchInt(move _10) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb1: { - StorageLive(_9); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - _9 = ((_3 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - _2 = _9; // scope 4 at $DIR/separate_const_switch.rs:+1:8: +1:10 - StorageDead(_9); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - Deinit(_0); // scope 0 at $DIR/separate_const_switch.rs:+1:5: +1:11 - ((_0 as Ok).0: i32) = move _2; // scope 0 at $DIR/separate_const_switch.rs:+1:5: +1:11 - discriminant(_0) = 0; // scope 0 at $DIR/separate_const_switch.rs:+1:5: +1:11 - StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11 - StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2 - return; // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2 - } - - bb2: { - unreachable; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - } - - bb3: { - StorageLive(_6); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - _6 = ((_3 as Break).0: std::result::Result); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageLive(_8); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10 - _8 = _6; // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageLive(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - _16 = move ((_8 as Err).0: i32); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - StorageLive(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - StorageLive(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - _18 = move _16; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - _17 = move _18; // scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - StorageDead(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - Deinit(_0); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - ((_0 as Err).0: i32) = move _17; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - discriminant(_0) = 1; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_8); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11 - StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2 - return; // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2 - } - - bb4: { - StorageLive(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - _13 = move ((_4 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageLive(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - StorageLive(_15); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - _15 = move _13; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - Deinit(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - ((_14 as Err).0: i32) = move _15; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - discriminant(_14) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_15); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - Deinit(_3); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - ((_3 as Break).0: std::result::Result) = move _14; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - discriminant(_3) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 -- _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 -- switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 -+ _5 = const 1_isize; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 -+ switchInt(const 1_isize) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - } - - bb5: { - unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb6: { - StorageLive(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - _11 = move ((_4 as Ok).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageLive(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - _12 = move _11; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - Deinit(_3); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - ((_3 as Continue).0: i32) = move _12; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - discriminant(_3) = 0; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 -- _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 -- switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 -+ _5 = const 0_isize; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 -+ switchInt(const 0_isize) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - } - } - diff --git a/src/test/mir-opt/separate_const_switch.identity.PreCodegen.after.mir b/src/test/mir-opt/separate_const_switch.identity.PreCodegen.after.mir deleted file mode 100644 index df20f0ed36b60..0000000000000 --- a/src/test/mir-opt/separate_const_switch.identity.PreCodegen.after.mir +++ /dev/null @@ -1,124 +0,0 @@ -// MIR for `identity` after PreCodegen - -fn identity(_1: Result) -> Result { - debug x => _1; // in scope 0 at $DIR/separate_const_switch.rs:+0:13: +0:14 - let mut _0: std::result::Result; // return place in scope 0 at $DIR/separate_const_switch.rs:+0:37: +0:53 - let mut _2: i32; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - let mut _3: std::ops::ControlFlow, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - let mut _4: std::result::Result; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 - let _5: std::result::Result; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - let mut _6: std::result::Result; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - let _7: i32; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - scope 1 { - debug residual => _5; // in scope 1 at $DIR/separate_const_switch.rs:+1:9: +1:10 - scope 2 { - scope 8 (inlined #[track_caller] as FromResidual>>::from_residual) { // at $DIR/separate_const_switch.rs:29:8: 29:10 - debug residual => _6; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let _14: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _15: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _16: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - scope 9 { - debug e => _14; // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - scope 10 (inlined >::from) { // at $SRC_DIR/core/src/result.rs:LL:COL - debug t => _16; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - } - } - } - } - } - scope 3 { - debug val => _7; // in scope 3 at $DIR/separate_const_switch.rs:+1:8: +1:10 - scope 4 { - } - } - scope 5 (inlined as Try>::branch) { // at $DIR/separate_const_switch.rs:29:8: 29:10 - debug self => _4; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _8: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let _9: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _10: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _12: std::result::Result; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _13: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - scope 6 { - debug v => _9; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - } - scope 7 { - debug e => _11; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - StorageLive(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 - _4 = _1; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9 - _8 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - switchInt(move _8) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb1: { - StorageLive(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - _11 = move ((_4 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageLive(_12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - StorageLive(_13); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - _13 = move _11; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - Deinit(_12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - ((_12 as Err).0: i32) = move _13; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - discriminant(_12) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_13); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - Deinit(_3); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - ((_3 as Break).0: std::result::Result) = move _12; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - discriminant(_3) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageLive(_5); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - _5 = ((_3 as Break).0: std::result::Result); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageLive(_6); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10 - _6 = _5; // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageLive(_14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - _14 = move ((_6 as Err).0: i32); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - StorageLive(_15); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - StorageLive(_16); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - _16 = move _14; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - _15 = move _16; // scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - StorageDead(_16); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - Deinit(_0); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - ((_0 as Err).0: i32) = move _15; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - discriminant(_0) = 1; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_15); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_6); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageDead(_5); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11 - StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2 - return; // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2 - } - - bb2: { - unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb3: { - StorageLive(_9); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - _9 = move ((_4 as Ok).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageLive(_10); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - _10 = move _9; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - Deinit(_3); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - ((_3 as Continue).0: i32) = move _10; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - discriminant(_3) = 0; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_10); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_9); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - StorageLive(_7); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - _7 = ((_3 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10 - _2 = _7; // scope 4 at $DIR/separate_const_switch.rs:+1:8: +1:10 - StorageDead(_7); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10 - Deinit(_0); // scope 0 at $DIR/separate_const_switch.rs:+1:5: +1:11 - ((_0 as Ok).0: i32) = move _2; // scope 0 at $DIR/separate_const_switch.rs:+1:5: +1:11 - discriminant(_0) = 0; // scope 0 at $DIR/separate_const_switch.rs:+1:5: +1:11 - StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11 - StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2 - return; // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2 - } -} diff --git a/src/test/mir-opt/separate_const_switch.too_complex.ConstProp.diff b/src/test/mir-opt/separate_const_switch.too_complex.ConstProp.diff deleted file mode 100644 index 28269165e1c27..0000000000000 --- a/src/test/mir-opt/separate_const_switch.too_complex.ConstProp.diff +++ /dev/null @@ -1,103 +0,0 @@ -- // MIR for `too_complex` before ConstProp -+ // MIR for `too_complex` after ConstProp - - fn too_complex(_1: Result) -> Option { - debug x => _1; // in scope 0 at $DIR/separate_const_switch.rs:+0:16: +0:17 - let mut _0: std::option::Option; // return place in scope 0 at $DIR/separate_const_switch.rs:+0:42: +0:53 - let mut _2: std::ops::ControlFlow; // in scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 - let mut _3: isize; // in scope 0 at $DIR/separate_const_switch.rs:+7:13: +7:18 - let _4: i32; // in scope 0 at $DIR/separate_const_switch.rs:+7:16: +7:17 - let mut _5: i32; // in scope 0 at $DIR/separate_const_switch.rs:+7:44: +7:45 - let _6: usize; // in scope 0 at $DIR/separate_const_switch.rs:+8:17: +8:18 - let mut _7: usize; // in scope 0 at $DIR/separate_const_switch.rs:+8:42: +8:43 - let mut _8: isize; // in scope 0 at $DIR/separate_const_switch.rs:+11:9: +11:33 - let _9: i32; // in scope 0 at $DIR/separate_const_switch.rs:+11:31: +11:32 - let mut _10: i32; // in scope 0 at $DIR/separate_const_switch.rs:+11:42: +11:43 - let _11: usize; // in scope 0 at $DIR/separate_const_switch.rs:+12:28: +12:29 - scope 1 { - debug v => _4; // in scope 1 at $DIR/separate_const_switch.rs:+7:16: +7:17 - } - scope 2 { - debug r => _6; // in scope 2 at $DIR/separate_const_switch.rs:+8:17: +8:18 - } - scope 3 { - debug v => _9; // in scope 3 at $DIR/separate_const_switch.rs:+11:31: +11:32 - } - scope 4 { - debug r => _11; // in scope 4 at $DIR/separate_const_switch.rs:+12:28: +12:29 - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 - _3 = discriminant(_1); // scope 0 at $DIR/separate_const_switch.rs:+6:15: +6:16 - switchInt(move _3) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+6:9: +6:16 - } - - bb1: { - StorageLive(_6); // scope 0 at $DIR/separate_const_switch.rs:+8:17: +8:18 - _6 = ((_1 as Err).0: usize); // scope 0 at $DIR/separate_const_switch.rs:+8:17: +8:18 - StorageLive(_7); // scope 2 at $DIR/separate_const_switch.rs:+8:42: +8:43 - _7 = _6; // scope 2 at $DIR/separate_const_switch.rs:+8:42: +8:43 - Deinit(_2); // scope 2 at $DIR/separate_const_switch.rs:+8:23: +8:44 - ((_2 as Break).0: usize) = move _7; // scope 2 at $DIR/separate_const_switch.rs:+8:23: +8:44 - discriminant(_2) = 1; // scope 2 at $DIR/separate_const_switch.rs:+8:23: +8:44 - StorageDead(_7); // scope 2 at $DIR/separate_const_switch.rs:+8:43: +8:44 - StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:+8:43: +8:44 -- _8 = discriminant(_2); // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 -- switchInt(move _8) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 -+ _8 = const 1_isize; // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 -+ switchInt(const 1_isize) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 - } - - bb2: { - unreachable; // scope 0 at $DIR/separate_const_switch.rs:+6:15: +6:16 - } - - bb3: { - StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+7:16: +7:17 - _4 = ((_1 as Ok).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+7:16: +7:17 - StorageLive(_5); // scope 1 at $DIR/separate_const_switch.rs:+7:44: +7:45 - _5 = _4; // scope 1 at $DIR/separate_const_switch.rs:+7:44: +7:45 - Deinit(_2); // scope 1 at $DIR/separate_const_switch.rs:+7:22: +7:46 - ((_2 as Continue).0: i32) = move _5; // scope 1 at $DIR/separate_const_switch.rs:+7:22: +7:46 - discriminant(_2) = 0; // scope 1 at $DIR/separate_const_switch.rs:+7:22: +7:46 - StorageDead(_5); // scope 1 at $DIR/separate_const_switch.rs:+7:45: +7:46 - StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+7:45: +7:46 -- _8 = discriminant(_2); // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 -- switchInt(move _8) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 -+ _8 = const 0_isize; // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 -+ switchInt(const 0_isize) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 0 at $DIR/separate_const_switch.rs:+5:5: +10:6 - } - - bb4: { - StorageLive(_11); // scope 0 at $DIR/separate_const_switch.rs:+12:28: +12:29 - _11 = ((_2 as Break).0: usize); // scope 0 at $DIR/separate_const_switch.rs:+12:28: +12:29 - Deinit(_0); // scope 4 at $DIR/separate_const_switch.rs:+12:34: +12:38 - discriminant(_0) = 0; // scope 4 at $DIR/separate_const_switch.rs:+12:34: +12:38 - StorageDead(_11); // scope 0 at $DIR/separate_const_switch.rs:+12:37: +12:38 - goto -> bb7; // scope 0 at $DIR/separate_const_switch.rs:+12:37: +12:38 - } - - bb5: { - unreachable; // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 - } - - bb6: { - StorageLive(_9); // scope 0 at $DIR/separate_const_switch.rs:+11:31: +11:32 - _9 = ((_2 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+11:31: +11:32 - StorageLive(_10); // scope 3 at $DIR/separate_const_switch.rs:+11:42: +11:43 - _10 = _9; // scope 3 at $DIR/separate_const_switch.rs:+11:42: +11:43 - Deinit(_0); // scope 3 at $DIR/separate_const_switch.rs:+11:37: +11:44 - ((_0 as Some).0: i32) = move _10; // scope 3 at $DIR/separate_const_switch.rs:+11:37: +11:44 - discriminant(_0) = 1; // scope 3 at $DIR/separate_const_switch.rs:+11:37: +11:44 - StorageDead(_10); // scope 3 at $DIR/separate_const_switch.rs:+11:43: +11:44 - StorageDead(_9); // scope 0 at $DIR/separate_const_switch.rs:+11:43: +11:44 - goto -> bb7; // scope 0 at $DIR/separate_const_switch.rs:+11:43: +11:44 - } - - bb7: { - StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+14:1: +14:2 - return; // scope 0 at $DIR/separate_const_switch.rs:+14:2: +14:2 - } - } - diff --git a/src/test/mir-opt/separate_const_switch.too_complex.PreCodegen.after.mir b/src/test/mir-opt/separate_const_switch.too_complex.PreCodegen.after.mir deleted file mode 100644 index 0ee070619e79d..0000000000000 --- a/src/test/mir-opt/separate_const_switch.too_complex.PreCodegen.after.mir +++ /dev/null @@ -1,73 +0,0 @@ -// MIR for `too_complex` after PreCodegen - -fn too_complex(_1: Result) -> Option { - debug x => _1; // in scope 0 at $DIR/separate_const_switch.rs:+0:16: +0:17 - let mut _0: std::option::Option; // return place in scope 0 at $DIR/separate_const_switch.rs:+0:42: +0:53 - let mut _2: std::ops::ControlFlow; // in scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 - let mut _3: isize; // in scope 0 at $DIR/separate_const_switch.rs:+7:13: +7:18 - let _4: i32; // in scope 0 at $DIR/separate_const_switch.rs:+7:16: +7:17 - let mut _5: i32; // in scope 0 at $DIR/separate_const_switch.rs:+7:44: +7:45 - let _6: usize; // in scope 0 at $DIR/separate_const_switch.rs:+8:17: +8:18 - let _7: i32; // in scope 0 at $DIR/separate_const_switch.rs:+11:31: +11:32 - let mut _8: i32; // in scope 0 at $DIR/separate_const_switch.rs:+11:42: +11:43 - let _9: usize; // in scope 0 at $DIR/separate_const_switch.rs:+12:28: +12:29 - scope 1 { - debug v => _4; // in scope 1 at $DIR/separate_const_switch.rs:+7:16: +7:17 - } - scope 2 { - debug r => _6; // in scope 2 at $DIR/separate_const_switch.rs:+8:17: +8:18 - } - scope 3 { - debug v => _7; // in scope 3 at $DIR/separate_const_switch.rs:+11:31: +11:32 - } - scope 4 { - debug r => _9; // in scope 4 at $DIR/separate_const_switch.rs:+12:28: +12:29 - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:+5:11: +10:6 - _3 = discriminant(_1); // scope 0 at $DIR/separate_const_switch.rs:+6:15: +6:16 - switchInt(move _3) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+6:9: +6:16 - } - - bb1: { - StorageLive(_6); // scope 0 at $DIR/separate_const_switch.rs:+8:17: +8:18 - StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:+8:43: +8:44 - StorageLive(_9); // scope 0 at $DIR/separate_const_switch.rs:+12:28: +12:29 - Deinit(_0); // scope 4 at $DIR/separate_const_switch.rs:+12:34: +12:38 - discriminant(_0) = 0; // scope 4 at $DIR/separate_const_switch.rs:+12:34: +12:38 - StorageDead(_9); // scope 0 at $DIR/separate_const_switch.rs:+12:37: +12:38 - goto -> bb4; // scope 0 at $DIR/separate_const_switch.rs:+12:37: +12:38 - } - - bb2: { - unreachable; // scope 0 at $DIR/separate_const_switch.rs:+6:15: +6:16 - } - - bb3: { - StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+7:16: +7:17 - _4 = ((_1 as Ok).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+7:16: +7:17 - StorageLive(_5); // scope 1 at $DIR/separate_const_switch.rs:+7:44: +7:45 - _5 = _4; // scope 1 at $DIR/separate_const_switch.rs:+7:44: +7:45 - Deinit(_2); // scope 1 at $DIR/separate_const_switch.rs:+7:22: +7:46 - ((_2 as Continue).0: i32) = move _5; // scope 1 at $DIR/separate_const_switch.rs:+7:22: +7:46 - discriminant(_2) = 0; // scope 1 at $DIR/separate_const_switch.rs:+7:22: +7:46 - StorageDead(_5); // scope 1 at $DIR/separate_const_switch.rs:+7:45: +7:46 - StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+7:45: +7:46 - StorageLive(_7); // scope 0 at $DIR/separate_const_switch.rs:+11:31: +11:32 - _7 = ((_2 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+11:31: +11:32 - StorageLive(_8); // scope 3 at $DIR/separate_const_switch.rs:+11:42: +11:43 - _8 = _7; // scope 3 at $DIR/separate_const_switch.rs:+11:42: +11:43 - Deinit(_0); // scope 3 at $DIR/separate_const_switch.rs:+11:37: +11:44 - ((_0 as Some).0: i32) = move _8; // scope 3 at $DIR/separate_const_switch.rs:+11:37: +11:44 - discriminant(_0) = 1; // scope 3 at $DIR/separate_const_switch.rs:+11:37: +11:44 - StorageDead(_8); // scope 3 at $DIR/separate_const_switch.rs:+11:43: +11:44 - StorageDead(_7); // scope 0 at $DIR/separate_const_switch.rs:+11:43: +11:44 - goto -> bb4; // scope 0 at $DIR/separate_const_switch.rs:+11:43: +11:44 - } - - bb4: { - StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+14:1: +14:2 - return; // scope 0 at $DIR/separate_const_switch.rs:+14:2: +14:2 - } -} diff --git a/src/test/mir-opt/simple-match.rs b/src/test/mir-opt/simple-match.rs index 44adc55b6f7fe..103033c4e2b86 100644 --- a/src/test/mir-opt/simple-match.rs +++ b/src/test/mir-opt/simple-match.rs @@ -1,6 +1,6 @@ // Test that we don't generate unnecessarily large MIR for very simple matches -// EMIT_MIR_FOR_EACH_BIT_WIDTH + // EMIT_MIR simple_match.match_bool.mir_map.0.mir fn match_bool(x: bool) -> usize { match x { diff --git a/src/test/mir-opt/simple_match.match_bool.mir_map.0.64bit.mir b/src/test/mir-opt/simple_match.match_bool.mir_map.0.64bit.mir deleted file mode 100644 index 3bef6aa0579a7..0000000000000 --- a/src/test/mir-opt/simple_match.match_bool.mir_map.0.64bit.mir +++ /dev/null @@ -1,29 +0,0 @@ -// MIR for `match_bool` 0 mir_map - -fn match_bool(_1: bool) -> usize { - debug x => _1; // in scope 0 at $DIR/simple-match.rs:+0:15: +0:16 - let mut _0: usize; // return place in scope 0 at $DIR/simple-match.rs:+0:27: +0:32 - - bb0: { - FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/simple-match.rs:+1:11: +1:12 - switchInt(_1) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/simple-match.rs:+1:5: +1:12 - } - - bb1: { - falseEdge -> [real: bb3, imaginary: bb2]; // scope 0 at $DIR/simple-match.rs:+2:9: +2:13 - } - - bb2: { - _0 = const 20_usize; // scope 0 at $DIR/simple-match.rs:+3:14: +3:16 - goto -> bb4; // scope 0 at $DIR/simple-match.rs:+3:14: +3:16 - } - - bb3: { - _0 = const 10_usize; // scope 0 at $DIR/simple-match.rs:+2:17: +2:19 - goto -> bb4; // scope 0 at $DIR/simple-match.rs:+2:17: +2:19 - } - - bb4: { - return; // scope 0 at $DIR/simple-match.rs:+5:2: +5:2 - } -} diff --git a/src/test/mir-opt/simple_match.match_bool.mir_map.0.32bit.mir b/src/test/mir-opt/simple_match.match_bool.mir_map.0.mir similarity index 100% rename from src/test/mir-opt/simple_match.match_bool.mir_map.0.32bit.mir rename to src/test/mir-opt/simple_match.match_bool.mir_map.0.mir diff --git a/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs b/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs index 62a15df04b144..d09bd92c4e81d 100644 --- a/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs +++ b/src/test/mir-opt/simplify-locals-removes-unused-discriminant-reads.rs @@ -11,5 +11,4 @@ fn main() { map(None); } -// EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff diff --git a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff deleted file mode 100644 index 51d26b08b2a1c..0000000000000 --- a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.64bit.diff +++ /dev/null @@ -1,52 +0,0 @@ -- // MIR for `map` before SimplifyLocals -+ // MIR for `map` after SimplifyLocals - - fn map(_1: Option>) -> Option> { - debug x => _1; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+0:8: +0:9 - let mut _0: std::option::Option>; // return place in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+0:31: +0:46 - let mut _2: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+2:9: +2:13 - let _3: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:14: +3:15 - let mut _4: std::boxed::Box<()>; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:25: +3:26 -- let mut _5: bool; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+5:1: +5:2 -- let mut _6: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+5:1: +5:2 -- let mut _7: isize; // in scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+5:1: +5:2 - scope 1 { - debug x => _3; // in scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:14: +3:15 - } - - bb0: { -- _5 = const false; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+1:11: +1:12 -- _5 = const true; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+1:11: +1:12 - _2 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+1:11: +1:12 - switchInt(move _2) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+1:5: +1:12 - } - - bb1: { - StorageLive(_3); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:14: +3:15 - _3 = move ((_1 as Some).0: std::boxed::Box<()>); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:14: +3:15 - StorageLive(_4); // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:25: +3:26 - _4 = move _3; // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:25: +3:26 - Deinit(_0); // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:20: +3:27 - ((_0 as Some).0: std::boxed::Box<()>) = move _4; // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:20: +3:27 - discriminant(_0) = 1; // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:20: +3:27 - StorageDead(_4); // scope 1 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:26: +3:27 - StorageDead(_3); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:26: +3:27 - goto -> bb4; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+3:26: +3:27 - } - - bb2: { - unreachable; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+1:11: +1:12 - } - - bb3: { - Deinit(_0); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+2:17: +2:21 - discriminant(_0) = 0; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+2:17: +2:21 - goto -> bb4; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+2:17: +2:21 - } - - bb4: { -- _6 = discriminant(_1); // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+5:1: +5:2 - return; // scope 0 at $DIR/simplify-locals-removes-unused-discriminant-reads.rs:+5:2: +5:2 - } - } - diff --git a/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff b/src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff similarity index 100% rename from src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.32bit.diff rename to src/test/mir-opt/simplify_locals_removes_unused_discriminant_reads.map.SimplifyLocals.diff diff --git a/src/test/mir-opt/slice-drop-shim.rs b/src/test/mir-opt/slice-drop-shim.rs index 0fd32906db6be..344c1af2c9134 100644 --- a/src/test/mir-opt/slice-drop-shim.rs +++ b/src/test/mir-opt/slice-drop-shim.rs @@ -1,6 +1,6 @@ // compile-flags: -Zmir-opt-level=0 -// EMIT_MIR_FOR_EACH_BIT_WIDTH + // EMIT_MIR core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir fn main() { let _fn = std::ptr::drop_in_place::<[String]> as unsafe fn(_); diff --git a/src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.64bit.mir b/src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.64bit.mir deleted file mode 100644 index b4b317e84afb7..0000000000000 --- a/src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.64bit.mir +++ /dev/null @@ -1,101 +0,0 @@ -// MIR for `std::ptr::drop_in_place` before AddMovesForPackedDrops - -fn std::ptr::drop_in_place(_1: *mut [String]) -> () { - let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _2: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _3: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _4: usize; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _5: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _6: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _7: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _8: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _9: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _10: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _11: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _12: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _13: *mut std::string::String; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _14: bool; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _15: *mut [std::string::String]; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - - bb0: { - goto -> bb15; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb1: { - return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb2 (cleanup): { - resume; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb3 (cleanup): { - _5 = &raw mut (*_1)[_4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _4 = Add(move _4, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - drop((*_5)) -> bb4; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb4 (cleanup): { - _6 = Eq(_4, _3); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _6) -> [false: bb3, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb5: { - _7 = &raw mut (*_1)[_4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _4 = Add(move _4, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - drop((*_7)) -> [return: bb6, unwind: bb4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb6: { - _8 = Eq(_4, _3); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _8) -> [false: bb5, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb7: { - _4 = const 0_usize; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - goto -> bb6; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb8: { - goto -> bb7; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb9 (cleanup): { - _11 = _9; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _9 = Offset(move _9, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - drop((*_11)) -> bb10; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb10 (cleanup): { - _12 = Eq(_9, _10); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _12) -> [false: bb9, otherwise: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb11: { - _13 = _9; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _9 = Offset(move _9, const 1_usize); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - drop((*_13)) -> [return: bb12, unwind: bb10]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb12: { - _14 = Eq(_9, _10); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _14) -> [false: bb11, otherwise: bb1]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb13: { - _15 = &raw mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _9 = move _15 as *mut std::string::String (Misc); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _10 = Offset(_9, move _3); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - goto -> bb12; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb14: { - goto -> bb13; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb15: { - _2 = SizeOf(std::string::String); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _3 = Len((*_1)); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - switchInt(move _2) -> [0_usize: bb8, otherwise: bb14]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } -} diff --git a/src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.32bit.mir b/src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir similarity index 100% rename from src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.32bit.mir rename to src/test/mir-opt/slice_drop_shim.core.ptr-drop_in_place.[String].AddMovesForPackedDrops.before.mir diff --git a/src/test/mir-opt/unusual-item-types.rs b/src/test/mir-opt/unusual-item-types.rs index 670f61cd5ce3a..9ef3d86472db2 100644 --- a/src/test/mir-opt/unusual-item-types.rs +++ b/src/test/mir-opt/unusual-item-types.rs @@ -1,7 +1,7 @@ // Test that we don't ICE when trying to dump MIR for unusual item types and // that we don't create filenames containing `<` and `>` // compile-flags: -Zmir-opt-level=0 -// EMIT_MIR_FOR_EACH_BIT_WIDTH + struct A; diff --git a/src/test/mir-opt/unusual_item_types.E-V-{constant#0}.mir_map.0.64bit.mir b/src/test/mir-opt/unusual_item_types.E-V-{constant#0}.mir_map.0.64bit.mir deleted file mode 100644 index a72e00ecde75f..0000000000000 --- a/src/test/mir-opt/unusual_item_types.E-V-{constant#0}.mir_map.0.64bit.mir +++ /dev/null @@ -1,10 +0,0 @@ -// MIR for `E::V::{constant#0}` 0 mir_map - -E::V::{constant#0}: isize = { - let mut _0: isize; // return place in scope 0 at $DIR/unusual-item-types.rs:+0:9: +0:10 - - bb0: { - _0 = const 5_isize; // scope 0 at $DIR/unusual-item-types.rs:+0:9: +0:10 - return; // scope 0 at $DIR/unusual-item-types.rs:+0:9: +0:10 - } -} diff --git a/src/test/mir-opt/unusual_item_types.E-V-{constant#0}.mir_map.0.32bit.mir b/src/test/mir-opt/unusual_item_types.E-V-{constant#0}.mir_map.0.mir similarity index 100% rename from src/test/mir-opt/unusual_item_types.E-V-{constant#0}.mir_map.0.32bit.mir rename to src/test/mir-opt/unusual_item_types.E-V-{constant#0}.mir_map.0.mir diff --git a/src/test/mir-opt/unusual_item_types.Test-X-{constructor#0}.mir_map.0.64bit.mir b/src/test/mir-opt/unusual_item_types.Test-X-{constructor#0}.mir_map.0.64bit.mir deleted file mode 100644 index 0686af46ed58e..0000000000000 --- a/src/test/mir-opt/unusual_item_types.Test-X-{constructor#0}.mir_map.0.64bit.mir +++ /dev/null @@ -1,12 +0,0 @@ -// MIR for `Test::X` 0 mir_map - -fn Test::X(_1: usize) -> Test { - let mut _0: Test; // return place in scope 0 at $DIR/unusual-item-types.rs:+0:5: +0:6 - - bb0: { - Deinit(_0); // scope 0 at $DIR/unusual-item-types.rs:+0:5: +0:6 - ((_0 as X).0: usize) = move _1; // scope 0 at $DIR/unusual-item-types.rs:+0:5: +0:6 - discriminant(_0) = 0; // scope 0 at $DIR/unusual-item-types.rs:+0:5: +0:6 - return; // scope 0 at $DIR/unusual-item-types.rs:+0:5: +0:6 - } -} diff --git a/src/test/mir-opt/unusual_item_types.Test-X-{constructor#0}.mir_map.0.32bit.mir b/src/test/mir-opt/unusual_item_types.Test-X-{constructor#0}.mir_map.0.mir similarity index 100% rename from src/test/mir-opt/unusual_item_types.Test-X-{constructor#0}.mir_map.0.32bit.mir rename to src/test/mir-opt/unusual_item_types.Test-X-{constructor#0}.mir_map.0.mir diff --git a/src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.64bit.mir b/src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.64bit.mir deleted file mode 100644 index 7ffd242e0dc3b..0000000000000 --- a/src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.64bit.mir +++ /dev/null @@ -1,39 +0,0 @@ -// MIR for `std::ptr::drop_in_place` before AddMovesForPackedDrops - -fn std::ptr::drop_in_place(_1: *mut Vec) -> () { - let mut _0: (); // return place in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _2: &mut std::vec::Vec; // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - let mut _3: (); // in scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - - bb0: { - goto -> bb6; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb1: { - return; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb2 (cleanup): { - resume; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb3: { - goto -> bb1; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb4 (cleanup): { - drop(((*_1).0: alloc::raw_vec::RawVec)) -> bb2; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb5: { - drop(((*_1).0: alloc::raw_vec::RawVec)) -> [return: bb3, unwind: bb2]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - } - - bb6: { - _2 = &mut (*_1); // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - _3 = as Drop>::drop(move _2) -> [return: bb5, unwind: bb4]; // scope 0 at $SRC_DIR/core/src/ptr/mod.rs:+0:1: +0:56 - // mir::Constant - // + span: $SRC_DIR/core/src/ptr/mod.rs:LL:COL - // + literal: Const { ty: for<'r> fn(&'r mut Vec) { as Drop>::drop}, val: Value() } - } -} diff --git a/src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.32bit.mir b/src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir similarity index 100% rename from src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.32bit.mir rename to src/test/mir-opt/unusual_item_types.core.ptr-drop_in_place.Vec_i32_.AddMovesForPackedDrops.before.mir diff --git a/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.64bit.mir b/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.64bit.mir deleted file mode 100644 index e2633f61b5fe4..0000000000000 --- a/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.64bit.mir +++ /dev/null @@ -1,10 +0,0 @@ -// MIR for `::ASSOCIATED_CONSTANT` 0 mir_map - -const ::ASSOCIATED_CONSTANT: i32 = { - let mut _0: i32; // return place in scope 0 at $DIR/unusual-item-types.rs:+0:32: +0:35 - - bb0: { - _0 = const 2_i32; // scope 0 at $DIR/unusual-item-types.rs:+0:38: +0:39 - return; // scope 0 at $DIR/unusual-item-types.rs:+0:5: +0:39 - } -} diff --git a/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.32bit.mir b/src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.mir similarity index 100% rename from src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.32bit.mir rename to src/test/mir-opt/unusual_item_types.{impl#0}-ASSOCIATED_CONSTANT.mir_map.0.mir diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff deleted file mode 100644 index eef7011149d3e..0000000000000 --- a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.64bit.diff +++ /dev/null @@ -1,55 +0,0 @@ -- // MIR for `change_loop_body` before ConstProp -+ // MIR for `change_loop_body` after ConstProp - - fn change_loop_body() -> () { - let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:+0:27: +0:27 - let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15 - let mut _2: (); // in scope 0 at $DIR/while_let_loops.rs:+0:1: +6:2 - let mut _3: std::option::Option; // in scope 0 at $DIR/while_let_loops.rs:+2:28: +2:32 - let mut _4: isize; // in scope 0 at $DIR/while_let_loops.rs:+2:15: +2:25 - let mut _5: !; // in scope 0 at $DIR/while_let_loops.rs:+2:33: +5:6 - let mut _6: !; // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6 - let _7: (); // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6 - let mut _8: !; // in scope 0 at $DIR/while_let_loops.rs:+2:5: +5:6 - scope 1 { - debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:+1:9: +1:15 - scope 2 { - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15 - _1 = const 0_i32; // scope 0 at $DIR/while_let_loops.rs:+1:18: +1:19 - StorageLive(_3); // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32 - Deinit(_3); // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32 - discriminant(_3) = 0; // scope 2 at $DIR/while_let_loops.rs:+2:28: +2:32 -- _4 = discriminant(_3); // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 -- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 -+ _4 = const 0_isize; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 -+ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 - } - - bb1: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 2 at $DIR/while_let_loops.rs:+2:15: +2:25 - } - - bb2: { - _1 = const 1_i32; // scope 2 at $DIR/while_let_loops.rs:+3:9: +3:15 - nop; // scope 2 at $DIR/while_let_loops.rs:+4:9: +4:14 - goto -> bb4; // scope 2 at $DIR/while_let_loops.rs:+4:9: +4:14 - } - - bb3: { - StorageLive(_7); // scope 1 at $DIR/while_let_loops.rs:+2:5: +5:6 - nop; // scope 1 at $DIR/while_let_loops.rs:+2:5: +5:6 - StorageDead(_7); // scope 1 at $DIR/while_let_loops.rs:+5:5: +5:6 - goto -> bb4; // scope 1 at no-location - } - - bb4: { - StorageDead(_3); // scope 1 at $DIR/while_let_loops.rs:+5:5: +5:6 - StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:+6:1: +6:2 - return; // scope 0 at $DIR/while_let_loops.rs:+6:2: +6:2 - } - } - diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff b/src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff similarity index 100% rename from src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.32bit.diff rename to src/test/mir-opt/while_let_loops.change_loop_body.ConstProp.diff diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir deleted file mode 100644 index 15b0aece8f54b..0000000000000 --- a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.64bit.mir +++ /dev/null @@ -1,17 +0,0 @@ -// MIR for `change_loop_body` after PreCodegen - -fn change_loop_body() -> () { - let mut _0: (); // return place in scope 0 at $DIR/while_let_loops.rs:+0:27: +0:27 - let mut _1: i32; // in scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15 - scope 1 { - debug _x => _1; // in scope 1 at $DIR/while_let_loops.rs:+1:9: +1:15 - scope 2 { - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/while_let_loops.rs:+1:9: +1:15 - StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:+6:1: +6:2 - return; // scope 0 at $DIR/while_let_loops.rs:+6:2: +6:2 - } -} diff --git a/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir b/src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir similarity index 100% rename from src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.32bit.mir rename to src/test/mir-opt/while_let_loops.change_loop_body.PreCodegen.after.mir diff --git a/src/test/mir-opt/while_let_loops.rs b/src/test/mir-opt/while_let_loops.rs index f320a218c852c..fc56cd6985d69 100644 --- a/src/test/mir-opt/while_let_loops.rs +++ b/src/test/mir-opt/while_let_loops.rs @@ -1,6 +1,5 @@ // EMIT_MIR while_let_loops.change_loop_body.ConstProp.diff // EMIT_MIR while_let_loops.change_loop_body.PreCodegen.after.mir -// EMIT_MIR_FOR_EACH_BIT_WIDTH pub fn change_loop_body() { let mut _x = 0; From 850090d99c81dde7615e2a7e2111c09650868a48 Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Mon, 5 Sep 2022 08:37:20 -0700 Subject: [PATCH 05/10] Avoid UB in the Windows filesystem code in... bootstrap? --- src/bootstrap/Cargo.toml | 1 + src/bootstrap/util.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index 2dad41bb18fce..95e711737738a 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -67,6 +67,7 @@ features = [ "psapi", "impl-default", "timezoneapi", + "winbase", ] [dev-dependencies] diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index 3a00e258e00e5..0ebabbd5ca5c0 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -197,9 +197,11 @@ pub fn symlink_dir(config: &Config, src: &Path, dest: &Path) -> io::Result<()> { ptr::null_mut(), ); - let mut data = [0u8; MAXIMUM_REPARSE_DATA_BUFFER_SIZE as usize]; - let db = data.as_mut_ptr() as *mut REPARSE_MOUNTPOINT_DATA_BUFFER; - let buf = &mut (*db).ReparseTarget as *mut u16; + #[repr(C, align(8))] + struct Align8(T); + let mut data = Align8([0u8; MAXIMUM_REPARSE_DATA_BUFFER_SIZE as usize]); + let db = data.0.as_mut_ptr() as *mut REPARSE_MOUNTPOINT_DATA_BUFFER; + let buf = core::ptr::addr_of_mut!((*db).ReparseTarget) as *mut u16; let mut i = 0; // FIXME: this conversion is very hacky let v = br"\??\"; @@ -219,7 +221,7 @@ pub fn symlink_dir(config: &Config, src: &Path, dest: &Path) -> io::Result<()> { let res = DeviceIoControl( h as *mut _, FSCTL_SET_REPARSE_POINT, - data.as_ptr() as *mut _, + db.cast(), (*db).ReparseDataLength + 8, ptr::null_mut(), 0, From b2e4f9dcb32aafcfa1bd2ab6b291ca84b7db0121 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Tue, 6 Sep 2022 10:49:34 +0100 Subject: [PATCH 06/10] Open a BCrypt algorithm handle --- library/std/src/sys/windows/c.rs | 14 ++++- library/std/src/sys/windows/rand.rs | 82 ++++++++++++++++++++++------- 2 files changed, 76 insertions(+), 20 deletions(-) diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs index 78d6ce3eff493..89d0ab59be89f 100644 --- a/library/std/src/sys/windows/c.rs +++ b/library/std/src/sys/windows/c.rs @@ -66,6 +66,7 @@ pub type LPSYSTEM_INFO = *mut SYSTEM_INFO; pub type LPWSABUF = *mut WSABUF; pub type LPWSAOVERLAPPED = *mut c_void; pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = *mut c_void; +pub type BCRYPT_ALG_HANDLE = LPVOID; pub type PCONDITION_VARIABLE = *mut CONDITION_VARIABLE; pub type PLARGE_INTEGER = *mut c_longlong; @@ -278,6 +279,7 @@ pub const STATUS_INVALID_PARAMETER: NTSTATUS = 0xc000000d_u32 as _; pub const STATUS_PENDING: NTSTATUS = 0x103 as _; pub const STATUS_END_OF_FILE: NTSTATUS = 0xC0000011_u32 as _; pub const STATUS_NOT_IMPLEMENTED: NTSTATUS = 0xC0000002_u32 as _; +pub const STATUS_NOT_SUPPORTED: NTSTATUS = 0xC00000BB_u32 as _; // Equivalent to the `NT_SUCCESS` C preprocessor macro. // See: https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values @@ -285,7 +287,8 @@ pub fn nt_success(status: NTSTATUS) -> bool { status >= 0 } -pub const BCRYPT_RNG_ALG_HANDLE: usize = 0x81; +// "RNG\0" +pub const BCRYPT_RNG_ALGORITHM: &[u16] = &[b'R' as u16, b'N' as u16, b'G' as u16, 0]; #[repr(C)] pub struct UNICODE_STRING { @@ -1229,11 +1232,18 @@ extern "system" { // >= Vista / Server 2008 // https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom pub fn BCryptGenRandom( - hAlgorithm: LPVOID, + hAlgorithm: BCRYPT_ALG_HANDLE, pBuffer: *mut u8, cbBuffer: ULONG, dwFlags: ULONG, ) -> NTSTATUS; + pub fn BCryptOpenAlgorithmProvider( + phalgorithm: *mut BCRYPT_ALG_HANDLE, + pszAlgId: LPCWSTR, + pszimplementation: LPCWSTR, + dwflags: ULONG, + ) -> NTSTATUS; + pub fn BCryptCloseAlgorithmProvider(hAlgorithm: BCRYPT_ALG_HANDLE, dwFlags: ULONG) -> NTSTATUS; } // Functions that aren't available on every version of Windows that we support, diff --git a/library/std/src/sys/windows/rand.rs b/library/std/src/sys/windows/rand.rs index 8b9697884364c..3dfa8dba97744 100644 --- a/library/std/src/sys/windows/rand.rs +++ b/library/std/src/sys/windows/rand.rs @@ -22,7 +22,6 @@ //! [`RtlGenRandom`]: https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom //! [`BCryptGenRandom`]: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom //! [Pseudo-handle]: https://docs.microsoft.com/en-us/windows/win32/seccng/cng-algorithm-pseudo-handles -use crate::io; use crate::mem; use crate::ptr; use crate::sys::c; @@ -34,35 +33,82 @@ use crate::sys::c; /// [`HashMap`]: crate::collections::HashMap /// [`RandomState`]: crate::collections::hash_map::RandomState pub fn hashmap_random_keys() -> (u64, u64) { - let mut v = (0, 0); - let ret = unsafe { - let size = mem::size_of_val(&v).try_into().unwrap(); - c::BCryptGenRandom( - // BCRYPT_RNG_ALG_HANDLE is only supported in Windows 10+. - // So for Windows 8.1 and Windows 7 we'll need a fallback when this fails. - ptr::invalid_mut(c::BCRYPT_RNG_ALG_HANDLE), - ptr::addr_of_mut!(v).cast(), - size, - 0, - ) - }; - if ret != 0 { fallback_rng() } else { v } + Rng::open().and_then(|rng| rng.gen_random_keys()).unwrap_or_else(fallback_rng) +} + +struct Rng(c::BCRYPT_ALG_HANDLE); +impl Rng { + // Open a handle to the RNG algorithm. + fn open() -> Result { + use crate::sync::atomic::AtomicPtr; + use crate::sync::atomic::Ordering::{Acquire, Release}; + const ERROR_VALUE: c::LPVOID = ptr::invalid_mut(usize::MAX); + + // An atomic is used so we don't need to reopen the handle every time. + static HANDLE: AtomicPtr = AtomicPtr::new(ptr::null_mut()); + + let mut handle = HANDLE.load(Acquire); + // We use a sentinel value to designate an error occurred last time. + if handle == ERROR_VALUE { + Err(c::STATUS_NOT_SUPPORTED) + } else if handle.is_null() { + let status = unsafe { + c::BCryptOpenAlgorithmProvider( + &mut handle, + c::BCRYPT_RNG_ALGORITHM.as_ptr(), + ptr::null(), + 0, + ) + }; + if c::nt_success(status) { + // If another thread opens a handle first then use that handle instead. + let result = HANDLE.compare_exchange(ptr::null_mut(), handle, Release, Acquire); + if let Err(previous_handle) = result { + // Close our handle and return the previous one. + unsafe { c::BCryptCloseAlgorithmProvider(handle, 0) }; + handle = previous_handle; + } + Ok(Self(handle)) + } else { + HANDLE.store(ERROR_VALUE, Release); + Err(status) + } + } else { + Ok(Self(handle)) + } + } + + fn gen_random_keys(self) -> Result<(u64, u64), c::NTSTATUS> { + let mut v = (0, 0); + let status = unsafe { + let size = mem::size_of_val(&v).try_into().unwrap(); + c::BCryptGenRandom(self.0, ptr::addr_of_mut!(v).cast(), size, 0) + }; + if c::nt_success(status) { Ok(v) } else { Err(status) } + } } /// Generate random numbers using the fallback RNG function (RtlGenRandom) #[cfg(not(target_vendor = "uwp"))] #[inline(never)] -fn fallback_rng() -> (u64, u64) { +fn fallback_rng(rng_status: c::NTSTATUS) -> (u64, u64) { let mut v = (0, 0); let ret = unsafe { c::RtlGenRandom(&mut v as *mut _ as *mut u8, mem::size_of_val(&v) as c::ULONG) }; - if ret != 0 { v } else { panic!("fallback RNG broken: {}", io::Error::last_os_error()) } + if ret != 0 { + v + } else { + panic!( + "RNG broken: {rng_status:#x}, fallback RNG broken: {}", + crate::io::Error::last_os_error() + ) + } } /// We can't use RtlGenRandom with UWP, so there is no fallback #[cfg(target_vendor = "uwp")] #[inline(never)] -fn fallback_rng() -> (u64, u64) { - panic!("fallback RNG broken: RtlGenRandom() not supported on UWP"); +fn fallback_rng(rng_status: c::NTSTATUS) -> (u64, u64) { + panic!("RNG broken: {rng_status:#x} fallback RNG broken: RtlGenRandom() not supported on UWP"); } From 5d94d424859933da5beb76d0ad9818fd095b382b Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 4 Sep 2022 00:55:53 +0200 Subject: [PATCH 07/10] Shrink span for bindings with subpatterns. --- compiler/rustc_mir_build/src/build/mod.rs | 2 +- .../rustc_mir_build/src/thir/pattern/mod.rs | 7 ++- ....match_tuple.SimplifyCfg-initial.after.mir | 16 +++--- ...ove_out.move_out_by_subslice.mir_map.0.mir | 8 +-- ...atterns-slice-patterns-box-patterns.stderr | 30 ++++++------ .../borrowck/borrowck-describe-lvalue.stderr | 8 +-- .../borrowck-move-out-from-array-match.stderr | 6 +-- ...ove-out-from-array-no-overlap-match.stderr | 6 +-- ...rowck-move-out-from-array-use-match.stderr | 10 ++-- ...out-from-array-use-no-overlap-match.stderr | 6 +-- .../borrowck-move-out-from-array-use.stderr | 20 ++++---- .../borrowck-move-out-from-array.stderr | 16 +++--- ...ck-slice-pattern-element-loan-array.stderr | 8 +-- ...ck-slice-pattern-element-loan-slice.stderr | 8 +-- .../borrowck-vec-pattern-move-tail.stderr | 2 +- .../borrowck-vec-pattern-nesting.stderr | 2 +- .../ui/moves/move-out-of-array-ref.stderr | 4 +- src/test/ui/moves/move-out-of-slice-2.stderr | 8 +-- src/test/ui/nll/issue-51244.stderr | 2 +- ...can-live-while-the-other-survives-1.stderr | 10 ++-- ...nd-by-move-no-subbindings-fun-param.stderr | 5 +- .../borrowck-move-and-move.stderr | 34 ++++++------- .../borrowck-pat-at-and-box.stderr | 30 +++++------- ...orrowck-pat-by-move-and-ref-inverse.stderr | 40 ++++++--------- .../borrowck-pat-by-move-and-ref.stderr | 49 ++++++++----------- .../borrowck-pat-ref-mut-and-ref.stderr | 42 +++++++--------- .../borrowck-pat-ref-mut-twice.stderr | 32 +++++------- .../copy-and-move-mixed.stderr | 5 +- ...inding-modes-both-sides-independent.stderr | 2 +- .../nested-binding-modes-mut.stderr | 2 +- .../borrowck-move-ref-pattern.stderr | 6 +-- 31 files changed, 190 insertions(+), 236 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index 763038c52d7fa..7f992c18a18e4 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -1036,7 +1036,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { VarBindingForm { binding_mode, opt_ty_info, - opt_match_place: Some((Some(place), span)), + opt_match_place: Some((None, span)), pat_span: span, }, ))))) diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index d2f93b679acc5..7e09efe5972a3 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -202,6 +202,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { fn lower_pattern_unadjusted(&mut self, pat: &'tcx hir::Pat<'tcx>) -> Box> { let mut ty = self.typeck_results.node_type(pat.hir_id); + let mut span = pat.span; let kind = match pat.kind { hir::PatKind::Wild => PatKind::Wild, @@ -262,6 +263,10 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { } hir::PatKind::Binding(_, id, ident, ref sub) => { + if let Some(ident_span) = ident.span.find_ancestor_inside(span) { + span = span.with_hi(ident_span.hi()); + } + let bm = *self .typeck_results .pat_binding_modes() @@ -326,7 +331,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { hir::PatKind::Or(ref pats) => PatKind::Or { pats: self.lower_patterns(pats) }, }; - Box::new(Pat { span: pat.span, ty, kind }) + Box::new(Pat { span, ty, kind }) } fn lower_tuple_subpats( diff --git a/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir b/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir index d39145973624f..96716a39a2bfd 100644 --- a/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir @@ -8,13 +8,13 @@ fn match_tuple(_1: (u32, bool, Option, u32)) -> u32 { let mut _4: bool; // in scope 0 at $DIR/exponential-or.rs:+2:70: +2:77 let mut _5: bool; // in scope 0 at $DIR/exponential-or.rs:+2:62: +2:67 let mut _6: bool; // in scope 0 at $DIR/exponential-or.rs:+2:62: +2:67 - let _7: u32; // in scope 0 at $DIR/exponential-or.rs:+2:10: +2:21 - let _8: u32; // in scope 0 at $DIR/exponential-or.rs:+2:57: +2:78 + let _7: u32; // in scope 0 at $DIR/exponential-or.rs:+2:10: +2:11 + let _8: u32; // in scope 0 at $DIR/exponential-or.rs:+2:57: +2:58 let mut _9: u32; // in scope 0 at $DIR/exponential-or.rs:+2:83: +2:84 let mut _10: u32; // in scope 0 at $DIR/exponential-or.rs:+2:87: +2:88 scope 1 { - debug y => _7; // in scope 1 at $DIR/exponential-or.rs:+2:10: +2:21 - debug z => _8; // in scope 1 at $DIR/exponential-or.rs:+2:57: +2:78 + debug y => _7; // in scope 1 at $DIR/exponential-or.rs:+2:10: +2:11 + debug z => _8; // in scope 1 at $DIR/exponential-or.rs:+2:57: +2:58 } bb0: { @@ -61,10 +61,10 @@ fn match_tuple(_1: (u32, bool, Option, u32)) -> u32 { } bb9: { - StorageLive(_7); // scope 0 at $DIR/exponential-or.rs:+2:10: +2:21 - _7 = (_1.0: u32); // scope 0 at $DIR/exponential-or.rs:+2:10: +2:21 - StorageLive(_8); // scope 0 at $DIR/exponential-or.rs:+2:57: +2:78 - _8 = (_1.3: u32); // scope 0 at $DIR/exponential-or.rs:+2:57: +2:78 + StorageLive(_7); // scope 0 at $DIR/exponential-or.rs:+2:10: +2:11 + _7 = (_1.0: u32); // scope 0 at $DIR/exponential-or.rs:+2:10: +2:11 + StorageLive(_8); // scope 0 at $DIR/exponential-or.rs:+2:57: +2:58 + _8 = (_1.3: u32); // scope 0 at $DIR/exponential-or.rs:+2:57: +2:58 StorageLive(_9); // scope 1 at $DIR/exponential-or.rs:+2:83: +2:84 _9 = _7; // scope 1 at $DIR/exponential-or.rs:+2:83: +2:84 StorageLive(_10); // scope 1 at $DIR/exponential-or.rs:+2:87: +2:88 diff --git a/src/test/mir-opt/uniform_array_move_out.move_out_by_subslice.mir_map.0.mir b/src/test/mir-opt/uniform_array_move_out.move_out_by_subslice.mir_map.0.mir index 6e9a8b4d975fa..6a5021139cf61 100644 --- a/src/test/mir-opt/uniform_array_move_out.move_out_by_subslice.mir_map.0.mir +++ b/src/test/mir-opt/uniform_array_move_out.move_out_by_subslice.mir_map.0.mir @@ -15,9 +15,9 @@ fn move_out_by_subslice() -> () { let mut _11: std::boxed::Box; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 scope 1 { debug a => _1; // in scope 1 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 - let _12: [std::boxed::Box; 2]; // in scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:17 + let _12: [std::boxed::Box; 2]; // in scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12 scope 4 { - debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+2:10: +2:17 + debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+2:10: +2:12 } } scope 2 { @@ -77,8 +77,8 @@ fn move_out_by_subslice() -> () { bb6: { StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 - StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:17 - _12 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:17 + StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12 + _12 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12 _0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +3:2 drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 } diff --git a/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr b/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr index d4f81930843bf..1fd1eb128511b 100644 --- a/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr +++ b/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr @@ -23,7 +23,7 @@ LL | fn bindings_after_at_slice_patterns_move_binding(x: [String; 4]) { | - move occurs because `x` has type `[String; 4]`, which does not implement the `Copy` trait LL | match x { LL | a @ [.., _] => (), - | ----------- value moved here + | - value moved here ... LL | &x; | ^^ value borrowed here after move @@ -32,7 +32,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:28:5 | LL | ref mut foo @ [.., _] => Some(foo), - | --------------------- mutable borrow occurs here + | ----------- mutable borrow occurs here ... LL | &x; | ^^ immutable borrow occurs here @@ -44,7 +44,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:50:5 | LL | [ref foo @ .., ref bar] => Some(foo), - | ------------ immutable borrow occurs here + | ------- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -56,7 +56,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:62:5 | LL | ref foo @ [.., ref bar] => Some(foo), - | ----------------------- immutable borrow occurs here + | ------- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -71,7 +71,7 @@ LL | fn bindings_after_at_or_patterns_move(x: Option) { | - move occurs because `x` has type `Option`, which does not implement the `Copy` trait LL | match x { LL | foo @ Some(Test::Foo | Test::Bar) => (), - | --------------------------------- + | --- | | | value moved here | value moved here @@ -83,7 +83,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:86:5 | LL | ref foo @ Some(Test::Foo | Test::Bar) => Some(foo), - | ------------------------------------- immutable borrow occurs here + | ------- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -95,7 +95,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:98:5 | LL | ref mut foo @ Some(Test::Foo | Test::Bar) => Some(foo), - | ----------------------------------------- mutable borrow occurs here + | ----------- mutable borrow occurs here ... LL | &x; | ^^ immutable borrow occurs here @@ -107,7 +107,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:112:5 | LL | ref foo @ Some(box ref s) => Some(foo), - | ------------------------- immutable borrow occurs here + | ------- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -122,7 +122,7 @@ LL | fn bindings_after_at_slice_patterns_or_patterns_moves(x: [Option; 4]) | - move occurs because `x` has type `[Option; 4]`, which does not implement the `Copy` trait LL | match x { LL | a @ [.., Some(Test::Foo | Test::Bar)] => (), - | ------------------------------------- + | - | | | value moved here | value moved here @@ -134,7 +134,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:144:5 | LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(a), - | ------------------------------------------------- immutable borrow occurs here + | ----- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -146,7 +146,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:156:5 | LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(b), - | ---------- immutable borrow occurs here + | ----- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -158,7 +158,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:170:5 | LL | [_, ref a @ Some(box ref b), ..] => Some(a), - | ----------------------- immutable borrow occurs here + | ----- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -170,7 +170,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:186:5 | LL | [_, ref a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), - | ------------------------------------------- immutable borrow occurs here + | ----- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here @@ -182,7 +182,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:200:5 | LL | [_, ref mut a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), - | ----------------------------------------------- mutable borrow occurs here + | --------- mutable borrow occurs here ... LL | &x; | ^^ immutable borrow occurs here @@ -194,7 +194,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:214:5 | LL | ref a @ [_, ref b @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), - | ------------------------------------------------------------ immutable borrow occurs here + | ----- immutable borrow occurs here ... LL | &mut x; | ^^^^^^ mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.stderr index cfcc62de4383b..2c1b9c10d4660 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.stderr +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.stderr @@ -200,7 +200,7 @@ LL | let x = &mut v; | ------ borrow of `v` occurs here LL | match v { LL | &[x @ ..] => println!("{:?}", x), - | ^^^^^^ use of borrowed `v` + | ^ use of borrowed `v` ... LL | drop(x); | - borrow later used here @@ -212,7 +212,7 @@ LL | let x = &mut v; | ------ borrow of `v` occurs here ... LL | &[_, x @ ..] => println!("{:?}", x), - | ^^^^^^ use of borrowed `v` + | ^ use of borrowed `v` ... LL | drop(x); | - borrow later used here @@ -224,7 +224,7 @@ LL | let x = &mut v; | ------ borrow of `v` occurs here ... LL | &[x @ .., _] => println!("{:?}", x), - | ^^^^^^ use of borrowed `v` + | ^ use of borrowed `v` ... LL | drop(x); | - borrow later used here @@ -236,7 +236,7 @@ LL | let x = &mut v; | ------ borrow of `v` occurs here ... LL | &[_, x @ .., _] => println!("{:?}", x), - | ^^^^^^ use of borrowed `v` + | ^ use of borrowed `v` ... LL | drop(x); | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr index 3249aae8f44a3..346b82a266644 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-match.stderr @@ -79,7 +79,7 @@ error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array-match.rs:89:11 | LL | [_y @ .., _, _] => {} - | ------- value moved here + | -- value moved here ... LL | [(_x, _), _, _] => {} | ^^ value used here after move @@ -90,7 +90,7 @@ error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array-match.rs:99:15 | LL | [_, _, _y @ ..] => {} - | ------- value moved here + | -- value moved here ... LL | [.., (_x, _)] => {} | ^^ value used here after move @@ -101,7 +101,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-match.rs:110:11 | LL | [x @ .., _] => {} - | ------ value partially moved here + | - value partially moved here LL | } LL | match a { | ^ value used here after partial move diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr index c198002265b73..6c6a25c251e70 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-no-overlap-match.stderr @@ -68,7 +68,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:85:11 | LL | [_, _y @ ..] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move @@ -79,7 +79,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:96:11 | LL | [_y @ .., _] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move @@ -90,7 +90,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:109:11 | LL | [x @ .., _, _] => {} - | ------ value partially moved here + | - value partially moved here LL | } LL | match a { | ^ value used here after partial move diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr index 8f2da9d203b0d..77702e145df81 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-match.stderr @@ -79,7 +79,7 @@ error[E0382]: borrow of moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use-match.rs:89:11 | LL | [_y @ .., _, _] => {} - | ------- value moved here + | -- value moved here ... LL | [(ref _x, _), _, _] => {} | ^^^^^^ value borrowed here after move @@ -90,7 +90,7 @@ error[E0382]: borrow of moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use-match.rs:99:15 | LL | [_, _, _y @ ..] => {} - | ------- value moved here + | -- value moved here ... LL | [.., (ref _x, _)] => {} | ^^^^^^ value borrowed here after move @@ -101,7 +101,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:110:11 | LL | [x @ .., _] => {} - | ------ value partially moved here + | - value partially moved here LL | } LL | match a { | ^ value used here after partial move @@ -134,7 +134,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:139:5 | LL | [_, _, _x @ ..] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | a[0] = Default::default(); | ^^^^ value used here after partial move @@ -145,7 +145,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-match.rs:147:5 | LL | [_, _, _x @ ..] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | a[0].1 = Default::default(); | ^^^^ value used here after partial move diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr index 4b27f03dc4589..6cc2c2f7a984c 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use-no-overlap-match.stderr @@ -68,7 +68,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:85:11 | LL | [_, _y @ ..] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move @@ -79,7 +79,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:96:11 | LL | [_y @ .., _] => {} - | ------- value partially moved here + | -- value partially moved here LL | } LL | match a { | ^ value used here after partial move @@ -90,7 +90,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:109:11 | LL | [x @ .., _, _] => {} - | ------ value partially moved here + | - value partially moved here LL | } LL | match a { | ^ value used here after partial move diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr index b0bad6e997887..9add7553afa70 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array-use.stderr @@ -34,7 +34,7 @@ error[E0382]: borrow of partially moved value: `a` LL | let [_x, _, _] = a; | -- value partially moved here LL | let [ref _y @ .., _, _] = a; - | ^^^^^^^^^^^ value borrowed here after partial move + | ^^^^^^ value borrowed here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait @@ -44,7 +44,7 @@ error[E0382]: borrow of partially moved value: `a` LL | let [.., _x] = a; | -- value partially moved here LL | let [_, _, ref _y @ ..] = a; - | ^^^^^^^^^^^ value borrowed here after partial move + | ^^^^^^ value borrowed here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait @@ -54,7 +54,7 @@ error[E0382]: borrow of partially moved value: `a` LL | let [(_x, _), _, _] = a; | -- value partially moved here LL | let [ref _y @ .., _, _] = a; - | ^^^^^^^^^^^ value borrowed here after partial move + | ^^^^^^ value borrowed here after partial move | = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait @@ -64,7 +64,7 @@ error[E0382]: borrow of partially moved value: `a` LL | let [.., (_x, _)] = a; | -- value partially moved here LL | let [_, _, ref _y @ ..] = a; - | ^^^^^^^^^^^ value borrowed here after partial move + | ^^^^^^ value borrowed here after partial move | = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait @@ -72,7 +72,7 @@ error[E0382]: borrow of moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use.rs:54:11 | LL | let [_y @ .., _, _] = a; - | ------- value moved here + | -- value moved here LL | let [(ref _x, _), _, _] = a; | ^^^^^^ value borrowed here after move | @@ -82,7 +82,7 @@ error[E0382]: borrow of moved value: `a[..]` --> $DIR/borrowck-move-out-from-array-use.rs:60:15 | LL | let [_, _, _y @ ..] = a; - | ------- value moved here + | -- value moved here LL | let [.., (ref _x, _)] = a; | ^^^^^^ value borrowed here after move | @@ -92,9 +92,9 @@ error[E0382]: borrow of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:68:13 | LL | let [x @ .., _] = a; - | ------ value partially moved here + | - value partially moved here LL | let [_, ref _y @ ..] = a; - | ^^^^^^^^^^^ value borrowed here after partial move + | ^^^^^^ value borrowed here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait @@ -122,7 +122,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:88:5 | LL | let [_, _, _x @ ..] = a; - | ------- value partially moved here + | -- value partially moved here LL | a[0] = Default::default(); | ^^^^ value used here after partial move | @@ -132,7 +132,7 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array-use.rs:94:5 | LL | let [_, _, _x @ ..] = a; - | ------- value partially moved here + | -- value partially moved here LL | a[0].1 = Default::default(); | ^^^^ value used here after partial move | diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr index 1fc2b292b84c7..363effcfe5322 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array.stderr @@ -34,7 +34,7 @@ error[E0382]: use of partially moved value: `a` LL | let [_x, _, _] = a; | -- value partially moved here LL | let [_y @ .., _, _] = a; - | ^^^^^^^ value used here after partial move + | ^^ value used here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait @@ -44,7 +44,7 @@ error[E0382]: use of partially moved value: `a` LL | let [.., _x] = a; | -- value partially moved here LL | let [_, _, _y @ ..] = a; - | ^^^^^^^ value used here after partial move + | ^^ value used here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait @@ -54,7 +54,7 @@ error[E0382]: use of partially moved value: `a` LL | let [(_x, _), _, _] = a; | -- value partially moved here LL | let [_y @ .., _, _] = a; - | ^^^^^^^ value used here after partial move + | ^^ value used here after partial move | = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait @@ -64,7 +64,7 @@ error[E0382]: use of partially moved value: `a` LL | let [.., (_x, _)] = a; | -- value partially moved here LL | let [_, _, _y @ ..] = a; - | ^^^^^^^ value used here after partial move + | ^^ value used here after partial move | = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait @@ -72,7 +72,7 @@ error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array.rs:54:11 | LL | let [_y @ .., _, _] = a; - | ------- value moved here + | -- value moved here LL | let [(_x, _), _, _] = a; | ^^ value used here after move | @@ -82,7 +82,7 @@ error[E0382]: use of moved value: `a[..].0` --> $DIR/borrowck-move-out-from-array.rs:60:15 | LL | let [_, _, _y @ ..] = a; - | ------- value moved here + | -- value moved here LL | let [.., (_x, _)] = a; | ^^ value used here after move | @@ -92,9 +92,9 @@ error[E0382]: use of partially moved value: `a` --> $DIR/borrowck-move-out-from-array.rs:68:13 | LL | let [x @ .., _] = a; - | ------ value partially moved here + | - value partially moved here LL | let [_, _y @ ..] = a; - | ^^^^^^^ value used here after partial move + | ^^ value used here after partial move | = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr index b8ac7a3a4469d..f4324110ccb8e 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-array.stderr @@ -57,7 +57,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | let [ref first, ref second, ..] = *s; | ---------- immutable borrow occurs here LL | let [_, ref mut tail @ ..] = *s; - | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -67,7 +67,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | let [.., ref second, ref first] = *s; | ---------- immutable borrow occurs here LL | let [ref mut tail @ .., _] = *s; - | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -75,9 +75,9 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im --> $DIR/borrowck-slice-pattern-element-loan-array.rs:46:10 | LL | let [_, ref s1 @ ..] = *s; - | ----------- immutable borrow occurs here + | ------ immutable borrow occurs here LL | let [ref mut s2 @ .., _, _] = *s; - | ^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^ mutable borrow occurs here LL | nop_subslice(s1); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr index d3388e071aa53..f9a63bd49dd57 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan-slice.stderr @@ -88,7 +88,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [ref first, ref second, ..] = *s { | ---------- immutable borrow occurs here LL | if let [_, ref mut tail @ ..] = *s { - | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -98,7 +98,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [.., ref second, ref first] = *s { | ---------- immutable borrow occurs here LL | if let [ref mut tail @ .., _] = *s { - | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -106,9 +106,9 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:65:17 | LL | if let [_, _, _, ref s1 @ ..] = *s { - | ----------- immutable borrow occurs here + | ------ immutable borrow occurs here LL | if let [ref mut s2 @ .., _, _, _] = *s { - | ^^^^^^^^^^^^^^^ mutable borrow occurs here + | ^^^^^^^^^^ mutable borrow occurs here LL | nop_subslice(s1); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr index ff70ba9fcca8b..0ac7df944d781 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr @@ -2,7 +2,7 @@ error[E0506]: cannot assign to `a[_]` because it is borrowed --> $DIR/borrowck-vec-pattern-move-tail.rs:8:5 | LL | [1, 2, ref tail @ ..] => tail, - | ------------- borrow of `a[_]` occurs here + | -------- borrow of `a[_]` occurs here ... LL | a[2] = 0; | ^^^^^^^^ assignment to borrowed `a[_]` occurs here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr index ddd89afe5bf91..c3bcb7de65daa 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -14,7 +14,7 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed --> $DIR/borrowck-vec-pattern-nesting.rs:23:13 | LL | &mut [ref _b @ ..] => { - | ----------- borrow of `vec[_]` occurs here + | ------ borrow of `vec[_]` occurs here LL | LL | vec[0] = Box::new(4); | ^^^^^^ assignment to borrowed `vec[_]` occurs here diff --git a/src/test/ui/moves/move-out-of-array-ref.stderr b/src/test/ui/moves/move-out-of-array-ref.stderr index fd682e56ae1de..0caa0b83a4c7c 100644 --- a/src/test/ui/moves/move-out-of-array-ref.stderr +++ b/src/test/ui/moves/move-out-of-array-ref.stderr @@ -13,7 +13,7 @@ error[E0508]: cannot move out of type `[D; 4]`, a non-copy array --> $DIR/move-out-of-array-ref.rs:13:27 | LL | let [_, s @ .. , _] = *a; - | ------ ^^ + | - ^^ | | | | | cannot move out of here | | help: consider borrowing here: `&*a` @@ -35,7 +35,7 @@ error[E0508]: cannot move out of type `[D; 4]`, a non-copy array --> $DIR/move-out-of-array-ref.rs:23:27 | LL | let [_, s @ .. , _] = *a; - | ------ ^^ + | - ^^ | | | | | cannot move out of here | | help: consider borrowing here: `&*a` diff --git a/src/test/ui/moves/move-out-of-slice-2.stderr b/src/test/ui/moves/move-out-of-slice-2.stderr index 9a863bf31a7fb..93b0dcfc2d18a 100644 --- a/src/test/ui/moves/move-out-of-slice-2.stderr +++ b/src/test/ui/moves/move-out-of-slice-2.stderr @@ -14,7 +14,7 @@ LL | match *a { | ^^ cannot move out of here LL | LL | [a @ ..] => {} - | ------ + | - | | | data moved here | move occurs because `a` has type `[A]`, which does not implement the `Copy` trait @@ -26,7 +26,7 @@ LL | match *b { | ^^ cannot move out of here LL | LL | [_, _, b @ .., _] => {} - | ------ + | - | | | data moved here | move occurs because `b` has type `[A]`, which does not implement the `Copy` trait @@ -38,7 +38,7 @@ LL | match *c { | ^^ cannot move out of here LL | LL | [c @ ..] => {} - | ------ + | - | | | data moved here | move occurs because `c` has type `[C]`, which does not implement the `Copy` trait @@ -50,7 +50,7 @@ LL | match *d { | ^^ cannot move out of here LL | LL | [_, _, d @ .., _] => {} - | ------ + | - | | | data moved here | move occurs because `d` has type `[C]`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/issue-51244.stderr b/src/test/ui/nll/issue-51244.stderr index 19f0223a357a5..dcb6f9fec18b6 100644 --- a/src/test/ui/nll/issue-51244.stderr +++ b/src/test/ui/nll/issue-51244.stderr @@ -2,7 +2,7 @@ error[E0594]: cannot assign to `*my_ref`, which is behind a `&` reference --> $DIR/issue-51244.rs:3:5 | LL | let ref my_ref @ _ = 0; - | -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _` + | ---------- help: consider changing this to be a mutable reference: `ref mut my_ref` LL | *my_ref = 0; | ^^^^^^^^^^^ `my_ref` is a `&` reference, so the data it refers to cannot be written diff --git a/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr b/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr index 4249a74b3ed62..fad84dda0e192 100644 --- a/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr +++ b/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr @@ -40,9 +40,8 @@ error[E0382]: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:12:14 | LL | Some(ref _y @ _z) => {} - | ^^^^^^^^^-- - | | | - | | value moved here + | ^^^^^^ -- value moved here + | | | value borrowed here after move | = note: move occurs because value has type `X`, which does not implement the `Copy` trait @@ -55,9 +54,8 @@ error[E0382]: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:26:14 | LL | Some(ref mut _y @ _z) => {} - | ^^^^^^^^^^^^^-- - | | | - | | value moved here + | ^^^^^^^^^^ -- value moved here + | | | value borrowed here after move | = note: move occurs because value has type `X`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/bind-by-move-no-subbindings-fun-param.stderr b/src/test/ui/pattern/bindings-after-at/bind-by-move-no-subbindings-fun-param.stderr index ee0885a014aa4..a481ca4683382 100644 --- a/src/test/ui/pattern/bindings-after-at/bind-by-move-no-subbindings-fun-param.stderr +++ b/src/test/ui/pattern/bindings-after-at/bind-by-move-no-subbindings-fun-param.stderr @@ -2,9 +2,8 @@ error[E0382]: use of partially moved value --> $DIR/bind-by-move-no-subbindings-fun-param.rs:7:6 | LL | fn f(a @ A(u): A) -> Box { - | ^^^^^^-^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr index 8e00bf5c328be..83751843b1b81 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-move-and-move.stderr @@ -2,7 +2,7 @@ error[E0382]: use of moved value --> $DIR/borrowck-move-and-move.rs:11:9 | LL | let a @ b = U; - | ^^^^- - move occurs because value has type `U`, which does not implement the `Copy` trait + | ^ - - move occurs because value has type `U`, which does not implement the `Copy` trait | | | | | value moved here | value used here after move @@ -11,9 +11,8 @@ error[E0382]: use of partially moved value --> $DIR/borrowck-move-and-move.rs:13:9 | LL | let a @ (b, c) = (U, U); - | ^^^^^^^^-^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -22,9 +21,8 @@ error[E0382]: use of partially moved value --> $DIR/borrowck-move-and-move.rs:15:9 | LL | let a @ (b, c) = (u(), u()); - | ^^^^^^^^-^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -35,9 +33,8 @@ error[E0382]: use of moved value LL | match Ok(U) { | ----- move occurs because value has type `Result`, which does not implement the `Copy` trait LL | a @ Ok(b) | a @ Err(b) => {} - | -------^- - | | | - | | value used here after move + | - ^ value used here after move + | | | value moved here error[E0382]: use of moved value @@ -46,18 +43,16 @@ error[E0382]: use of moved value LL | match Ok(U) { | ----- move occurs because value has type `Result`, which does not implement the `Copy` trait LL | a @ Ok(b) | a @ Err(b) => {} - | --------^- - | | | - | | value used here after move + | - ^ value used here after move + | | | value moved here error[E0382]: use of partially moved value --> $DIR/borrowck-move-and-move.rs:25:9 | LL | xs @ [a, .., b] => {} - | ^^^^^^^^^^^^^-^ - | | | - | | value partially moved here + | ^^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -66,9 +61,8 @@ error[E0382]: use of partially moved value --> $DIR/borrowck-move-and-move.rs:29:9 | LL | xs @ [_, ys @ .., _] => {} - | ^^^^^^^^^-------^^^^ - | | | - | | value partially moved here + | ^^ -- value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -77,7 +71,7 @@ error[E0382]: use of moved value --> $DIR/borrowck-move-and-move.rs:22:12 | LL | fn fun(a @ b: U) {} - | ^^^^- + | ^---- | | | | | value moved here | value used here after move diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr index 4b2048855ebb4..002c7609f6109 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr @@ -74,9 +74,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-at-and-box.rs:31:9 | LL | let ref a @ box b = Box::new(NC); - | ^^^^^^^^^^^^- - | | | - | | value moved here + | ^^^^^ - value moved here + | | | value borrowed here after move | = note: move occurs because value has type `NC`, which does not implement the `Copy` trait @@ -85,9 +84,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-at-and-box.rs:38:9 | LL | let ref a @ box ref mut b = Box::new(NC); - | ^^^^^^^^^^^^--------- - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here ... LL | *b = NC; @@ -97,9 +95,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-at-and-box.rs:42:9 | LL | let ref a @ box ref mut b = Box::new(NC); - | ^^^^^^^^^^^^--------- - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here ... LL | *b = NC; @@ -109,9 +106,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-at-and-box.rs:48:9 | LL | let ref mut a @ box ref b = Box::new(NC); - | ^^^^^^^^^^^^^^^^----- - | | | - | | immutable borrow occurs here + | ^^^^^^^^^ ----- immutable borrow occurs here + | | | mutable borrow occurs here ... LL | drop(b); @@ -121,9 +117,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-at-and-box.rs:62:9 | LL | ref mut a @ box ref b => { - | ^^^^^^^^^^^^^^^^----- - | | | - | | immutable borrow occurs here + | ^^^^^^^^^ ----- immutable borrow occurs here + | | | mutable borrow occurs here ... LL | drop(b); @@ -133,9 +128,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-at-and-box.rs:54:11 | LL | fn f5(ref mut a @ box ref b: Box) { - | ^^^^^^^^^^^^^^^^----- - | | | - | | immutable borrow occurs here + | ^^^^^^^^^ ----- immutable borrow occurs here + | | | mutable borrow occurs here ... LL | drop(b); diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr index bc2c1625fd0ef..a9e66de084242 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr @@ -262,9 +262,8 @@ error[E0382]: use of partially moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:9 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); - | ^^^^^^^^^^^^^^^^^^^^^^^^---------^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -273,9 +272,8 @@ error[E0382]: use of partially moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:9 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); - | ^^^^^^^^^^^^^^^^^^^^^^^^---------^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -286,10 +284,7 @@ error[E0382]: use of moved value LL | match Some((U, U)) { | ------------ move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -----------------------------^^^^^^^^^-- - | | | - | | value used here after move - | value moved here + | - value moved here ^ value used here after move error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:55:30 @@ -297,9 +292,8 @@ error[E0382]: borrow of moved value LL | match Some([U, U]) { | ------------ move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait LL | mut a @ Some([ref b, ref mut c]) => {} - | ---------------------^^^^^^^^^-- - | | | - | | value borrowed here after move + | ----- ^^^^^^^^^ value borrowed here after move + | | | value moved here error[E0382]: borrow of moved value @@ -308,9 +302,8 @@ error[E0382]: borrow of moved value LL | match Some(u()) { | --------- move occurs because value has type `Option`, which does not implement the `Copy` trait LL | a @ Some(ref b) => {} - | ---------^^^^^- - | | | - | | value borrowed here after move + | - ^^^^^ value borrowed here after move + | | | value moved here error[E0382]: use of moved value @@ -319,10 +312,7 @@ error[E0382]: use of moved value LL | match Some((u(), u())) { | ---------------- move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} - | -----------------------------^^^^^^^^^-- - | | | - | | value used here after move - | value moved here + | - value moved here ^ value used here after move error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:75:30 @@ -330,18 +320,16 @@ error[E0382]: borrow of moved value LL | match Some([u(), u()]) { | ---------------- move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait LL | mut a @ Some([ref b, ref mut c]) => {} - | ---------------------^^^^^^^^^-- - | | | - | | value borrowed here after move + | ----- ^^^^^^^^^ value borrowed here after move + | | | value moved here error[E0382]: use of partially moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:11 | LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} - | ^^^^^^^^^^^^^^^^^^^^-------------^ - | | | - | | value partially moved here + | ^^^^^ ----- value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr index c019aae3dfc9c..e03a9298214e4 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr @@ -237,9 +237,8 @@ error[E0382]: borrow of partially moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:30:9 | LL | let ref mut a @ [b, mut c] = [U, U]; - | ^^^^^^^^^^^^^^^^-----^ - | | | - | | value partially moved here + | ^^^^^^^^^ ----- value partially moved here + | | | value borrowed here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -248,7 +247,7 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:33:9 | LL | let ref a @ b = u(); - | ^^^^^^^^- --- move occurs because value has type `U`, which does not implement the `Copy` trait + | ^^^^^ - --- move occurs because value has type `U`, which does not implement the `Copy` trait | | | | | value moved here | value borrowed here after move @@ -257,9 +256,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:36:18 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); - | ^^^^^^^^----- - | | | - | | value moved here + | ^^^^^ ----- value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -268,9 +266,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:36:33 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); - | ^^^^^^^^- - | | | - | | value moved here + | ^^^^^ - value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -279,9 +276,8 @@ error[E0382]: borrow of partially moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:42:9 | LL | let ref mut a @ [b, mut c] = [u(), u()]; - | ^^^^^^^^^^^^^^^^-----^ - | | | - | | value partially moved here + | ^^^^^^^^^ ----- value partially moved here + | | | value borrowed here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait @@ -290,9 +286,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:69:23 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | ^^^^^^^^----- - | | | - | | value moved here + | ^^^^^ ----- value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -305,9 +300,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:69:38 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} - | ^^^^^^^^- - | | | - | | value moved here + | ^^^^^ - value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -320,7 +314,7 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:11:11 | LL | fn f1(ref a @ b: U) {} - | ^^^^^^^^- + | ^^^^^---- | | | | | value moved here | value borrowed here after move @@ -330,9 +324,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:14:20 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} - | ^^^^^^^^----- - | | | - | | value moved here + | ^^^^^ ----- value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -341,9 +334,8 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:14:35 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} - | ^^^^^^^^- - | | | - | | value moved here + | ^^^^^ - value moved here + | | | value borrowed here after move | = note: move occurs because value has type `U`, which does not implement the `Copy` trait @@ -352,9 +344,8 @@ error[E0382]: borrow of partially moved value --> $DIR/borrowck-pat-by-move-and-ref.rs:20:11 | LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {} - | ^^^^^^^^^^^^^^^^-----^ - | | | - | | value partially moved here + | ^^^^^^^^^ ----- value partially moved here + | | | value borrowed here after partial move | = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr index 2ae78d1084e0e..9fd5e229afd0a 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr @@ -298,9 +298,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:31 | LL | ref mut z @ &mut Some(ref a) => { - | ----------------------^^^^^- - | | | - | | immutable borrow occurs here + | --------- ^^^^^ immutable borrow occurs here + | | | mutable borrow occurs here ... LL | **z = None; @@ -310,9 +309,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9 | LL | let ref mut a @ ref b = u(); - | ^^^^^^^^^^^^----- - | | | - | | immutable borrow occurs here + | ^^^^^^^^^ ----- immutable borrow occurs here + | | | mutable borrow occurs here ... LL | drop(b); @@ -322,9 +320,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9 | LL | let ref a @ ref mut b = u(); - | ^^^^^^^^--------- - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here ... LL | *b = u(); @@ -334,9 +331,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:20 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { - | -----------^^^^^^^^^- - | | | - | | mutable borrow occurs here + | ----- ^^^^^^^^^ mutable borrow occurs here + | | | immutable borrow occurs here ... LL | drop(a); @@ -346,9 +342,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:45 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { - | ------------^^^^^^^^^- - | | | - | | mutable borrow occurs here + | ----- ^^^^^^^^^ mutable borrow occurs here + | | | immutable borrow occurs here ... LL | drop(a); @@ -406,9 +401,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | ^^^^^^^^^---------^^^^^^^^^^^^ - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here ... LL | *b = U; @@ -418,9 +412,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | ^^^^^^^^^---------^^^^^^^^^^^^ - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here ... LL | *b = U; @@ -430,9 +423,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu --> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); - | ^^^^^^^^^---------^^^^^^^^^^^^ - | | | - | | mutable borrow occurs here + | ^^^^^ --------- mutable borrow occurs here + | | | immutable borrow occurs here LL | LL | *b = U; @@ -442,7 +434,7 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30 | LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {} - | --------^^^^^^^^^^^^- + | --------^^^^^^^^^---- | | | | | | | value moved here | | value borrowed here after move diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr index aa02230419b5e..e47aea9c77e6c 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr @@ -262,9 +262,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:29:9 | LL | let ref mut a @ ref mut b = U; - | ^^^^^^^^^^^^--------- - | | | - | | first mutable borrow occurs here + | ^^^^^^^^^ --------- first mutable borrow occurs here + | | | second mutable borrow occurs here ... LL | drop(b); @@ -274,9 +273,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:39:9 | LL | let ref mut a @ ref mut b = U; - | ^^^^^^^^^^^^--------- - | | | - | | first mutable borrow occurs here + | ^^^^^^^^^ --------- first mutable borrow occurs here + | | | second mutable borrow occurs here ... LL | *b = U; @@ -286,9 +284,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:89:24 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------------^^^^^^^^^- - | | | - | | second mutable borrow occurs here + | --------- ^^^^^^^^^ second mutable borrow occurs here + | | | first mutable borrow occurs here ... LL | *a = Err(U); @@ -298,9 +295,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:89:53 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ----------------^^^^^^^^^- - | | | - | | second mutable borrow occurs here + | --------- ^^^^^^^^^ second mutable borrow occurs here + | | | first mutable borrow occurs here ... LL | *a = Err(U); @@ -310,9 +306,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:101:24 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ---------------^^^^^^^^^- - | | | - | | second mutable borrow occurs here + | --------- ^^^^^^^^^ second mutable borrow occurs here + | | | first mutable borrow occurs here ... LL | drop(a); @@ -322,9 +317,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:101:53 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - | ----------------^^^^^^^^^- - | | | - | | second mutable borrow occurs here + | --------- ^^^^^^^^^ second mutable borrow occurs here + | | | first mutable borrow occurs here ... LL | drop(a); @@ -334,7 +328,7 @@ error[E0382]: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:21:34 | LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} - | ------------^^^^^^^^^^^^- + | ------------^^^^^^^^^---- | | | | | | | value moved here | | value borrowed here after move diff --git a/src/test/ui/pattern/bindings-after-at/copy-and-move-mixed.stderr b/src/test/ui/pattern/bindings-after-at/copy-and-move-mixed.stderr index d290144b6155a..cd3234952fa54 100644 --- a/src/test/ui/pattern/bindings-after-at/copy-and-move-mixed.stderr +++ b/src/test/ui/pattern/bindings-after-at/copy-and-move-mixed.stderr @@ -2,9 +2,8 @@ error[E0382]: use of partially moved value --> $DIR/copy-and-move-mixed.rs:12:9 | LL | let a @ NC(b, c @ NC(d, e)) = NC(C, NC(C, C)); - | ^^^^^^^^^^------------^ - | | | - | | value partially moved here + | ^ - value partially moved here + | | | value used here after partial move | = note: partial move occurs because value has type `NC`, which does not implement the `Copy` trait diff --git a/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr b/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr index d78faa682b507..840a513d6c67d 100644 --- a/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr +++ b/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr @@ -48,7 +48,7 @@ error[E0382]: borrow of moved value --> $DIR/default-binding-modes-both-sides-independent.rs:29:9 | LL | let ref mut a @ b = NotCopy; - | ^^^^^^^^^^^^- ------- move occurs because value has type `NotCopy`, which does not implement the `Copy` trait + | ^^^^^^^^^ - ------- move occurs because value has type `NotCopy`, which does not implement the `Copy` trait | | | | | value moved here | value borrowed here after move diff --git a/src/test/ui/pattern/bindings-after-at/nested-binding-modes-mut.stderr b/src/test/ui/pattern/bindings-after-at/nested-binding-modes-mut.stderr index 3180bd0afc104..70beb5d423223 100644 --- a/src/test/ui/pattern/bindings-after-at/nested-binding-modes-mut.stderr +++ b/src/test/ui/pattern/bindings-after-at/nested-binding-modes-mut.stderr @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `not_mut` as mutable, as it is not declared as mutab --> $DIR/nested-binding-modes-mut.rs:9:5 | LL | let not_mut @ mut is_mut = 42; - | -------------------- help: consider changing this to be mutable: `mut not_mut` + | ------- help: consider changing this to be mutable: `mut not_mut` LL | &mut is_mut; LL | &mut not_mut; | ^^^^^^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr b/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr index 5beca04d28590..bac2db6ce825c 100644 --- a/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr +++ b/src/test/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr @@ -35,7 +35,7 @@ error[E0502]: cannot borrow `arr[..]` as mutable because it is also borrowed as --> $DIR/borrowck-move-ref-pattern.rs:13:16 | LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; - | ---------------- immutable borrow occurs here + | ----------- immutable borrow occurs here ... LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; | ^^^^^^^^^^^ mutable borrow occurs here @@ -47,7 +47,7 @@ error[E0505]: cannot move out of `arr[..]` because it is borrowed --> $DIR/borrowck-move-ref-pattern.rs:13:29 | LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; - | ---------------- borrow of `arr[..]` occurs here + | ----------- borrow of `arr[..]` occurs here ... LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; | ^^^ move out of `arr[..]` occurs here @@ -59,7 +59,7 @@ error[E0505]: cannot move out of `arr[..]` because it is borrowed --> $DIR/borrowck-move-ref-pattern.rs:13:34 | LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; - | ---------------- borrow of `arr[..]` occurs here + | ----------- borrow of `arr[..]` occurs here ... LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; | ^^^^^^^ move out of `arr[..]` occurs here From 71b40b9dd3feddd7132073cba3de32da49402233 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 6 Sep 2022 14:29:46 -0700 Subject: [PATCH 08/10] rustdoc: remove unused CSS `#main-content > .since` I missed one from 096efc29f1be25daca6675f5f7684780ff294613. --- src/librustdoc/html/static/css/rustdoc.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 3502d97d470fe..fcb357e8d8eca 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -704,9 +704,6 @@ pre, .rustdoc.source .example-wrap { #main-content { position: relative; } -#main-content > .since { - top: inherit; -} .content table { border-spacing: 0 5px; From 4856affd90df68b0b56dee73c431e9d9cdfc977a Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 1 Sep 2022 20:43:12 -0500 Subject: [PATCH 09/10] Make `HandleCycleError` an enum instead of a macro-generated closure - Add a `HandleCycleError` enum to rustc_query_system, along with a `handle_cycle_error` function - Move `Value` to rustc_query_system, so `handle_cycle_error` can use it - Move the `Value` impls from rustc_query_impl to rustc_middle. This is necessary due to orphan rules. --- compiler/rustc_middle/src/lib.rs | 1 + .../src/values.rs | 33 ++++++---------- compiler/rustc_query_impl/src/lib.rs | 3 -- compiler/rustc_query_impl/src/plumbing.rs | 24 ++++++------ compiler/rustc_query_system/src/error.rs | 7 ++++ compiler/rustc_query_system/src/lib.rs | 4 ++ .../rustc_query_system/src/query/config.rs | 5 ++- .../rustc_query_system/src/query/plumbing.rs | 38 +++++++++++++++++-- compiler/rustc_query_system/src/values.rs | 14 +++++++ 9 files changed, 86 insertions(+), 43 deletions(-) rename compiler/{rustc_query_impl => rustc_middle}/src/values.rs (65%) create mode 100644 compiler/rustc_query_system/src/values.rs diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index be9e5865e541c..7edc9a16cc17f 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -95,6 +95,7 @@ pub mod mir; pub mod thir; pub mod traits; pub mod ty; +mod values; pub mod util { pub mod bug; diff --git a/compiler/rustc_query_impl/src/values.rs b/compiler/rustc_middle/src/values.rs similarity index 65% rename from compiler/rustc_query_impl/src/values.rs rename to compiler/rustc_middle/src/values.rs index 0ed48f8d4a051..7fbe9ae2a8418 100644 --- a/compiler/rustc_query_impl/src/values.rs +++ b/compiler/rustc_middle/src/values.rs @@ -1,39 +1,28 @@ -use super::QueryCtxt; -use rustc_middle::ty::{self, AdtSizedConstraint, Ty}; +use rustc_middle::ty::{self, AdtSizedConstraint, Ty, TyCtxt}; +use rustc_query_system::Value; -pub(super) trait Value<'tcx>: Sized { - fn from_cycle_error(tcx: QueryCtxt<'tcx>) -> Self; -} - -impl<'tcx, T> Value<'tcx> for T { - default fn from_cycle_error(tcx: QueryCtxt<'tcx>) -> T { - tcx.sess.abort_if_errors(); - bug!("Value::from_cycle_error called without errors"); - } -} - -impl<'tcx> Value<'tcx> for Ty<'_> { - fn from_cycle_error(tcx: QueryCtxt<'tcx>) -> Self { +impl<'tcx> Value> for Ty<'_> { + fn from_cycle_error(tcx: TyCtxt<'tcx>) -> Self { // SAFETY: This is never called when `Self` is not `Ty<'tcx>`. // FIXME: Represent the above fact in the trait system somehow. unsafe { std::mem::transmute::, Ty<'_>>(tcx.ty_error()) } } } -impl<'tcx> Value<'tcx> for ty::SymbolName<'_> { - fn from_cycle_error(tcx: QueryCtxt<'tcx>) -> Self { +impl<'tcx> Value> for ty::SymbolName<'_> { + fn from_cycle_error(tcx: TyCtxt<'tcx>) -> Self { // SAFETY: This is never called when `Self` is not `SymbolName<'tcx>`. // FIXME: Represent the above fact in the trait system somehow. unsafe { std::mem::transmute::, ty::SymbolName<'_>>(ty::SymbolName::new( - *tcx, "", + tcx, "", )) } } } -impl<'tcx> Value<'tcx> for AdtSizedConstraint<'_> { - fn from_cycle_error(tcx: QueryCtxt<'tcx>) -> Self { +impl<'tcx> Value> for AdtSizedConstraint<'_> { + fn from_cycle_error(tcx: TyCtxt<'tcx>) -> Self { // SAFETY: This is never called when `Self` is not `AdtSizedConstraint<'tcx>`. // FIXME: Represent the above fact in the trait system somehow. unsafe { @@ -44,8 +33,8 @@ impl<'tcx> Value<'tcx> for AdtSizedConstraint<'_> { } } -impl<'tcx> Value<'tcx> for ty::Binder<'_, ty::FnSig<'_>> { - fn from_cycle_error(tcx: QueryCtxt<'tcx>) -> Self { +impl<'tcx> Value> for ty::Binder<'_, ty::FnSig<'_>> { + fn from_cycle_error(tcx: TyCtxt<'tcx>) -> Self { let err = tcx.ty_error(); // FIXME(compiler-errors): It would be nice if we could get the // query key, so we could at least generate a fn signature that diff --git a/compiler/rustc_query_impl/src/lib.rs b/compiler/rustc_query_impl/src/lib.rs index 8ea09880694ea..26d397f70e0ce 100644 --- a/compiler/rustc_query_impl/src/lib.rs +++ b/compiler/rustc_query_impl/src/lib.rs @@ -34,9 +34,6 @@ pub use rustc_query_system::query::{deadlock, QueryContext}; mod keys; use keys::Key; -mod values; -use self::values::Value; - pub use rustc_query_system::query::QueryConfig; pub(crate) use rustc_query_system::query::{QueryDescription, QueryVTable}; diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 274df5b5e5e94..1e375deb20d1d 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -18,6 +18,7 @@ use rustc_query_system::query::{ force_query, QueryConfig, QueryContext, QueryDescription, QueryJobId, QueryMap, QuerySideEffects, QueryStackFrame, }; +use rustc_query_system::Value; use std::any::Any; use std::num::NonZeroU64; use thin_vec::ThinVec; @@ -174,21 +175,17 @@ impl<'tcx> QueryCtxt<'tcx> { } macro_rules! handle_cycle_error { - ([][$tcx: expr, $error:expr]) => {{ - $error.emit(); - Value::from_cycle_error($tcx) + ([]) => {{ + rustc_query_system::HandleCycleError::Error }}; - ([(fatal_cycle) $($rest:tt)*][$tcx:expr, $error:expr]) => {{ - $error.emit(); - $tcx.sess.abort_if_errors(); - unreachable!() + ([(fatal_cycle) $($rest:tt)*]) => {{ + rustc_query_system::HandleCycleError::Fatal }}; - ([(cycle_delay_bug) $($rest:tt)*][$tcx:expr, $error:expr]) => {{ - $error.delay_as_bug(); - Value::from_cycle_error($tcx) + ([(cycle_delay_bug) $($rest:tt)*]) => {{ + rustc_query_system::HandleCycleError::DelayBug }}; - ([$other:tt $($modifiers:tt)*][$($args:tt)*]) => { - handle_cycle_error!([$($modifiers)*][$($args)*]) + ([$other:tt $($modifiers:tt)*]) => { + handle_cycle_error!([$($modifiers)*]) }; } @@ -320,6 +317,7 @@ fn force_from_dep_node<'tcx, Q>(tcx: TyCtxt<'tcx>, dep_node: DepNode) -> bool where Q: QueryDescription>, Q::Key: DepNodeParams>, + Q::Value: Value>, { if let Some(key) = Q::Key::recover(tcx, &dep_node) { #[cfg(debug_assertions)] @@ -418,7 +416,7 @@ macro_rules! define_queries { depth_limit: depth_limit!([$($modifiers)*]), dep_kind: dep_graph::DepKind::$name, hash_result: hash_result!([$($modifiers)*]), - handle_cycle_error: |tcx, mut error| handle_cycle_error!([$($modifiers)*][tcx, error]), + handle_cycle_error: handle_cycle_error!([$($modifiers)*]), compute, cache_on_disk, try_load_from_disk: Self::TRY_LOAD_FROM_DISK, diff --git a/compiler/rustc_query_system/src/error.rs b/compiler/rustc_query_system/src/error.rs index 5f992ec9e21ea..3fb06cbedbd50 100644 --- a/compiler/rustc_query_system/src/error.rs +++ b/compiler/rustc_query_system/src/error.rs @@ -12,6 +12,13 @@ impl AddSubdiagnostic for CycleStack { } } +#[derive(Copy, Clone)] +pub enum HandleCycleError { + Error, + Fatal, + DelayBug, +} + #[derive(SessionSubdiagnostic)] pub enum StackCount { #[note(query_system::cycle_stack_single)] diff --git a/compiler/rustc_query_system/src/lib.rs b/compiler/rustc_query_system/src/lib.rs index 7067bc5f09cfc..8a88b5c334078 100644 --- a/compiler/rustc_query_system/src/lib.rs +++ b/compiler/rustc_query_system/src/lib.rs @@ -20,3 +20,7 @@ pub mod dep_graph; mod error; pub mod ich; pub mod query; +mod values; + +pub use error::HandleCycleError; +pub use values::Value; diff --git a/compiler/rustc_query_system/src/query/config.rs b/compiler/rustc_query_system/src/query/config.rs index ea38df836cbf1..c63e110a62e39 100644 --- a/compiler/rustc_query_system/src/query/config.rs +++ b/compiler/rustc_query_system/src/query/config.rs @@ -2,12 +2,12 @@ use crate::dep_graph::DepNode; use crate::dep_graph::SerializedDepNodeIndex; +use crate::error::HandleCycleError; use crate::ich::StableHashingContext; use crate::query::caches::QueryCache; use crate::query::{QueryContext, QueryState}; use rustc_data_structures::fingerprint::Fingerprint; -use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed}; use std::fmt::Debug; use std::hash::Hash; @@ -19,6 +19,7 @@ pub trait QueryConfig { type Stored: Clone; } +#[derive(Copy, Clone)] pub struct QueryVTable { pub anon: bool, pub dep_kind: CTX::DepKind, @@ -28,7 +29,7 @@ pub struct QueryVTable { pub compute: fn(CTX::DepContext, K) -> V, pub hash_result: Option, &V) -> Fingerprint>, - pub handle_cycle_error: fn(CTX, DiagnosticBuilder<'_, ErrorGuaranteed>) -> V, + pub handle_cycle_error: HandleCycleError, pub try_load_from_disk: Option Option>, } diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index 7bbc22e8293a5..e39e39860cbb8 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -7,6 +7,8 @@ use crate::query::caches::QueryCache; use crate::query::config::{QueryDescription, QueryVTable}; use crate::query::job::{report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo}; use crate::query::{QueryContext, QueryMap, QuerySideEffects, QueryStackFrame}; +use crate::values::Value; +use crate::HandleCycleError; use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; #[cfg(parallel_compiler)] @@ -118,19 +120,46 @@ where fn mk_cycle( tcx: CTX, error: CycleError, - handle_cycle_error: fn(CTX, DiagnosticBuilder<'_, ErrorGuaranteed>) -> V, + handler: HandleCycleError, cache: &dyn crate::query::QueryStorage, ) -> R where CTX: QueryContext, - V: std::fmt::Debug, + V: std::fmt::Debug + Value, R: Clone, { let error = report_cycle(tcx.dep_context().sess(), error); - let value = handle_cycle_error(tcx, error); + let value = handle_cycle_error(*tcx.dep_context(), error, handler); cache.store_nocache(value) } +fn handle_cycle_error( + tcx: CTX, + mut error: DiagnosticBuilder<'_, ErrorGuaranteed>, + handler: HandleCycleError, +) -> V +where + CTX: DepContext, + V: Value, +{ + use HandleCycleError::*; + match handler { + Error => { + error.emit(); + Value::from_cycle_error(tcx) + } + Fatal => { + error.emit(); + tcx.sess().abort_if_errors(); + unreachable!() + } + DelayBug => { + error.delay_as_bug(); + Value::from_cycle_error(tcx) + } + } +} + impl<'tcx, K> JobOwner<'tcx, K> where K: Eq + Hash + Clone, @@ -336,6 +365,7 @@ fn try_execute_query( where C: QueryCache, C::Key: Clone + DepNodeParams, + C::Value: Value, CTX: QueryContext, { match JobOwner::<'_, C::Key>::try_start(&tcx, state, span, key.clone()) { @@ -686,6 +716,7 @@ pub fn get_query(tcx: CTX, span: Span, key: Q::Key, mode: QueryMode) -> where Q: QueryDescription, Q::Key: DepNodeParams, + Q::Value: Value, CTX: QueryContext, { let query = Q::make_vtable(tcx, &key); @@ -718,6 +749,7 @@ pub fn force_query(tcx: CTX, key: Q::Key, dep_node: DepNode, Q::Key: DepNodeParams, + Q::Value: Value, CTX: QueryContext, { // We may be concurrently trying both execute and force a query. diff --git a/compiler/rustc_query_system/src/values.rs b/compiler/rustc_query_system/src/values.rs new file mode 100644 index 0000000000000..aeef66f86dacc --- /dev/null +++ b/compiler/rustc_query_system/src/values.rs @@ -0,0 +1,14 @@ +use crate::dep_graph::DepContext; + +pub trait Value: Sized { + fn from_cycle_error(tcx: CTX) -> Self; +} + +impl Value for T { + default fn from_cycle_error(tcx: CTX) -> T { + tcx.sess().abort_if_errors(); + // Ideally we would use `bug!` here. But bug! is only defined in rustc_middle, and it's + // non-trivial to define it earlier. + panic!("Value::from_cycle_error called without errors"); + } +} From 9cef1ee11376be184b374e9ce9f4724bb9367892 Mon Sep 17 00:00:00 2001 From: Ikko Ashimine Date: Wed, 7 Sep 2022 19:32:28 +0900 Subject: [PATCH 10/10] Fix typo in pass_manager.rs overriden -> overridden --- compiler/rustc_mir_transform/src/pass_manager.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_mir_transform/src/pass_manager.rs b/compiler/rustc_mir_transform/src/pass_manager.rs index 67ea5cfdb3c00..67dae71468f90 100644 --- a/compiler/rustc_mir_transform/src/pass_manager.rs +++ b/compiler/rustc_mir_transform/src/pass_manager.rs @@ -103,7 +103,7 @@ fn run_passes_inner<'tcx>( let name = pass.name(); // Gather information about what we should be doing for this pass - let overriden = + let overridden = overridden_passes.iter().rev().find(|(s, _)| s == &*name).map(|(_name, polarity)| { trace!( pass = %name, @@ -112,7 +112,7 @@ fn run_passes_inner<'tcx>( ); *polarity }); - let is_enabled = overriden.unwrap_or_else(|| pass.is_enabled(&tcx.sess)); + let is_enabled = overridden.unwrap_or_else(|| pass.is_enabled(&tcx.sess)); let new_phase = pass.phase_change(); let dump_enabled = (is_enabled && pass.is_mir_dump_enabled()) || new_phase.is_some(); let validate = (validate && is_enabled)