| Age | Commit message (Collapse) | Author | Lines |
|
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.
|
|
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.
|
|
|
|
|
|
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
|
|
|
|
we already track this info in the `definitions` field
|
|
It's a very small and simple type.
|
|
this is used in diagnostics to focus on relevant live locals to match
NLL diagnostics
|
|
|
|
|
|
- invert pre/code which was an invalid combination, that works fine in
practice
- remove unneeded code wrapper for graphs
|
|
|
|
|
|
|
|
escape the regular raw MIR into its own section
|
|
|
|
- move constraints to an Option
- check `-Zpolonius=next` only once
- rewrite fixme comments to make the actionable part clear
|
|
This is mostly for test purposes to show the localized constraints until
the MIR debugger is set up.
|