Skip to content

Commit

Permalink
Rollup merge of rust-lang#98930 - tmiasko:pub-basic-blocks, r=oli-obk
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Dylan-DPC authored Jul 7, 2022
2 parents 4f9933a + cac25cd commit 5474f56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone {
// `arg` is a reference as it is `.deref()`ed in the previous block.
// Look into the predecessor block and find out the source of deref.

let ps = &mir.predecessors()[bb];
let ps = &mir.basic_blocks.predecessors()[bb];
if ps.len() != 1 {
continue;
}
Expand Down

0 comments on commit 5474f56

Please sign in to comment.