about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-07-07 18:06:53 +0530
committerGitHub <noreply@github.com>2022-07-07 18:06:53 +0530
commit71b3fbdb47d940ccdb2aef06cf3f989057e30824 (patch)
treea116a0ec9c811de5a4b72a010151590568f00550 /src
parentade6d2cf6b1b42b3974ab4085918a06e55947865 (diff)
parent17adfeb2b477231515dfcb20a371f9f778969d15 (diff)
downloadrust-71b3fbdb47d940ccdb2aef06cf3f989057e30824.tar.gz
rust-71b3fbdb47d940ccdb2aef06cf3f989057e30824.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/tools/clippy/clippy_lints/src/redundant_clone.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/clippy/clippy_lints/src/redundant_clone.rs b/src/tools/clippy/clippy_lints/src/redundant_clone.rs
index 6d0b9a0f03f..eddca604575 100644
--- a/src/tools/clippy/clippy_lints/src/redundant_clone.rs
+++ b/src/tools/clippy/clippy_lints/src/redundant_clone.rs
@@ -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;
                 }