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

Expand polonius MIR dump #136031

Merged
merged 5 commits into from
Jan 26, 2025
Merged

Conversation

lqd
Copy link
Member

@lqd lqd commented Jan 24, 2025

This PR starts expanding the polonius MIR:

  • switches to an HTML file, to show graphs in the same document as the MIR dump, share them more easily since it's a single file that can be hosted as a gist, and also to allow for interactivity in the near future.
  • adds the regular NLL MIR + polonius constraints
  • embeds a mermaid version of the CFG, similar to the graphviz one, but that needs a smaller js than dot's emscripten js from graphvizonline

Here's an example of how it looks.


In future PRs: mermaid graphs of the NLL region graph, of the NLL SCCs, of the polonius localized outlives constraints, and the interactive polonius MIR dump.

r? @matthewjasper

@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 Jan 24, 2025
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.

r=me unless you want a specific review from matthewjasper

/// That being said, if the above requirements have been validated already, this function is where
/// most of the MIR dumping occurs, if one needs to export it to a file they have created with
/// [create_dump_file], rather than to a new file created as part of [dump_mir].
pub fn dump_mir_to_writer<'tcx, F>(
Copy link
Member

Choose a reason for hiding this comment

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

I've wanted this so I could dump MIR to stderr :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Darn I’ve also wanted that before, I’ll actually add it to the comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@lqd
Copy link
Member Author

lqd commented Jan 25, 2025

Thanks for the review, Michael! In this case it was also to keep Matthew updated on the work, have his feedback in case he has opinions or ideas about debugging borrowck issues and how to support it better, but there’s no need to block on that yet and a ping also works. We can iterate later easily.

I’ll r=you once I’ve updated the comment.

lqd added 5 commits January 25, 2025 07:32
for cases where we want to dump the MIR to a given writer instead of a
new file as the default does.

this will be used when dumping the MIR to a buffer to process
differently, e.g. post-process to escape for an HTML dump.
escape the regular raw MIR into its own section
@lqd lqd force-pushed the polonius-debugger-episode-1 branch from f686d39 to 09fb70a Compare January 25, 2025 07:51
@lqd
Copy link
Member Author

lqd commented Jan 25, 2025

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Jan 25, 2025

📌 Commit 09fb70a 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 Jan 25, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 25, 2025
…=compiler-errors

Expand polonius MIR dump

This PR starts expanding the polonius MIR:
- switches to an HTML file, to show graphs in the same document as the MIR dump, share them more easily since it's a single file that can be hosted as a gist, and also to allow for interactivity in the near future.
- adds the regular NLL MIR + polonius constraints
- embeds a mermaid version of the CFG, similar to the graphviz one, but that needs a smaller js than `dot`'s emscripten js from graphvizonline

[Here's an example](https://gistpreview.github.io/?0c18f2a59b5e24ac0f96447aa34ffe00) of how it looks.

---
In future PRs: mermaid graphs of the NLL region graph, of the NLL SCCs, of the polonius localized outlives constraints, and the interactive polonius MIR dump.

r? `@matthewjasper`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 25, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#133631 (Support QNX 7.1 with `io-sock`+libstd and QNX 8.0 (`no_std` only))
 - rust-lang#133951 (Make the wasm_c_abi future compat warning a hard error)
 - rust-lang#134283 (fix(libtest): Deprecate '--logfile')
 - rust-lang#134679 (Windows: remove readonly files)
 - rust-lang#135635 (Move `std::io::pipe` code into its own file)
 - rust-lang#135842 (TRPL: more backward-compatible Edition changes)
 - rust-lang#135953 (ci.py: check the return code in `run-local`)
 - rust-lang#136031 (Expand polonius MIR dump)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 25, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#133631 (Support QNX 7.1 with `io-sock`+libstd and QNX 8.0 (`no_std` only))
 - rust-lang#133951 (Make the wasm_c_abi future compat warning a hard error)
 - rust-lang#134283 (fix(libtest): Deprecate '--logfile')
 - rust-lang#134679 (Windows: remove readonly files)
 - rust-lang#135635 (Move `std::io::pipe` code into its own file)
 - rust-lang#135842 (TRPL: more backward-compatible Edition changes)
 - rust-lang#135953 (ci.py: check the return code in `run-local`)
 - rust-lang#136031 (Expand polonius MIR dump)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 26, 2025
…=compiler-errors

Expand polonius MIR dump

This PR starts expanding the polonius MIR:
- switches to an HTML file, to show graphs in the same document as the MIR dump, share them more easily since it's a single file that can be hosted as a gist, and also to allow for interactivity in the near future.
- adds the regular NLL MIR + polonius constraints
- embeds a mermaid version of the CFG, similar to the graphviz one, but that needs a smaller js than `dot`'s emscripten js from graphvizonline

[Here's an example](https://gistpreview.github.io/?0c18f2a59b5e24ac0f96447aa34ffe00) of how it looks.

---
In future PRs: mermaid graphs of the NLL region graph, of the NLL SCCs, of the polonius localized outlives constraints, and the interactive polonius MIR dump.

r? ``@matthewjasper``
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 26, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang#133951 (Make the wasm_c_abi future compat warning a hard error)
 - rust-lang#134283 (fix(libtest): Deprecate '--logfile')
 - rust-lang#135785 (use `PassMode::Direct` for vector types on `s390x`)
 - rust-lang#135948 (Update emscripten std tests)
 - rust-lang#135951 (Use `fmt::from_fn` in more places in the compiler)
 - rust-lang#136031 (Expand polonius MIR dump)
 - rust-lang#136032 (Account for mutable borrow in argument suggestion)

Failed merges:

 - rust-lang#135635 (Move `std::io::pipe` code into its own file)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 182ccfa into rust-lang:master Jan 26, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 26, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 26, 2025
Rollup merge of rust-lang#136031 - lqd:polonius-debugger-episode-1, r=compiler-errors

Expand polonius MIR dump

This PR starts expanding the polonius MIR:
- switches to an HTML file, to show graphs in the same document as the MIR dump, share them more easily since it's a single file that can be hosted as a gist, and also to allow for interactivity in the near future.
- adds the regular NLL MIR + polonius constraints
- embeds a mermaid version of the CFG, similar to the graphviz one, but that needs a smaller js than `dot`'s emscripten js from graphvizonline

[Here's an example](https://gistpreview.github.io/?0c18f2a59b5e24ac0f96447aa34ffe00) of how it looks.

---
In future PRs: mermaid graphs of the NLL region graph, of the NLL SCCs, of the polonius localized outlives constraints, and the interactive polonius MIR dump.

r? ```@matthewjasper```
@lqd lqd deleted the polonius-debugger-episode-1 branch January 26, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants