about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/polonius/dump.rs
AgeCommit message (Collapse)AuthorLines
2025-09-01Introduce `MirDumper` and `MirWriter`.Nicholas Nethercote-55/+32
MIR dumping is a mess. There are lots of functions and entry points, e.g. `dump_mir`, `dump_mir_with_options`, `dump_polonius_mir`, `dump_mir_to_writer`. Also, it's crucial that `create_dump_file` is never called without `dump_enabled` first being checked, but there is no mechanism for ensuring this and it's hard to tell if it is satisfied on all paths. (`dump_enabled` is checked twice on some paths, however!) This commit introduces `MirWriter`, which controls the MIR writing, and encapsulates the `extra_data` closure and `options`. Two existing functions are now methods of this type. It sets reasonable defaults, allowing the removal of many `|_, _| Ok(())` closures. The commit also introduces `MirDumper`, which is layered on top of `MirWriter`, and which manages the creation of the dump files, encapsulating pass names, disambiguators, etc. Four existing functions are now methods of this type. - `MirDumper::new` will only succeed if dumps are enabled, and will return `None` otherwise, which makes it impossible to dump when you shouldn't. - It also sets reasonable defaults for various things like disambiguators, which means you no longer need to specify them in many cases. When they do need to be specified, it's now done via setter methods. - It avoids some repetition. E.g. `dump_nll_mir` previously specifed the pass name `"nll"` four times and the disambiguator `&0` three times; now it specifies them just once, to put them in the `MirDumper`. - For Polonius, the `extra_data` closure can now be specified earlier, which avoids having to pass some arguments through some functions.
2025-09-01Use trait object references for closures.Nicholas Nethercote-1/+1
The dynamic dispatch cost doesn't matter for MIR dumping, which is perf-insensitive. And it's necessary for the next commit, which will store some `extra_data` closures in a struct.
2025-07-04Remove Symbol for Named LateParam/Bound variantsMichael Goulet-7/+10
2025-04-11move `dump_polonius_mir`lcnr-1/+1
2025-04-08Auto merge of #139536 - matthiaskrgr:rollup-j6goald, r=matthiaskrgrbors-2/+2
Rollup of 7 pull requests Successful merges: - #139476 (rm `RegionInferenceContext::var_infos`) - #139485 (compiletest: Stricter parsing for diagnostic kinds) - #139491 (Update books) - #139500 (document panic behavior of Vec::resize and Vec::resize_with) - #139501 (Fix stack overflow in exhaustiveness due to recursive HIR opaque hidden types) - #139504 (add missing word in doc comment) - #139509 (clean: remove Deref<Target=RegionKind> impl for Region and use `.kind()`) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-08move `ClosureRegionRequirements` to `rustc_borrowck`lcnr-2/+2
2025-04-07rm `RegionInferenceContext::var_infos`lcnr-2/+2
we already track this info in the `definitions` field
2025-02-21Make `PassWhere` impl `Copy`.Nicholas Nethercote-1/+1
It's a very small and simple type.
2025-01-31record boring locals in polonius contextRémy Rakic-4/+4
this is used in diagnostics to focus on relevant live locals to match NLL diagnostics
2025-01-31create context for errors and diagnostics for last borrowck phaseRémy Rakic-5/+7
2025-01-30add constraint graph to polonius MIR dumpRémy Rakic-9/+101
2025-01-26tidy up html structureRémy Rakic-4/+4
- invert pre/code which was an invalid combination, that works fine in practice - remove unneeded code wrapper for graphs
2025-01-26add NLL SCCs to polonius MIR dumpRémy Rakic-0/+49
2025-01-26add NLL region graph to the polonius MIR dumpRémy Rakic-1/+83
2025-01-25add CFG to polonius MIR dumpRémy Rakic-2/+71
2025-01-25switch polonius MIR dump to HTMLRémy Rakic-9/+67
escape the regular raw MIR into its own section
2025-01-25use more explicit MIR dumping processRémy Rakic-4/+36
2024-12-18address review commentsRémy Rakic-2/+5
- move constraints to an Option - check `-Zpolonius=next` only once - rewrite fixme comments to make the actionable part clear
2024-12-18introduce beginnings of polonius MIR dumpRémy Rakic-0/+101
This is mostly for test purposes to show the localized constraints until the MIR debugger is set up.