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

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

celinval
Copy link
Contributor

@celinval celinval commented Oct 25, 2024

Improve identation, and a few other rvalue printing

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

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

tests/ui/stable-mir-print/operands.rs Show resolved Hide resolved
@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
@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 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
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???

@rustbot
Copy link
Collaborator

rustbot commented Nov 7, 2024

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@celinval
Copy link
Contributor Author

celinval commented Nov 7, 2024

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

bors commented Nov 7, 2024

⌛ Trying commit 3bfe733 with merge d889fd4...

@celinval
Copy link
Contributor Author

celinval commented Nov 7, 2024

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

@compiler-errors
Copy link
Member

compiler-errors commented Nov 7, 2024

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

bors commented Nov 7, 2024

💔 Test failed - checks-actions

@compiler-errors
Copy link
Member

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

celinval commented Nov 7, 2024

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
Member

cc @jieyouxu

Improve identation, and a few other rvalue printing
@celinval
Copy link
Contributor Author

celinval commented Nov 8, 2024

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

bors commented Nov 8, 2024

⌛ 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
Member

r=me if CI is green

@bors
Copy link
Contributor

bors commented Nov 8, 2024

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

@celinval
Copy link
Contributor Author

celinval commented Nov 8, 2024

@bors r=compiler-errors rollup

@bors
Copy link
Contributor

bors commented Nov 8, 2024

📌 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
7 checks passed
@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-stable-MIR Area: stable MIR 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