diff options
Diffstat (limited to 'src/test')
139 files changed, 1363 insertions, 812 deletions
diff --git a/src/test/incremental/const-generics/hash-tyvid-regression-1.rs b/src/test/incremental/const-generics/hash-tyvid-regression-1.rs index b5a0108a0a3..5ff7b19d894 100644 --- a/src/test/incremental/const-generics/hash-tyvid-regression-1.rs +++ b/src/test/incremental/const-generics/hash-tyvid-regression-1.rs @@ -9,7 +9,8 @@ where use std::convert::TryFrom; <[T; N.get()]>::try_from(()) //~^ error: the trait bound - //~^^ error: mismatched types + //~| error: the trait bound + //~| error: mismatched types } fn main() {} diff --git a/src/test/mir-opt/bool_compare.opt1.InstCombine.diff b/src/test/mir-opt/bool_compare.opt1.InstCombine.diff index a14f64467a6..8f57d307abf 100644 --- a/src/test/mir-opt/bool_compare.opt1.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt1.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Ne(move _3, const true); // scope 0 at $DIR/bool_compare.rs:3:8: 3:17 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:3:8: 3:17 StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:3:16: 3:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:3:5: 3:34 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:3:8: 3:17 } bb1: { diff --git a/src/test/mir-opt/bool_compare.opt2.InstCombine.diff b/src/test/mir-opt/bool_compare.opt2.InstCombine.diff index 4e9c255ad62..1f5738ae758 100644 --- a/src/test/mir-opt/bool_compare.opt2.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt2.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Ne(const true, move _3); // scope 0 at $DIR/bool_compare.rs:8:8: 8:17 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:8:8: 8:17 StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:8:16: 8:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:8:5: 8:34 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:8:8: 8:17 } bb1: { diff --git a/src/test/mir-opt/bool_compare.opt3.InstCombine.diff b/src/test/mir-opt/bool_compare.opt3.InstCombine.diff index 2048c97a9e1..3320509a7b3 100644 --- a/src/test/mir-opt/bool_compare.opt3.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt3.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Eq(move _3, const false); // scope 0 at $DIR/bool_compare.rs:13:8: 13:18 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:13:8: 13:18 StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:13:17: 13:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:13:5: 13:35 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:13:8: 13:18 } bb1: { diff --git a/src/test/mir-opt/bool_compare.opt4.InstCombine.diff b/src/test/mir-opt/bool_compare.opt4.InstCombine.diff index efcaa2766a9..02049f4126d 100644 --- a/src/test/mir-opt/bool_compare.opt4.InstCombine.diff +++ b/src/test/mir-opt/bool_compare.opt4.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Eq(const false, move _3); // scope 0 at $DIR/bool_compare.rs:18:8: 18:18 + _2 = Not(move _3); // scope 0 at $DIR/bool_compare.rs:18:8: 18:18 StorageDead(_3); // scope 0 at $DIR/bool_compare.rs:18:17: 18:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:18:5: 18:35 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/bool_compare.rs:18:8: 18:18 } bb1: { diff --git a/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff b/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff index 0f64f7c09ab..544d16a251a 100644 --- a/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff +++ b/src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff @@ -29,7 +29,7 @@ - } - - bb3: { -- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto.rs:12:5: 12:57 +- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - } - - bb4: { diff --git a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff index 1b7c51b3954..1eb40e50d7a 100644 --- a/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff +++ b/src/test/mir-opt/const_prop/control_flow_simplification.hello.ConstProp.diff @@ -9,9 +9,9 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 - _1 = const <bool as NeedsDrop>::NEEDS; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 -- switchInt(move _1) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:12:5: 14:6 +- switchInt(move _1) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 + _1 = const false; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 -+ switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:12:5: 14:6 ++ switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21 } bb1: { diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff index bbfeb4dc392..de23e5446a0 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.32bit.diff @@ -18,22 +18,22 @@ ((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -- switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - _2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:11:59: 11:61 - goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { - switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } bb3: { - _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + _2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:11:59: 11:61 goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } diff --git a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff index bbfeb4dc392..de23e5446a0 100644 --- a/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff +++ b/src/test/mir-opt/const_prop/discriminant.main.ConstProp.64bit.diff @@ -18,22 +18,22 @@ ((_3 as Some).0: bool) = const true; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 discriminant(_3) = 1; // scope 0 at $DIR/discriminant.rs:11:34: 11:44 - _4 = discriminant(_3); // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -- switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + _4 = const 1_isize; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 -+ switchInt(const 1_isize) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 ++ switchInt(const 1_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 } bb1: { - _2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:11:59: 11:61 - goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 + switchInt(((_3 as Some).0: bool)) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 } bb2: { - switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // scope 0 at $DIR/discriminant.rs:11:21: 11:31 + _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } bb3: { - _2 = const 42_i32; // scope 0 at $DIR/discriminant.rs:11:47: 11:49 + _2 = const 10_i32; // scope 0 at $DIR/discriminant.rs:11:59: 11:61 goto -> bb4; // scope 0 at $DIR/discriminant.rs:11:13: 11:64 } diff --git a/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff b/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff index 6d2dbb820f9..629bed8fec5 100644 --- a/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff +++ b/src/test/mir-opt/deaggregator_test_enum_2.test1.Deaggregator.diff @@ -12,7 +12,7 @@ bb0: { StorageLive(_3); // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 _3 = _1; // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 - switchInt(move _3) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6 + switchInt(move _3) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9 } bb1: { diff --git a/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff b/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff index 500d6d20db8..02821a1079e 100644 --- a/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff +++ b/src/test/mir-opt/dest-prop/branch.main.DestinationPropagation.diff @@ -36,7 +36,7 @@ } bb2: { - switchInt(move _3) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:15:13: 20:6 + switchInt(move _3) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/branch.rs:15:16: 15:22 } bb3: { diff --git a/src/test/mir-opt/equal_true.opt.InstCombine.diff b/src/test/mir-opt/equal_true.opt.InstCombine.diff index 1bc4c0f8b37..174095888b4 100644 --- a/src/test/mir-opt/equal_true.opt.InstCombine.diff +++ b/src/test/mir-opt/equal_true.opt.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Eq(move _3, const true); // scope 0 at $DIR/equal_true.rs:4:8: 4:17 + _2 = move _3; // scope 0 at $DIR/equal_true.rs:4:8: 4:17 StorageDead(_3); // scope 0 at $DIR/equal_true.rs:4:16: 4:17 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:4:5: 4:34 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/equal_true.rs:4:8: 4:17 } bb1: { diff --git a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff index 44167ac0c48..fd29e14a041 100644 --- a/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff +++ b/src/test/mir-opt/funky_arms.float_to_exponential_common.ConstProp.diff @@ -73,25 +73,10 @@ bb5: { StorageDead(_8); // scope 2 at $DIR/funky_arms.rs:24:44: 24:45 _9 = discriminant(_7); // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 - switchInt(move _9) -> [1_isize: bb7, otherwise: bb6]; // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 + switchInt(move _9) -> [1_isize: bb6, otherwise: bb8]; // scope 2 at $DIR/funky_arms.rs:24:12: 24:27 } bb6: { - StorageLive(_18); // scope 2 at $DIR/funky_arms.rs:28:46: 28:49 - _18 = &mut (*_1); // scope 2 at $DIR/funky_arms.rs:28:46: 28:49 - StorageLive(_19); // scope 2 at $DIR/funky_arms.rs:28:51: 28:54 - _19 = _2; // scope 2 at $DIR/funky_arms.rs:28:51: 28:54 - StorageLive(_20); // scope 2 at $DIR/funky_arms.rs:28:56: 28:60 - _20 = _6; // scope 2 at $DIR/funky_arms.rs:28:56: 28:60 - StorageLive(_21); // scope 2 at $DIR/funky_arms.rs:28:62: 28:67 - _21 = _3; // scope 2 at $DIR/funky_arms.rs:28:62: 28:67 - _0 = float_to_exponential_common_shortest::<T>(move _18, move _19, move _20, move _21) -> bb9; // scope 2 at $DIR/funky_arms.rs:28:9: 28:68 - // mir::Constant - // + span: $DIR/funky_arms.rs:28:9: 28:45 - // + literal: Const { ty: for<'r, 's, 't0> fn(&'r mut std::fmt::Formatter<'s>, &'t0 T, core::num::flt2dec::Sign, bool) -> std::result::Result<(), std::fmt::Error> {float_to_exponential_common_shortest::<T>}, val: Value(Scalar(<ZST>)) } - } - - bb7: { StorageLive(_10); // scope 2 at $DIR/funky_arms.rs:24:17: 24:26 _10 = ((_7 as Some).0: usize); // scope 2 at $DIR/funky_arms.rs:24:17: 24:26 StorageLive(_11); // scope 2 at $DIR/funky_arms.rs:26:43: 26:46 @@ -110,21 +95,37 @@ StorageDead(_15); // scope 2 at $DIR/funky_arms.rs:26:78: 26:79 StorageLive(_17); // scope 2 at $DIR/funky_arms.rs:26:81: 26:86 _17 = _3; // scope 2 at $DIR/funky_arms.rs:26:81: 26:86 - _0 = float_to_exponential_common_exact::<T>(move _11, move _12, move _13, move _14, move _17) -> bb8; // scope 2 at $DIR/funky_arms.rs:26:9: 26:87 + _0 = float_to_exponential_common_exact::<T>(move _11, move _12, move _13, move _14, move _17) -> bb7; // scope 2 at $DIR/funky_arms.rs:26:9: 26:87 // mir::Constant // + span: $DIR/funky_arms.rs:26:9: 26:42 // + literal: Const { ty: for<'r, 's, 't0> fn(&'r mut std::fmt::Formatter<'s>, &'t0 T, core::num::flt2dec::Sign, u32, bool) -> std::result::Result<(), std::fmt::Error> {float_to_exponential_common_exact::<T>}, val: Value(Scalar(<ZST>)) } } - bb8: { + bb7: { StorageDead(_17); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 StorageDead(_14); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 StorageDead(_13); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 StorageDead(_12); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 StorageDead(_11); // scope 2 at $DIR/funky_arms.rs:26:86: 26:87 + StorageDead(_10); // scope 2 at $DIR/funky_arms.rs:27:5: 27:6 goto -> bb10; // scope 2 at $DIR/funky_arms.rs:24:5: 29:6 } + bb8: { + StorageLive(_18); // scope 2 at $DIR/funky_arms.rs:28:46: 28:49 + _18 = &mut (*_1); // scope 2 at $DIR/funky_arms.rs:28:46: 28:49 + StorageLive(_19); // scope 2 at $DIR/funky_arms.rs:28:51: 28:54 + _19 = _2; // scope 2 at $DIR/funky_arms.rs:28:51: 28:54 + StorageLive(_20); // scope 2 at $DIR/funky_arms.rs:28:56: 28:60 + _20 = _6; // scope 2 at $DIR/funky_arms.rs:28:56: 28:60 + StorageLive(_21); // scope 2 at $DIR/funky_arms.rs:28:62: 28:67 + _21 = _3; // scope 2 at $DIR/funky_arms.rs:28:62: 28:67 + _0 = float_to_exponential_common_shortest::<T>(move _18, move _19, move _20, move _21) -> bb9; // scope 2 at $DIR/funky_arms.rs:28:9: 28:68 + // mir::Constant + // + span: $DIR/funky_arms.rs:28:9: 28:45 + // + literal: Const { ty: for<'r, 's, 't0> fn(&'r mut std::fmt::Formatter<'s>, &'t0 T, core::num::flt2dec::Sign, bool) -> std::result::Result<(), std::fmt::Error> {float_to_exponential_common_shortest::<T>}, val: Value(Scalar(<ZST>)) } + } + bb9: { StorageDead(_21); // scope 2 at $DIR/funky_arms.rs:28:67: 28:68 StorageDead(_20); // scope 2 at $DIR/funky_arms.rs:28:67: 28:68 @@ -134,7 +135,6 @@ } bb10: { - StorageDead(_10); // scope 2 at $DIR/funky_arms.rs:29:5: 29:6 StorageDead(_6); // scope 1 at $DIR/funky_arms.rs:30:1: 30:2 StorageDead(_4); // scope 0 at $DIR/funky_arms.rs:30:1: 30:2 StorageDead(_7); // scope 0 at $DIR/funky_arms.rs:30:1: 30:2 diff --git a/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff index 875e5a0a71f..dddb7acae2b 100644 --- a/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.dont_opt_bool.SimplifyComparisonIntegral.diff @@ -9,7 +9,7 @@ bb0: { StorageLive(_2); // scope 0 at $DIR/if-condition-int.rs:17:8: 17:9 _2 = _1; // scope 0 at $DIR/if-condition-int.rs:17:8: 17:9 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:17:5: 17:26 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:17:8: 17:9 } bb1: { diff --git a/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff index 64a3f52f3a0..2ff8386b205 100644 --- a/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.dont_opt_floats.SimplifyComparisonIntegral.diff @@ -13,7 +13,7 @@ _3 = _1; // scope 0 at $DIR/if-condition-int.rs:53:8: 53:9 _2 = Eq(move _3, const -42f32); // scope 0 at $DIR/if-condition-int.rs:53:8: 53:18 StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:53:17: 53:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:53:5: 53:35 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:53:8: 53:18 } bb1: { diff --git a/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff index 661591658df..40de48385f0 100644 --- a/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_char.SimplifyComparisonIntegral.diff @@ -13,20 +13,20 @@ _3 = _1; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:9 - _2 = Eq(move _3, const 'x'); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 - StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:21:15: 21:16 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:21:5: 21:33 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 + nop; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 + nop; // scope 0 at $DIR/if-condition-int.rs:21:15: 21:16 -+ switchInt(move _3) -> ['x': bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:21:5: 21:33 ++ switchInt(move _3) -> ['x': bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:21:5: 21:33 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:21:19: 21:20 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:21:5: 21:33 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:21:5: 21:33 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:21:8: 21:16 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:21:30: 21:31 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:21:5: 21:33 } diff --git a/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff index 7d0ed7338d7..28c36aed84c 100644 --- a/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_i8.SimplifyComparisonIntegral.diff @@ -13,20 +13,20 @@ _3 = _1; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:9 - _2 = Eq(move _3, const 42_i8); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 - StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:25:14: 25:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:25:5: 25:32 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 + nop; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 + nop; // scope 0 at $DIR/if-condition-int.rs:25:14: 25:15 -+ switchInt(move _3) -> [42_i8: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:25:5: 25:32 ++ switchInt(move _3) -> [42_i8: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:25:5: 25:32 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:25:18: 25:19 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:25:5: 25:32 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:25:5: 25:32 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:25:8: 25:15 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:25:29: 25:30 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:25:5: 25:32 } diff --git a/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff index bf388a141b6..55932fee960 100644 --- a/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_multiple_ifs.SimplifyComparisonIntegral.diff @@ -15,39 +15,39 @@ _3 = _1; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:9 - _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 - StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:33:14: 33:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:33:5: 39:6 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 + nop; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 + nop; // scope 0 at $DIR/if-condition-int.rs:33:14: 33:15 -+ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:33:5: 39:6 ++ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:33:5: 39:6 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:34:9: 34:10 goto -> bb6; // scope 0 at $DIR/if-condition-int.rs:33:5: 39:6 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:33:5: 39:6 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:33:8: 33:15 StorageLive(_4); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 StorageLive(_5); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:16 _5 = _1; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:16 - _4 = Ne(move _5, const 21_u32); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 - StorageDead(_5); // scope 0 at $DIR/if-condition-int.rs:35:21: 35:22 -- switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/if-condition-int.rs:35:12: 39:6 +- switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 + nop; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 + nop; // scope 0 at $DIR/if-condition-int.rs:35:21: 35:22 -+ switchInt(move _5) -> [21_u32: bb4, otherwise: bb3]; // scope 0 at $DIR/if-condition-int.rs:35:12: 39:6 ++ switchInt(move _5) -> [21_u32: bb4, otherwise: bb3]; // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 } bb3: { -+ StorageDead(_5); // scope 0 at $DIR/if-condition-int.rs:35:12: 39:6 ++ StorageDead(_5); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:36:9: 36:10 goto -> bb5; // scope 0 at $DIR/if-condition-int.rs:35:12: 39:6 } bb4: { -+ StorageDead(_5); // scope 0 at $DIR/if-condition-int.rs:35:12: 39:6 ++ StorageDead(_5); // scope 0 at $DIR/if-condition-int.rs:35:15: 35:22 _0 = const 2_u32; // scope 0 at $DIR/if-condition-int.rs:38:9: 38:10 goto -> bb5; // scope 0 at $DIR/if-condition-int.rs:35:12: 39:6 } diff --git a/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff index bee2e030b7e..c4574b32a59 100644 --- a/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_negative.SimplifyComparisonIntegral.diff @@ -13,20 +13,20 @@ _3 = _1; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:9 - _2 = Eq(move _3, const -42_i32); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 - StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:29:15: 29:16 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:29:5: 29:33 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 + nop; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 + nop; // scope 0 at $DIR/if-condition-int.rs:29:15: 29:16 -+ switchInt(move _3) -> [-42_i32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:29:5: 29:33 ++ switchInt(move _3) -> [-42_i32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:29:5: 29:33 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:29:19: 29:20 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:29:5: 29:33 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:29:5: 29:33 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:29:8: 29:16 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:29:30: 29:31 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:29:5: 29:33 } diff --git a/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff b/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff index 09a87591be1..88d9d5622b8 100644 --- a/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff +++ b/src/test/mir-opt/if_condition_int.opt_u32.SimplifyComparisonIntegral.diff @@ -13,20 +13,20 @@ _3 = _1; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:9 - _2 = Eq(move _3, const 42_u32); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 - StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:12:14: 12:15 -- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:12:5: 12:32 +- switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 + nop; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 + nop; // scope 0 at $DIR/if-condition-int.rs:12:14: 12:15 -+ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:12:5: 12:32 ++ switchInt(move _3) -> [42_u32: bb1, otherwise: bb2]; // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 } bb1: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:12:5: 12:32 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 _0 = const 0_u32; // scope 0 at $DIR/if-condition-int.rs:12:18: 12:19 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:12:5: 12:32 } bb2: { -+ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:12:5: 12:32 ++ StorageDead(_3); // scope 0 at $DIR/if-condition-int.rs:12:8: 12:15 _0 = const 1_u32; // scope 0 at $DIR/if-condition-int.rs:12:29: 12:30 goto -> bb3; // scope 0 at $DIR/if-condition-int.rs:12:5: 12:32 } diff --git a/src/test/mir-opt/inline/inline_diverging.g.Inline.diff b/src/test/mir-opt/inline/inline_diverging.g.Inline.diff index 97ffd664463..ce30b050d67 100644 --- a/src/test/mir-opt/inline/inline_diverging.g.Inline.diff +++ b/src/test/mir-opt/inline/inline_diverging.g.Inline.diff @@ -19,7 +19,7 @@ _3 = _1; // scope 0 at $DIR/inline-diverging.rs:13:8: 13:9 _2 = Gt(move _3, const 0_i32); // scope 0 at $DIR/inline-diverging.rs:13:8: 13:13 StorageDead(_3); // scope 0 at $DIR/inline-diverging.rs:13:12: 13:13 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/inline-diverging.rs:13:5: 17:6 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/inline-diverging.rs:13:8: 13:13 } bb1: { diff --git a/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff b/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff index 226db9558ef..3539fc8b487 100644 --- a/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff +++ b/src/test/mir-opt/instrument_coverage.main.InstrumentCoverage.diff @@ -21,7 +21,7 @@ } bb2: { - switchInt(move _2) -> [false: bb4, otherwise: bb3]; // scope 0 at /the/src/instrument_coverage.rs:12:9: 14:10 + switchInt(move _2) -> [false: bb4, otherwise: bb3]; // scope 0 at /the/src/instrument_coverage.rs:12:12: 12:17 } bb3: { diff --git a/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir b/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir index 8355b2d195e..a2471e4308b 100644 --- a/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/issue_38669.main.SimplifyCfg-initial.after.mir @@ -26,7 +26,7 @@ fn main() -> () { StorageLive(_3); // scope 1 at $DIR/issue-38669.rs:7:9: 9:10 StorageLive(_4); // scope 1 at $DIR/issue-38669.rs:7:12: 7:24 _4 = _1; // scope 1 at $DIR/issue-38669.rs:7:12: 7:24 - switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/issue-38669.rs:7:9: 9:10 + switchInt(move _4) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/issue-38669.rs:7:12: 7:24 } bb3: { diff --git a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir index 0417ed8c88b..54930937c91 100644 --- a/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir +++ b/src/test/mir-opt/issue_41888.main.ElaborateDrops.after.mir @@ -26,14 +26,14 @@ fn main() -> () { _8 = const false; // scope 0 at $DIR/issue-41888.rs:7:9: 7:10 StorageLive(_1); // scope 0 at $DIR/issue-41888.rs:7:9: 7:10 StorageLive(_2); // scope 1 at $DIR/issue-41888.rs:8:8: 8:14 - _2 = cond() -> [return: bb1, unwind: bb12]; // scope 1 at $DIR/issue-41888.rs:8:8: 8:14 + _2 = cond() -> [return: bb1, unwind: bb11]; // scope 1 at $DIR/issue-41888.rs:8:8: 8:14 // mir::Constant // + span: $DIR/issue-41888.rs:8:8: 8:12 // + literal: Const { ty: fn() -> bool {cond}, val: Value(Scalar(<ZST>)) } } bb1: { - switchInt(move _2) -> [false: bb3, otherwise: bb2]; // scope 1 at $DIR/issue-41888.rs:8:5: 14:6 + switchInt(move _2) -> [false: bb7, otherwise: bb2]; // scope 1 at $DIR/issue-41888.rs:8:8: 8:14 } bb2: { @@ -42,22 +42,26 @@ fn main() -> () { _4 = K; // scope 1 at $DIR/issue-41888.rs:9:18: 9:19 _3 = E::F(move _4); // scope 1 at $DIR/issue-41888.rs:9:13: 9:20 StorageDead(_4); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 - goto -> bb15; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + goto -> bb14; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 } bb3: { - _0 = const (); // scope 1 at $DIR/issue-41888.rs:14:6: 14:6 - goto -> bb9; // scope 1 at $DIR/issue-41888.rs:8:5: 14:6 + goto -> bb4; // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 } bb4: { - goto -> bb5; // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 + StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 + _5 = discriminant(_1); // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 + switchInt(move _5) -> [0_isize: bb5, otherwise: bb6]; // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 } bb5: { - StorageDead(_3); // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 - _5 = discriminant(_1); // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 - switchInt(move _5) -> [0_isize: bb7, otherwise: bb6]; // scope 1 at $DIR/issue-41888.rs:10:16: 10:24 + StorageLive(_6); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 + _9 = const false; // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 + _6 = move ((_1 as F).0: K); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 + _0 = const (); // scope 1 at $DIR/issue-41888.rs:10:29: 13:10 + StorageDead(_6); // scope 1 at $DIR/issue-41888.rs:13:9: 13:10 + goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 } bb6: { @@ -66,24 +70,16 @@ fn main() -> () { } bb7: { - StorageLive(_6); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _9 = const false; // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _6 = move ((_1 as F).0: K); // scope 1 at $DIR/issue-41888.rs:10:21: 10:23 - _0 = const (); // scope 1 at $DIR/issue-41888.rs:10:29: 13:10 - goto -> bb8; // scope 1 at $DIR/issue-41888.rs:10:9: 13:10 + _0 = const (); // scope 1 at $DIR/issue-41888.rs:14:6: 14:6 + goto -> bb8; // scope 1 at $DIR/issue-41888.rs:8:5: 14:6 } bb8: { - StorageDead(_6); // scope 1 at $DIR/issue-41888.rs:13:9: 13:10 - goto -> bb9; // scope 1 at $DIR/issue-41888.rs:8:5: 14:6 - } - - bb9: { StorageDead(_2); // scope 1 at $DIR/issue-41888.rs:14:5: 14:6 - goto -> bb21; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 + goto -> bb20; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 } - bb10: { + bb9: { _7 = const false; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 _8 = const false; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 _9 = const false; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 @@ -91,66 +87,66 @@ fn main() -> () { return; // scope 0 at $DIR/issue-41888.rs:15:2: 15:2 } - bb11 (cleanup): { - goto -> bb12; // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 + bb10 (cleanup): { + goto -> bb11; // scope 1 at $DIR/issue-41888.rs:9:19: 9:20 } - bb12 (cleanup): { - goto -> bb13; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 + bb11 (cleanup): { + goto -> bb12; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 } - bb13 (cleanup): { + bb12 (cleanup): { resume; // scope 0 at $DIR/issue-41888.rs:6:1: 15:2 } - bb14 (cleanup): { + bb13 (cleanup): { _7 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 _8 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 _9 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 _1 = move _3; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 - goto -> bb11; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + goto -> bb10; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 } - bb15: { + bb14: { _7 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 _8 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 _9 = const true; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 _1 = move _3; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 - goto -> bb4; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 + goto -> bb3; // scope 1 at $DIR/issue-41888.rs:9:9: 9:10 } - bb16: { + bb15: { _7 = const false; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 - goto -> bb10; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 + goto -> bb9; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 } - bb17 (cleanup): { - goto -> bb13; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 + bb16 (cleanup): { + goto -> bb12; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 } - bb18: { - drop(_1) -> [return: bb16, unwind: bb13]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 + bb17: { + drop(_1) -> [return: bb15, unwind: bb12]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 } - bb19 (cleanup): { - drop(_1) -> bb13; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 + bb18 (cleanup): { + drop(_1) -> bb12; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 } - bb20: { + bb19: { _10 = discriminant(_1); // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 - switchInt(move _10) -> [0_isize: bb16, otherwise: bb18]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 + switchInt(move _10) -> [0_isize: bb15, otherwise: bb17]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 } - bb21: { - switchInt(_7) -> [false: bb16, otherwise: bb20]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 + bb20: { + switchInt(_7) -> [false: bb15, otherwise: bb19]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 } - bb22 (cleanup): { + bb21 (cleanup): { _11 = discriminant(_1); // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 - switchInt(move _11) -> [0_isize: bb17, otherwise: bb19]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 + switchInt(move _11) -> [0_isize: bb16, otherwise: bb18]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 } - bb23 (cleanup): { - switchInt(_7) -> [false: bb13, otherwise: bb22]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 + bb22 (cleanup): { + switchInt(_7) -> [false: bb12, otherwise: bb21]; // scope 0 at $DIR/issue-41888.rs:15:1: 15:2 } } diff --git a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir index 86ec31ce47e..d028f0b989a 100644 --- a/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir +++ b/src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir @@ -43,29 +43,29 @@ fn num_to_digit(_1: char) -> u32 { } bb1: { - StorageDead(_11); // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 + StorageDead(_11); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 StorageLive(_3); // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 StorageLive(_4); // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 _4 = _1; // scope 0 at $DIR/issue-59352.rs:14:26: 14:29 - _3 = char::methods::<impl char>::to_digit(move _4, const 8_u32) -> bb3; // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 + _3 = char::methods::<impl char>::to_digit(move _4, const 8_u32) -> bb2; // scope 0 at $DIR/issue-59352.rs:14:26: 14:41 // mir::Constant // + span: $DIR/issue-59352.rs:14:30: 14:38 // + literal: Const { ty: fn(char, u32) -> std::option::Option<u32> {std::char::methods::<impl char>::to_digit}, val: Value(Scalar(<ZST>)) } } bb2: { - StorageDead(_11); // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 - _0 = const 0_u32; // scope 0 at $DIR/issue-59352.rs:14:60: 14:61 - goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 - } - - bb3: { StorageDead(_4); // scope 0 at $DIR/issue-59352.rs:14:40: 14:41 StorageLive(_10); // scope 0 at $DIR/issue-59352.rs:14:26: 14:50 _10 = discriminant(_3); // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 switchInt(move _10) -> [0_isize: bb6, 1_isize: bb8, otherwise: bb7]; // scope 3 at $DIR/issue-59352.rs:14:26: 14:50 } + bb3: { + StorageDead(_11); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 + _0 = const 0_u32; // scope 0 at $DIR/issue-59352.rs:14:60: 14:61 + goto -> bb4; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 + } + bb4: { return; // scope 0 at $DIR/issue-59352.rs:15:2: 15:2 } @@ -82,7 +82,7 @@ fn num_to_digit(_1: char) -> u32 { StorageDead(_7); // scope 1 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_5); // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 StorageDead(_2); // scope 0 at $DIR/issue-59352.rs:14:22: 14:23 - switchInt(move _11) -> [1_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/issue-59352.rs:14:5: 14:63 + switchInt(move _11) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/issue-59352.rs:14:8: 14:23 } bb6: { diff --git a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index 0d19b3d459e..4630c408750 100644 --- a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -32,54 +32,54 @@ bb1: { StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:7:52: 7:53 - switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 } bb2: { - switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 } bb3: { - switchInt(_2[2 of 4]) -> [0_u32: bb6, 4294901760_u32: bb7, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + switchInt(_2[2 of 4]) -> [0_u32: bb5, 4294901760_u32: bb6, otherwise: bb8]; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 } bb4: { - discriminant(_0) = 0; // scope 1 at $DIR/issue-75439.rs:12:9: 12:13 - goto -> bb9; // scope 1 at $DIR/issue-75439.rs:9:5: 13:6 - } - - bb5: { StorageLive(_5); // scope 1 at $DIR/issue-75439.rs:10:14: 10:38 StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:10:33: 10:35 _6 = _4; // scope 4 at $DIR/issue-75439.rs:10:33: 10:35 - _5 = transmute::<u32, [u8; 4]>(move _6) -> bb8; // scope 4 at $DIR/issue-75439.rs:10:23: 10:36 + _5 = transmute::<u32, [u8; 4]>(move _6) -> bb7; // scope 4 at $DIR/issue-75439.rs:10:23: 10:36 // mir::Constant // + span: $DIR/issue-75439.rs:10:23: 10:32 // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u32) -> [u8; 4] {std::intrinsics::transmute::<u32, [u8; 4]>}, val: Value(Scalar(<ZST>)) } } - bb6: { + bb5: { StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - goto -> bb5; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + goto -> bb4; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 } - bb7: { + bb6: { StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:9:27: 9:29 - goto -> bb5; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 + goto -> bb4; // scope 1 at $DIR/issue-75439.rs:9:12: 9:30 } - bb8: { + bb7: { StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:10:35: 10:36 ((_0 as Some).0: [u8; 4]) = move _5; // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 discriminant(_0) = 1; // scope 1 at $DIR/issue-75439.rs:10:9: 10:39 StorageDead(_5); // scope 1 at $DIR/issue-75439.rs:10:38: 10:39 + StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:11:5: 11:6 + goto -> bb9; // scope 1 at $DIR/issue-75439.rs:9:5: 13:6 + } + + bb8: { + discriminant(_0) = 0; // scope 1 at $DIR/issue-75439.rs:12:9: 12:13 goto -> bb9; // scope 1 at $DIR/issue-75439.rs:9:5: 13:6 } bb9: { - StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:13:5: 13:6 StorageDead(_2); // scope 0 at $DIR/issue-75439.rs:14:1: 14:2 return; // scope 0 at $DIR/issue-75439.rs:14:2: 14:2 } diff --git a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir index db88f77bb63..9e91603cee9 100644 --- a/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir +++ b/src/test/mir-opt/loop_test.main.SimplifyCfg-promote-consts.after.mir @@ -16,7 +16,7 @@ fn main() -> () { StorageLive(_1); // scope 0 at $DIR/loop_test.rs:10:5: 12:6 StorageLive(_2); // scope 0 at $DIR/loop_test.rs:10:8: 10:12 _2 = const true; // scope 0 at $DIR/loop_test.rs:10:8: 10:12 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/loop_test.rs:10:5: 12:6 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/loop_test.rs:10:8: 10:12 } bb1: { diff --git a/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff b/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff index d2056ac13a7..25db3b98c25 100644 --- a/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff +++ b/src/test/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.diff @@ -33,7 +33,7 @@ _3 = Lt(move _4, move _5); // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27 StorageDead(_5); // scope 0 at $DIR/lower_slice_len.rs:5:26: 5:27 StorageDead(_4); // scope 0 at $DIR/lower_slice_len.rs:5:26: 5:27 - switchInt(move _3) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/lower_slice_len.rs:5:5: 9:6 + switchInt(move _3) -> [false: bb4, otherwise: bb2]; // scope 0 at $DIR/lower_slice_len.rs:5:8: 5:27 } bb2: { @@ -41,17 +41,17 @@ _7 = _1; // scope 0 at $DIR/lower_slice_len.rs:6:15: 6:20 _8 = Len((*_2)); // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 _9 = Lt(_7, _8); // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 - assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb4; // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb3; // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 } bb3: { - _0 = const 42_u8; // scope 0 at $DIR/lower_slice_len.rs:8:9: 8:11 + _0 = (*_2)[_7]; // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 + StorageDead(_7); // scope 0 at $DIR/lower_slice_len.rs:7:5: 7:6 goto -> bb5; // scope 0 at $DIR/lower_slice_len.rs:5:5: 9:6 } bb4: { - _0 = (*_2)[_7]; // scope 0 at $DIR/lower_slice_len.rs:6:9: 6:21 - StorageDead(_7); // scope 0 at $DIR/lower_slice_len.rs:7:5: 7:6 + _0 = const 42_u8; // scope 0 at $DIR/lower_slice_len.rs:8:9: 8:11 goto -> bb5; // scope 0 at $DIR/lower_slice_len.rs:5:5: 9:6 } diff --git a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff index f756b6bbf3d..0917278875a 100644 --- a/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff +++ b/src/test/mir-opt/match_arm_scopes.complicated_match.SimplifyCfg-initial.after-ElaborateDrops.after.diff @@ -85,8 +85,8 @@ StorageLive(_9); // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 StorageLive(_10); // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 _10 = _1; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 -- switchInt(move _10) -> [false: bb10, otherwise: bb9]; // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 -+ switchInt(move _10) -> [false: bb7, otherwise: bb6]; // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 +- switchInt(move _10) -> [false: bb10, otherwise: bb9]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 ++ switchInt(move _10) -> [false: bb7, otherwise: bb6]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 } - bb9: { @@ -101,14 +101,13 @@ - bb10: { + bb7: { _9 = (*_6); // scope 0 at $DIR/match-arm-scopes.rs:15:70: 15:71 - StorageDead(_10); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - switchInt(move _9) -> [false: bb12, otherwise: bb11]; // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 + switchInt(move _9) -> [false: bb9, otherwise: bb8]; // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 } - bb11: { + bb8: { - StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 + StorageDead(_10); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - FakeRead(ForMatchGuard, _3); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 @@ -123,6 +122,7 @@ - bb12: { + bb9: { + StorageDead(_10); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 @@ -141,8 +141,8 @@ StorageLive(_12); // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 StorageLive(_13); // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 _13 = _1; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 -- switchInt(move _13) -> [false: bb15, otherwise: bb14]; // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 -+ switchInt(move _13) -> [false: bb12, otherwise: bb11]; // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 +- switchInt(move _13) -> [false: bb15, otherwise: bb14]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 ++ switchInt(move _13) -> [false: bb12, otherwise: bb11]; // scope 0 at $DIR/match-arm-scopes.rs:15:45: 15:49 } - bb14: { @@ -157,14 +157,13 @@ - bb15: { + bb12: { _12 = (*_6); // scope 0 at $DIR/match-arm-scopes.rs:15:70: 15:71 - StorageDead(_13); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - switchInt(move _12) -> [false: bb17, otherwise: bb16]; // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 + switchInt(move _12) -> [false: bb14, otherwise: bb13]; // scope 0 at $DIR/match-arm-scopes.rs:15:42: 15:73 } - bb16: { + bb13: { - StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 + StorageDead(_13); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - FakeRead(ForMatchGuard, _3); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 - FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 @@ -179,6 +178,7 @@ - bb17: { + bb14: { + StorageDead(_13); // scope 0 at $DIR/match-arm-scopes.rs:15:72: 15:73 StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 @@ -190,6 +190,7 @@ + bb15: { StorageDead(_7); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 StorageDead(_5); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 + StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 - goto -> bb22; // scope 0 at $DIR/match-arm-scopes.rs:15:77: 15:78 diff --git a/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir b/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir index 7d868666021..b2fbe225915 100644 --- a/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir +++ b/src/test/mir-opt/match_false_edges.full_tested_match.PromoteTemps.after.mir @@ -72,7 +72,6 @@ fn full_tested_match() -> () { } bb7: { - StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:16:36: 16:37 FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_false_edges.rs:16:26: 16:27 FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_false_edges.rs:16:26: 16:27 StorageLive(_5); // scope 0 at $DIR/match_false_edges.rs:16:14: 16:15 @@ -82,6 +81,7 @@ fn full_tested_match() -> () { _1 = (const 1_i32, move _8); // scope 2 at $DIR/match_false_edges.rs:16:31: 16:37 StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:16:36: 16:37 StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:16:36: 16:37 + StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:16:36: 16:37 StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:16:36: 16:37 goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:16:36: 16:37 } diff --git a/src/test/mir-opt/match_false_edges.full_tested_match2.PromoteTemps.before.mir b/src/test/mir-opt/match_false_edges.full_tested_match2.PromoteTemps.before.mir index 9913d179edd..8ff555dbb87 100644 --- a/src/test/mir-opt/match_false_edges.full_tested_match2.PromoteTemps.before.mir +++ b/src/test/mir-opt/match_false_edges.full_tested_match2.PromoteTemps.before.mir @@ -70,7 +70,6 @@ fn full_tested_match2() -> () { } bb7: { - StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:27:36: 27:37 FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_false_edges.rs:27:26: 27:27 FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_false_edges.rs:27:26: 27:27 StorageLive(_5); // scope 0 at $DIR/match_false_edges.rs:27:14: 27:15 @@ -80,6 +79,7 @@ fn full_tested_match2() -> () { _1 = (const 1_i32, move _8); // scope 2 at $DIR/match_false_edges.rs:27:31: 27:37 StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:27:36: 27:37 StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:27:36: 27:37 + StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:27:36: 27:37 StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:27:36: 27:37 goto -> bb10; // scope 0 at $DIR/match_false_edges.rs:27:36: 27:37 } diff --git a/src/test/mir-opt/match_false_edges.main.PromoteTemps.before.mir b/src/test/mir-opt/match_false_edges.main.PromoteTemps.before.mir index 9113d9d3189..3fb06cfe638 100644 --- a/src/test/mir-opt/match_false_edges.main.PromoteTemps.before.mir +++ b/src/test/mir-opt/match_false_edges.main.PromoteTemps.before.mir @@ -78,13 +78,13 @@ fn main() -> () { } bb7: { - StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:36:32: 36:33 FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:36:27: 36:28 FakeRead(ForGuardBinding, _7); // scope 0 at $DIR/match_false_edges.rs:36:27: 36:28 StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:36:14: 36:16 _6 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:36:14: 36:16 _1 = const 1_i32; // scope 2 at $DIR/match_false_edges.rs:36:32: 36:33 StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:36:32: 36:33 + StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:36:32: 36:33 StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:36:32: 36:33 goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:36:32: 36:33 } @@ -117,23 +117,24 @@ fn main() -> () { } bb11: { - StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:38:28: 38:29 switchInt(move _12) -> [false: bb13, otherwise: bb12]; // scope 0 at $DIR/match_false_edges.rs:38:20: 38:29 } bb12: { - StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34 + StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:38:28: 38:29 FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:38:28: 38:29 FakeRead(ForGuardBinding, _11); // scope 0 at $DIR/match_false_edges.rs:38:28: 38:29 StorageLive(_10); // scope 0 at $DIR/match_false_edges.rs:38:14: 38:15 _10 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:38:14: 38:15 _1 = const 3_i32; // scope 4 at $DIR/match_false_edges.rs:38:33: 38:34 StorageDead(_10); // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34 + StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34 StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34 goto -> bb14; // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34 } bb13: { + StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:38:28: 38:29 StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34 StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34 falseEdge -> [real: bb3, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:38:20: 38:29 diff --git a/src/test/mir-opt/match_test.main.SimplifyCfg-initial.after.mir b/src/test/mir-opt/match_test.main.SimplifyCfg-initial.after.mir index 4dab5b4c1ef..6cb27d24444 100644 --- a/src/test/mir-opt/match_test.main.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/match_test.main.SimplifyCfg-initial.after.mir @@ -75,9 +75,9 @@ fn main() -> () { } bb10: { - StorageDead(_9); // scope 2 at $DIR/match_test.rs:13:23: 13:24 FakeRead(ForMatchGuard, _8); // scope 2 at $DIR/match_test.rs:13:18: 13:19 _3 = const 0_i32; // scope 2 at $DIR/match_test.rs:13:23: 13:24 + StorageDead(_9); // scope 2 at $DIR/match_test.rs:13:23: 13:24 goto -> bb14; // scope 2 at $DIR/match_test.rs:13:23: 13:24 } 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.32bit.diff index 4ce1b57b9a3..4a9982d7699 100644 --- 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.32bit.diff @@ -4,105 +4,80 @@ fn match_nested_if() -> bool { let mut _0: bool; // return place in scope 0 at $DIR/matches_reduce_branches.rs:39:25: 39:29 let _1: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:40:9: 40:12 - let mut _2: (); // in scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:23 - let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 - let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 -+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 -+ let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 -+ let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -+ let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 + let mut _2: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 + let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 + let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 ++ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 scope 1 { debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:40:9: 40:12 } bb0: { StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:40:9: 40:12 - StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:23 - StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 - StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 - _6 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 -- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 + StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 + StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 + StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 + _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 +- switchInt(move _4) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 - } - - bb1: { -- _5 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:31: 41:35 +- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:31: 41:35 - goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - } - - bb2: { -- _5 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50 +- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50 - goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - } - - bb3: { -+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 -+ _7 = move _6; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 -+ _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50 -+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52 -- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 ++ StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ _5 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ _3 = Ne(_5, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50 ++ StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 + StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52 +- switchInt(move _3) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - } - - bb4: { -- _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:55: 41:59 +- _2 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:55: 41:59 - goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - } - - bb5: { -- _4 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74 +- _2 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74 - goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - } - - bb6: { -+ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 -+ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 -+ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74 -+ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:75: 41:76 -- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 ++ StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 ++ _6 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 ++ _2 = Ne(_6, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74 ++ StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 + StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:75: 41:76 +- switchInt(move _2) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - } - - bb7: { -- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:42:13: 42:17 -- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -- } -- -- bb8: { -- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:44:13: 44:18 -- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -- } -- -- bb9: { -+ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -+ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -+ _3 = Ne(_9, const false); // scope 0 at $DIR/matches_reduce_branches.rs:44:13: 44:18 -+ StorageDead(_9); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 - StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10 -- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -- } -- -- bb10: { -+ StorageLive(_10); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -+ _10 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 - StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10 ++ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 ++ _7 = move _2; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 + StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10 - _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17 -- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17 +- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10 - } - -- bb11: { -- StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10 +- bb8: { +- StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10 - _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 -- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 +- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 - } - -- bb12: { -+ _1 = Ne(_10, const false); // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 -+ StorageDead(_10); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 - StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:50:6: 50:7 +- bb9: { ++ _1 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 ++ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 _0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:51:5: 51:8 StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:52:1: 52:2 return; // scope 0 at $DIR/matches_reduce_branches.rs:52:2: 52:2 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 index 4ce1b57b9a3..4a9982d7699 100644 --- 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 @@ -4,105 +4,80 @@ fn match_nested_if() -> bool { let mut _0: bool; // return place in scope 0 at $DIR/matches_reduce_branches.rs:39:25: 39:29 let _1: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:40:9: 40:12 - let mut _2: (); // in scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:23 - let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 - let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 -+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 -+ let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 -+ let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -+ let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 + let mut _2: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 + let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 + let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 ++ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 scope 1 { debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:40:9: 40:12 } bb0: { StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:40:9: 40:12 - StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:40:21: 40:23 - StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 - StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 - _6 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 -- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 + StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 + StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 + StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 + _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 +- switchInt(move _4) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 - } - - bb1: { -- _5 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:31: 41:35 +- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:31: 41:35 - goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - } - - bb2: { -- _5 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50 +- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50 - goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - } - - bb3: { -+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 -+ _7 = move _6; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 -+ _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50 -+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52 -- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 ++ StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ _5 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 ++ _3 = Ne(_5, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:45: 41:50 ++ StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:24: 41:28 + StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:41:51: 41:52 +- switchInt(move _3) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 - } - - bb4: { -- _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:55: 41:59 +- _2 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:41:55: 41:59 - goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - } - - bb5: { -- _4 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74 +- _2 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74 - goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - } - - bb6: { -+ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 -+ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 -+ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74 -+ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:41:75: 41:76 -- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 ++ StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 ++ _6 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 ++ _2 = Ne(_6, const false); // scope 0 at $DIR/matches_reduce_branches.rs:41:69: 41:74 ++ StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:41:21: 41:52 + StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:41:75: 41:76 +- switchInt(move _2) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 - } - - bb7: { -- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:42:13: 42:17 -- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -- } -- -- bb8: { -- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:44:13: 44:18 -- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -- } -- -- bb9: { -+ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -+ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -+ _3 = Ne(_9, const false); // scope 0 at $DIR/matches_reduce_branches.rs:44:13: 44:18 -+ StorageDead(_9); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 - StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10 -- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -- } -- -- bb10: { -+ StorageLive(_10); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 -+ _10 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 - StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10 ++ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 ++ _7 = move _2; // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 + StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10 - _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17 -- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:47:13: 47:17 +- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10 - } - -- bb11: { -- StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:48:9: 48:10 +- bb8: { +- StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:45:9: 45:10 - _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 -- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 +- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 - } - -- bb12: { -+ _1 = Ne(_10, const false); // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 -+ StorageDead(_10); // scope 0 at $DIR/matches_reduce_branches.rs:41:15: 45:10 - StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:50:6: 50:7 +- bb9: { ++ _1 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:49:14: 49:19 ++ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:41:18: 41:76 _0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:51:5: 51:8 StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:52:1: 52:2 return; // scope 0 at $DIR/matches_reduce_branches.rs:52:2: 52:2 diff --git a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir index 39e6cee11b4..3ef7844ce43 100644 --- a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir +++ b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.32bit.mir @@ -5,16 +5,16 @@ | '_#1r | Local | ['_#1r] | | Inferred Region Values -| '_#0r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0], '_#0r, '_#1r} -| '_#1r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0], '_#1r} +| '_#0r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#0r, '_#1r} +| '_#1r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#1r} | '_#2r | U0 | {} | '_#3r | U0 | {bb1[0..=7], bb2[0..=2]} | '_#4r | U0 | {bb1[1..=7], bb2[0..=2]} | '_#5r | U0 | {bb1[4..=7], bb2[0..=2]} | | Inference Constraints -| '_#0r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0]} -| '_#1r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0]} +| '_#0r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} +| '_#1r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} | '_#3r live at {bb1[0]} | '_#4r live at {bb1[1..=3]} | '_#5r live at {bb1[4..=7], bb2[0..=2]} @@ -63,32 +63,32 @@ fn main() -> () { FakeRead(ForLet(None), _6); // bb1[4]: scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10 StorageLive(_7); // bb1[5]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 _7 = const Const(Value(Scalar(0x01)): bool); // bb1[6]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 - switchInt(move _7) -> [Const(Value(Scalar(0x00)): bool): bb3, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 + switchInt(move _7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 } bb2: { StorageLive(_8); // bb2[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 StorageLive(_9); // bb2[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17 _9 = (*_6); // bb2[2]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17 - _8 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(move _9) -> [return: bb4, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 + _8 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 // mir::Constant // + span: $DIR/region-subtyping-basic.rs:21:9: 21:14 // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) } } bb3: { - StorageLive(_10); // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18 - _10 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x00000016)): usize)) -> [return: bb5, unwind: bb7]; // bb3[1]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18 - // mir::Constant - // + span: $DIR/region-subtyping-basic.rs:23:9: 23:14 - // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) } + StorageDead(_9); // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18 + StorageDead(_8); // bb3[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19 + _0 = const Const(Value(Scalar(<ZST>)): ()); // bb3[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6 + goto -> bb6; // bb3[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 } bb4: { - StorageDead(_9); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18 - StorageDead(_8); // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19 - _0 = const Const(Value(Scalar(<ZST>)): ()); // bb4[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6 - goto -> bb6; // bb4[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 + StorageLive(_10); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18 + _10 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x00000016)): usize)) -> [return: bb5, unwind: bb7]; // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18 + // mir::Constant + // + span: $DIR/region-subtyping-basic.rs:23:9: 23:14 + // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) } } bb5: { diff --git a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir index 6021b6529f9..d6b4a0beebd 100644 --- a/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir +++ b/src/test/mir-opt/nll/region_subtyping_basic.main.nll.0.64bit.mir @@ -5,16 +5,16 @@ | '_#1r | Local | ['_#1r] | | Inferred Region Values -| '_#0r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0], '_#0r, '_#1r} -| '_#1r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0], '_#1r} +| '_#0r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#0r, '_#1r} +| '_#1r | U0 | {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0], '_#1r} | '_#2r | U0 | {} | '_#3r | U0 | {bb1[0..=7], bb2[0..=2]} | '_#4r | U0 | {bb1[1..=7], bb2[0..=2]} | '_#5r | U0 | {bb1[4..=7], bb2[0..=2]} | | Inference Constraints -| '_#0r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0]} -| '_#1r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=1], bb4[0..=3], bb5[0..=2], bb6[0..=5], bb7[0]} +| '_#0r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} +| '_#1r live at {bb0[0..=8], bb1[0..=7], bb2[0..=3], bb3[0..=3], bb4[0..=1], bb5[0..=2], bb6[0..=5], bb7[0]} | '_#3r live at {bb1[0]} | '_#4r live at {bb1[1..=3]} | '_#5r live at {bb1[4..=7], bb2[0..=2]} @@ -63,32 +63,32 @@ fn main() -> () { FakeRead(ForLet(None), _6); // bb1[4]: scope 2 at $DIR/region-subtyping-basic.rs:19:9: 19:10 StorageLive(_7); // bb1[5]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 _7 = const Const(Value(Scalar(0x01)): bool); // bb1[6]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 - switchInt(move _7) -> [Const(Value(Scalar(0x00)): bool): bb3, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 + switchInt(move _7) -> [Const(Value(Scalar(0x00)): bool): bb4, otherwise: bb2]; // bb1[7]: scope 3 at $DIR/region-subtyping-basic.rs:20:8: 20:12 } bb2: { StorageLive(_8); // bb2[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 StorageLive(_9); // bb2[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17 _9 = (*_6); // bb2[2]: scope 3 at $DIR/region-subtyping-basic.rs:21:15: 21:17 - _8 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(move _9) -> [return: bb4, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 + _8 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(move _9) -> [return: bb3, unwind: bb7]; // bb2[3]: scope 3 at $DIR/region-subtyping-basic.rs:21:9: 21:18 // mir::Constant // + span: $DIR/region-subtyping-basic.rs:21:9: 21:14 // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) } } bb3: { - StorageLive(_10); // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18 - _10 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x0000000000000016)): usize)) -> [return: bb5, unwind: bb7]; // bb3[1]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18 - // mir::Constant - // + span: $DIR/region-subtyping-basic.rs:23:9: 23:14 - // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) } + StorageDead(_9); // bb3[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18 + StorageDead(_8); // bb3[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19 + _0 = const Const(Value(Scalar(<ZST>)): ()); // bb3[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6 + goto -> bb6; // bb3[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 } bb4: { - StorageDead(_9); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:21:17: 21:18 - StorageDead(_8); // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:21:18: 21:19 - _0 = const Const(Value(Scalar(<ZST>)): ()); // bb4[2]: scope 3 at $DIR/region-subtyping-basic.rs:20:13: 22:6 - goto -> bb6; // bb4[3]: scope 3 at $DIR/region-subtyping-basic.rs:20:5: 24:6 + StorageLive(_10); // bb4[0]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18 + _10 = Const(Value(Scalar(<ZST>)): fn(usize) -> bool {use_x})(const Const(Value(Scalar(0x0000000000000016)): usize)) -> [return: bb5, unwind: bb7]; // bb4[1]: scope 3 at $DIR/region-subtyping-basic.rs:23:9: 23:18 + // mir::Constant + // + span: $DIR/region-subtyping-basic.rs:23:9: 23:14 + // + literal: Const { ty: fn(usize) -> bool {use_x}, val: Value(Scalar(<ZST>)) } } bb5: { diff --git a/src/test/mir-opt/not_equal_false.opt.InstCombine.diff b/src/test/mir-opt/not_equal_false.opt.InstCombine.diff index 6fe28c0149e..249db1c8a5a 100644 --- a/src/test/mir-opt/not_equal_false.opt.InstCombine.diff +++ b/src/test/mir-opt/not_equal_false.opt.InstCombine.diff @@ -14,7 +14,7 @@ - _2 = Ne(move _3, const false); // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 + _2 = move _3; // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 StorageDead(_3); // scope 0 at $DIR/not_equal_false.rs:4:17: 4:18 - switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:35 + switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18 } bb1: { diff --git a/src/test/mir-opt/remove_fake_borrows.match_guard.CleanupNonCodegenStatements.diff b/src/test/mir-opt/remove_fake_borrows.match_guard.CleanupNonCodegenStatements.diff index 52b5611e905..eacc99dcf49 100644 --- a/src/test/mir-opt/remove_fake_borrows.match_guard.CleanupNonCodegenStatements.diff +++ b/src/test/mir-opt/remove_fake_borrows.match_guard.CleanupNonCodegenStatements.diff @@ -47,7 +47,6 @@ } bb5: { - StorageDead(_8); // scope 0 at $DIR/remove_fake_borrows.rs:8:25: 8:26 - FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/remove_fake_borrows.rs:8:20: 8:21 - FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/remove_fake_borrows.rs:8:20: 8:21 - FakeRead(ForMatchGuard, _6); // scope 0 at $DIR/remove_fake_borrows.rs:8:20: 8:21 @@ -57,6 +56,7 @@ + nop; // scope 0 at $DIR/remove_fake_borrows.rs:8:20: 8:21 + nop; // scope 0 at $DIR/remove_fake_borrows.rs:8:20: 8:21 _0 = const 0_i32; // scope 0 at $DIR/remove_fake_borrows.rs:8:25: 8:26 + StorageDead(_8); // scope 0 at $DIR/remove_fake_borrows.rs:8:25: 8:26 goto -> bb7; // scope 0 at $DIR/remove_fake_borrows.rs:8:25: 8:26 } diff --git a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff index f72a12a5be0..eac9328500d 100644 --- a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff +++ b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-early-opt.diff @@ -21,9 +21,9 @@ } - bb2: { -- switchInt(move _2) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/simplify_cfg.rs:9:9: 11:10 +- switchInt(move _2) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 + bb1: { -+ switchInt(move _2) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/simplify_cfg.rs:9:9: 11:10 ++ switchInt(move _2) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 } - bb3: { diff --git a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff index 9857322053f..f5ac2a41f5f 100644 --- a/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff +++ b/src/test/mir-opt/simplify_cfg.main.SimplifyCfg-initial.diff @@ -13,12 +13,12 @@ } bb1: { -- falseUnwind -> [real: bb2, cleanup: bb10]; // scope 0 at $DIR/simplify_cfg.rs:8:5: 12:6 +- falseUnwind -> [real: bb2, cleanup: bb11]; // scope 0 at $DIR/simplify_cfg.rs:8:5: 12:6 - } - - bb2: { StorageLive(_2); // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 -- _2 = bar() -> [return: bb3, unwind: bb10]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 +- _2 = bar() -> [return: bb3, unwind: bb11]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 + _2 = bar() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 // mir::Constant // + span: $DIR/simplify_cfg.rs:9:12: 9:15 @@ -26,23 +26,21 @@ } - bb3: { -- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:9:9: 11:10 +- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 + bb2: { -+ switchInt(move _2) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/simplify_cfg.rs:9:9: 11:10 ++ switchInt(move _2) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 } - bb4: { + bb3: { _0 = const (); // scope 0 at $DIR/simplify_cfg.rs:10:13: 10:18 -- goto -> bb9; // scope 0 at $DIR/simplify_cfg.rs:10:13: 10:18 +- goto -> bb10; // scope 0 at $DIR/simplify_cfg.rs:10:13: 10:18 + StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:11:9: 11:10 + return; // scope 0 at $DIR/simplify_cfg.rs:13:2: 13:2 } - bb5: { -+ bb4: { - _1 = const (); // scope 0 at $DIR/simplify_cfg.rs:11:10: 11:10 -- goto -> bb8; // scope 0 at $DIR/simplify_cfg.rs:9:9: 11:10 +- goto -> bb8; // scope 0 at $DIR/simplify_cfg.rs:9:12: 9:17 - } - - bb6: { @@ -50,21 +48,27 @@ - } - - bb7: { -- goto -> bb8; // scope 0 at $DIR/simplify_cfg.rs:9:9: 11:10 +- goto -> bb9; // scope 0 at $DIR/simplify_cfg.rs:9:9: 11:10 - } - - bb8: { ++ bb4: { + _1 = const (); // scope 0 at $DIR/simplify_cfg.rs:11:10: 11:10 +- goto -> bb9; // scope 0 at $DIR/simplify_cfg.rs:9:9: 11:10 +- } +- +- bb9: { StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:11:9: 11:10 - goto -> bb1; // scope 0 at $DIR/simplify_cfg.rs:8:5: 12:6 + goto -> bb0; // scope 0 at $DIR/simplify_cfg.rs:8:5: 12:6 } -- bb9: { +- bb10: { - StorageDead(_2); // scope 0 at $DIR/simplify_cfg.rs:11:9: 11:10 - return; // scope 0 at $DIR/simplify_cfg.rs:13:2: 13:2 - } - -- bb10 (cleanup): { +- bb11 (cleanup): { + bb5 (cleanup): { resume; // scope 0 at $DIR/simplify_cfg.rs:7:1: 13:2 } diff --git a/src/test/mir-opt/simplify_if.main.SimplifyBranches-after-const-prop.diff b/src/test/mir-opt/simplify_if.main.SimplifyBranches-after-const-prop.diff index b6ce74d7289..def6f835131 100644 --- a/src/test/mir-opt/simplify_if.main.SimplifyBranches-after-const-prop.diff +++ b/src/test/mir-opt/simplify_if.main.SimplifyBranches-after-const-prop.diff @@ -9,26 +9,26 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 _1 = const false; // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 -- switchInt(const false) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/simplify_if.rs:6:5: 8:6 -+ goto -> bb2; // scope 0 at $DIR/simplify_if.rs:6:5: 8:6 +- switchInt(const false) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 ++ goto -> bb3; // scope 0 at $DIR/simplify_if.rs:6:8: 6:13 } bb1: { StorageLive(_2); // scope 0 at $DIR/simplify_if.rs:7:9: 7:15 - _2 = noop() -> bb3; // scope 0 at $DIR/simplify_if.rs:7:9: 7:15 + _2 = noop() -> bb2; // scope 0 at $DIR/simplify_if.rs:7:9: 7:15 // mir::Constant // + span: $DIR/simplify_if.rs:7:9: 7:13 // + literal: Const { ty: fn() {noop}, val: Value(Scalar(<ZST>)) } } bb2: { - nop; // scope 0 at $DIR/simplify_if.rs:8:6: 8:6 + StorageDead(_2); // scope 0 at $DIR/simplify_if.rs:7:15: 7:16 + nop; // scope 0 at $DIR/simplify_if.rs:6:14: 8:6 goto -> bb4; // scope 0 at $DIR/simplify_if.rs:6:5: 8:6 } bb3: { - StorageDead(_2); // scope 0 at $DIR/simplify_if.rs:7:15: 7:16 - nop; // scope 0 at $DIR/simplify_if.rs:6:14: 8:6 + nop; // scope 0 at $DIR/simplify_if.rs:8:6: 8:6 goto -> bb4; // scope 0 at $DIR/simplify_if.rs:6:5: 8:6 } diff --git a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff index 381f4056cc8..fdd838f9a90 100644 --- a/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff +++ b/src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff @@ -43,11 +43,11 @@ - _7 = Gt(move _8, const 42_u8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20 - StorageDead(_8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20 - StorageDead(_7); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10 + StorageDead(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:5: 8:6 goto -> bb3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6 } bb3: { - StorageDead(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:5: 8:6 drop(_1) -> bb4; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:9:1: 9:2 } diff --git a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff index ff05951a99b..63356a400d2 100644 --- a/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable.main.UnreachablePropagation.diff @@ -27,44 +27,43 @@ bb1: { _2 = discriminant(_1); // scope 0 at $DIR/unreachable.rs:9:12: 9:20 -- switchInt(move _2) -> [1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 +- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 + goto -> bb2; // scope 0 at $DIR/unreachable.rs:9:12: 9:20 } bb2: { - _0 = const (); // scope 0 at $DIR/unreachable.rs:19:6: 19:6 - StorageDead(_3); // scope 0 at $DIR/unreachable.rs:19:5: 19:6 - StorageDead(_1); // scope 0 at $DIR/unreachable.rs:20:1: 20:2 - return; // scope 0 at $DIR/unreachable.rs:20:2: 20:2 -- } -- -- bb3: { - StorageLive(_3); // scope 0 at $DIR/unreachable.rs:9:17: 9:19 - _3 = move ((_1 as Some).0: Empty); // scope 0 at $DIR/unreachable.rs:9:17: 9:19 - StorageLive(_4); // scope 0 at $DIR/unreachable.rs:10:13: 10:19 - StorageLive(_5); // scope 2 at $DIR/unreachable.rs:12:9: 16:10 - StorageLive(_6); // scope 2 at $DIR/unreachable.rs:12:12: 12:16 - _6 = const true; // scope 2 at $DIR/unreachable.rs:12:12: 12:16 -- switchInt(move _6) -> [false: bb5, otherwise: bb4]; // scope 2 at $DIR/unreachable.rs:12:9: 16:10 +- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable.rs:12:12: 12:16 - } - -- bb4: { +- bb3: { - _4 = const 21_i32; // scope 2 at $DIR/unreachable.rs:13:13: 13:20 - _5 = const (); // scope 2 at $DIR/unreachable.rs:12:17: 14:10 -- goto -> bb6; // scope 2 at $DIR/unreachable.rs:12:9: 16:10 +- goto -> bb5; // scope 2 at $DIR/unreachable.rs:12:9: 16:10 - } - -- bb5: { +- bb4: { - _4 = const 42_i32; // scope 2 at $DIR/unreachable.rs:15:13: 15:20 - _5 = const (); // scope 2 at $DIR/unreachable.rs:14:16: 16:10 -- goto -> bb6; // scope 2 at $DIR/unreachable.rs:12:9: 16:10 +- goto -> bb5; // scope 2 at $DIR/unreachable.rs:12:9: 16:10 - } - -- bb6: { +- bb5: { - StorageDead(_6); // scope 2 at $DIR/unreachable.rs:16:9: 16:10 - StorageDead(_5); // scope 2 at $DIR/unreachable.rs:16:9: 16:10 - StorageLive(_7); // scope 2 at $DIR/unreachable.rs:18:9: 18:21 - unreachable; // scope 2 at $DIR/unreachable.rs:18:15: 18:17 +- } +- +- bb6: { + _0 = const (); // scope 0 at $DIR/unreachable.rs:19:6: 19:6 + StorageDead(_1); // scope 0 at $DIR/unreachable.rs:20:1: 20:2 + return; // scope 0 at $DIR/unreachable.rs:20:2: 20:2 } } diff --git a/src/test/mir-opt/unreachable_asm.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_asm.main.UnreachablePropagation.diff index b94441d5919..09eb210f368 100644 --- a/src/test/mir-opt/unreachable_asm.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_asm.main.UnreachablePropagation.diff @@ -30,39 +30,32 @@ bb1: { _2 = discriminant(_1); // scope 0 at $DIR/unreachable_asm.rs:11:12: 11:20 - switchInt(move _2) -> [1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/unreachable_asm.rs:11:12: 11:20 + switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/unreachable_asm.rs:11:12: 11:20 } bb2: { - _0 = const (); // scope 0 at $DIR/unreachable_asm.rs:23:6: 23:6 - StorageDead(_3); // scope 0 at $DIR/unreachable_asm.rs:23:5: 23:6 - StorageDead(_1); // scope 0 at $DIR/unreachable_asm.rs:24:1: 24:2 - return; // scope 0 at $DIR/unreachable_asm.rs:24:2: 24:2 - } - - bb3: { StorageLive(_3); // scope 0 at $DIR/unreachable_asm.rs:11:17: 11:19 _3 = move ((_1 as Some).0: Empty); // scope 0 at $DIR/unreachable_asm.rs:11:17: 11:19 StorageLive(_4); // scope 0 at $DIR/unreachable_asm.rs:12:13: 12:19 StorageLive(_5); // scope 2 at $DIR/unreachable_asm.rs:14:9: 18:10 StorageLive(_6); // scope 2 at $DIR/unreachable_asm.rs:14:12: 14:16 _6 = const true; // scope 2 at $DIR/unreachable_asm.rs:14:12: 14:16 - switchInt(move _6) -> [false: bb5, otherwise: bb4]; // scope 2 at $DIR/unreachable_asm.rs:14:9: 18:10 + switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_asm.rs:14:12: 14:16 } - bb4: { + bb3: { _4 = const 21_i32; // scope 2 at $DIR/unreachable_asm.rs:15:13: 15:20 _5 = const (); // scope 2 at $DIR/unreachable_asm.rs:14:17: 16:10 - goto -> bb6; // scope 2 at $DIR/unreachable_asm.rs:14:9: 18:10 + goto -> bb5; // scope 2 at $DIR/unreachable_asm.rs:14:9: 18:10 } - bb5: { + bb4: { _4 = const 42_i32; // scope 2 at $DIR/unreachable_asm.rs:17:13: 17:20 _5 = const (); // scope 2 at $DIR/unreachable_asm.rs:16:16: 18:10 - goto -> bb6; // scope 2 at $DIR/unreachable_asm.rs:14:9: 18:10 + goto -> bb5; // scope 2 at $DIR/unreachable_asm.rs:14:9: 18:10 } - bb6: { + bb5: { StorageDead(_6); // scope 2 at $DIR/unreachable_asm.rs:18:9: 18:10 StorageDead(_5); // scope 2 at $DIR/unreachable_asm.rs:18:9: 18:10 StorageLive(_7); // scope 2 at $DIR/unreachable_asm.rs:21:9: 21:37 @@ -72,5 +65,11 @@ StorageLive(_8); // scope 2 at $DIR/unreachable_asm.rs:22:9: 22:21 unreachable; // scope 2 at $DIR/unreachable_asm.rs:22:15: 22:17 } + + bb6: { + _0 = const (); // scope 0 at $DIR/unreachable_asm.rs:23:6: 23:6 + StorageDead(_1); // scope 0 at $DIR/unreachable_asm.rs:24:1: 24:2 + return; // scope 0 at $DIR/unreachable_asm.rs:24:2: 24:2 + } } diff --git a/src/test/mir-opt/unreachable_asm_2.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_asm_2.main.UnreachablePropagation.diff index 666843eab3d..cdb28ca12cc 100644 --- a/src/test/mir-opt/unreachable_asm_2.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_asm_2.main.UnreachablePropagation.diff @@ -33,53 +33,53 @@ bb1: { _2 = discriminant(_1); // scope 0 at $DIR/unreachable_asm_2.rs:11:12: 11:20 - switchInt(move _2) -> [1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/unreachable_asm_2.rs:11:12: 11:20 +- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/unreachable_asm_2.rs:11:12: 11:20 ++ switchInt(move _2) -> [1_isize: bb2, otherwise: bb5]; // scope 0 at $DIR/unreachable_asm_2.rs:11:12: 11:20 } bb2: { - _0 = const (); // scope 0 at $DIR/unreachable_asm_2.rs:25:6: 25:6 - StorageDead(_3); // scope 0 at $DIR/unreachable_asm_2.rs:25:5: 25:6 - StorageDead(_1); // scope 0 at $DIR/unreachable_asm_2.rs:26:1: 26:2 - return; // scope 0 at $DIR/unreachable_asm_2.rs:26:2: 26:2 - } - - bb3: { StorageLive(_3); // scope 0 at $DIR/unreachable_asm_2.rs:11:17: 11:19 _3 = move ((_1 as Some).0: Empty); // scope 0 at $DIR/unreachable_asm_2.rs:11:17: 11:19 StorageLive(_4); // scope 0 at $DIR/unreachable_asm_2.rs:12:13: 12:19 StorageLive(_5); // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 StorageLive(_6); // scope 2 at $DIR/unreachable_asm_2.rs:14:12: 14:16 _6 = const true; // scope 2 at $DIR/unreachable_asm_2.rs:14:12: 14:16 - switchInt(move _6) -> [false: bb5, otherwise: bb4]; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 + switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_asm_2.rs:14:12: 14:16 } - bb4: { + bb3: { StorageLive(_7); // scope 2 at $DIR/unreachable_asm_2.rs:16:13: 16:41 llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // scope 3 at $DIR/unreachable_asm_2.rs:16:22: 16:39 _7 = const (); // scope 3 at $DIR/unreachable_asm_2.rs:16:13: 16:41 StorageDead(_7); // scope 2 at $DIR/unreachable_asm_2.rs:16:40: 16:41 _4 = const 21_i32; // scope 2 at $DIR/unreachable_asm_2.rs:17:13: 17:20 _5 = const (); // scope 2 at $DIR/unreachable_asm_2.rs:14:17: 18:10 -- goto -> bb6; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 +- goto -> bb5; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 + unreachable; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 } - bb5: { + bb4: { StorageLive(_8); // scope 2 at $DIR/unreachable_asm_2.rs:20:13: 20:41 llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // scope 4 at $DIR/unreachable_asm_2.rs:20:22: 20:39 _8 = const (); // scope 4 at $DIR/unreachable_asm_2.rs:20:13: 20:41 StorageDead(_8); // scope 2 at $DIR/unreachable_asm_2.rs:20:40: 20:41 _4 = const 42_i32; // scope 2 at $DIR/unreachable_asm_2.rs:21:13: 21:20 _5 = const (); // scope 2 at $DIR/unreachable_asm_2.rs:18:16: 22:10 -- goto -> bb6; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 -- } -- -- bb6: { +- goto -> bb5; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 ++ unreachable; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 + } + + bb5: { - StorageDead(_6); // scope 2 at $DIR/unreachable_asm_2.rs:22:9: 22:10 - StorageDead(_5); // scope 2 at $DIR/unreachable_asm_2.rs:22:9: 22:10 - StorageLive(_9); // scope 2 at $DIR/unreachable_asm_2.rs:24:9: 24:21 - unreachable; // scope 2 at $DIR/unreachable_asm_2.rs:24:15: 24:17 -+ unreachable; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 +- } +- +- bb6: { + _0 = const (); // scope 0 at $DIR/unreachable_asm_2.rs:25:6: 25:6 + StorageDead(_1); // scope 0 at $DIR/unreachable_asm_2.rs:26:1: 26:2 + return; // scope 0 at $DIR/unreachable_asm_2.rs:26:2: 26:2 } } diff --git a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff index 32a067f2245..3e93ae7b198 100644 --- a/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff +++ b/src/test/mir-opt/unreachable_diverging.main.UnreachablePropagation.diff @@ -29,45 +29,46 @@ bb1: { _3 = discriminant(_2); // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 - switchInt(move _3) -> [1_isize: bb3, otherwise: bb2]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 +- switchInt(move _3) -> [1_isize: bb2, otherwise: bb6]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 ++ switchInt(move _3) -> [1_isize: bb2, otherwise: bb5]; // scope 1 at $DIR/unreachable_diverging.rs:14:12: 14:22 } bb2: { - _0 = const (); // scope 1 at $DIR/unreachable_diverging.rs:19:6: 19:6 - StorageDead(_4); // scope 1 at $DIR/unreachable_diverging.rs:19:5: 19:6 - StorageDead(_1); // scope 0 at $DIR/unreachable_diverging.rs:20:1: 20:2 - StorageDead(_2); // scope 0 at $DIR/unreachable_diverging.rs:20:1: 20:2 - return; // scope 0 at $DIR/unreachable_diverging.rs:20:2: 20:2 - } - - bb3: { StorageLive(_4); // scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 _4 = move ((_2 as Some).0: Empty); // scope 1 at $DIR/unreachable_diverging.rs:14:17: 14:21 StorageLive(_5); // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 StorageLive(_6); // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 _6 = _1; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 -- switchInt(move _6) -> [false: bb5, otherwise: bb4]; // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 -+ goto -> bb4; // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 +- switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 ++ goto -> bb3; // scope 1 at $DIR/unreachable_diverging.rs:15:12: 15:13 } - bb4: { -- _5 = loop_forever() -> bb6; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 -+ _5 = loop_forever() -> bb5; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 + bb3: { +- _5 = loop_forever() -> bb5; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 ++ _5 = loop_forever() -> bb4; // scope 1 at $DIR/unreachable_diverging.rs:16:13: 16:27 // mir::Constant // + span: $DIR/unreachable_diverging.rs:16:13: 16:25 // + literal: Const { ty: fn() {loop_forever}, val: Value(Scalar(<ZST>)) } } - bb5: { + bb4: { - _5 = const (); // scope 1 at $DIR/unreachable_diverging.rs:17:10: 17:10 -- goto -> bb6; // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 +- goto -> bb5; // scope 1 at $DIR/unreachable_diverging.rs:15:9: 17:10 - } - -- bb6: { +- bb5: { StorageDead(_6); // scope 1 at $DIR/unreachable_diverging.rs:17:9: 17:10 StorageDead(_5); // scope 1 at $DIR/unreachable_diverging.rs:17:9: 17:10 StorageLive(_7); // scope 1 at $DIR/unreachable_diverging.rs:18:9: 18:22 unreachable; // scope 1 at $DIR/unreachable_diverging.rs:18:15: 18:19 } + +- bb6: { ++ bb5: { + _0 = const (); // scope 1 at $DIR/unreachable_diverging.rs:19:6: 19:6 + StorageDead(_1); // scope 0 at $DIR/unreachable_diverging.rs:20:1: 20:2 + StorageDead(_2); // scope 0 at $DIR/unreachable_diverging.rs:20:1: 20:2 + return; // scope 0 at $DIR/unreachable_diverging.rs:20:2: 20: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.32bit.diff index c5a100fe3e5..8ecda3a1ae2 100644 --- 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.32bit.diff @@ -21,28 +21,28 @@ StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 discriminant(_3) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - _4 = discriminant(_3); // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -- switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + _4 = const 0_isize; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ switchInt(const 0_isize) -> [1_isize: bb2, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - StorageLive(_7); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 - nop; // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 - StorageDead(_7); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6 - goto -> bb4; // scope 1 at no-location + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb3, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 - } - - bb3: { _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 } + bb3: { + StorageLive(_7); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 + nop; // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 + StorageDead(_7); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6 + goto -> bb4; // scope 1 at no-location + } + bb4: { StorageDead(_3); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6 StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2 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 index c5a100fe3e5..8ecda3a1ae2 100644 --- 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 @@ -21,28 +21,28 @@ StorageLive(_3); // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 discriminant(_3) = 0; // scope 1 at $DIR/while_let_loops.rs:7:28: 7:32 - _4 = discriminant(_3); // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -- switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 +- switchInt(move _4) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 + _4 = const 0_isize; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 -+ switchInt(const 0_isize) -> [1_isize: bb2, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 ++ switchInt(const 0_isize) -> [1_isize: bb1, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 } bb1: { - StorageLive(_7); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 - nop; // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 - StorageDead(_7); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6 - goto -> bb4; // scope 1 at no-location + switchInt(((_3 as Some).0: u32)) -> [0_u32: bb2, otherwise: bb3]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 } bb2: { - switchInt(((_3 as Some).0: u32)) -> [0_u32: bb3, otherwise: bb1]; // scope 1 at $DIR/while_let_loops.rs:7:15: 7:25 - } - - bb3: { _1 = const 1_i32; // scope 1 at $DIR/while_let_loops.rs:8:9: 8:15 nop; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 goto -> bb4; // scope 1 at $DIR/while_let_loops.rs:9:9: 9:14 } + bb3: { + StorageLive(_7); // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 + nop; // scope 1 at $DIR/while_let_loops.rs:7:5: 10:6 + StorageDead(_7); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6 + goto -> bb4; // scope 1 at no-location + } + bb4: { StorageDead(_3); // scope 1 at $DIR/while_let_loops.rs:10:5: 10:6 StorageDead(_1); // scope 0 at $DIR/while_let_loops.rs:11:1: 11:2 diff --git a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir index 325b8591c73..9db77d705ff 100644 --- a/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir +++ b/src/test/mir-opt/while_storage.while_loop.PreCodegen.after.mir @@ -20,39 +20,39 @@ fn while_loop(_1: bool) -> () { bb1: { StorageDead(_3); // scope 0 at $DIR/while-storage.rs:10:21: 10:22 - switchInt(move _2) -> [false: bb3, otherwise: bb2]; // scope 0 at $DIR/while-storage.rs:10:5: 14:6 + switchInt(move _2) -> [false: bb6, otherwise: bb2]; // scope 0 at $DIR/while-storage.rs:10:11: 10:22 } bb2: { StorageLive(_4); // scope 0 at $DIR/while-storage.rs:11:12: 11:23 StorageLive(_5); // scope 0 at $DIR/while-storage.rs:11:21: 11:22 _5 = _1; // scope 0 at $DIR/while-storage.rs:11:21: 11:22 - _4 = get_bool(move _5) -> bb4; // scope 0 at $DIR/while-storage.rs:11:12: 11:23 + _4 = get_bool(move _5) -> bb3; // scope 0 at $DIR/while-storage.rs:11:12: 11:23 // mir::Constant // + span: $DIR/while-storage.rs:11:12: 11:20 // + literal: Const { ty: fn(bool) -> bool {get_bool}, val: Value(Scalar(<ZST>)) } } bb3: { - goto -> bb7; // scope 0 at no-location - } - - bb4: { StorageDead(_5); // scope 0 at $DIR/while-storage.rs:11:22: 11:23 - switchInt(move _4) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/while-storage.rs:11:9: 13:10 + switchInt(move _4) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/while-storage.rs:11:12: 11:23 } - bb5: { + bb4: { StorageDead(_4); // scope 0 at $DIR/while-storage.rs:13:9: 13:10 goto -> bb7; // scope 0 at no-location } - bb6: { + bb5: { StorageDead(_4); // scope 0 at $DIR/while-storage.rs:13:9: 13:10 StorageDead(_2); // scope 0 at $DIR/while-storage.rs:14:5: 14:6 goto -> bb0; // scope 0 at $DIR/while-storage.rs:10:5: 14:6 } + bb6: { + goto -> bb7; // scope 0 at no-location + } + bb7: { StorageDead(_2); // scope 0 at $DIR/while-storage.rs:14:5: 14:6 return; // scope 0 at $DIR/while-storage.rs:15:2: 15:2 diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_inline_crate.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_inline_crate.txt index dab31cbf4ac..89636294035 100644 --- a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_inline_crate.txt +++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.uses_inline_crate.txt @@ -42,12 +42,12 @@ 40| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg); 41| 2|} ------------------ - | used_inline_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>: + | used_inline_crate::used_only_from_bin_crate_generic_function::<&str>: | 39| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { | 40| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); | 41| 1|} ------------------ - | used_inline_crate::used_only_from_bin_crate_generic_function::<&str>: + | used_inline_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>: | 39| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { | 40| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); | 41| 1|} @@ -61,12 +61,12 @@ 46| 4| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); 47| 4|} ------------------ - | used_inline_crate::used_only_from_this_lib_crate_generic_function::<alloc::vec::Vec<i32>>: + | used_inline_crate::used_only_from_this_lib_crate_generic_function::<&str>: | 45| 2|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) { | 46| 2| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); | 47| 2|} ------------------ - | used_inline_crate::used_only_from_this_lib_crate_generic_function::<&str>: + | used_inline_crate::used_only_from_this_lib_crate_generic_function::<alloc::vec::Vec<i32>>: | 45| 2|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) { | 46| 2| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); | 47| 2|} diff --git a/src/test/run-make/wasm-spurious-import/Makefile b/src/test/run-make/wasm-spurious-import/Makefile new file mode 100644 index 00000000000..1bb59dc1bfa --- /dev/null +++ b/src/test/run-make/wasm-spurious-import/Makefile @@ -0,0 +1,7 @@ +-include ../../run-make-fulldeps/tools.mk + +# only-wasm32-bare + +all: + $(RUSTC) main.rs -C overflow-checks=yes -C panic=abort -C lto -C opt-level=z --target wasm32-unknown-unknown + $(NODE) verify.js $(TMPDIR)/main.wasm diff --git a/src/test/run-make/wasm-spurious-import/main.rs b/src/test/run-make/wasm-spurious-import/main.rs new file mode 100644 index 00000000000..fcbead5e28b --- /dev/null +++ b/src/test/run-make/wasm-spurious-import/main.rs @@ -0,0 +1,14 @@ +#![crate_type = "cdylib"] +#![no_std] + +#[panic_handler] +fn my_panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} + +#[no_mangle] +pub fn multer(a: i128, b: i128) -> i128 { + // Trigger usage of the __multi3 compiler intrinsic which then leads to an imported + // panic function in case of a bug. We verify that no imports exist in our verifier. + a * b +} diff --git a/src/test/run-make/wasm-spurious-import/verify.js b/src/test/run-make/wasm-spurious-import/verify.js new file mode 100644 index 00000000000..d3b2101b662 --- /dev/null +++ b/src/test/run-make/wasm-spurious-import/verify.js @@ -0,0 +1,9 @@ +const fs = require('fs'); +const process = require('process'); +const assert = require('assert'); +const buffer = fs.readFileSync(process.argv[2]); + +let m = new WebAssembly.Module(buffer); +let imports = WebAssembly.Module.imports(m); +console.log('imports', imports); +assert.strictEqual(imports.length, 0); diff --git a/src/test/rustdoc-gui/implementors.goml b/src/test/rustdoc-gui/implementors.goml index 87e4f2a7bd1..c9042eb4813 100644 --- a/src/test/rustdoc-gui/implementors.goml +++ b/src/test/rustdoc-gui/implementors.goml @@ -3,14 +3,14 @@ goto: file://|DOC_PATH|/implementors/trait.Whatever.html assert: "#implementors-list" // There are supposed to be two implementors listed. -assert-count: ("#implementors-list > .impl", 2) +assert-count: ("#implementors-list .impl", 2) // Now we check that both implementors have an anchor, an ID and a similar DOM. -assert: ("#implementors-list > .impl:nth-child(1) > a.anchor") -assert-attribute: ("#implementors-list > .impl:nth-child(1)", {"id": "impl-Whatever"}) -assert-attribute: ("#implementors-list > .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"}) -assert: "#implementors-list > .impl:nth-child(1) > .code-header.in-band" +assert: ("#implementors-list .impl:nth-child(1) > a.anchor") +assert-attribute: ("#implementors-list .impl:nth-child(1)", {"id": "impl-Whatever"}) +assert-attribute: ("#implementors-list .impl:nth-child(1) > a.anchor", {"href": "#impl-Whatever"}) +assert: "#implementors-list .impl:nth-child(1) > .code-header.in-band" -assert: ("#implementors-list > .impl:nth-child(2) > a.anchor") -assert-attribute: ("#implementors-list > .impl:nth-child(2)", {"id": "impl-Whatever-1"}) -assert-attribute: ("#implementors-list > .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"}) -assert: "#implementors-list > .impl:nth-child(2) > .code-header.in-band" +assert: ("#implementors-list .impl:nth-child(2) > a.anchor") +assert-attribute: ("#implementors-list .impl:nth-child(2)", {"id": "impl-Whatever-1"}) +assert-attribute: ("#implementors-list .impl:nth-child(2) > a.anchor", {"href": "#impl-Whatever-1"}) +assert: "#implementors-list .impl:nth-child(2) > .code-header.in-band" diff --git a/src/test/rustdoc-gui/src/lib2/implementors/lib.rs b/src/test/rustdoc-gui/src/lib2/implementors/lib.rs index 4b2f6962e30..6417a6ac5af 100644 --- a/src/test/rustdoc-gui/src/lib2/implementors/lib.rs +++ b/src/test/rustdoc-gui/src/lib2/implementors/lib.rs @@ -1,7 +1,11 @@ pub trait Whatever { + type Foo; + fn method() {} } pub struct Struct; -impl Whatever for Struct {} +impl Whatever for Struct { + type Foo = u8; +} diff --git a/src/test/rustdoc-gui/src/lib2/lib.rs b/src/test/rustdoc-gui/src/lib2/lib.rs index 36373d24971..cb63a9f6002 100644 --- a/src/test/rustdoc-gui/src/lib2/lib.rs +++ b/src/test/rustdoc-gui/src/lib2/lib.rs @@ -38,7 +38,9 @@ impl Trait for Foo { } -impl implementors::Whatever for Foo {} +impl implementors::Whatever for Foo { + type Foo = u32; +} pub mod sub_mod { /// ```txt diff --git a/src/test/rustdoc-gui/toggle-implementors.goml b/src/test/rustdoc-gui/toggle-implementors.goml new file mode 100644 index 00000000000..15521ff0f49 --- /dev/null +++ b/src/test/rustdoc-gui/toggle-implementors.goml @@ -0,0 +1,4 @@ +// This test ensures that the implementors toggle are not open by default. +goto: file://|DOC_PATH|/implementors/trait.Whatever.html + +assert-attribute-false: ("#implementors-list > details", {"open": ""}, ALL) diff --git a/src/test/rustdoc-json/structs/with_primitives.rs b/src/test/rustdoc-json/structs/with_primitives.rs index ea98676863b..9e64317ec20 100644 --- a/src/test/rustdoc-json/structs/with_primitives.rs +++ b/src/test/rustdoc-json/structs/with_primitives.rs @@ -1,7 +1,7 @@ // @has with_primitives.json "$.index[*][?(@.name=='WithPrimitives')].visibility" \"public\" // @has - "$.index[*][?(@.name=='WithPrimitives')].kind" \"struct\" // @has - "$.index[*][?(@.name=='WithPrimitives')].inner.generics.params[0].name" \"\'a\" -// @has - "$.index[*][?(@.name=='WithPrimitives')].inner.generics.params[0].kind" \"lifetime\" +// @has - "$.index[*][?(@.name=='WithPrimitives')].inner.generics.params[0].kind.lifetime.outlives" [] // @has - "$.index[*][?(@.name=='WithPrimitives')].inner.struct_type" \"plain\" // @has - "$.index[*][?(@.name=='WithPrimitives')].inner.fields_stripped" true pub struct WithPrimitives<'a> { diff --git a/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs b/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs new file mode 100644 index 00000000000..3ad56aebc21 --- /dev/null +++ b/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs @@ -0,0 +1,17 @@ +// This test ensures that rustdoc does not panic on inherented associated types +// that are referred to without fully-qualified syntax. + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +pub struct Struct; + +impl Struct { + pub type AssocTy = usize; + pub const AssocConst: Self::AssocTy = 42; + //~^ ERROR ambiguous associated type + //~| HELP use fully-qualified syntax + // FIXME: for some reason, the error is shown twice with rustdoc but only once with rustc + //~| ERROR ambiguous associated type + //~| HELP use fully-qualified syntax +} diff --git a/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.stderr b/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.stderr new file mode 100644 index 00000000000..b963b722f66 --- /dev/null +++ b/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.stderr @@ -0,0 +1,15 @@ +error[E0223]: ambiguous associated type + --> $DIR/ambiguous-inherent-assoc-ty.rs:11:27 + | +LL | pub const AssocConst: Self::AssocTy = 42; + | ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<Struct as Trait>::AssocTy` + +error[E0223]: ambiguous associated type + --> $DIR/ambiguous-inherent-assoc-ty.rs:11:27 + | +LL | pub const AssocConst: Self::AssocTy = 42; + | ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<Struct as Trait>::AssocTy` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0223`. diff --git a/src/test/rustdoc-ui/bounded-hr-lifetime.rs b/src/test/rustdoc-ui/bounded-hr-lifetime.rs new file mode 100644 index 00000000000..b2e000b9757 --- /dev/null +++ b/src/test/rustdoc-ui/bounded-hr-lifetime.rs @@ -0,0 +1,9 @@ +// This test ensures that rustdoc doesn't panic on higher-ranked lifetimes +// with bounds, because an error should have already been emitted by rustc. + +pub fn hrlt<'b, 'c>() +where + for<'a: 'b + 'c> &'a (): std::fmt::Debug, + //~^ ERROR lifetime bounds cannot be used in this context +{ +} diff --git a/src/test/rustdoc-ui/bounded-hr-lifetime.stderr b/src/test/rustdoc-ui/bounded-hr-lifetime.stderr new file mode 100644 index 00000000000..d8fcd6cb4b1 --- /dev/null +++ b/src/test/rustdoc-ui/bounded-hr-lifetime.stderr @@ -0,0 +1,10 @@ +error: lifetime bounds cannot be used in this context + --> $DIR/bounded-hr-lifetime.rs:6:13 + | +LL | for<'a: 'b + 'c> &'a (): std::fmt::Debug, + | ^^ ^^ + +error: Compilation failed, aborting rustdoc + +error: aborting due to 2 previous errors + diff --git a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs index ddbe93febdc..4d25835bf08 100644 --- a/src/test/rustdoc/trait-impl-items-links-and-anchors.rs +++ b/src/test/rustdoc/trait-impl-items-links-and-anchors.rs @@ -1,6 +1,6 @@ pub trait MyTrait { type Assoc; - const VALUE: u32; + const VALUE: u32 = 12; fn trait_function(&self); fn defaulted(&self) {} fn defaulted_override(&self) {} @@ -38,9 +38,11 @@ impl MyTrait for Vec<u8> { } impl MyTrait for MyStruct { + // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="type"]/@href' trait.MyTrait.html#associatedtype.Assoc // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc type Assoc = bool; + // @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3 // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="constant"]/@href' trait.MyTrait.html#associatedconstant.VALUE // @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="anchor"]/@href' #associatedconstant.VALUE const VALUE: u32 = 20; @@ -55,3 +57,10 @@ impl MyTrait for MyStruct { } pub struct MyStruct; + +// We check that associated items with default values aren't generated in the implementors list. +impl MyTrait for (u8, u8) { + // @!has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-4"]' + type Assoc = bool; + fn trait_function(&self) {} +} diff --git a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs index ed8e498b6b7..8b0cebfa60e 100644 --- a/src/test/ui-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/ui-fulldeps/pprust-expr-roundtrip.rs @@ -106,6 +106,7 @@ fn iter_exprs(depth: usize, f: &mut dyn FnMut(P<Expr>)) { rules: BlockCheckMode::Default, span: DUMMY_SP, tokens: None, + could_be_bare_literal: false, }); iter_exprs(depth - 1, &mut |e| g(ExprKind::If(e, block.clone(), None))); } diff --git a/src/test/ui/asm/type-check-1.stderr b/src/test/ui/asm/type-check-1.stderr index ad981d93d51..5edbcf4a2a7 100644 --- a/src/test/ui/asm/type-check-1.stderr +++ b/src/test/ui/asm/type-check-1.stderr @@ -25,6 +25,21 @@ LL | let x = 0; LL | asm!("{}", const const_bar(x)); | ^ non-constant value +error[E0308]: mismatched types + --> $DIR/type-check-1.rs:48:26 + | +LL | asm!("{}", const 0f32); + | ^^^^ expected integer, found `f32` + +error[E0308]: mismatched types + --> $DIR/type-check-1.rs:50:26 + | +LL | asm!("{}", const 0 as *mut u8); + | ^^^^^^^^^^^^ expected integer, found *-ptr + | + = note: expected type `{integer}` + found raw pointer `*mut u8` + error: invalid asm output --> $DIR/type-check-1.rs:10:29 | @@ -65,21 +80,6 @@ LL | asm!("{}", inout(reg) v[..]); = note: all inline asm arguments must have a statically known size error[E0308]: mismatched types - --> $DIR/type-check-1.rs:48:26 - | -LL | asm!("{}", const 0f32); - | ^^^^ expected integer, found `f32` - -error[E0308]: mismatched types - --> $DIR/type-check-1.rs:50:26 - | -LL | asm!("{}", const 0 as *mut u8); - | ^^^^^^^^^^^^ expected integer, found *-ptr - | - = note: expected type `{integer}` - found raw pointer `*mut u8` - -error[E0308]: mismatched types --> $DIR/type-check-1.rs:60:25 | LL | global_asm!("{}", const 0f32); diff --git a/src/test/ui/ast-json/ast-json-noexpand-output.stdout b/src/test/ui/ast-json/ast-json-noexpand-output.stdout index 0307875c154..8961655ede3 100644 --- a/src/test/ui/ast-json/ast-json-noexpand-output.stdout +++ b/src/test/ui/ast-json/ast-json-noexpand-output.stdout @@ -1 +1 @@ -{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"span":{"lo":0,"hi":0},"proc_macros":[]} +{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"span":{"lo":0,"hi":0}} diff --git a/src/test/ui/ast-json/ast-json-output.stdout b/src/test/ui/ast-json/ast-json-output.stdout index 535f57bf6af..082f04134ce 100644 --- a/src/test/ui/ast-json/ast-json-output.stdout +++ b/src/test/ui/ast-json/ast-json-output.stdout @@ -1 +1 @@ -{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"prelude_import","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"","span":{"lo":0,"hi":0}},"kind":{"variant":"Use","fields":[{"prefix":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"{{root}}","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"std","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"prelude","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"rust_2015","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"kind":"Glob","span":{"lo":0,"hi":0}}]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"macro_use","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"std","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null},{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"span":{"lo":0,"hi":0},"proc_macros":[]} +{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"kind":{"variant":"Interpolated","fields":[{"variant":"NtExpr","fields":[{"id":0,"kind":{"variant":"Lit","fields":[{"token":{"kind":"Str","symbol":"lib","suffix":null},"kind":{"variant":"Str","fields":["lib","Cooked"]},"span":{"lo":0,"hi":0}}]},"span":{"lo":0,"hi":0},"attrs":{"0":null},"tokens":{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}}]}]},"span":{"lo":0,"hi":0}}]},"tokens":null},{"0":[[{"variant":"Token","fields":[{"kind":"Pound","span":{"lo":0,"hi":0}}]},"Joint"],[{"variant":"Token","fields":[{"kind":"Not","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Delimited","fields":[{"open":{"lo":0,"hi":0},"close":{"lo":0,"hi":0}},"Bracket",{"0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate_type",false]},"span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":"Eq","span":{"lo":0,"hi":0}}]},"Alone"],[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"Alone"]]}]},"Alone"]]}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"items":[{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"prelude_import","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"","span":{"lo":0,"hi":0}},"kind":{"variant":"Use","fields":[{"prefix":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"{{root}}","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"std","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"prelude","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"rust_2015","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"kind":"Glob","span":{"lo":0,"hi":0}}]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"macro_use","span":{"lo":0,"hi":0}},"id":0,"args":null}],"tokens":null},"args":"Empty","tokens":null},null]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"std","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null},{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"kind":"Inherited","span":{"lo":0,"hi":0},"tokens":null},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null}],"span":{"lo":0,"hi":0}} diff --git a/src/test/ui/borrowck/issue-64453.stderr b/src/test/ui/borrowck/issue-64453.stderr index 5513c3d217e..14e16670389 100644 --- a/src/test/ui/borrowck/issue-64453.stderr +++ b/src/test/ui/borrowck/issue-64453.stderr @@ -1,9 +1,3 @@ -error[E0507]: cannot move out of static item `settings_dir` - --> $DIR/issue-64453.rs:14:37 - | -LL | let settings_data = from_string(settings_dir); - | ^^^^^^^^^^^^ move occurs because `settings_dir` has type `String`, which does not implement the `Copy` trait - error: `Arguments::<'a>::new_v1` is not yet stable as a const fn --> $DIR/issue-64453.rs:4:31 | @@ -21,6 +15,12 @@ LL | static settings_dir: String = format!(""); | = note: this error originates in the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info) +error[E0507]: cannot move out of static item `settings_dir` + --> $DIR/issue-64453.rs:14:37 + | +LL | let settings_data = from_string(settings_dir); + | ^^^^^^^^^^^^ move occurs because `settings_dir` has type `String`, which does not implement the `Copy` trait + error: aborting due to 3 previous errors Some errors have detailed explanations: E0015, E0507. diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.fixed b/src/test/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.fixed new file mode 100644 index 00000000000..f91454aa211 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.fixed @@ -0,0 +1,25 @@ +// run-rustfix +// edition:2018 +// check-pass +#![warn(rust_2021_compatibility)] + +macro_rules! m { + (@ $body:expr) => {{ + let f = || $body; + //~^ WARNING: drop order + f(); + }}; + ($body:block) => {{ + m!(@ $body); + }}; +} + +fn main() { + let a = (1.to_string(), 2.to_string()); + m!({ + let _ = &a; + //~^ HELP: add a dummy + let x = a.0; + println!("{}", x); + }); +} diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.rs b/src/test/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.rs new file mode 100644 index 00000000000..5a1026d0433 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.rs @@ -0,0 +1,24 @@ +// run-rustfix +// edition:2018 +// check-pass +#![warn(rust_2021_compatibility)] + +macro_rules! m { + (@ $body:expr) => {{ + let f = || $body; + //~^ WARNING: drop order + f(); + }}; + ($body:block) => {{ + m!(@ $body); + }}; +} + +fn main() { + let a = (1.to_string(), 2.to_string()); + m!({ + //~^ HELP: add a dummy + let x = a.0; + println!("{}", x); + }); +} diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.stderr new file mode 100644 index 00000000000..e6e5598f6d2 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.stderr @@ -0,0 +1,37 @@ +warning: changes to closure capture in Rust 2021 will affect drop order + --> $DIR/closure-body-macro-fragment.rs:8:17 + | +LL | let f = || $body; + | _________________^ +LL | | +LL | | f(); +LL | | }}; + | | - in Rust 2018, `a` is dropped here, but in Rust 2021, only `a.0` will be dropped here as part of the closure +LL | | ($body:block) => {{ +LL | | m!(@ $body); + | |__________________^ +... +LL | / m!({ +LL | | +LL | | let x = a.0; + | | --- in Rust 2018, this closure captures all of `a`, but in Rust 2021, it will only capture `a.0` +LL | | println!("{}", x); +LL | | }); + | |_______- in this macro invocation + | +note: the lint level is defined here + --> $DIR/closure-body-macro-fragment.rs:4:9 + | +LL | #![warn(rust_2021_compatibility)] + | ^^^^^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(rust_2021_incompatible_closure_captures)]` implied by `#[warn(rust_2021_compatibility)]` + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html> + = note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: add a dummy let to cause `a` to be fully captured + | +LL ~ m!({ +LL + let _ = &a; + | + +warning: 1 warning emitted + diff --git a/src/test/ui/const-generics/const_trait_fn-issue-88433.rs b/src/test/ui/const-generics/const_trait_fn-issue-88433.rs new file mode 100644 index 00000000000..8724fa69825 --- /dev/null +++ b/src/test/ui/const-generics/const_trait_fn-issue-88433.rs @@ -0,0 +1,26 @@ +// build-pass + +#![feature(const_trait_impl)] + +trait Func<T> { + type Output; + + fn call_once(self, arg: T) -> Self::Output; +} + + +struct Closure; + +impl const Func<&usize> for Closure { + type Output = usize; + + fn call_once(self, arg: &usize) -> Self::Output { + *arg + } +} + +enum Bug<T = [(); Closure.call_once(&0) ]> { + V(T), +} + +fn main() {} diff --git a/src/test/ui/const-generics/type_mismatch.stderr b/src/test/ui/const-generics/type_mismatch.stderr index f5053e4c8c8..8d779bee265 100644 --- a/src/test/ui/const-generics/type_mismatch.stderr +++ b/src/test/ui/const-generics/type_mismatch.stderr @@ -5,12 +5,6 @@ LL | bar::<N>() | ^ expected `u8`, found `usize` error[E0308]: mismatched types - --> $DIR/type_mismatch.rs:5:31 - | -LL | fn bar<const N: u8>() -> [u8; N] {} - | ^ expected `usize`, found `u8` - -error[E0308]: mismatched types --> $DIR/type_mismatch.rs:5:26 | LL | fn bar<const N: u8>() -> [u8; N] {} @@ -18,6 +12,12 @@ LL | fn bar<const N: u8>() -> [u8; N] {} | | | implicitly returns `()` as its body has no tail or `return` expression +error[E0308]: mismatched types + --> $DIR/type_mismatch.rs:5:31 + | +LL | fn bar<const N: u8>() -> [u8; N] {} + | ^ expected `usize`, found `u8` + error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/consts/const-eval/infinite_loop.stderr b/src/test/ui/consts/const-eval/infinite_loop.stderr index d01376e5959..3b5a0f22f28 100644 --- a/src/test/ui/consts/const-eval/infinite_loop.stderr +++ b/src/test/ui/consts/const-eval/infinite_loop.stderr @@ -1,8 +1,8 @@ error[E0080]: evaluation of constant value failed - --> $DIR/infinite_loop.rs:7:17 + --> $DIR/infinite_loop.rs:7:20 | LL | n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) + | ^^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) error: aborting due to previous error diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr index b643ecc0ce8..33014a1500c 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr @@ -1,16 +1,16 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/const-extern-fn-requires-unsafe.rs:11:5 + --> $DIR/const-extern-fn-requires-unsafe.rs:9:17 | -LL | foo(); - | ^^^^^ call to unsafe function +LL | let a: [u8; foo()]; + | ^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/const-extern-fn-requires-unsafe.rs:9:17 + --> $DIR/const-extern-fn-requires-unsafe.rs:11:5 | -LL | let a: [u8; foo()]; - | ^^^^^ call to unsafe function +LL | foo(); + | ^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr b/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr index 10e54e0348c..5e706a4466e 100644 --- a/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr +++ b/src/test/ui/consts/const_limit/const_eval_limit_reached.stderr @@ -1,19 +1,15 @@ error: any use of this value will cause an error - --> $DIR/const_eval_limit_reached.rs:6:5 + --> $DIR/const_eval_limit_reached.rs:6:11 | -LL | / const X: usize = { -LL | | let mut x = 0; -LL | | while x != 1000 { - | |_____^ -LL | || -LL | || -LL | || x += 1; -LL | || } - | ||_____^ exceeded interpreter step limit (see `#[const_eval_limit]`) -LL | | -LL | | x -LL | | }; - | |__- +LL | / const X: usize = { +LL | | let mut x = 0; +LL | | while x != 1000 { + | | ^^^^^^^^^ exceeded interpreter step limit (see `#[const_eval_limit]`) +LL | | +... | +LL | | x +LL | | }; + | |__- | = note: `#[deny(const_err)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/consts/issue-66693.stderr b/src/test/ui/consts/issue-66693.stderr index 50c95c89e0b..3349e9813a8 100644 --- a/src/test/ui/consts/issue-66693.stderr +++ b/src/test/ui/consts/issue-66693.stderr @@ -1,12 +1,4 @@ error: argument to `panic!()` in a const context must have type `&str` - --> $DIR/issue-66693.rs:13:5 - | -LL | panic!(&1); - | ^^^^^^^^^^^ - | - = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: argument to `panic!()` in a const context must have type `&str` --> $DIR/issue-66693.rs:6:15 | LL | const _: () = panic!(1); @@ -22,5 +14,13 @@ LL | static _FOO: () = panic!(true); | = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) +error: argument to `panic!()` in a const context must have type `&str` + --> $DIR/issue-66693.rs:13:5 + | +LL | panic!(&1); + | ^^^^^^^^^^^ + | + = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) + error: aborting due to 3 previous errors diff --git a/src/test/ui/drop/drop-if-let-binding.rs b/src/test/ui/drop/drop-if-let-binding.rs new file mode 100644 index 00000000000..9c1ac4e0c7f --- /dev/null +++ b/src/test/ui/drop/drop-if-let-binding.rs @@ -0,0 +1,7 @@ +// build-pass +// regression test for issue #88307 +// compile-flags: -C opt-level=s + +fn main() { + if let Some(_val) = Option::<String>::None {} +} diff --git a/src/test/ui/editions/dyn-trait-sugg-2021.rs b/src/test/ui/editions/dyn-trait-sugg-2021.rs new file mode 100644 index 00000000000..47c48e7ec9e --- /dev/null +++ b/src/test/ui/editions/dyn-trait-sugg-2021.rs @@ -0,0 +1,12 @@ +// edition:2021 + +trait Foo<T> {} + +impl<T> dyn Foo<T> { + fn hi(_x: T) {} +} + +fn main() { + Foo::hi(123); + //~^ ERROR trait objects without an explicit `dyn` are deprecated +} diff --git a/src/test/ui/editions/dyn-trait-sugg-2021.stderr b/src/test/ui/editions/dyn-trait-sugg-2021.stderr new file mode 100644 index 00000000000..f6e9fa96a15 --- /dev/null +++ b/src/test/ui/editions/dyn-trait-sugg-2021.stderr @@ -0,0 +1,9 @@ +error[E0783]: trait objects without an explicit `dyn` are deprecated + --> $DIR/dyn-trait-sugg-2021.rs:10:5 + | +LL | Foo::hi(123); + | ^^^ help: use `dyn`: `<dyn Foo>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0783`. diff --git a/src/test/ui/impl-trait/auto-trait-leak.stderr b/src/test/ui/impl-trait/auto-trait-leak.stderr index 3eb141cc2bb..a31c104d8f5 100644 --- a/src/test/ui/impl-trait/auto-trait-leak.stderr +++ b/src/test/ui/impl-trait/auto-trait-leak.stderr @@ -30,10 +30,10 @@ note: ...which requires building MIR for `cycle1`... LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires type-checking `cycle1`... - --> $DIR/auto-trait-leak.rs:12:1 + --> $DIR/auto-trait-leak.rs:14:5 | -LL | fn cycle1() -> impl Clone { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | send(cycle2().clone()); + | ^^^^ = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`... note: ...which requires computing type of `cycle2::{opaque#0}`... --> $DIR/auto-trait-leak.rs:19:16 @@ -66,10 +66,10 @@ note: ...which requires building MIR for `cycle2`... LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...which requires type-checking `cycle2`... - --> $DIR/auto-trait-leak.rs:19:1 + --> $DIR/auto-trait-leak.rs:20:5 | -LL | fn cycle2() -> impl Clone { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | send(cycle1().clone()); + | ^^^^ = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`... = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module diff --git a/src/test/ui/issues/issue-47486.stderr b/src/test/ui/issues/issue-47486.stderr index cf95d309c63..a029948ca3b 100644 --- a/src/test/ui/issues/issue-47486.stderr +++ b/src/test/ui/issues/issue-47486.stderr @@ -1,15 +1,15 @@ +error[E0282]: type annotations needed + --> $DIR/issue-47486.rs:3:31 + | +LL | [0u8; std::mem::size_of::<_>()]; + | ^ cannot infer type + error[E0308]: mismatched types --> $DIR/issue-47486.rs:2:10 | LL | () < std::mem::size_of::<_>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `usize` -error[E0282]: type annotations needed - --> $DIR/issue-47486.rs:3:11 - | -LL | [0u8; std::mem::size_of::<_>()]; - | ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type - error: aborting due to 2 previous errors Some errors have detailed explanations: E0282, E0308. diff --git a/src/test/ui/issues/issue-83190.rs b/src/test/ui/issues/issue-83190.rs new file mode 100644 index 00000000000..da931c3edaf --- /dev/null +++ b/src/test/ui/issues/issue-83190.rs @@ -0,0 +1,49 @@ +// check-pass + +// Regression test for issue #83190, triggering an ICE in borrowck. + +pub trait Any {} +impl<T> Any for T {} + +pub trait StreamOnce { + type Range; +} + +pub trait Parser<Input>: Sized { + type Output; + type PartialState; + fn map(self) -> Map<Self> { + todo!() + } +} + +pub struct Map<P>(P); +impl<I, P: Parser<I, Output = ()>> Parser<I> for Map<P> { + type Output = (); + type PartialState = P::PartialState; +} + +struct TakeWhile1<Input>(Input); +impl<I: StreamOnce> Parser<I> for TakeWhile1<I> { + type Output = I::Range; + type PartialState = (); +} +impl<I> TakeWhile1<I> { + fn new() -> Self { + todo!() + } +} + +impl<I, A: Parser<I>> Parser<I> for (A,) { + type Output = (); + type PartialState = Map<A::Output>; +} + +pub fn metric_stream_parser<'a, I>() -> impl Parser<I, Output = (), PartialState = impl Any + 'a> +where + I: StreamOnce<Range = &'a [()]>, +{ + (TakeWhile1::new(),).map() +} + +fn main() {} diff --git a/src/test/ui/iterators/into-iter-on-arrays-2018.rs b/src/test/ui/iterators/into-iter-on-arrays-2018.rs index e56c2956a69..60995170a51 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-2018.rs +++ b/src/test/ui/iterators/into-iter-on-arrays-2018.rs @@ -19,9 +19,12 @@ fn main() { //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` //~| WARNING this changes meaning - // The `array_into_iter` lint doesn't cover other wrappers that deref to an array. let _: Iter<'_, i32> = Rc::new(array).into_iter(); + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning let _: Iter<'_, i32> = Array(array).into_iter(); + //~^ WARNING this method call resolves to `<&[T; N] as IntoIterator>::into_iter` + //~| WARNING this changes meaning // But you can always use the trait method explicitly as an array. let _: IntoIter<i32, 10> = IntoIterator::into_iter(array); diff --git a/src/test/ui/iterators/into-iter-on-arrays-2018.stderr b/src/test/ui/iterators/into-iter-on-arrays-2018.stderr index e9780d9b165..bc08fdcafa0 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-2018.stderr +++ b/src/test/ui/iterators/into-iter-on-arrays-2018.stderr @@ -20,21 +20,31 @@ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (du --> $DIR/into-iter-on-arrays-2018.rs:18:44 | LL | let _: Iter<'_, i32> = Box::new(array).into_iter(); - | ^^^^^^^^^ + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> -help: use `.iter()` instead of `.into_iter()` to avoid ambiguity + +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-2018.rs:22:43 | -LL | let _: Iter<'_, i32> = Box::new(array).iter(); - | ~~~~ -help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value +LL | let _: Iter<'_, i32> = Rc::new(array).into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this changes meaning in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> + +warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. + --> $DIR/into-iter-on-arrays-2018.rs:25:41 | -LL | let _: Iter<'_, i32> = IntoIterator::into_iter(Box::new(array)); - | ++++++++++++++++++++++++ ~ +LL | let _: Iter<'_, i32> = Array(array).into_iter(); + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` + | + = warning: this changes meaning in Rust 2021 + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. - --> $DIR/into-iter-on-arrays-2018.rs:29:24 + --> $DIR/into-iter-on-arrays-2018.rs:32:24 | LL | for _ in [1, 2, 3].into_iter() {} | ^^^^^^^^^ @@ -51,5 +61,5 @@ LL - for _ in [1, 2, 3].into_iter() {} LL + for _ in [1, 2, 3] {} | -warning: 3 warnings emitted +warning: 5 warnings emitted diff --git a/src/test/ui/iterators/into-iter-on-arrays-lint.stderr b/src/test/ui/iterators/into-iter-on-arrays-lint.stderr index 138becc4ffe..2df1a06df20 100644 --- a/src/test/ui/iterators/into-iter-on-arrays-lint.stderr +++ b/src/test/ui/iterators/into-iter-on-arrays-lint.stderr @@ -71,137 +71,73 @@ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (du --> $DIR/into-iter-on-arrays-lint.rs:23:21 | LL | Box::new(small).into_iter(); - | ^^^^^^^^^ + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> -help: use `.iter()` instead of `.into_iter()` to avoid ambiguity - | -LL | Box::new(small).iter(); - | ~~~~ -help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value - | -LL | IntoIterator::into_iter(Box::new(small)); - | ++++++++++++++++++++++++ ~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. --> $DIR/into-iter-on-arrays-lint.rs:26:22 | LL | Box::new([1, 2]).into_iter(); - | ^^^^^^^^^ + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> -help: use `.iter()` instead of `.into_iter()` to avoid ambiguity - | -LL | Box::new([1, 2]).iter(); - | ~~~~ -help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value - | -LL | IntoIterator::into_iter(Box::new([1, 2])); - | ++++++++++++++++++++++++ ~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. --> $DIR/into-iter-on-arrays-lint.rs:29:19 | LL | Box::new(big).into_iter(); - | ^^^^^^^^^ + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> -help: use `.iter()` instead of `.into_iter()` to avoid ambiguity - | -LL | Box::new(big).iter(); - | ~~~~ -help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value - | -LL | IntoIterator::into_iter(Box::new(big)); - | ++++++++++++++++++++++++ ~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. --> $DIR/into-iter-on-arrays-lint.rs:32:25 | LL | Box::new([0u8; 33]).into_iter(); - | ^^^^^^^^^ + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> -help: use `.iter()` instead of `.into_iter()` to avoid ambiguity - | -LL | Box::new([0u8; 33]).iter(); - | ~~~~ -help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value - | -LL | IntoIterator::into_iter(Box::new([0u8; 33])); - | ++++++++++++++++++++++++ ~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. --> $DIR/into-iter-on-arrays-lint.rs:36:31 | LL | Box::new(Box::new(small)).into_iter(); - | ^^^^^^^^^ + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> -help: use `.iter()` instead of `.into_iter()` to avoid ambiguity - | -LL | Box::new(Box::new(small)).iter(); - | ~~~~ -help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value - | -LL | IntoIterator::into_iter(Box::new(Box::new(small))); - | ++++++++++++++++++++++++ ~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. --> $DIR/into-iter-on-arrays-lint.rs:39:32 | LL | Box::new(Box::new([1, 2])).into_iter(); - | ^^^^^^^^^ + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> -help: use `.iter()` instead of `.into_iter()` to avoid ambiguity - | -LL | Box::new(Box::new([1, 2])).iter(); - | ~~~~ -help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value - | -LL | IntoIterator::into_iter(Box::new(Box::new([1, 2]))); - | ++++++++++++++++++++++++ ~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. --> $DIR/into-iter-on-arrays-lint.rs:42:29 | LL | Box::new(Box::new(big)).into_iter(); - | ^^^^^^^^^ + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> -help: use `.iter()` instead of `.into_iter()` to avoid ambiguity - | -LL | Box::new(Box::new(big)).iter(); - | ~~~~ -help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value - | -LL | IntoIterator::into_iter(Box::new(Box::new(big))); - | ++++++++++++++++++++++++ ~ warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to <[T; N] as IntoIterator>::into_iter in Rust 2021. --> $DIR/into-iter-on-arrays-lint.rs:45:35 | LL | Box::new(Box::new([0u8; 33])).into_iter(); - | ^^^^^^^^^ + | ^^^^^^^^^ help: use `.iter()` instead of `.into_iter()` to avoid ambiguity: `iter` | = warning: this changes meaning in Rust 2021 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html> -help: use `.iter()` instead of `.into_iter()` to avoid ambiguity - | -LL | Box::new(Box::new([0u8; 33])).iter(); - | ~~~~ -help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value - | -LL | IntoIterator::into_iter(Box::new(Box::new([0u8; 33]))); - | ++++++++++++++++++++++++ ~ warning: 12 warnings emitted diff --git a/src/test/ui/lint/unused/issue-88519-unused-paren.rs b/src/test/ui/lint/unused/issue-88519-unused-paren.rs new file mode 100644 index 00000000000..be02fcd3f00 --- /dev/null +++ b/src/test/ui/lint/unused/issue-88519-unused-paren.rs @@ -0,0 +1,94 @@ +// check-pass +// Make sure unused parens lint doesn't emit a false positive. +// See https://github.com/rust-lang/rust/issues/88519 +#![deny(unused_parens)] +#![feature(type_ascription)] + +// binary ops are tested in issue-71290-unused-paren-binop.rs + +mod call { + fn noop() -> u8 { 0 } + fn outside() -> u8 { + ({ noop })() + } + fn inside() -> u8 { + ({ noop }()) + } + fn outside_match() -> u8 { + (match noop { x => x })() + } + fn inside_match() -> u8 { + (match noop { x => x }()) + } + fn outside_if() -> u8 { + (if false { noop } else { noop })() + } + fn inside_if() -> u8 { + (if false { noop } else { noop }()) + } +} + +mod casts { + fn outside() -> u8 { + ({ 0 }) as u8 + } + fn inside() -> u8 { + ({ 0 } as u8) + } + fn outside_match() -> u8 { + (match 0 { x => x }) as u8 + } + fn inside_match() -> u8 { + (match 0 { x => x } as u8) + } + fn outside_if() -> u8 { + (if false { 0 } else { 0 }) as u8 + } + fn inside_if() -> u8 { + (if false { 0 } else { 0 } as u8) + } +} + +mod typeascription { + fn outside() -> u8 { + ({ 0 }): u8 + } + fn inside() -> u8 { + ({ 0 }: u8) + } + fn outside_match() -> u8 { + (match 0 { x => x }): u8 + } + fn inside_match() -> u8 { + (match 0 { x => x }: u8) + } + fn outside_if() -> u8 { + (if false { 0 } else { 0 }): u8 + } + fn inside_if() -> u8 { + (if false { 0 } else { 0 }: u8) + } +} + +mod index { + fn outside(x: &[u8]) -> u8 { + ({ x })[0] + } + fn inside(x: &[u8]) -> u8 { + ({ x }[0]) + } + fn outside_match(x: &[u8]) -> u8 { + (match x { x => x })[0] + } + fn inside_match(x: &[u8]) -> u8 { + (match x { x => x }[0]) + } + fn outside_if(x: &[u8]) -> u8 { + (if false { x } else { x })[0] + } + fn inside_if(x: &[u8]) -> u8 { + (if false { x } else { x }[0]) + } +} + +fn main() {} diff --git a/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr b/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr index d08fbac0bca..d9dac5de622 100644 --- a/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr +++ b/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr @@ -1,18 +1,4 @@ error[E0308]: mismatched types - --> $DIR/liveness-return-last-stmt-semi.rs:4:41 - | -LL | macro_rules! test { () => { fn foo() -> i32 { 1; } } } - | --- ^^^ - help: consider removing this semicolon - | | | - | | expected `i32`, found `()` - | implicitly returns `()` as its body has no tail or `return` expression -... -LL | test!(); - | -------- in this macro invocation - | - = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0308]: mismatched types --> $DIR/liveness-return-last-stmt-semi.rs:7:19 | LL | fn no_return() -> i32 {} @@ -38,6 +24,20 @@ LL | fn baz(x: u64) -> u32 { | | | implicitly returns `()` as its body has no tail or `return` expression +error[E0308]: mismatched types + --> $DIR/liveness-return-last-stmt-semi.rs:4:41 + | +LL | macro_rules! test { () => { fn foo() -> i32 { 1; } } } + | --- ^^^ - help: consider removing this semicolon + | | | + | | expected `i32`, found `()` + | implicitly returns `()` as its body has no tail or `return` expression +... +LL | test!(); + | -------- in this macro invocation + | + = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) + error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/macros/issue-87877.rs b/src/test/ui/macros/issue-87877.rs new file mode 100644 index 00000000000..a40e2c5f970 --- /dev/null +++ b/src/test/ui/macros/issue-87877.rs @@ -0,0 +1,25 @@ +// check-pass + +macro_rules! two_items { + () => { + extern "C" {} + extern "C" {} + }; +} + +macro_rules! single_expr_funneler { + ($expr:expr) => { + $expr; // note the semicolon, it changes the statement kind during parsing + }; +} + +macro_rules! single_item_funneler { + ($item:item) => { + $item + }; +} + +fn main() { + single_expr_funneler! { two_items! {} } + single_item_funneler! { two_items! {} } +} diff --git a/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr b/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr index cec6980c008..d38b98a1901 100644 --- a/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr +++ b/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr @@ -4,7 +4,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = box #![attr] 0; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `]` --> $DIR/attr-stmt-expr-attr-bad.rs:7:40 @@ -24,7 +25,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `)` --> $DIR/attr-stmt-expr-attr-bad.rs:11:44 @@ -38,7 +40,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `)` --> $DIR/attr-stmt-expr-attr-bad.rs:14:46 @@ -52,7 +55,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:19:33 @@ -60,7 +64,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:21:33 @@ -68,7 +73,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#` --> $DIR/attr-stmt-expr-attr-bad.rs:23:34 @@ -82,7 +88,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:27:40 @@ -90,7 +97,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:29:35 @@ -98,7 +106,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:31:40 @@ -106,7 +115,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `..` --> $DIR/attr-stmt-expr-attr-bad.rs:33:40 @@ -126,7 +136,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/attr-stmt-expr-attr-bad.rs:39:45 @@ -134,7 +145,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches --> $DIR/attr-stmt-expr-attr-bad.rs:41:37 @@ -151,7 +163,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` --> $DIR/attr-stmt-expr-attr-bad.rs:45:40 @@ -174,7 +187,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches --> $DIR/attr-stmt-expr-attr-bad.rs:51:45 @@ -200,7 +214,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches --> $DIR/attr-stmt-expr-attr-bad.rs:57:45 @@ -217,7 +232,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` --> $DIR/attr-stmt-expr-attr-bad.rs:61:48 @@ -240,7 +256,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches --> $DIR/attr-stmt-expr-attr-bad.rs:67:53 @@ -266,7 +283,8 @@ error: an inner attribute is not permitted in this context LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; } | ^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute --> $DIR/attr-stmt-expr-attr-bad.rs:74:32 @@ -276,7 +294,8 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; } | | | previous outer attribute | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute --> $DIR/attr-stmt-expr-attr-bad.rs:76:32 @@ -286,37 +305,56 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; } | | | previous outer attribute | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute --> $DIR/attr-stmt-expr-attr-bad.rs:78:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } - | ------- ^^^^^^^^ not permitted following an outer attribute - | | + | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation + | | | + | | not permitted following an outer attribute | previous outer attribute | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files +help: to annotate the item macro invocation, change the attribute from inner to outer style + | +LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } +LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!(); } + | error: an inner attribute is not permitted following an outer attribute --> $DIR/attr-stmt-expr-attr-bad.rs:80:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } - | ------- ^^^^^^^^ not permitted following an outer attribute - | | + | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation + | | | + | | not permitted following an outer attribute | previous outer attribute | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files +help: to annotate the item macro invocation, change the attribute from inner to outer style + | +LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } +LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo![]; } + | error: an inner attribute is not permitted following an outer attribute --> $DIR/attr-stmt-expr-attr-bad.rs:82:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } - | ------- ^^^^^^^^ not permitted following an outer attribute - | | + | ------- ^^^^^^^^ ------ the inner attribute doesn't annotate this item macro invocation + | | | + | | not permitted following an outer attribute | previous outer attribute | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files +help: to annotate the item macro invocation, change the attribute from inner to outer style + | +LL - #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } +LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!{}; } + | error[E0586]: inclusive range with no end --> $DIR/attr-stmt-expr-attr-bad.rs:88:35 diff --git a/src/test/ui/parser/attr.stderr b/src/test/ui/parser/attr.stderr index 400a0276b3b..3cec61fe41e 100644 --- a/src/test/ui/parser/attr.stderr +++ b/src/test/ui/parser/attr.stderr @@ -3,8 +3,16 @@ error: an inner attribute is not permitted in this context | LL | #![lang = "foo"] | ^^^^^^^^^^^^^^^^ +LL | +LL | fn foo() {} + | ----------- the inner attribute doesn't annotate this function | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files +help: to annotate the function, change the attribute from inner to outer style + | +LL - #![lang = "foo"] +LL + #[lang = "foo"] + | error[E0522]: definition of an unknown language item: `foo` --> $DIR/attr.rs:5:1 diff --git a/src/test/ui/parser/doc-comment-in-if-statement.stderr b/src/test/ui/parser/doc-comment-in-if-statement.stderr index be52a0afd46..b7c1847fc7c 100644 --- a/src/test/ui/parser/doc-comment-in-if-statement.stderr +++ b/src/test/ui/parser/doc-comment-in-if-statement.stderr @@ -5,6 +5,11 @@ LL | if true /*!*/ {} | ^^^^^ | = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items +help: you might have meant to write a regular comment + | +LL - if true /*!*/ {} +LL + if true /**/ {} + | error: outer attributes are not allowed on `if` and `else` branches --> $DIR/doc-comment-in-if-statement.rs:2:13 diff --git a/src/test/ui/parser/inner-attr-after-doc-comment.stderr b/src/test/ui/parser/inner-attr-after-doc-comment.stderr index c1e9e7a427f..404800ee15b 100644 --- a/src/test/ui/parser/inner-attr-after-doc-comment.stderr +++ b/src/test/ui/parser/inner-attr-after-doc-comment.stderr @@ -8,8 +8,16 @@ LL | | */ LL | LL | #![recursion_limit="100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ not permitted following an outer attribute +LL | +LL | fn main() {} + | ------------ the inner attribute doesn't annotate this function | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files +help: to annotate the function, change the attribute from inner to outer style + | +LL - #![recursion_limit="100"] +LL + #[recursion_limit="100"] + | error: aborting due to previous error diff --git a/src/test/ui/parser/inner-attr.stderr b/src/test/ui/parser/inner-attr.stderr index e1bf2cca1c9..1adac745908 100644 --- a/src/test/ui/parser/inner-attr.stderr +++ b/src/test/ui/parser/inner-attr.stderr @@ -6,8 +6,15 @@ LL | #[feature(lang_items)] LL | LL | #![recursion_limit="100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ not permitted following an outer attribute +LL | fn main() {} + | ------------ the inner attribute doesn't annotate this function | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files +help: to annotate the function, change the attribute from inner to outer style + | +LL - #![recursion_limit="100"] +LL + #[recursion_limit="100"] + | error: aborting due to previous error diff --git a/src/test/ui/parser/issue-10636-1.stderr b/src/test/ui/parser/issue-10636-1.stderr index ff90cb97096..1e6294ebe16 100644 --- a/src/test/ui/parser/issue-10636-1.stderr +++ b/src/test/ui/parser/issue-10636-1.stderr @@ -1,8 +1,8 @@ error: mismatched closing delimiter: `)` - --> $DIR/issue-10636-1.rs:4:1 + --> $DIR/issue-10636-1.rs:1:12 | LL | struct Obj { - | - unclosed delimiter + | ^ unclosed delimiter ... LL | ) | ^ mismatched closing delimiter diff --git a/src/test/ui/parser/issue-10636-2.stderr b/src/test/ui/parser/issue-10636-2.stderr index 5b9a9b7f06c..d4f2da9e3ab 100644 --- a/src/test/ui/parser/issue-10636-2.stderr +++ b/src/test/ui/parser/issue-10636-2.stderr @@ -1,8 +1,8 @@ error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` - --> $DIR/issue-10636-2.rs:5:25 + --> $DIR/issue-10636-2.rs:5:15 | LL | option.map(|some| 42; - | - ^ help: `)` may belong here + | ^ ^ help: `)` may belong here | | | unclosed delimiter diff --git a/src/test/ui/parser/issue-30318.fixed b/src/test/ui/parser/issue-30318.fixed new file mode 100644 index 00000000000..71fc82172a5 --- /dev/null +++ b/src/test/ui/parser/issue-30318.fixed @@ -0,0 +1,27 @@ +// run-rustfix +#![allow(unused)] +fn foo() { } + +/// Misplaced comment... +//~^ ERROR expected outer doc comment +fn bar() { } //~ NOTE the inner doc comment doesn't annotate this function + +#[test] //~ ERROR an inner attribute is not permitted in this context +fn baz() { } //~ NOTE the inner attribute doesn't annotate this function +//~^^ NOTE inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually + +/** Misplaced comment... */ +//~^ ERROR expected outer doc comment +fn bat() { } //~ NOTE the inner doc comment doesn't annotate this function + +fn main() { } + +// Misplaced comment... +//~^ ERROR expected outer doc comment +//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items +//~| NOTE other attributes here +/* Misplaced comment... */ +//~^ ERROR expected outer doc comment +//~| NOTE this doc comment doesn't document anything +//~| ERROR expected item after doc comment +//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items diff --git a/src/test/ui/parser/issue-30318.rs b/src/test/ui/parser/issue-30318.rs index 38e30de716d..465dca2ff82 100644 --- a/src/test/ui/parser/issue-30318.rs +++ b/src/test/ui/parser/issue-30318.rs @@ -1,7 +1,27 @@ +// run-rustfix +#![allow(unused)] fn foo() { } //! Misplaced comment... //~^ ERROR expected outer doc comment -//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items +fn bar() { } //~ NOTE the inner doc comment doesn't annotate this function + +#![test] //~ ERROR an inner attribute is not permitted in this context +fn baz() { } //~ NOTE the inner attribute doesn't annotate this function +//~^^ NOTE inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually + +/*! Misplaced comment... */ +//~^ ERROR expected outer doc comment +fn bat() { } //~ NOTE the inner doc comment doesn't annotate this function fn main() { } + +//! Misplaced comment... +//~^ ERROR expected outer doc comment +//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items +//~| NOTE other attributes here +/*! Misplaced comment... */ +//~^ ERROR expected outer doc comment +//~| NOTE this doc comment doesn't document anything +//~| ERROR expected item after doc comment +//~| NOTE inner doc comments like this (starting with `//!` or `/*!`) can only appear before items diff --git a/src/test/ui/parser/issue-30318.stderr b/src/test/ui/parser/issue-30318.stderr index b3a27f19851..7e710884554 100644 --- a/src/test/ui/parser/issue-30318.stderr +++ b/src/test/ui/parser/issue-30318.stderr @@ -1,11 +1,81 @@ error[E0753]: expected outer doc comment - --> $DIR/issue-30318.rs:3:1 + --> $DIR/issue-30318.rs:5:1 + | +LL | //! Misplaced comment... + | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | fn bar() { } + | ------------ the inner doc comment doesn't annotate this function + | +help: to annotate the function, change the doc comment from inner to outer style + | +LL | /// Misplaced comment... + | ~ + +error: an inner attribute is not permitted in this context + --> $DIR/issue-30318.rs:9:1 + | +LL | #![test] + | ^^^^^^^^ +LL | fn baz() { } + | ------------ the inner attribute doesn't annotate this function + | + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files +help: to annotate the function, change the attribute from inner to outer style + | +LL - #![test] +LL + #[test] + | + +error[E0753]: expected outer doc comment + --> $DIR/issue-30318.rs:13:1 + | +LL | /*! Misplaced comment... */ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | fn bat() { } + | ------------ the inner doc comment doesn't annotate this function + | +help: to annotate the function, change the doc comment from inner to outer style + | +LL | /** Misplaced comment... */ + | ~ + +error[E0753]: expected outer doc comment + --> $DIR/issue-30318.rs:19:1 | LL | //! Misplaced comment... | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items +help: you might have meant to write a regular comment + | +LL - //! Misplaced comment... +LL + // Misplaced comment... + | + +error[E0753]: expected outer doc comment + --> $DIR/issue-30318.rs:23:1 + | +LL | /*! Misplaced comment... */ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items +help: you might have meant to write a regular comment + | +LL - /*! Misplaced comment... */ +LL + /* Misplaced comment... */ + | + +error: expected item after doc comment + --> $DIR/issue-30318.rs:23:1 + | +LL | //! Misplaced comment... + | ------------------------ other attributes here +... +LL | /*! Misplaced comment... */ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment doesn't document anything -error: aborting due to previous error +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0753`. diff --git a/src/test/ui/parser/issue-45296.rs b/src/test/ui/parser/issue-45296.rs index f242c1d2937..d3a97e89f9a 100644 --- a/src/test/ui/parser/issue-45296.rs +++ b/src/test/ui/parser/issue-45296.rs @@ -2,4 +2,5 @@ fn main() { let unused = (); #![allow(unused_variables)] //~ ERROR not permitted in this context + fn foo() {} } diff --git a/src/test/ui/parser/issue-45296.stderr b/src/test/ui/parser/issue-45296.stderr index c0d4ce1243e..6abe266d4e9 100644 --- a/src/test/ui/parser/issue-45296.stderr +++ b/src/test/ui/parser/issue-45296.stderr @@ -3,8 +3,15 @@ error: an inner attribute is not permitted in this context | LL | #![allow(unused_variables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo() {} + | ----------- the inner attribute doesn't annotate this function | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files +help: to annotate the function, change the attribute from inner to outer style + | +LL - #![allow(unused_variables)] +LL + #[allow(unused_variables)] + | error: aborting due to previous error diff --git a/src/test/ui/parser/issue-58856-1.stderr b/src/test/ui/parser/issue-58856-1.stderr index f1abb40ed7a..2afb26d1758 100644 --- a/src/test/ui/parser/issue-58856-1.stderr +++ b/src/test/ui/parser/issue-58856-1.stderr @@ -1,8 +1,8 @@ error: expected one of `)`, `,`, or `:`, found `>` - --> $DIR/issue-58856-1.rs:3:14 + --> $DIR/issue-58856-1.rs:3:9 | LL | fn b(self> - | - ^ help: `)` may belong here + | ^ ^ help: `)` may belong here | | | unclosed delimiter diff --git a/src/test/ui/parser/issue-58856-2.stderr b/src/test/ui/parser/issue-58856-2.stderr index 303b5eacc32..627dd389059 100644 --- a/src/test/ui/parser/issue-58856-2.stderr +++ b/src/test/ui/parser/issue-58856-2.stderr @@ -1,8 +1,8 @@ error: expected one of `)` or `,`, found `->` - --> $DIR/issue-58856-2.rs:6:26 + --> $DIR/issue-58856-2.rs:6:19 | LL | fn how_are_you(&self -> Empty { - | - -^^ + | ^ -^^ | | | | | help: `)` may belong here | unclosed delimiter diff --git a/src/test/ui/parser/issue-60075.stderr b/src/test/ui/parser/issue-60075.stderr index e3b7f4ad420..210ef700cd4 100644 --- a/src/test/ui/parser/issue-60075.stderr +++ b/src/test/ui/parser/issue-60075.stderr @@ -17,10 +17,10 @@ LL | } | - item list ends here error: mismatched closing delimiter: `)` - --> $DIR/issue-60075.rs:6:10 + --> $DIR/issue-60075.rs:4:31 | LL | fn qux() -> Option<usize> { - | - unclosed delimiter + | ^ unclosed delimiter LL | let _ = if true { LL | }); | ^ mismatched closing delimiter diff --git a/src/test/ui/parser/issue-62973.stderr b/src/test/ui/parser/issue-62973.stderr index 3065d642fe1..51d835e7329 100644 --- a/src/test/ui/parser/issue-62973.stderr +++ b/src/test/ui/parser/issue-62973.stderr @@ -21,10 +21,10 @@ LL | | ^ error: expected one of `,` or `}`, found `{` - --> $DIR/issue-62973.rs:6:25 + --> $DIR/issue-62973.rs:6:8 | LL | fn p() { match s { v, E { [) {) } - | - - -^ expected one of `,` or `}` + | ^ - -^ expected one of `,` or `}` | | | | | | | help: `}` may belong here | | while parsing this struct @@ -56,18 +56,18 @@ LL | | ^ expected one of `.`, `?`, `{`, or an operator error: mismatched closing delimiter: `)` - --> $DIR/issue-62973.rs:6:28 + --> $DIR/issue-62973.rs:6:27 | LL | fn p() { match s { v, E { [) {) } - | -^ mismatched closing delimiter + | ^^ mismatched closing delimiter | | | unclosed delimiter error: mismatched closing delimiter: `)` - --> $DIR/issue-62973.rs:6:31 + --> $DIR/issue-62973.rs:6:30 | LL | fn p() { match s { v, E { [) {) } - | -^ mismatched closing delimiter + | ^^ mismatched closing delimiter | | | unclosed delimiter diff --git a/src/test/ui/parser/issue-63116.stderr b/src/test/ui/parser/issue-63116.stderr index 4766dfafea1..cfdd99d1434 100644 --- a/src/test/ui/parser/issue-63116.stderr +++ b/src/test/ui/parser/issue-63116.stderr @@ -13,10 +13,10 @@ LL | impl W <s(f;Y(;] | ^ expected one of 7 possible tokens error: mismatched closing delimiter: `]` - --> $DIR/issue-63116.rs:3:16 + --> $DIR/issue-63116.rs:3:14 | LL | impl W <s(f;Y(;] - | - ^ mismatched closing delimiter + | ^ ^ mismatched closing delimiter | | | unclosed delimiter diff --git a/src/test/ui/parser/issue-66357-unexpected-unreachable.stderr b/src/test/ui/parser/issue-66357-unexpected-unreachable.stderr index 332711df72f..6cbab855c76 100644 --- a/src/test/ui/parser/issue-66357-unexpected-unreachable.stderr +++ b/src/test/ui/parser/issue-66357-unexpected-unreachable.stderr @@ -5,10 +5,10 @@ LL | fn f() { |[](* } | ^ expected one of `,` or `:` error: expected one of `&`, `(`, `)`, `-`, `...`, `..=`, `..`, `[`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*` - --> $DIR/issue-66357-unexpected-unreachable.rs:12:14 + --> $DIR/issue-66357-unexpected-unreachable.rs:12:13 | LL | fn f() { |[](* } - | -^ help: `)` may belong here + | ^^ help: `)` may belong here | | | unclosed delimiter diff --git a/src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.stderr b/src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.stderr index f20ec755353..34f1397ce1d 100644 --- a/src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.stderr +++ b/src/test/ui/parser/issue-67377-invalid-syntax-in-enum-discriminant.stderr @@ -1,107 +1,107 @@ error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27 | LL | V = [PhantomData; { [ () ].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 | LL | V = [Vec::new; { [].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 | LL | V = [Vec::new; { [0].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27 | LL | V = [PhantomData; { [ () ].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 | LL | V = [Vec::new; { [].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 | LL | V = [Vec::new; { [0].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27 | LL | V = [PhantomData; { [ () ].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 | LL | V = [Vec::new; { [].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 | LL | V = [Vec::new; { [0].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:42 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27 | LL | V = [PhantomData; { [ () ].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:36 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 | LL | V = [Vec::new; { [].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:36 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 | LL | V = [Vec::new; { [0].len() ].len() as isize, - | - - ^ mismatched closing delimiter + | - ^ ^ mismatched closing delimiter | | | | | unclosed delimiter | closing delimiter possibly meant for this diff --git a/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr b/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr index 93c5ab383d4..077d3180048 100644 --- a/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr +++ b/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr @@ -1,8 +1,8 @@ error: mismatched closing delimiter: `)` - --> $DIR/macro-mismatched-delim-brace-paren.rs:6:5 + --> $DIR/macro-mismatched-delim-brace-paren.rs:4:10 | LL | foo! { - | - unclosed delimiter + | ^ unclosed delimiter LL | bar, "baz", 1, 2.0 LL | ) | ^ mismatched closing delimiter diff --git a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr index 424c7a60c19..967a3e6fdc1 100644 --- a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr +++ b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr @@ -10,10 +10,10 @@ LL | } | ^ unexpected closing delimiter error: mismatched closing delimiter: `}` - --> $DIR/macro-mismatched-delim-paren-brace.rs:4:5 + --> $DIR/macro-mismatched-delim-paren-brace.rs:2:10 | LL | foo! ( - | - unclosed delimiter + | ^ unclosed delimiter LL | bar, "baz", 1, 2.0 LL | } | ^ mismatched closing delimiter diff --git a/src/test/ui/parser/parser-recovery-2.stderr b/src/test/ui/parser/parser-recovery-2.stderr index cd3da4c71f0..0980d033fe7 100644 --- a/src/test/ui/parser/parser-recovery-2.stderr +++ b/src/test/ui/parser/parser-recovery-2.stderr @@ -5,10 +5,10 @@ LL | let x = y.; | ^ error: mismatched closing delimiter: `)` - --> $DIR/parser-recovery-2.rs:6:5 + --> $DIR/parser-recovery-2.rs:4:14 | LL | fn bar() { - | - unclosed delimiter + | ^ unclosed delimiter LL | let x = foo(); LL | ) | ^ mismatched closing delimiter diff --git a/src/test/ui/parser/stmt_expr_attrs_placement.stderr b/src/test/ui/parser/stmt_expr_attrs_placement.stderr index 808903d9c62..bf4005698a3 100644 --- a/src/test/ui/parser/stmt_expr_attrs_placement.stderr +++ b/src/test/ui/parser/stmt_expr_attrs_placement.stderr @@ -4,7 +4,8 @@ error: an inner attribute is not permitted in this context LL | let a = #![allow(warnings)] (1, 2); | ^^^^^^^^^^^^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/stmt_expr_attrs_placement.rs:10:14 @@ -12,7 +13,8 @@ error: an inner attribute is not permitted in this context LL | let b = (#![allow(warnings)] 1, 2); | ^^^^^^^^^^^^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/stmt_expr_attrs_placement.rs:15:10 @@ -20,7 +22,8 @@ error: an inner attribute is not permitted in this context LL | (#![allow(warnings)] 1, 2) | ^^^^^^^^^^^^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/stmt_expr_attrs_placement.rs:21:18 @@ -28,7 +31,8 @@ error: an inner attribute is not permitted in this context LL | let e = (#![allow(warnings)] 1, 2); | ^^^^^^^^^^^^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/stmt_expr_attrs_placement.rs:26:14 @@ -36,7 +40,8 @@ error: an inner attribute is not permitted in this context LL | let e = [#![allow(warnings)] 1, 2]; | ^^^^^^^^^^^^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/stmt_expr_attrs_placement.rs:29:14 @@ -44,7 +49,8 @@ error: an inner attribute is not permitted in this context LL | let f = [#![allow(warnings)] 1; 0]; | ^^^^^^^^^^^^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context --> $DIR/stmt_expr_attrs_placement.rs:36:24 @@ -52,7 +58,8 @@ error: an inner attribute is not permitted in this context LL | let h = MyStruct { #![allow(warnings)] field: 0 }; | ^^^^^^^^^^^^^^^^^^^ | - = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them error: aborting due to 7 previous errors diff --git a/src/test/ui/parser/unclosed-delimiter-in-dep.stderr b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr index 00861a5a3d4..1366ef1bba8 100644 --- a/src/test/ui/parser/unclosed-delimiter-in-dep.stderr +++ b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr @@ -1,10 +1,10 @@ error: mismatched closing delimiter: `}` - --> $DIR/unclosed_delim_mod.rs:7:1 + --> $DIR/unclosed_delim_mod.rs:5:7 | LL | pub fn new() -> Result<Value, ()> { | - closing delimiter possibly meant for this LL | Ok(Value { - | - unclosed delimiter + | ^ unclosed delimiter LL | } LL | } | ^ mismatched closing delimiter diff --git a/src/test/ui/parser/unclosed_delim_mod.stderr b/src/test/ui/parser/unclosed_delim_mod.stderr index 9c167072123..a46d020b967 100644 --- a/src/test/ui/parser/unclosed_delim_mod.stderr +++ b/src/test/ui/parser/unclosed_delim_mod.stderr @@ -1,10 +1,10 @@ error: mismatched closing delimiter: `}` - --> $DIR/unclosed_delim_mod.rs:7:1 + --> $DIR/unclosed_delim_mod.rs:5:7 | LL | pub fn new() -> Result<Value, ()> { | - closing delimiter possibly meant for this LL | Ok(Value { - | - unclosed delimiter + | ^ unclosed delimiter LL | } LL | } | ^ mismatched closing delimiter diff --git a/src/test/ui/parser/use-unclosed-brace.stderr b/src/test/ui/parser/use-unclosed-brace.stderr index d29a68f8214..438fe9c47ea 100644 --- a/src/test/ui/parser/use-unclosed-brace.stderr +++ b/src/test/ui/parser/use-unclosed-brace.stderr @@ -8,10 +8,10 @@ LL | fn main() {} | ^ error: expected one of `,`, `::`, `as`, or `}`, found `;` - --> $DIR/use-unclosed-brace.rs:4:19 + --> $DIR/use-unclosed-brace.rs:4:10 | LL | use foo::{bar, baz; - | - ^ + | ^ ^ | | | | | expected one of `,`, `::`, `as`, or `}` | | help: `}` may belong here diff --git a/src/test/ui/proc-macro/attribute-with-error.stderr b/src/test/ui/proc-macro/attribute-with-error.stderr index 7f3a7e670b9..127c49957c1 100644 --- a/src/test/ui/proc-macro/attribute-with-error.stderr +++ b/src/test/ui/proc-macro/attribute-with-error.stderr @@ -1,4 +1,12 @@ error[E0308]: mismatched types + --> $DIR/attribute-with-error.rs:25:22 + | +LL | let a: i32 = "foo"; + | --- ^^^^^ expected `i32`, found `&str` + | | + | expected due to this + +error[E0308]: mismatched types --> $DIR/attribute-with-error.rs:10:18 | LL | let a: i32 = "foo"; @@ -15,14 +23,6 @@ LL | let b: i32 = "f'oo"; | expected due to this error[E0308]: mismatched types - --> $DIR/attribute-with-error.rs:25:22 - | -LL | let a: i32 = "foo"; - | --- ^^^^^ expected `i32`, found `&str` - | | - | expected due to this - -error[E0308]: mismatched types --> $DIR/attribute-with-error.rs:35:22 | LL | let a: i32 = "foo"; diff --git a/src/test/ui/proc-macro/issue-86781-bad-inner-doc.fixed b/src/test/ui/proc-macro/issue-86781-bad-inner-doc.fixed new file mode 100644 index 00000000000..426a5fa723f --- /dev/null +++ b/src/test/ui/proc-macro/issue-86781-bad-inner-doc.fixed @@ -0,0 +1,12 @@ +// aux-build:test-macros.rs +// run-rustfix + +#[macro_use] +extern crate test_macros; + +/// Inner doc comment +//~^ ERROR expected outer doc comment +#[derive(Empty)] +pub struct Foo; //~ NOTE the inner doc comment doesn't annotate this struct + +fn main() {} diff --git a/src/test/ui/proc-macro/issue-86781-bad-inner-doc.rs b/src/test/ui/proc-macro/issue-86781-bad-inner-doc.rs index 8be1ae77738..31e3f3c8592 100644 --- a/src/test/ui/proc-macro/issue-86781-bad-inner-doc.rs +++ b/src/test/ui/proc-macro/issue-86781-bad-inner-doc.rs @@ -1,4 +1,5 @@ // aux-build:test-macros.rs +// run-rustfix #[macro_use] extern crate test_macros; @@ -6,6 +7,6 @@ extern crate test_macros; //! Inner doc comment //~^ ERROR expected outer doc comment #[derive(Empty)] -pub struct Foo; +pub struct Foo; //~ NOTE the inner doc comment doesn't annotate this struct fn main() {} diff --git a/src/test/ui/proc-macro/issue-86781-bad-inner-doc.stderr b/src/test/ui/proc-macro/issue-86781-bad-inner-doc.stderr index 0b2e612ee5b..a92f07522e5 100644 --- a/src/test/ui/proc-macro/issue-86781-bad-inner-doc.stderr +++ b/src/test/ui/proc-macro/issue-86781-bad-inner-doc.stderr @@ -1,10 +1,16 @@ error[E0753]: expected outer doc comment - --> $DIR/issue-86781-bad-inner-doc.rs:6:1 + --> $DIR/issue-86781-bad-inner-doc.rs:7:1 | LL | //! Inner doc comment | ^^^^^^^^^^^^^^^^^^^^^ +... +LL | pub struct Foo; + | --------------- the inner doc comment doesn't annotate this struct | - = note: inner doc comments like this (starting with `//!` or `/*!`) can only appear before items +help: to annotate the struct, change the doc comment from inner to outer style + | +LL | /// Inner doc comment + | ~ error: aborting due to previous error diff --git a/src/test/ui/remap-path-prefix.rs b/src/test/ui/remap-path-prefix.rs new file mode 100644 index 00000000000..2eef9709977 --- /dev/null +++ b/src/test/ui/remap-path-prefix.rs @@ -0,0 +1,9 @@ +// compile-flags: --remap-path-prefix={{src-base}}=remapped + +fn main() { + // We cannot actually put an ERROR marker here because + // the file name in the error message is not what the + // test framework expects (since the filename gets remapped). + // We still test the expected error in the stderr file. + ferris +} diff --git a/src/test/ui/remap-path-prefix.stderr b/src/test/ui/remap-path-prefix.stderr new file mode 100644 index 00000000000..ad6a35d1256 --- /dev/null +++ b/src/test/ui/remap-path-prefix.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `ferris` in this scope + --> remapped/remap-path-prefix.rs:8:5 + | +LL | ferris + | ^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/repeat_count.stderr b/src/test/ui/repeat_count.stderr index cd07e5b8935..c85f0572031 100644 --- a/src/test/ui/repeat_count.stderr +++ b/src/test/ui/repeat_count.stderr @@ -31,12 +31,6 @@ LL | let e = [0; "foo"]; | ^^^^^ expected `usize`, found `&str` error[E0308]: mismatched types - --> $DIR/repeat_count.rs:31:17 - | -LL | let g = [0; G { g: () }]; - | ^^^^^^^^^^^ expected `usize`, found struct `G` - -error[E0308]: mismatched types --> $DIR/repeat_count.rs:19:17 | LL | let f = [0; -4_isize]; @@ -63,6 +57,12 @@ help: change the type of the numeric literal from `u8` to `usize` LL | let f = [0; 4usize]; | ~~~~~~ +error[E0308]: mismatched types + --> $DIR/repeat_count.rs:31:17 + | +LL | let g = [0; G { g: () }]; + | ^^^^^^^^^^^ expected `usize`, found struct `G` + error: aborting due to 9 previous errors Some errors have detailed explanations: E0308, E0435. diff --git a/src/test/ui/resolve/token-error-correct-2.stderr b/src/test/ui/resolve/token-error-correct-2.stderr index 4014af2f41b..cca9f2dc88c 100644 --- a/src/test/ui/resolve/token-error-correct-2.stderr +++ b/src/test/ui/resolve/token-error-correct-2.stderr @@ -1,8 +1,8 @@ error: mismatched closing delimiter: `)` - --> $DIR/token-error-correct-2.rs:6:5 + --> $DIR/token-error-correct-2.rs:4:12 | LL | if foo { - | - unclosed delimiter + | ^ unclosed delimiter LL | LL | ) | ^ mismatched closing delimiter diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr index 31087e394ad..77c87c78466 100644 --- a/src/test/ui/resolve/token-error-correct-3.stderr +++ b/src/test/ui/resolve/token-error-correct-3.stderr @@ -1,8 +1,8 @@ error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` - --> $DIR/token-error-correct-3.rs:13:35 + --> $DIR/token-error-correct-3.rs:13:21 | LL | callback(path.as_ref(); - | - ^ help: `)` may belong here + | ^ ^ help: `)` may belong here | | | unclosed delimiter diff --git a/src/test/ui/resolve/token-error-correct-4.stderr b/src/test/ui/resolve/token-error-correct-4.stderr index 64aff54ba73..81e5a133691 100644 --- a/src/test/ui/resolve/token-error-correct-4.stderr +++ b/src/test/ui/resolve/token-error-correct-4.stderr @@ -1,8 +1,8 @@ error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` - --> $DIR/token-error-correct-4.rs:9:21 + --> $DIR/token-error-correct-4.rs:9:12 | LL | setsuna(kazusa(); - | - ^ help: `)` may belong here + | ^ ^ help: `)` may belong here | | | unclosed delimiter diff --git a/src/test/ui/resolve/token-error-correct.stderr b/src/test/ui/resolve/token-error-correct.stderr index bf300ecd781..ca0c4c18ad4 100644 --- a/src/test/ui/resolve/token-error-correct.stderr +++ b/src/test/ui/resolve/token-error-correct.stderr @@ -1,10 +1,10 @@ error: mismatched closing delimiter: `}` - --> $DIR/token-error-correct.rs:6:1 + --> $DIR/token-error-correct.rs:4:12 | LL | fn main() { | - closing delimiter possibly meant for this LL | foo(bar(; - | - unclosed delimiter + | ^ unclosed delimiter LL | LL | } | ^ mismatched closing delimiter diff --git a/src/test/ui/suggestions/impl-trait-with-missing-bounds.stderr b/src/test/ui/suggestions/impl-trait-with-missing-bounds.stderr index 1cde42ff2cb..bb7919ebb79 100644 --- a/src/test/ui/suggestions/impl-trait-with-missing-bounds.stderr +++ b/src/test/ui/suggestions/impl-trait-with-missing-bounds.stderr @@ -1,21 +1,4 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` - --> $DIR/impl-trait-with-missing-bounds.rs:6:13 - | -LL | qux(constraint); - | ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` - | - = help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item` -note: required by a bound in `qux` - --> $DIR/impl-trait-with-missing-bounds.rs:50:16 - | -LL | fn qux(_: impl std::fmt::Debug) {} - | ^^^^^^^^^^^^^^^ required by this bound in `qux` -help: introduce a type parameter with a trait bound instead of using `impl Trait` - | -LL | fn foo<I: Iterator>(constraints: I) where <I as Iterator>::Item: Debug { - | +++++++++++++ ~ ++++++++++++++++++++++++++++++++++ - -error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:14:13 | LL | qux(constraint); @@ -84,6 +67,23 @@ LL | fn bak<I: Iterator + std::fmt::Debug>(constraints: I) where <I as Iterator> | +++++++++++++++++++++++++++++++ ~ ++++++++++++++++++++++++++++++++++ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` + --> $DIR/impl-trait-with-missing-bounds.rs:6:13 + | +LL | qux(constraint); + | ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` + | + = help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item` +note: required by a bound in `qux` + --> $DIR/impl-trait-with-missing-bounds.rs:50:16 + | +LL | fn qux(_: impl std::fmt::Debug) {} + | ^^^^^^^^^^^^^^^ required by this bound in `qux` +help: introduce a type parameter with a trait bound instead of using `impl Trait` + | +LL | fn foo<I: Iterator>(constraints: I) where <I as Iterator>::Item: Debug { + | +++++++++++++ ~ ++++++++++++++++++++++++++++++++++ + +error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:45:13 | LL | qux(constraint); diff --git a/src/test/ui/suggestions/suggest-ref-macro.stderr b/src/test/ui/suggestions/suggest-ref-macro.stderr index 147001f0c94..1f41d2329ee 100644 --- a/src/test/ui/suggestions/suggest-ref-macro.stderr +++ b/src/test/ui/suggestions/suggest-ref-macro.stderr @@ -1,12 +1,4 @@ error[E0308]: mismatched types - --> $DIR/suggest-ref-macro.rs:8:1 - | -LL | #[hello] - | ^^^^^^^^ expected `&mut i32`, found integer - | - = note: this error originates in the attribute macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0308]: mismatched types --> $DIR/suggest-ref-macro.rs:15:11 | LL | x(123); @@ -29,6 +21,14 @@ LL | bla!(456); | expected `&mut i32`, found integer | help: consider mutably borrowing here: `&mut 456` +error[E0308]: mismatched types + --> $DIR/suggest-ref-macro.rs:8:1 + | +LL | #[hello] + | ^^^^^^^^ expected `&mut i32`, found integer + | + = note: this error originates in the attribute macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info) + error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/traits/cycle-cache-err-60010.rs b/src/test/ui/traits/cycle-cache-err-60010.rs index 98bfcb8d67b..94e718317e7 100644 --- a/src/test/ui/traits/cycle-cache-err-60010.rs +++ b/src/test/ui/traits/cycle-cache-err-60010.rs @@ -25,6 +25,7 @@ struct Runtime<DB: Database> { } struct SalsaStorage { _parse: <ParseQuery as Query<RootDatabase>>::Data, + //~^ ERROR overflow } impl Database for RootDatabase { @@ -67,7 +68,6 @@ pub(crate) fn goto_implementation(db: &RootDatabase) -> u32 { // we used to fail to report an error here because we got the // caching wrong. SourceDatabase::parse(db); - //~^ ERROR overflow 22 } diff --git a/src/test/ui/traits/cycle-cache-err-60010.stderr b/src/test/ui/traits/cycle-cache-err-60010.stderr index 565899677bf..9452e11e302 100644 --- a/src/test/ui/traits/cycle-cache-err-60010.stderr +++ b/src/test/ui/traits/cycle-cache-err-60010.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `SalsaStorage: RefUnwindSafe` - --> $DIR/cycle-cache-err-60010.rs:69:5 + --> $DIR/cycle-cache-err-60010.rs:27:13 | -LL | SourceDatabase::parse(db); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | _parse: <ParseQuery as Query<RootDatabase>>::Data, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: required because it appears within the type `*const SalsaStorage` = note: required because it appears within the type `Unique<SalsaStorage>` @@ -18,15 +18,15 @@ note: required because it appears within the type `RootDatabase` LL | struct RootDatabase { | ^^^^^^^^^^^^ note: required because of the requirements on the impl of `SourceDatabase` for `RootDatabase` - --> $DIR/cycle-cache-err-60010.rs:43:9 + --> $DIR/cycle-cache-err-60010.rs:44:9 | LL | impl<T> SourceDatabase for T | ^^^^^^^^^^^^^^ ^ -note: required by `SourceDatabase::parse` - --> $DIR/cycle-cache-err-60010.rs:14:5 +note: required because of the requirements on the impl of `Query<RootDatabase>` for `ParseQuery` + --> $DIR/cycle-cache-err-60010.rs:37:10 | -LL | fn parse(&self) { - | ^^^^^^^^^^^^^^^ +LL | impl<DB> Query<DB> for ParseQuery + | ^^^^^^^^^ ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/inductive-overflow/lifetime.rs b/src/test/ui/traits/inductive-overflow/lifetime.rs index 072c46bc21e..8be42fc4ad0 100644 --- a/src/test/ui/traits/inductive-overflow/lifetime.rs +++ b/src/test/ui/traits/inductive-overflow/lifetime.rs @@ -15,8 +15,8 @@ impl<'a> Y for C<'a> { struct C<'a>(&'a ()); struct X<T: Y>(T::P); -impl<T: NotAuto> NotAuto for Box<T> {} -impl<T: Y> NotAuto for X<T> where T::P: NotAuto {} //~ NOTE: required +impl<T: NotAuto> NotAuto for Box<T> {} //~ NOTE: required +impl<T: Y> NotAuto for X<T> where T::P: NotAuto {} impl<'a> NotAuto for C<'a> {} fn is_send<S: NotAuto>() {} @@ -26,6 +26,6 @@ fn main() { // Should only be a few notes. is_send::<X<C<'static>>>(); //~^ ERROR overflow evaluating - //~| 2 redundant requirements hidden + //~| 3 redundant requirements hidden //~| required because of } diff --git a/src/test/ui/traits/inductive-overflow/lifetime.stderr b/src/test/ui/traits/inductive-overflow/lifetime.stderr index 2905deb940f..2ffcdb0e1c6 100644 --- a/src/test/ui/traits/inductive-overflow/lifetime.stderr +++ b/src/test/ui/traits/inductive-overflow/lifetime.stderr @@ -1,15 +1,15 @@ -error[E0275]: overflow evaluating the requirement `Box<X<C<'_>>>: NotAuto` +error[E0275]: overflow evaluating the requirement `X<C<'_>>: NotAuto` --> $DIR/lifetime.rs:27:5 | LL | is_send::<X<C<'static>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | -note: required because of the requirements on the impl of `NotAuto` for `X<C<'_>>` - --> $DIR/lifetime.rs:19:12 +note: required because of the requirements on the impl of `NotAuto` for `Box<X<C<'_>>>` + --> $DIR/lifetime.rs:18:18 | -LL | impl<T: Y> NotAuto for X<T> where T::P: NotAuto {} - | ^^^^^^^ ^^^^ - = note: 2 redundant requirements hidden +LL | impl<T: NotAuto> NotAuto for Box<T> {} + | ^^^^^^^ ^^^^^^ + = note: 3 redundant requirements hidden = note: required because of the requirements on the impl of `NotAuto` for `X<C<'static>>` note: required by a bound in `is_send` --> $DIR/lifetime.rs:22:15 diff --git a/src/test/ui/traits/inductive-overflow/simultaneous.stderr b/src/test/ui/traits/inductive-overflow/simultaneous.stderr index 7eb1c9ffb3b..230c2638c50 100644 --- a/src/test/ui/traits/inductive-overflow/simultaneous.stderr +++ b/src/test/ui/traits/inductive-overflow/simultaneous.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `{integer}: Tweedledee` +error[E0275]: overflow evaluating the requirement `{integer}: Tweedledum` --> $DIR/simultaneous.rs:18:5 | LL | is_ee(4); diff --git a/src/test/ui/type-alias-impl-trait/auto-trait-leakage3.stderr b/src/test/ui/type-alias-impl-trait/auto-trait-leakage3.stderr index ac7bbd272c7..86b3f87d34d 100644 --- a/src/test/ui/type-alias-impl-trait/auto-trait-leakage3.stderr +++ b/src/test/ui/type-alias-impl-trait/auto-trait-leakage3.stderr @@ -5,10 +5,10 @@ LL | type Foo = impl std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^ | note: ...which requires type-checking `m::bar`... - --> $DIR/auto-trait-leakage3.rs:14:5 + --> $DIR/auto-trait-leakage3.rs:15:9 | -LL | pub fn bar() { - | ^^^^^^^^^^^^ +LL | is_send(foo()); + | ^^^^^^^ = note: ...which requires evaluating trait selection obligation `impl std::fmt::Debug: std::marker::Send`... = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle note: cycle used when checking item types in module `m` diff --git a/src/test/ui/type-alias-impl-trait/inference-cycle.stderr b/src/test/ui/type-alias-impl-trait/inference-cycle.stderr index ac0ca8e048c..4c5921c7f66 100644 --- a/src/test/ui/type-alias-impl-trait/inference-cycle.stderr +++ b/src/test/ui/type-alias-impl-trait/inference-cycle.stderr @@ -5,10 +5,10 @@ LL | type Foo = impl std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^ | note: ...which requires type-checking `m::bar`... - --> $DIR/inference-cycle.rs:14:5 + --> $DIR/inference-cycle.rs:15:9 | -LL | pub fn bar() { - | ^^^^^^^^^^^^ +LL | is_send(foo()); // Today: error + | ^^^^^^^ = note: ...which requires evaluating trait selection obligation `impl std::fmt::Debug: std::marker::Send`... = note: ...which again requires computing type of `m::Foo::{opaque#0}`, completing the cycle note: cycle used when checking item types in module `m` diff --git a/src/test/ui/type/ascription/issue-34255-1.stderr b/src/test/ui/type/ascription/issue-34255-1.stderr index 96ee422b7b9..43f0fbbc4e3 100644 --- a/src/test/ui/type/ascription/issue-34255-1.stderr +++ b/src/test/ui/type/ascription/issue-34255-1.stderr @@ -3,6 +3,16 @@ error[E0425]: cannot find value `input_cells` in this scope | LL | input_cells: Vec::new() | ^^^^^^^^^^^ a field by this name exists in `Self` + | +help: you might have meant to write a `struct` literal + | +LL ~ pub fn new() -> Self { SomeStruct { +LL | input_cells: Vec::new() +LL | +LL | +LL | +LL ~ }} + | error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/issue-34255-1.rs:7:27 diff --git a/src/test/ui/union/union-derive-clone.mirunsafeck.stderr b/src/test/ui/union/union-derive-clone.mirunsafeck.stderr index 414d2759a47..b52117cd19c 100644 --- a/src/test/ui/union/union-derive-clone.mirunsafeck.stderr +++ b/src/test/ui/union/union-derive-clone.mirunsafeck.stderr @@ -1,16 +1,3 @@ -error[E0277]: the trait bound `U1: Copy` is not satisfied - --> $DIR/union-derive-clone.rs:6:10 - | -LL | #[derive(Clone)] - | ^^^^^ the trait `Copy` is not implemented for `U1` - | -note: required by a bound in `AssertParamIsCopy` - --> $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> { - | ^^^^ required by this bound in `AssertParamIsCopy` - = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0599]: the method `clone` exists for union `U5<CloneNoCopy>`, but its trait bounds were not satisfied --> $DIR/union-derive-clone.rs:38:15 | @@ -30,6 +17,19 @@ LL | let w = u.clone(); `CloneNoCopy: Copy` which is required by `U5<CloneNoCopy>: Clone` +error[E0277]: the trait bound `U1: Copy` is not satisfied + --> $DIR/union-derive-clone.rs:6:10 + | +LL | #[derive(Clone)] + | ^^^^^ the trait `Copy` is not implemented for `U1` + | +note: required by a bound in `AssertParamIsCopy` + --> $SRC_DIR/core/src/clone.rs:LL:COL + | +LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> { + | ^^^^ required by this bound in `AssertParamIsCopy` + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) + error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0599. diff --git a/src/test/ui/union/union-derive-clone.thirunsafeck.stderr b/src/test/ui/union/union-derive-clone.thirunsafeck.stderr index 414d2759a47..b52117cd19c 100644 --- a/src/test/ui/union/union-derive-clone.thirunsafeck.stderr +++ b/src/test/ui/union/union-derive-clone.thirunsafeck.stderr @@ -1,16 +1,3 @@ -error[E0277]: the trait bound `U1: Copy` is not satisfied - --> $DIR/union-derive-clone.rs:6:10 - | -LL | #[derive(Clone)] - | ^^^^^ the trait `Copy` is not implemented for `U1` - | -note: required by a bound in `AssertParamIsCopy` - --> $SRC_DIR/core/src/clone.rs:LL:COL - | -LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> { - | ^^^^ required by this bound in `AssertParamIsCopy` - = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0599]: the method `clone` exists for union `U5<CloneNoCopy>`, but its trait bounds were not satisfied --> $DIR/union-derive-clone.rs:38:15 | @@ -30,6 +17,19 @@ LL | let w = u.clone(); `CloneNoCopy: Copy` which is required by `U5<CloneNoCopy>: Clone` +error[E0277]: the trait bound `U1: Copy` is not satisfied + --> $DIR/union-derive-clone.rs:6:10 + | +LL | #[derive(Clone)] + | ^^^^^ the trait `Copy` is not implemented for `U1` + | +note: required by a bound in `AssertParamIsCopy` + --> $SRC_DIR/core/src/clone.rs:LL:COL + | +LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> { + | ^^^^ required by this bound in `AssertParamIsCopy` + = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) + error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0599. |
