Uh oh!
There was an error while loading. Please reload this page.
Make MIR basic blocks field public - #98930
Conversation
rustbot
commented
Jul 5, 2022
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
commented
Jul 5, 2022
(rust-highfive has picked a reviewer for you, use r? to override) |
Uh oh!
There was an error while loading. Please reload this page.
oli-obk
commented
Jul 5, 2022
r? @oli-obk this is neat, definitely a massive improvement over the explosion of iteration methods ^^ |
JakobDegen
commented
Jul 5, 2022
Yeah, agreed, this is a much better solution than what I did |
oli-obk
commented
Jul 6, 2022
@bors r+ |
bors
commented
Jul 6, 2022
📌 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.
Dylan-DPC
commented
Jul 7, 2022
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.
oli-obk
commented
Jul 7, 2022
@bors r+ |
bors
commented
Jul 7, 2022
📌 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.
eddyb
commented
Jul 7, 2022
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
BasicBlockswraps together basic blocksand control flow graph caches.
The
BasicBlocksdereferences toIndexVec<BasicBlock, BasicBlockData>.On the other hand a mutable access requires explicit
as_mut()call.