Skip to content

[StableMIR] A few fixes to pretty printing#132161

Merged
bors merged 1 commit into
rust-lang:masterfrom
celinval:smir-fix-indent
Nov 8, 2024
Merged

[StableMIR] A few fixes to pretty printing#132161
bors merged 1 commit into
rust-lang:masterfrom
celinval:smir-fix-indent

Conversation

@celinval

@celinval celinval commented Oct 25, 2024

Copy link
Copy Markdown
Contributor

Improve identation, and a few other rvalue printing

try-job: x86_64-msvc
try-job: test-various

@rustbot

rustbot commented Oct 25, 2024

Copy link
Copy Markdown
Collaborator

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-rustc_public Area: Crate rustc_public (formerly: Stable MIR, SMIR) 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

rustbot commented Oct 25, 2024

Copy link
Copy Markdown
Collaborator

This PR changes Stable MIR

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

@compiler-errors compiler-errors left a comment

Copy link
Copy Markdown
Contributor

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?

Comment thread tests/ui/stable-mir-print/operands.rs
@compiler-errors

Copy link
Copy Markdown
Contributor

@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
@celinval

Copy link
Copy Markdown
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
Comment thread compiler/stable_mir/src/mir/pretty.rs Outdated
@compiler-errors

Copy link
Copy Markdown
Contributor

LGTM

@bors r+ rollup

@bors

bors commented Oct 28, 2024

Copy link
Copy Markdown
Collaborator

📌 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
Copy Markdown
Contributor

thx

@bors r+

@bors

bors commented Oct 28, 2024

Copy link
Copy Markdown
Collaborator

📌 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
Copy Markdown
Member

@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 29, 2024
@workingjubilee

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

@celinval

celinval commented Nov 7, 2024

Copy link
Copy Markdown
Contributor Author

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 7, 2024
[StableMIR] A few fixes to pretty printing

Improve identation, and a few other rvalue printing

try-job: x86_64-msvc
try-job: test-various
@bors

bors commented Nov 7, 2024

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 3bfe733 with merge d889fd4...

@celinval

celinval commented Nov 7, 2024

Copy link
Copy Markdown
Contributor Author

@compiler-errors I can squash the first 3 commits of this PR if you prefer.

@compiler-errors

compiler-errors commented Nov 7, 2024

Copy link
Copy Markdown
Contributor

Sure. Don't push before the try build is done or else it'll cancel the run.

If this ends up working out, then r=me; otherwise, you can revert back to the manual normalization strategy and r=me. If the latter, I'd prefer if you would open a bug issue so we can track this, since it seems like a bug in compiletest.

@rust-log-analyzer

This comment has been minimized.

@bors

bors commented Nov 7, 2024

Copy link
Copy Markdown
Collaborator

💔 Test failed - checks-actions

@compiler-errors

Copy link
Copy Markdown
Contributor

There's obviously something weird going on here with us converting \\ to /, and then not remapping the path correctly since that probably expects backslashes. Probably some ordering thing in the output sanitization. This also seems to do with the fact that, unlike basically everything else in the MIR output, we're using a debug-style output for SMIR spans.

I assume that's why this doesn't affect spans in regular MIR dumps, and if we printed the path strings outside of a quote, then perhaps compiletest would actually know what to do here.

@celinval

celinval commented Nov 7, 2024

Copy link
Copy Markdown
Contributor Author

There's obviously something weird going on here with us converting \\ to /, and then not remapping the path correctly since that probably expects backslashes. Probably some ordering thing in the output sanitization. This also seems to do with the fact that, unlike basically everything else in the MIR output, we're using a debug-style output for SMIR spans.

I assume that's why this doesn't affect spans in regular MIR dumps, and if we printed the path strings outside of a quote, then perhaps compiletest would actually know what to do here.

Instead of normalizing the test, I could fix how StableMIR is printing the span. That won't fix the compiletest issue, but I would be able to get rid of the hacky normalization

@workingjubilee

Copy link
Copy Markdown
Member

cc @jieyouxu

Improve identation, and a few other rvalue printing
@celinval

celinval commented Nov 8, 2024

Copy link
Copy Markdown
Contributor Author

@compiler-errors I fixed how StableMIR is printing closures and coroutines so it no longer prints the span debug. With that, I removed the manual normalization from the test (and the compiletest changes). I also squashed everything into a single commit.

I created a separate issue related to the compiletest normalization.

@bors try

@bors

bors commented Nov 8, 2024

Copy link
Copy Markdown
Collaborator

⌛ Trying commit dd6ddcb with merge 69d16ac...

bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 8, 2024
[StableMIR] A few fixes to pretty printing

Improve identation, and a few other rvalue printing

try-job: x86_64-msvc
try-job: test-various
@compiler-errors

Copy link
Copy Markdown
Contributor

r=me if CI is green

@bors

bors commented Nov 8, 2024

Copy link
Copy Markdown
Collaborator

☀️ Try build successful - checks-actions
Build commit: 69d16ac (69d16ac972b9896af6263a5073bcfca0d3d13408)

@celinval

celinval commented Nov 8, 2024

Copy link
Copy Markdown
Contributor Author

@bors r=compiler-errors rollup

@bors

bors commented Nov 8, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit dd6ddcb 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 8, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 8, 2024
Rollup of 5 pull requests

Successful merges:

 - rust-lang#132161 ([StableMIR] A few fixes to pretty printing)
 - rust-lang#132389 (coverage: Simplify parts of coverage graph creation)
 - rust-lang#132452 (coverage: Extract safe FFI wrapper functions to `llvm_cov`)
 - rust-lang#132590 (Simplify FFI calls for `-Ztime-llvm-passes` and `-Zprint-codegen-stats`)
 - rust-lang#132738 (Initialize channel `Block`s directly on the heap)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5043c57 into rust-lang:master Nov 8, 2024
@rustbot rustbot added this to the 1.84.0 milestone Nov 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 8, 2024
Rollup merge of rust-lang#132161 - celinval:smir-fix-indent, r=compiler-errors

[StableMIR] A few fixes to pretty printing

Improve identation, and a few other rvalue printing

try-job: x86_64-msvc
try-job: test-various
mati865 pushed a commit to mati865/rust that referenced this pull request Nov 12, 2024
…er-errors

[StableMIR] A few fixes to pretty printing

Improve identation, and a few other rvalue printing

try-job: x86_64-msvc
try-job: test-various
mati865 pushed a commit to mati865/rust that referenced this pull request Nov 12, 2024
Rollup of 5 pull requests

Successful merges:

 - rust-lang#132161 ([StableMIR] A few fixes to pretty printing)
 - rust-lang#132389 (coverage: Simplify parts of coverage graph creation)
 - rust-lang#132452 (coverage: Extract safe FFI wrapper functions to `llvm_cov`)
 - rust-lang#132590 (Simplify FFI calls for `-Ztime-llvm-passes` and `-Zprint-codegen-stats`)
 - rust-lang#132738 (Initialize channel `Block`s directly on the heap)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-rustc_public Area: Crate rustc_public (formerly: Stable MIR, SMIR) A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

7 participants