Skip to content

Commit 5474f56

Browse files
authored
Rollup merge of #98930 - tmiasko:pub-basic-blocks, r=oli-obk
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.
2 parents 4f9933a + cac25cd commit 5474f56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clippy_lints/src/redundant_clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone {
161161
// `arg` is a reference as it is `.deref()`ed in the previous block.
162162
// Look into the predecessor block and find out the source of deref.
163163

164-
let ps = &mir.predecessors()[bb];
164+
let ps = &mir.basic_blocks.predecessors()[bb];
165165
if ps.len() != 1 {
166166
continue;
167167
}

0 commit comments

Comments
 (0)