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

Show absolute line numbers if span is outside relative span #99908

Merged
merged 4 commits into from
Aug 22, 2022

Conversation

Noratrieb
Copy link
Member

In the MIR pretty printing, it can sometimes happen that the span of the statement is outside the span of the body (for example through inlining). In this case, don't display a relative span but an absolute span. This will make the mir-opt-tests a little more prone to diffs again, but the impact should be small.

Fixes #99854

r? @oli-obk

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 29, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 29, 2022
Comment on lines -6 to +13
let mut _0: (); // return place in scope 0 at $DIR/generator-storage-dead-unwind.rs:+0:19: +0:19
let _3: Foo; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:+1:13: +1:14
let _5: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:+3:9: +3:14
let mut _6: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:+3:9: +3:14
let _7: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:+4:9: +4:16
let mut _8: Foo; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:+4:14: +4:15
let _9: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:+5:9: +5:16
let mut _10: Bar; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:+5:14: +5:15
let mut _0: (); // return place in scope 0 at $DIR/generator-storage-dead-unwind.rs:22:19: 22:19
let _3: Foo; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:23:13: 23:14
let _5: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
let mut _6: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
let _7: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:26:9: 26:16
let mut _8: Foo; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:26:14: 26:15
let _9: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:27:9: 27:16
let mut _10: Bar; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:27:14: 27:15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing for closures, their main span only points to the || at the start

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing it for consts and statics was fairly simple. But also doing it for closures not only caused big diffs in the ui tests, but also regressed a borrowck diagnostic in src/test/ui/borrowck/issue-93093.rs where it didn't suggest making the parameter of an async function &mut self anymore because the changes in the spans somehow affected it. Unless you have a quick idea, I would prefer not doing that in this PR, and staying with consts and statics for now.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 4, 2022

☔ The latest upstream changes (presumably #100087) made this pull request unmergeable. Please resolve the merge conflicts.

@Noratrieb
Copy link
Member Author

This is a little bitrotty, I'll reroll to get it through

r? mir-opt

@Noratrieb
Copy link
Member Author

That doesn't work either, I guess I'll just assign someone directly
r? @wesleywiser

@rust-highfive rust-highfive assigned wesleywiser and unassigned oli-obk Aug 21, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Aug 22, 2022

r? @oli-obk

@bors r+ p=1 bitrotty

@bors
Copy link
Contributor

bors commented Aug 22, 2022

📌 Commit ab883c4b51b557855d13498dd184112bf1c3215d has been approved by oli-obk

It is now in the queue for this repository.

@rust-highfive rust-highfive assigned oli-obk and unassigned wesleywiser Aug 22, 2022
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 22, 2022
@bors
Copy link
Contributor

bors commented Aug 22, 2022

⌛ Testing commit ab883c4b51b557855d13498dd184112bf1c3215d with merge 5003bd390ff07eed19b30f0c05c43aced8d0200f...

@bors
Copy link
Contributor

bors commented Aug 22, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 22, 2022
@rust-log-analyzer

This comment has been minimized.

@Noratrieb
Copy link
Member Author

Huh, interesting, that's not even a 32-bit or profiling test. I'll try to fix it.

In the MIR pretty printing, it can sometimes happen that the span of the
statement is outside the span of the body (for example through
inlining). In this case, don't display a relative span but an absolute
span. This will make the mir-opt-tests a little more prone to diffs
again, but the impact should be small.
@oli-obk
Copy link
Contributor

oli-obk commented Aug 22, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Aug 22, 2022

📌 Commit 5d7ce21 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 22, 2022
@bors
Copy link
Contributor

bors commented Aug 22, 2022

⌛ Testing commit 5d7ce21 with merge e0dc8d7...

@bors
Copy link
Contributor

bors commented Aug 22, 2022

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing e0dc8d7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 22, 2022
@bors bors merged commit e0dc8d7 into rust-lang:master Aug 22, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 22, 2022
@Noratrieb Noratrieb deleted the mir-opt-span branch August 22, 2022 17:47
@Noratrieb Noratrieb mentioned this pull request Aug 22, 2022
@bors bors mentioned this pull request Aug 22, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e0dc8d7): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.5% [2.5%, 2.5%] 1
Improvements ✅
(primary)
-2.2% [-2.2%, -2.2%] 1
Improvements ✅
(secondary)
-3.1% [-3.7%, -2.4%] 2
All ❌✅ (primary) -2.2% [-2.2%, -2.2%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
4.4% [4.4%, 4.4%] 1
Regressions ❌
(secondary)
2.4% [2.4%, 2.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.4% [4.4%, 4.4%] 1

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad MIR spans
8 participants