Hello! I've suddenly got a lot of time on my hands and I'd really like to get more involved in rustc. The rustc dev guide suggested joining a wg and mir opt is something I'm particularly interested in (although my knowledge of mir is very limited). Are there any issues that are a good place for me to start?
Welcome! This one I filed a few days ago should be fairly straightforward: https://github.com/rust-lang/rust/issues/72959
Awesome! I'll have a look :)
Something else that would be fairly useful would be documenting the MIR invariants that the validator and Miri are enforcing as doc comments on the MIR types themselves
I can definitely have a look at that as well
For unwind blocks I think this is already the case
(As in the invariant is documented, but it's not yet enforced)
I had a quick look (#73133) some feedback on how to write tests/if this is the right idea would be amazing
unfortunately we have no way to generate arbitrary MIR, but we'd like to have: https://github.com/rust-lang/miri/issues/196
without a way to generate abitrary MIR, you can't test for broken MIR, as rustc should not be emitting broken MIR
note that your validation checks seem to have found a bug in the MIR building phase
You can also set
RUSTFLAGS_NOT_BOOTSTRAP=-Zvalidate-mir to run the validator after every MIR transformation. This should give you a good idea of whether some pass produces broken MIR.
Ok, thanks a lot! I'll investigate the breakage (just want to check should all edges between cleanup blocks be unwind?)
No, they can also have normal edges
But once in a cleanup block you can never go back to a non-cleanup block
Ok got it!
With that relaxation the validation seems to pass fine
Edges between cleanup blocks should only be normal edges.
Panicking in cleanup aborts
should this use a dataflow algorithm?
any custom algorithm would have to basically replicate dataflow I think
We mark which blocks are cleanup. There's no need for dataflow.
Ok that's an easy fix - I don't think it needs data-flow
Jonas Schievink said:
You can also set
RUSTFLAGS_NOT_BOOTSTRAP=-Zvalidate-mirto run the validator after every MIR transformation. This should give you a good idea of whether some pass produces broken MIR.
oh thats how you do that :D