-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix misc printing issues in emit=stable_mir
#118364
Conversation
This PR changes Stable MIR cc @oli-obk, @celinval, @spastorino, @ouz-a |
I've asked before but I will ask again -- is it possible for you to prioritize working on some sort of test? It's kinda sketchy to be putting up PRs like this with absolutely no evidence that it's doing anything. |
Alright will start working on a test immediately |
Opened PR for the test #118375 |
…=compiler-errors Add -Zunpretty=stable-mir output test As strongly suggested here rust-lang#118364 (comment) this adds output test for `-Zunpretty=stable-mir`, added test shows almost all the functionality of the current printer. r? `@compiler-errors`
Do you mind rebasing this on top of #118375? Then you can bless the tests in your commit and see the output changes due to these tweaks. |
a67486e
to
fcc7002
Compare
Just rebased and run bless |
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.
I think this is a good opportunity to make more tweaks to the output since I can now see what's broken 😃 thanks for that
Also, plz squash the "rebase" commit into the "fix" commit.
No problem, it's better for someone other than me to also look at this and have some opinion about it 😄 |
…=compiler-errors Add -Zunpretty=stable-mir output test As strongly suggested here rust-lang#118364 (comment) this adds output test for `-Zunpretty=stable-mir`, added test shows almost all the functionality of the current printer. r? ``@compiler-errors``
fcc7002
to
bab21f3
Compare
This comment has been minimized.
This comment has been minimized.
bab21f3
to
844c493
Compare
This comment has been minimized.
This comment has been minimized.
844c493
to
45a53d3
Compare
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.
I noticed that the successor for Goto
terminators is missing the bb
in the label. For example, we're printing something like:
goto -> 5
when I expected:
goto -> bb5
ee889d9
to
88df8fa
Compare
☔ The latest upstream changes (presumably #118543) made this pull request unmergeable. Please resolve the merge conflicts. |
…=celinval Add -Zunpretty=stable-mir output test As strongly suggested here rust-lang#118364 (comment) this adds output test for `-Zunpretty=stable-mir`, added test shows almost all the functionality of the current printer. r? `@compiler-errors`
…elinval Add -Zunpretty=stable-mir output test As strongly suggested here rust-lang#118364 (comment) this adds output test for `-Zunpretty=stable-mir`, added test shows almost all the functionality of the current printer. r? `@compiler-errors`
88df8fa
to
7e3c287
Compare
…elinval Add -Zunpretty=stable-mir output test As strongly suggested here rust-lang#118364 (comment) this adds output test for `-Zunpretty=stable-mir`, added test shows almost all the functionality of the current printer. r? `@compiler-errors`
☔ The latest upstream changes (presumably #118375) made this pull request unmergeable. Please resolve the merge conflicts. |
Add -Zunpretty=stable-mir output test As strongly suggested here rust-lang/rust#118364 (comment) this adds output test for `-Zunpretty=stable-mir`, added test shows almost all the functionality of the current printer. r? `@compiler-errors`
7e3c287
to
dc78b1c
Compare
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 is looking so much better. I'm hoping we can merge this after the next revision. Btw, have you compared the expected file with the internal MIR dump? It might be helpful to spot what's missing or what's wrong.
_2 = 1 Add const 1_i32 | ||
assert(!move _2 bool),"attempt to compute `{} + {}`, which would overflow", 1, const 1_i32) -> [success: bb1, unwind continue] | ||
_2 = CheckedAdd(_1, const 1_i32) | ||
assert(!move _2 bool),"attempt to compute `{} + {}`, which would overflow", _1, const 1_i32) -> [success: bb1, unwind continue] |
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.
Where's this bool
coming from?
bb0: { | ||
_3 = refShared1 | ||
_3 = &1 |
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.
Should this be _1
?
_5 = refMut { | ||
kind: TwoPhaseBorrow, | ||
}2 | ||
_5 = &mut 2 |
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.
Where's _5
declaration?
} | ||
fn bar(_0: &mut std::vec::Vec) -> std::vec::Vec { | ||
let mut _0: std::vec::Vec; | ||
let mut _1: &std::vec::Vec; |
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.
Are we missing _1
initialization?
Will go trough another pass and then compare with mir output |
☔ The latest upstream changes (presumably #119837) made this pull request unmergeable. Please resolve the merge conflicts. |
@ouz-a anything interesting to report w.r.t. to your prev. comment? No hurry, I'll just flip the review switch @rustbot author |
I been meaning to look at this for some time but I been extremely busy with life/job in past couple months 😓 |
Hey @ouz-a do you mind if I take a stab at this? |
Yeah, go ahead. |
…rrors Fix misc printing issues in emit=stable_mir Trying to continue the work that `@ouz-a` started here: rust-lang#118364 Few modifications beyond fixes: 1. I made the `pretty_*` functions private. 2. I added a function to print the instance body 3. Changed a bunch of signatures to write to the writer directly. 4. Added a function to translate the place to its internal representation, so we could use the internal debug implementation. 5. Also removed `pretty_ty`, replaced by Display implementation of Ty which uses the internal display.
…rrors Fix misc printing issues in emit=stable_mir Trying to continue the work that ``@ouz-a`` started here: rust-lang#118364 Few modifications beyond fixes: 1. I made the `pretty_*` functions private. 2. I added a function to print the instance body 3. Changed a bunch of signatures to write to the writer directly. 4. Added a function to translate the place to its internal representation, so we could use the internal debug implementation. 5. Also removed `pretty_ty`, replaced by Display implementation of Ty which uses the internal display.
…rrors Fix misc printing issues in emit=stable_mir Trying to continue the work that ```@ouz-a``` started here: rust-lang#118364 Few modifications beyond fixes: 1. I made the `pretty_*` functions private. 2. I added a function to print the instance body 3. Changed a bunch of signatures to write to the writer directly. 4. Added a function to translate the place to its internal representation, so we could use the internal debug implementation. 5. Also removed `pretty_ty`, replaced by Display implementation of Ty which uses the internal display.
…rrors Fix misc printing issues in emit=stable_mir Trying to continue the work that ````@ouz-a```` started here: rust-lang#118364 Few modifications beyond fixes: 1. I made the `pretty_*` functions private. 2. I added a function to print the instance body 3. Changed a bunch of signatures to write to the writer directly. 4. Added a function to translate the place to its internal representation, so we could use the internal debug implementation. 5. Also removed `pretty_ty`, replaced by Display implementation of Ty which uses the internal display.
Rollup merge of rust-lang#122801 - celinval:smir-pretty, r=compiler-errors Fix misc printing issues in emit=stable_mir Trying to continue the work that ````@ouz-a```` started here: rust-lang#118364 Few modifications beyond fixes: 1. I made the `pretty_*` functions private. 2. I added a function to print the instance body 3. Changed a bunch of signatures to write to the writer directly. 4. Added a function to translate the place to its internal representation, so we could use the internal debug implementation. 5. Also removed `pretty_ty`, replaced by Display implementation of Ty which uses the internal display.
Closing this in favor of #122801 |
Previously our
}
closed early and looked bit weird, now it closes when function call ends, and previouslyAdt
printing was too verbose now it's similar to mir outputr? @celinval