-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make MIR basic blocks field public #98930
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
Conversation
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
(rust-highfive has picked a reviewer for you, use r? to override) |
r? @oli-obk this is neat, definitely a massive improvement over the explosion of iteration methods ^^ |
Yeah, agreed, this is a much better solution than what I did |
@bors r+ |
📌 Commit 802cb1c has been approved by |
This makes it possible to mutably borrow different fields of the MIR body without resorting to methods like `basic_blocks_local_decls_mut_and_var_debug_info`. To preserve validity of control flow graph caches in the presence of modifications, a new struct `BasicBlocks` wraps together basic blocks and control flow graph caches. The `BasicBlocks` dereferences to `IndexVec<BasicBlock, BasicBlockData>`. On the other hand a mutable access requires explicit `as_mut()` call.
@bors r+ |
📌 Commit 17adfeb has been approved by |
Neat! I guess the focus on As a random aside, I believe some IRs would describe this subset of information as "the CFG" (though they might vary in whether that includes the BB contents, or just the terminators). The only reason I bring this up is because |
This makes it possible to mutably borrow different fields of the MIR
body without resorting to methods like
basic_blocks_local_decls_mut_and_var_debug_info
.To preserve validity of control flow graph caches in the presence of
modifications, a new struct
BasicBlocks
wraps together basic blocksand control flow graph caches.
The
BasicBlocks
dereferences toIndexVec<BasicBlock, BasicBlockData>
.On the other hand a mutable access requires explicit
as_mut()
call.