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

[StableMIR] A few fixes to pretty printing #132161

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

celinval
Copy link
Contributor

Improve identation, and a few other rvalue printing

Improve identation, and a few other rvalue printing
@rustbot
Copy link
Collaborator

rustbot commented Oct 25, 2024

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@celinval celinval added the A-stable-MIR Area: stable MIR label Oct 25, 2024
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 25, 2024
@rustbot
Copy link
Collaborator

rustbot commented Oct 25, 2024

This PR changes Stable MIR

cc @oli-obk, @celinval, @ouz-a

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

LGTM, but this doesn't actually exercise most of the new code it adds, does it?

@@ -0,0 +1,25 @@
//@ compile-flags: -Z unpretty=stable-mir --crate-type lib -C panic=abort
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add some examples for more aggregates. Ideas that come to mind are:

  1. Structs w braced args {}
  2. Structs w no args
  3. Closures that capture values
  4. Arrays constructed per-element ([1, 2, 3]) style

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BTW, for 1, this will still print Struct (). But I can add more tests

Copy link
Member

Choose a reason for hiding this comment

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

That's fine, I just want to see how the existing behavior is exercised. Better to have tests that are wrong so we can see when they become right, rather than have no tests at all for things we explicitly know act weirdly...

@compiler-errors
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 26, 2024
Add a comma between function arguments
@celinval
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 28, 2024
compiler/stable_mir/src/mir/pretty.rs Outdated Show resolved Hide resolved
@compiler-errors
Copy link
Member

LGTM

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 28, 2024

📌 Commit 3b2c906 has been approved by compiler-errors

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 Oct 28, 2024
@compiler-errors
Copy link
Member

thx

@bors r+

@bors
Copy link
Contributor

bors commented Oct 28, 2024

📌 Commit a38d2fe has been approved by compiler-errors

It is now in the queue for this repository.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 28, 2024
…er-errors

[StableMIR] A few fixes to pretty printing

Improve identation, and a few other rvalue printing
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 28, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#131375 (compiler: apply clippy::clone_on_ref_ptr for CI)
 - rust-lang#131984 (Stabilize if_let_rescope)
 - rust-lang#132151 (Ensure that resume arg outlives region bound for coroutines)
 - rust-lang#132161 ([StableMIR] A few fixes to pretty printing)
 - rust-lang#132194 (Collect item bounds for RPITITs from trait where clauses just like associated types)
 - rust-lang#132233 (Split `boxed.rs` into a few modules)
 - rust-lang#132270 (clarified doc for `std::fs::OpenOptions.truncate()`)
 - rust-lang#132284 (Remove my ping for rustdoc/clean/types.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
@workingjubilee
Copy link
Member

@bors r-

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 29, 2024
@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 29, 2024
@workingjubilee
Copy link
Member

Failed in #132288 (comment)

---- [ui] tests\ui\stable-mir-print\operands.rs stdout ----
$DIR\operands.rs
$DIR\operands.rs
\a\rust\rust\tests\ui\stable-mir-print\operands.rs
$DIR\operands.rs
Saved the actual stdout to "C:\\a\\rust\\rust\\build\\x86_64-pc-windows-msvc\\test\\ui\\stable-mir-print\\operands\\operands.stdout"


226     debug x => _1;
227     debug z => _2;
228     bb0: {
-         _0 = {closure@Span { id: 105, repr: "$DIR/operands.rs:44:5: 44:19" }}(_1, _2);
+         _0 = {closure@Span { id: 105, repr: "C:/a/rust/rust/tests/ui/stable-mir-print/operands.rs:44:5: 44:19" }}(_1, _2);
231     }
232 }

@compiler-errors
Copy link
Member

🤔 path normalization needs to be more generic i guess???

@celinval
Copy link
Contributor Author

Still haven't figured out how to fix this. The test passes in my development machine (Linux) and it looks like one of the linux jobs have passed as well, which makes me wonder if this can only be reproduced in Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stable-MIR Area: stable MIR S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

6 participants