Skip to content

Commit 740f228

Browse files
Remove predecessors_for
There is no `Arc::map` equivalent to `LockGuard::map`
1 parent db9b05a commit 740f228

File tree

5 files changed

+5
-16
lines changed

5 files changed

+5
-16
lines changed

src/librustc_codegen_ssa/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
155155
let cleanup_kinds = analyze::cleanup_kinds(&mir);
156156
// Allocate a `Block` for every basic block, except
157157
// the start block, if nothing loops back to it.
158-
let reentrant_start_block = !mir.predecessors_for(mir::START_BLOCK).is_empty();
158+
let reentrant_start_block = !mir.predecessors()[mir::START_BLOCK].is_empty();
159159
let block_bxs: IndexVec<mir::BasicBlock, Bx::BasicBlock> = mir
160160
.basic_blocks()
161161
.indices()

src/librustc_middle/mir/mod.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ use rustc_ast::ast::Name;
2323
use rustc_data_structures::fx::FxHashSet;
2424
use rustc_data_structures::graph::dominators::{dominators, Dominators};
2525
use rustc_data_structures::graph::{self, GraphSuccessors};
26-
use rustc_data_structures::sync::MappedLockGuard;
2726
use rustc_index::bit_set::BitMatrix;
2827
use rustc_index::vec::{Idx, IndexVec};
2928
use rustc_macros::HashStable;
3029
use rustc_serialize::{Decodable, Encodable};
3130
use rustc_span::symbol::Symbol;
3231
use rustc_span::{Span, DUMMY_SP};
33-
use smallvec::SmallVec;
3432
use std::borrow::Cow;
3533
use std::fmt::{self, Debug, Display, Formatter, Write};
3634
use std::ops::{Index, IndexMut};
@@ -392,15 +390,6 @@ impl<'tcx> Body<'tcx> {
392390
Location { block: bb, statement_index: self[bb].statements.len() }
393391
}
394392

395-
#[inline]
396-
pub fn predecessors_for(
397-
&self,
398-
bb: BasicBlock,
399-
) -> impl std::ops::Deref<Target = SmallVec<[BasicBlock; 4]>> + '_ {
400-
let predecessors = self.predecessor_cache.compute(&self.basic_blocks);
401-
MappedLockGuard::map(predecessors, |preds| &mut preds[bb])
402-
}
403-
404393
#[inline]
405394
pub fn predecessors(&self) -> impl std::ops::Deref<Target = Predecessors> + '_ {
406395
self.predecessor_cache.compute(&self.basic_blocks)
@@ -2676,7 +2665,7 @@ impl graph::GraphPredecessors<'graph> for Body<'tcx> {
26762665
impl graph::WithPredecessors for Body<'tcx> {
26772666
#[inline]
26782667
fn predecessors(&self, node: Self::Node) -> <Self as graph::GraphPredecessors<'_>>::Iter {
2679-
self.predecessors_for(node).clone().into_iter()
2668+
self.predecessors()[node].clone().into_iter()
26802669
}
26812670
}
26822671

src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12681268
location: Location,
12691269
) -> impl Iterator<Item = Location> + 'a {
12701270
if location.statement_index == 0 {
1271-
let predecessors = body.predecessors_for(location.block).to_vec();
1271+
let predecessors = body.predecessors()[location.block].to_vec();
12721272
Either::Left(predecessors.into_iter().map(move |bb| body.terminator_loc(bb)))
12731273
} else {
12741274
Either::Right(std::iter::once(Location {

src/librustc_mir/borrow_check/region_infer/values.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl RegionValueElements {
8989
// If this is a basic block head, then the predecessors are
9090
// the terminators of other basic blocks
9191
stack.extend(
92-
body.predecessors_for(block)
92+
body.predecessors()[block]
9393
.iter()
9494
.map(|&pred_bb| body.terminator_loc(pred_bb))
9595
.map(|pred_loc| self.point_from_location(pred_loc)),

src/librustc_mir/borrow_check/type_check/liveness/trace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl LivenessResults<'me, 'typeck, 'flow, 'tcx> {
303303
}
304304

305305
let body = self.cx.body;
306-
for &pred_block in body.predecessors_for(block).iter() {
306+
for &pred_block in body.predecessors()[block].iter() {
307307
debug!("compute_drop_live_points_for_block: pred_block = {:?}", pred_block,);
308308

309309
// Check whether the variable is (at least partially)

0 commit comments

Comments
 (0)