-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
coverage: Fix an unstable-sort inconsistency in coverage spans #115930
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
Function name: closure_bug::main | ||
Raw bytes (241): 0x[01, 01, 34, 01, 00, 01, 05, 05, ce, 01, 01, 05, cb, 01, 00, 05, ce, 01, 01, 05, cb, 01, 09, 05, ce, 01, 01, 05, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, c3, 01, 00, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, bb, 01, 00, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, bb, 01, 11, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, 11, b6, 01, bb, 01, 11, 0d, be, 01, c3, 01, 0d, 09, c6, 01, cb, 01, 09, 05, ce, 01, 01, 05, 11, 01, 06, 01, 03, 0a, 03, 09, 05, 01, 0e, 05, 01, 0f, 00, 17, ce, 01, 00, 17, 00, 18, cb, 01, 02, 09, 00, 0a, 13, 06, 05, 01, 0e, 09, 01, 0f, 00, 17, c6, 01, 00, 17, 00, 18, c3, 01, 02, 09, 00, 0a, 3b, 06, 05, 01, 0e, 0d, 01, 0f, 00, 17, be, 01, 00, 17, 00, 18, bb, 01, 02, 09, 00, 0a, 7b, 06, 05, 01, 0e, 11, 01, 0f, 00, 17, b6, 01, 00, 17, 00, 18, b3, 01, 01, 01, 00, 02] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 52 | ||
- expression 0 operands: lhs = Counter(0), rhs = Zero | ||
- expression 1 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 2 operands: lhs = Counter(1), rhs = Expression(51, Sub) | ||
- expression 3 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 4 operands: lhs = Expression(50, Add), rhs = Zero | ||
- expression 5 operands: lhs = Counter(1), rhs = Expression(51, Sub) | ||
- expression 6 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 7 operands: lhs = Expression(50, Add), rhs = Counter(2) | ||
- expression 8 operands: lhs = Counter(1), rhs = Expression(51, Sub) | ||
- expression 9 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 10 operands: lhs = Counter(2), rhs = Expression(49, Sub) | ||
- expression 11 operands: lhs = Expression(50, Add), rhs = Counter(2) | ||
- expression 12 operands: lhs = Counter(1), rhs = Expression(51, Sub) | ||
- expression 13 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 14 operands: lhs = Expression(48, Add), rhs = Zero | ||
- expression 15 operands: lhs = Counter(2), rhs = Expression(49, Sub) | ||
- expression 16 operands: lhs = Expression(50, Add), rhs = Counter(2) | ||
- expression 17 operands: lhs = Counter(1), rhs = Expression(51, Sub) | ||
- expression 18 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 19 operands: lhs = Expression(48, Add), rhs = Counter(3) | ||
- expression 20 operands: lhs = Counter(2), rhs = Expression(49, Sub) | ||
- expression 21 operands: lhs = Expression(50, Add), rhs = Counter(2) | ||
- expression 22 operands: lhs = Counter(1), rhs = Expression(51, Sub) | ||
- expression 23 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 24 operands: lhs = Counter(3), rhs = Expression(47, Sub) | ||
- expression 25 operands: lhs = Expression(48, Add), rhs = Counter(3) | ||
- expression 26 operands: lhs = Counter(2), rhs = Expression(49, Sub) | ||
- expression 27 operands: lhs = Expression(50, Add), rhs = Counter(2) | ||
- expression 28 operands: lhs = Counter(1), rhs = Expression(51, Sub) | ||
- expression 29 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 30 operands: lhs = Expression(46, Add), rhs = Zero | ||
- expression 31 operands: lhs = Counter(3), rhs = Expression(47, Sub) | ||
- expression 32 operands: lhs = Expression(48, Add), rhs = Counter(3) | ||
- expression 33 operands: lhs = Counter(2), rhs = Expression(49, Sub) | ||
- expression 34 operands: lhs = Expression(50, Add), rhs = Counter(2) | ||
- expression 35 operands: lhs = Counter(1), rhs = Expression(51, Sub) | ||
- expression 36 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 37 operands: lhs = Expression(46, Add), rhs = Counter(4) | ||
- expression 38 operands: lhs = Counter(3), rhs = Expression(47, Sub) | ||
- expression 39 operands: lhs = Expression(48, Add), rhs = Counter(3) | ||
- expression 40 operands: lhs = Counter(2), rhs = Expression(49, Sub) | ||
- expression 41 operands: lhs = Expression(50, Add), rhs = Counter(2) | ||
- expression 42 operands: lhs = Counter(1), rhs = Expression(51, Sub) | ||
- expression 43 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 44 operands: lhs = Counter(4), rhs = Expression(45, Sub) | ||
- expression 45 operands: lhs = Expression(46, Add), rhs = Counter(4) | ||
- expression 46 operands: lhs = Counter(3), rhs = Expression(47, Sub) | ||
- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(3) | ||
- expression 48 operands: lhs = Counter(2), rhs = Expression(49, Sub) | ||
- expression 49 operands: lhs = Expression(50, Add), rhs = Counter(2) | ||
- expression 50 operands: lhs = Counter(1), rhs = Expression(51, Sub) | ||
- expression 51 operands: lhs = Counter(0), rhs = Counter(1) | ||
Number of file 0 mappings: 17 | ||
- Code(Counter(0)) at (prev + 6, 1) to (start + 3, 10) | ||
- Code(Expression(0, Add)) at (prev + 9, 5) to (start + 1, 14) | ||
= (c0 + Zero) | ||
- Code(Counter(1)) at (prev + 1, 15) to (start + 0, 23) | ||
- Code(Expression(51, Sub)) at (prev + 0, 23) to (start + 0, 24) | ||
= (c0 - c1) | ||
- Code(Expression(50, Add)) at (prev + 2, 9) to (start + 0, 10) | ||
= (c1 + (c0 - c1)) | ||
- Code(Expression(4, Add)) at (prev + 6, 5) to (start + 1, 14) | ||
= ((c1 + (c0 - c1)) + Zero) | ||
- Code(Counter(2)) at (prev + 1, 15) to (start + 0, 23) | ||
- Code(Expression(49, Sub)) at (prev + 0, 23) to (start + 0, 24) | ||
= ((c1 + (c0 - c1)) - c2) | ||
- Code(Expression(48, Add)) at (prev + 2, 9) to (start + 0, 10) | ||
= (c2 + ((c1 + (c0 - c1)) - c2)) | ||
- Code(Expression(14, Add)) at (prev + 6, 5) to (start + 1, 14) | ||
= ((c2 + ((c1 + (c0 - c1)) - c2)) + Zero) | ||
- Code(Counter(3)) at (prev + 1, 15) to (start + 0, 23) | ||
- Code(Expression(47, Sub)) at (prev + 0, 23) to (start + 0, 24) | ||
= ((c2 + ((c1 + (c0 - c1)) - c2)) - c3) | ||
- Code(Expression(46, Add)) at (prev + 2, 9) to (start + 0, 10) | ||
= (c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) | ||
- Code(Expression(30, Add)) at (prev + 6, 5) to (start + 1, 14) | ||
= ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) + Zero) | ||
- Code(Counter(4)) at (prev + 1, 15) to (start + 0, 23) | ||
- Code(Expression(45, Sub)) at (prev + 0, 23) to (start + 0, 24) | ||
= ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4) | ||
- Code(Expression(44, Add)) at (prev + 1, 1) to (start + 0, 2) | ||
= (c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) | ||
|
||
Function name: closure_bug::main::{closure#0} | ||
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0d, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 2 | ||
- expression 0 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub) | ||
Number of file 0 mappings: 4 | ||
- Code(Counter(0)) at (prev + 13, 9) to (start + 0, 18) | ||
- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25) | ||
- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40) | ||
= (c0 - c1) | ||
- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42) | ||
= (c1 + (c0 - c1)) | ||
|
||
Function name: closure_bug::main::{closure#1} | ||
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 16, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 2 | ||
- expression 0 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub) | ||
Number of file 0 mappings: 4 | ||
- Code(Counter(0)) at (prev + 22, 9) to (start + 0, 18) | ||
- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25) | ||
- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40) | ||
= (c0 - c1) | ||
- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42) | ||
= (c1 + (c0 - c1)) | ||
|
||
Function name: closure_bug::main::{closure#2} | ||
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 1f, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 2 | ||
- expression 0 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub) | ||
Number of file 0 mappings: 4 | ||
- Code(Counter(0)) at (prev + 31, 9) to (start + 0, 18) | ||
- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25) | ||
- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40) | ||
= (c0 - c1) | ||
- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42) | ||
= (c1 + (c0 - c1)) | ||
|
||
Function name: closure_bug::main::{closure#3} | ||
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 28, 09, 00, 12, 05, 00, 15, 00, 19, 02, 00, 23, 00, 28, 07, 00, 29, 00, 2a] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 2 | ||
- expression 0 operands: lhs = Counter(0), rhs = Counter(1) | ||
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub) | ||
Number of file 0 mappings: 4 | ||
- Code(Counter(0)) at (prev + 40, 9) to (start + 0, 18) | ||
- Code(Counter(1)) at (prev + 0, 21) to (start + 0, 25) | ||
- Code(Expression(0, Sub)) at (prev + 0, 35) to (start + 0, 40) | ||
= (c0 - c1) | ||
- Code(Expression(1, Add)) at (prev + 0, 41) to (start + 0, 42) | ||
= (c1 + (c0 - c1)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Regression test for #115930. | ||
// All of these closures are identical, and should produce identical output in | ||
// the coverage report. However, an unstable sort was causing them to be treated | ||
// inconsistently when preparing coverage spans. | ||
|
||
fn main() { | ||
let truthy = std::env::args().len() == 1; | ||
|
||
let a | ||
= | ||
| | ||
| | ||
if truthy { true } else { false }; | ||
|
||
a(); | ||
if truthy { a(); } | ||
|
||
let b | ||
= | ||
| | ||
| | ||
if truthy { true } else { false }; | ||
|
||
b(); | ||
if truthy { b(); } | ||
|
||
let c | ||
= | ||
| | ||
| | ||
if truthy { true } else { false }; | ||
|
||
c(); | ||
if truthy { c(); } | ||
|
||
let d | ||
= | ||
| | ||
| | ||
if truthy { true } else { false }; | ||
|
||
d(); | ||
if truthy { d(); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file shows the inconsistent handling of closure spans caused by this bug.
Some closure signatures were already treated as non-executable, while others were being treated as part of the preceding code, depending on implementation details of the unstable sort.