Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly mark the ending span of a match arm #74125

Merged
merged 1 commit into from
Jul 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_parse/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ fn match_tuple(_1: (u32, bool, std::option::Option<i32>, 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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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
}

Expand All @@ -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
Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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
}

Expand All @@ -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: {
Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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
}

Expand All @@ -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
Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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
}

Expand All @@ -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: {
Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand All @@ -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
}

Expand Down
Loading