-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Make MIR basic blocks field public #98930
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 |
Make MIR basic blocks field public 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.
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 |
Make MIR basic blocks field public 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.
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 |
Rollup of 8 pull requests Successful merges: - rust-lang#96856 (Fix ProjectionElem validation) - rust-lang#97711 (Improve soundness of rustc_arena) - rust-lang#98507 (Finishing touches for `#[expect]` (RFC 2383)) - rust-lang#98692 (rustdoc: Cleanup more FIXMEs) - rust-lang#98901 (incr: cache dwarf objects in work products) - rust-lang#98930 (Make MIR basic blocks field public) - rust-lang#98973 (Remove (unused) inherent impl anchors) - rust-lang#98981 ( Edit `rustc_mir_dataflow::framework` documentation ) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Make MIR basic blocks field public 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.
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Replace `Body::basic_blocks()` with field access Since the refactoring in rust-lang#98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
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.