diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs index d52cea74520bd..3926122606e6d 100644 --- a/src/librustc_parse/parser/expr.rs +++ b/src/librustc_parse/parser/expr.rs @@ -1833,7 +1833,7 @@ impl<'a> Parser<'a> { let require_comma = classify::expr_requires_semi_to_be_stmt(&expr) && self.token != token::CloseDelim(token::Brace); - let hi = self.token.span; + let hi = self.prev_token.span; if require_comma { let sm = self.sess.source_map(); diff --git a/src/test/mir-opt/exponential-or/rustc.match_tuple.SimplifyCfg-initial.after.mir b/src/test/mir-opt/exponential-or/rustc.match_tuple.SimplifyCfg-initial.after.mir index b84ca5df9964e..00942cd12b42c 100644 --- a/src/test/mir-opt/exponential-or/rustc.match_tuple.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/exponential-or/rustc.match_tuple.SimplifyCfg-initial.after.mir @@ -102,8 +102,8 @@ fn match_tuple(_1: (u32, bool, std::option::Option, u32)) -> u32 { _0 = BitXor(move _9, move _10); // scope 1 at $DIR/exponential-or.rs:8:83: 8:88 StorageDead(_10); // scope 1 at $DIR/exponential-or.rs:8:87: 8:88 StorageDead(_9); // scope 1 at $DIR/exponential-or.rs:8:87: 8:88 - StorageDead(_8); // scope 0 at $DIR/exponential-or.rs:8:88: 8:89 - StorageDead(_7); // scope 0 at $DIR/exponential-or.rs:8:88: 8:89 + StorageDead(_8); // scope 0 at $DIR/exponential-or.rs:8:87: 8:88 + StorageDead(_7); // scope 0 at $DIR/exponential-or.rs:8:87: 8:88 goto -> bb10; // scope 0 at $DIR/exponential-or.rs:7:5: 10:6 } diff --git a/src/test/mir-opt/issue-73223/32bit/rustc.main.SimplifyArmIdentity.diff b/src/test/mir-opt/issue-73223/32bit/rustc.main.SimplifyArmIdentity.diff index e5b4a0328808f..1020fc965fe86 100644 --- a/src/test/mir-opt/issue-73223/32bit/rustc.main.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/issue-73223/32bit/rustc.main.SimplifyArmIdentity.diff @@ -137,7 +137,7 @@ StorageLive(_4); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 _4 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 _1 = _4; // scope 2 at $DIR/issue-73223.rs:3:20: 3:21 - StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:3:21: 3:22 + StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21 StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 StorageLive(_6); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14 StorageLive(_7); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 diff --git a/src/test/mir-opt/issue-73223/64bit/rustc.main.SimplifyArmIdentity.diff b/src/test/mir-opt/issue-73223/64bit/rustc.main.SimplifyArmIdentity.diff index 0c2651dc3c68d..aa606ed22b6d0 100644 --- a/src/test/mir-opt/issue-73223/64bit/rustc.main.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/issue-73223/64bit/rustc.main.SimplifyArmIdentity.diff @@ -137,7 +137,7 @@ StorageLive(_4); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 _4 = ((_2 as Some).0: i32); // scope 0 at $DIR/issue-73223.rs:3:14: 3:15 _1 = _4; // scope 2 at $DIR/issue-73223.rs:3:20: 3:21 - StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:3:21: 3:22 + StorageDead(_4); // scope 0 at $DIR/issue-73223.rs:3:20: 3:21 StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 StorageLive(_6); // scope 1 at $DIR/issue-73223.rs:7:9: 7:14 StorageLive(_7); // scope 1 at $DIR/issue-73223.rs:7:22: 7:27 diff --git a/src/test/mir-opt/match-arm-scopes/rustc.complicated_match.ElaborateDrops.after.mir b/src/test/mir-opt/match-arm-scopes/rustc.complicated_match.ElaborateDrops.after.mir index c6832f21208d4..df6a247bb5ff6 100644 --- a/src/test/mir-opt/match-arm-scopes/rustc.complicated_match.ElaborateDrops.after.mir +++ b/src/test/mir-opt/match-arm-scopes/rustc.complicated_match.ElaborateDrops.after.mir @@ -61,7 +61,7 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { // mir::Constant // + span: $DIR/match-arm-scopes.rs:16:77: 16:78 // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } - drop(_7) -> [return: bb19, unwind: bb10]; // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + drop(_7) -> [return: bb19, unwind: bb10]; // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 } bb6: { @@ -90,9 +90,9 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { // + span: $DIR/match-arm-scopes.rs:16:59: 16:60 // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) } StorageDead(_10); // scope 0 at $DIR/match-arm-scopes.rs:16:72: 16:73 - StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 goto -> bb11; // scope 0 at $DIR/match-arm-scopes.rs:16:52: 16:60 } @@ -109,7 +109,7 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { } bb12: { - StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 StorageLive(_5); // scope 0 at $DIR/match-arm-scopes.rs:16:17: 16:18 _5 = (_2.1: bool); // scope 0 at $DIR/match-arm-scopes.rs:16:17: 16:18 StorageLive(_7); // scope 0 at $DIR/match-arm-scopes.rs:16:20: 16:21 @@ -118,9 +118,9 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { } bb13: { - StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 goto -> bb2; // scope 0 at $DIR/match-arm-scopes.rs:16:42: 16:73 } @@ -150,14 +150,14 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { // + span: $DIR/match-arm-scopes.rs:16:59: 16:60 // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) } StorageDead(_13); // scope 0 at $DIR/match-arm-scopes.rs:16:72: 16:73 - StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 goto -> bb11; // scope 0 at $DIR/match-arm-scopes.rs:16:52: 16:60 } bb17: { - StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 StorageLive(_5); // scope 0 at $DIR/match-arm-scopes.rs:16:26: 16:27 _5 = (_2.0: bool); // scope 0 at $DIR/match-arm-scopes.rs:16:26: 16:27 StorageLive(_7); // scope 0 at $DIR/match-arm-scopes.rs:16:36: 16:37 @@ -166,17 +166,17 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { } bb18: { - StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 goto -> bb3; // scope 0 at $DIR/match-arm-scopes.rs:16:42: 16:73 } bb19: { - StorageDead(_7); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_5); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_7); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_5); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 goto -> bb23; // scope 0 at $DIR/match-arm-scopes.rs:15:5: 18:6 } @@ -188,7 +188,7 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { // mir::Constant // + span: $DIR/match-arm-scopes.rs:17:41: 17:42 // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) } - drop(_16) -> [return: bb22, unwind: bb10]; // scope 0 at $DIR/match-arm-scopes.rs:17:42: 17:43 + drop(_16) -> [return: bb22, unwind: bb10]; // scope 0 at $DIR/match-arm-scopes.rs:17:41: 17:42 } bb21: { @@ -200,8 +200,8 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { } bb22: { - StorageDead(_16); // scope 0 at $DIR/match-arm-scopes.rs:17:42: 17:43 - StorageDead(_15); // scope 0 at $DIR/match-arm-scopes.rs:17:42: 17:43 + StorageDead(_16); // scope 0 at $DIR/match-arm-scopes.rs:17:41: 17:42 + StorageDead(_15); // scope 0 at $DIR/match-arm-scopes.rs:17:41: 17:42 goto -> bb23; // scope 0 at $DIR/match-arm-scopes.rs:15:5: 18:6 } diff --git a/src/test/mir-opt/match-arm-scopes/rustc.complicated_match.SimplifyCfg-initial.after.mir b/src/test/mir-opt/match-arm-scopes/rustc.complicated_match.SimplifyCfg-initial.after.mir index 45f7e91d097c0..dadbc3668cb29 100644 --- a/src/test/mir-opt/match-arm-scopes/rustc.complicated_match.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/match-arm-scopes/rustc.complicated_match.SimplifyCfg-initial.after.mir @@ -74,7 +74,7 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { // mir::Constant // + span: $DIR/match-arm-scopes.rs:16:77: 16:78 // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } - drop(_7) -> [return: bb24, unwind: bb14]; // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + drop(_7) -> [return: bb24, unwind: bb14]; // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 } bb9: { @@ -110,9 +110,9 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { // + span: $DIR/match-arm-scopes.rs:16:59: 16:60 // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) } StorageDead(_10); // scope 0 at $DIR/match-arm-scopes.rs:16:72: 16:73 - StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 goto -> bb15; // scope 0 at $DIR/match-arm-scopes.rs:16:52: 16:60 } @@ -129,7 +129,7 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { } bb16: { - StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 FakeRead(ForMatchGuard, _3); // scope 0 at $DIR/match-arm-scopes.rs:16:72: 16:73 FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match-arm-scopes.rs:16:72: 16:73 FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match-arm-scopes.rs:16:72: 16:73 @@ -142,9 +142,9 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { } bb17: { - StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_9); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 falseEdge -> [real: bb3, imaginary: bb4]; // scope 0 at $DIR/match-arm-scopes.rs:16:42: 16:73 } @@ -181,14 +181,14 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { // + span: $DIR/match-arm-scopes.rs:16:59: 16:60 // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) } StorageDead(_13); // scope 0 at $DIR/match-arm-scopes.rs:16:72: 16:73 - StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 goto -> bb15; // scope 0 at $DIR/match-arm-scopes.rs:16:52: 16:60 } bb22: { - StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 FakeRead(ForMatchGuard, _3); // scope 0 at $DIR/match-arm-scopes.rs:16:72: 16:73 FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match-arm-scopes.rs:16:72: 16:73 FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match-arm-scopes.rs:16:72: 16:73 @@ -201,17 +201,17 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { } bb23: { - StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_12); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 falseEdge -> [real: bb5, imaginary: bb6]; // scope 0 at $DIR/match-arm-scopes.rs:16:42: 16:73 } bb24: { - StorageDead(_7); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_5); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 - StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:78: 16:79 + StorageDead(_7); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_5); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_8); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 + StorageDead(_6); // scope 0 at $DIR/match-arm-scopes.rs:16:77: 16:78 goto -> bb28; // scope 0 at $DIR/match-arm-scopes.rs:15:5: 18:6 } @@ -223,7 +223,7 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { // mir::Constant // + span: $DIR/match-arm-scopes.rs:17:41: 17:42 // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) } - drop(_16) -> [return: bb27, unwind: bb14]; // scope 0 at $DIR/match-arm-scopes.rs:17:42: 17:43 + drop(_16) -> [return: bb27, unwind: bb14]; // scope 0 at $DIR/match-arm-scopes.rs:17:41: 17:42 } bb26: { @@ -235,8 +235,8 @@ fn complicated_match(_1: bool, _2: (bool, bool, std::string::String)) -> i32 { } bb27: { - StorageDead(_16); // scope 0 at $DIR/match-arm-scopes.rs:17:42: 17:43 - StorageDead(_15); // scope 0 at $DIR/match-arm-scopes.rs:17:42: 17:43 + StorageDead(_16); // scope 0 at $DIR/match-arm-scopes.rs:17:41: 17:42 + StorageDead(_15); // scope 0 at $DIR/match-arm-scopes.rs:17:41: 17:42 goto -> bb28; // scope 0 at $DIR/match-arm-scopes.rs:15:5: 18:6 } diff --git a/src/test/mir-opt/match_false_edges/rustc.full_tested_match.PromoteTemps.after.mir b/src/test/mir-opt/match_false_edges/rustc.full_tested_match.PromoteTemps.after.mir index d4a2afe295781..5ff4150d2ac1a 100644 --- a/src/test/mir-opt/match_false_edges/rustc.full_tested_match.PromoteTemps.after.mir +++ b/src/test/mir-opt/match_false_edges/rustc.full_tested_match.PromoteTemps.after.mir @@ -97,7 +97,7 @@ fn full_tested_match() -> () { } bb8: { - StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:16:37: 16:38 + 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 @@ -112,14 +112,14 @@ fn full_tested_match() -> () { // + span: $DIR/match_false_edges.rs:16:32: 16:33 // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } 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:37: 16:38 - StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:16:37: 16:38 + StorageDead(_5); // 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 -> bb11; // scope 0 at $DIR/match_false_edges.rs:15:13: 19:6 } bb9: { - StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:16:37: 16:38 - StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:16:37: 16:38 + 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 -> bb4; // scope 0 at $DIR/match_false_edges.rs:16:20: 16:27 } @@ -136,7 +136,7 @@ fn full_tested_match() -> () { // + span: $DIR/match_false_edges.rs:17:21: 17:22 // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) } StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:17:25: 17:26 - StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:17:26: 17:27 + StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:17:25: 17:26 goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:15:13: 19:6 } diff --git a/src/test/mir-opt/match_false_edges/rustc.full_tested_match2.PromoteTemps.before.mir b/src/test/mir-opt/match_false_edges/rustc.full_tested_match2.PromoteTemps.before.mir index f1744a94fdc13..b79416fe31a41 100644 --- a/src/test/mir-opt/match_false_edges/rustc.full_tested_match2.PromoteTemps.before.mir +++ b/src/test/mir-opt/match_false_edges/rustc.full_tested_match2.PromoteTemps.before.mir @@ -62,7 +62,7 @@ fn full_tested_match2() -> () { // + span: $DIR/match_false_edges.rs:29:21: 29:22 // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) } StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:29:25: 29:26 - StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:29:26: 29:27 + StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:29:25: 29:26 goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:26:13: 30:6 } @@ -89,7 +89,7 @@ fn full_tested_match2() -> () { } bb8: { - StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:27:37: 27:38 + 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 @@ -104,14 +104,14 @@ fn full_tested_match2() -> () { // + span: $DIR/match_false_edges.rs:27:32: 27:33 // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } 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:37: 27:38 - StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:27:37: 27:38 + StorageDead(_5); // 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 -> bb11; // scope 0 at $DIR/match_false_edges.rs:26:13: 30:6 } bb9: { - StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:27:37: 27:38 - StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:27:37: 27:38 + 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 falseEdge -> [real: bb4, imaginary: bb2]; // scope 0 at $DIR/match_false_edges.rs:27:20: 27:27 } diff --git a/src/test/mir-opt/match_false_edges/rustc.main.PromoteTemps.before.mir b/src/test/mir-opt/match_false_edges/rustc.main.PromoteTemps.before.mir index 4ab4c4d341e2f..5b449da93d493 100644 --- a/src/test/mir-opt/match_false_edges/rustc.main.PromoteTemps.before.mir +++ b/src/test/mir-opt/match_false_edges/rustc.main.PromoteTemps.before.mir @@ -70,7 +70,7 @@ fn main() -> () { // mir::Constant // + span: $DIR/match_false_edges.rs:39:15: 39:16 // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) } - StorageDead(_14); // scope 0 at $DIR/match_false_edges.rs:39:16: 39:17 + StorageDead(_14); // scope 0 at $DIR/match_false_edges.rs:39:15: 39:16 goto -> bb15; // scope 0 at $DIR/match_false_edges.rs:35:13: 40:6 } @@ -97,7 +97,7 @@ fn main() -> () { } bb8: { - StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:36:33: 36:34 + 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 @@ -109,14 +109,14 @@ fn main() -> () { // mir::Constant // + span: $DIR/match_false_edges.rs:36:32: 36:33 // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) } - StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:36:33: 36:34 - StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:36:33: 36:34 + StorageDead(_6); // 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 -> bb15; // scope 0 at $DIR/match_false_edges.rs:35:13: 40:6 } bb9: { - StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:36:33: 36:34 - StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:36:33: 36:34 + 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 falseEdge -> [real: bb2, imaginary: bb2]; // scope 0 at $DIR/match_false_edges.rs:36:21: 36:28 } @@ -130,7 +130,7 @@ fn main() -> () { // mir::Constant // + span: $DIR/match_false_edges.rs:37:15: 37:16 // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) } - StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:37:16: 37:17 + StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:37:15: 37:16 goto -> bb15; // scope 0 at $DIR/match_false_edges.rs:35:13: 40:6 } @@ -156,7 +156,7 @@ fn main() -> () { } bb13: { - StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:38:34: 38:35 + StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:38:33: 38:34 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 @@ -168,14 +168,14 @@ fn main() -> () { // mir::Constant // + span: $DIR/match_false_edges.rs:38:33: 38:34 // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) } - StorageDead(_10); // scope 0 at $DIR/match_false_edges.rs:38:34: 38:35 - StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:38:34: 38:35 + StorageDead(_10); // 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 -> bb15; // scope 0 at $DIR/match_false_edges.rs:35:13: 40:6 } bb14: { - StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:38:34: 38:35 - StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:38:34: 38:35 + 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: bb4, imaginary: bb4]; // scope 0 at $DIR/match_false_edges.rs:38:20: 38:29 } diff --git a/src/test/mir-opt/match_test/rustc.main.SimplifyCfg-initial.after.mir b/src/test/mir-opt/match_test/rustc.main.SimplifyCfg-initial.after.mir index ef6c88d8005b3..16895942cb81b 100644 --- a/src/test/mir-opt/match_test/rustc.main.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/match_test/rustc.main.SimplifyCfg-initial.after.mir @@ -117,7 +117,7 @@ fn main() -> () { } bb10: { - StorageDead(_9); // scope 2 at $DIR/match_test.rs:13:24: 13:25 + 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 // ty::Const @@ -130,7 +130,7 @@ fn main() -> () { } bb11: { - StorageDead(_9); // scope 2 at $DIR/match_test.rs:13:24: 13:25 + StorageDead(_9); // scope 2 at $DIR/match_test.rs:13:23: 13:24 falseEdge -> [real: bb3, imaginary: bb6]; // scope 2 at $DIR/match_test.rs:13:18: 13:19 } diff --git a/src/test/mir-opt/no-drop-for-inactive-variant/rustc.unwrap.SimplifyCfg-elaborate-drops.after.mir b/src/test/mir-opt/no-drop-for-inactive-variant/rustc.unwrap.SimplifyCfg-elaborate-drops.after.mir index 2e8cfaea937d7..f3f2b68e53d5c 100644 --- a/src/test/mir-opt/no-drop-for-inactive-variant/rustc.unwrap.SimplifyCfg-elaborate-drops.after.mir +++ b/src/test/mir-opt/no-drop-for-inactive-variant/rustc.unwrap.SimplifyCfg-elaborate-drops.after.mir @@ -43,7 +43,7 @@ fn unwrap(_1: std::option::Option) -> T { StorageLive(_3); // scope 0 at $DIR/no-drop-for-inactive-variant.rs:9:14: 9:15 _3 = move ((_1 as Some).0: T); // scope 0 at $DIR/no-drop-for-inactive-variant.rs:9:14: 9:15 _0 = move _3; // scope 1 at $DIR/no-drop-for-inactive-variant.rs:9:20: 9:21 - StorageDead(_3); // scope 0 at $DIR/no-drop-for-inactive-variant.rs:9:21: 9:22 + StorageDead(_3); // scope 0 at $DIR/no-drop-for-inactive-variant.rs:9:20: 9:21 _6 = discriminant(_1); // scope 0 at $DIR/no-drop-for-inactive-variant.rs:12:1: 12:2 return; // scope 0 at $DIR/no-drop-for-inactive-variant.rs:12:2: 12:2 } diff --git a/src/test/mir-opt/remove_fake_borrows/rustc.match_guard.CleanupNonCodegenStatements.diff b/src/test/mir-opt/remove_fake_borrows/rustc.match_guard.CleanupNonCodegenStatements.diff index 7fc209778703e..0822d8cc03c60 100644 --- a/src/test/mir-opt/remove_fake_borrows/rustc.match_guard.CleanupNonCodegenStatements.diff +++ b/src/test/mir-opt/remove_fake_borrows/rustc.match_guard.CleanupNonCodegenStatements.diff @@ -53,7 +53,7 @@ } bb5: { - StorageDead(_8); // scope 0 at $DIR/remove_fake_borrows.rs:8:26: 8:27 + 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 @@ -73,7 +73,7 @@ } bb6: { - StorageDead(_8); // scope 0 at $DIR/remove_fake_borrows.rs:8:26: 8:27 + StorageDead(_8); // scope 0 at $DIR/remove_fake_borrows.rs:8:25: 8:26 goto -> bb1; // scope 0 at $DIR/remove_fake_borrows.rs:8:20: 8:21 } diff --git a/src/test/mir-opt/simplify-arm-identity/32bit/rustc.main.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify-arm-identity/32bit/rustc.main.SimplifyArmIdentity.diff index 33a3403cada92..0de80f72a1e70 100644 --- a/src/test/mir-opt/simplify-arm-identity/32bit/rustc.main.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/simplify-arm-identity/32bit/rustc.main.SimplifyArmIdentity.diff @@ -61,7 +61,7 @@ ((_2 as Foo).0: u8) = move _5; // scope 3 at $DIR/simplify-arm-identity.rs:20:24: 20:35 discriminant(_2) = 0; // scope 3 at $DIR/simplify-arm-identity.rs:20:24: 20:35 StorageDead(_5); // scope 3 at $DIR/simplify-arm-identity.rs:20:34: 20:35 - StorageDead(_4); // scope 1 at $DIR/simplify-arm-identity.rs:20:35: 20:36 + StorageDead(_4); // scope 1 at $DIR/simplify-arm-identity.rs:20:34: 20:35 goto -> bb4; // scope 1 at $DIR/simplify-arm-identity.rs:19:18: 22:6 } diff --git a/src/test/mir-opt/simplify-arm-identity/64bit/rustc.main.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify-arm-identity/64bit/rustc.main.SimplifyArmIdentity.diff index 7e4fe1c2dcc4c..4fa0aff8fa0ef 100644 --- a/src/test/mir-opt/simplify-arm-identity/64bit/rustc.main.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/simplify-arm-identity/64bit/rustc.main.SimplifyArmIdentity.diff @@ -61,7 +61,7 @@ ((_2 as Foo).0: u8) = move _5; // scope 3 at $DIR/simplify-arm-identity.rs:20:24: 20:35 discriminant(_2) = 0; // scope 3 at $DIR/simplify-arm-identity.rs:20:24: 20:35 StorageDead(_5); // scope 3 at $DIR/simplify-arm-identity.rs:20:34: 20:35 - StorageDead(_4); // scope 1 at $DIR/simplify-arm-identity.rs:20:35: 20:36 + StorageDead(_4); // scope 1 at $DIR/simplify-arm-identity.rs:20:34: 20:35 goto -> bb4; // scope 1 at $DIR/simplify-arm-identity.rs:19:18: 22:6 } diff --git a/src/test/mir-opt/simplify-arm/rustc.id.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify-arm/rustc.id.SimplifyArmIdentity.diff index daae94e87f044..0cddcb061cfc8 100644 --- a/src/test/mir-opt/simplify-arm/rustc.id.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/simplify-arm/rustc.id.SimplifyArmIdentity.diff @@ -33,7 +33,7 @@ ((_0 as Some).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27 discriminant(_0) = 1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27 StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:11:26: 11:27 - StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:11:27: 11:28 + StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:11:26: 11:27 goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:10:5: 13:6 } diff --git a/src/test/mir-opt/simplify-arm/rustc.id.SimplifyBranchSame.diff b/src/test/mir-opt/simplify-arm/rustc.id.SimplifyBranchSame.diff index 15bd5e7c9f0b0..cd5962c682a5a 100644 --- a/src/test/mir-opt/simplify-arm/rustc.id.SimplifyBranchSame.diff +++ b/src/test/mir-opt/simplify-arm/rustc.id.SimplifyBranchSame.diff @@ -33,7 +33,7 @@ ((_0 as Some).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27 discriminant(_0) = 1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27 StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:11:26: 11:27 - StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:11:27: 11:28 + StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:11:26: 11:27 goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:10:5: 13:6 } diff --git a/src/test/mir-opt/simplify-arm/rustc.id_result.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify-arm/rustc.id_result.SimplifyArmIdentity.diff index 37273d1d6517b..642ccc1ab14b7 100644 --- a/src/test/mir-opt/simplify-arm/rustc.id_result.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/simplify-arm/rustc.id_result.SimplifyArmIdentity.diff @@ -29,7 +29,7 @@ ((_0 as Err).0: i32) = move _6; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25 discriminant(_0) = 1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25 StorageDead(_6); // scope 2 at $DIR/simplify-arm.rs:19:24: 19:25 - StorageDead(_5); // scope 0 at $DIR/simplify-arm.rs:19:25: 19:26 + StorageDead(_5); // scope 0 at $DIR/simplify-arm.rs:19:24: 19:25 goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6 } @@ -45,7 +45,7 @@ ((_0 as Ok).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23 discriminant(_0) = 0; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23 StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:18:22: 18:23 - StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:18:23: 18:24 + StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:18:22: 18:23 goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6 } diff --git a/src/test/mir-opt/simplify-arm/rustc.id_result.SimplifyBranchSame.diff b/src/test/mir-opt/simplify-arm/rustc.id_result.SimplifyBranchSame.diff index f138d637435f8..95ce09a39ed50 100644 --- a/src/test/mir-opt/simplify-arm/rustc.id_result.SimplifyBranchSame.diff +++ b/src/test/mir-opt/simplify-arm/rustc.id_result.SimplifyBranchSame.diff @@ -29,7 +29,7 @@ ((_0 as Err).0: i32) = move _6; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25 discriminant(_0) = 1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25 StorageDead(_6); // scope 2 at $DIR/simplify-arm.rs:19:24: 19:25 - StorageDead(_5); // scope 0 at $DIR/simplify-arm.rs:19:25: 19:26 + StorageDead(_5); // scope 0 at $DIR/simplify-arm.rs:19:24: 19:25 goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6 } @@ -45,7 +45,7 @@ ((_0 as Ok).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23 discriminant(_0) = 0; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23 StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:18:22: 18:23 - StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:18:23: 18:24 + StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:18:22: 18:23 goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6 } diff --git a/src/test/mir-opt/simplify_try_if_let/rustc.{{impl}}-append.SimplifyArmIdentity.diff b/src/test/mir-opt/simplify_try_if_let/rustc.{{impl}}-append.SimplifyArmIdentity.diff index aa416049f6613..4471f4d206ca2 100644 --- a/src/test/mir-opt/simplify_try_if_let/rustc.{{impl}}-append.SimplifyArmIdentity.diff +++ b/src/test/mir-opt/simplify_try_if_let/rustc.{{impl}}-append.SimplifyArmIdentity.diff @@ -115,7 +115,7 @@ bb8: { StorageDead(_5); // scope 1 at $DIR/simplify_try_if_let.rs:31:13: 31:14 - StorageDead(_4); // scope 0 at $DIR/simplify_try_if_let.rs:32:9: 32:10 + StorageDead(_4); // scope 0 at $DIR/simplify_try_if_let.rs:31:13: 31:14 goto -> bb9; // scope 0 at $DIR/simplify_try_if_let.rs:21:9: 32:10 } diff --git a/src/test/ui/match/issue-74050-end-span.rs b/src/test/ui/match/issue-74050-end-span.rs new file mode 100644 index 0000000000000..cc81214e2701b --- /dev/null +++ b/src/test/ui/match/issue-74050-end-span.rs @@ -0,0 +1,13 @@ +fn main() { + let mut args = std::env::args_os(); + let _arg = match args.next() { + Some(arg) => { + match arg.to_str() { + //~^ ERROR `arg` does not live long enough + Some(s) => s, + None => return, + } + } + None => return, + }; +} diff --git a/src/test/ui/match/issue-74050-end-span.stderr b/src/test/ui/match/issue-74050-end-span.stderr new file mode 100644 index 0000000000000..d636a11a91cec --- /dev/null +++ b/src/test/ui/match/issue-74050-end-span.stderr @@ -0,0 +1,15 @@ +error[E0597]: `arg` does not live long enough + --> $DIR/issue-74050-end-span.rs:5:19 + | +LL | let _arg = match args.next() { + | ---- borrow later stored here +LL | Some(arg) => { +LL | match arg.to_str() { + | ^^^ borrowed value does not live long enough +... +LL | } + | - `arg` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`.