Skip to content

Commit 34dfbc3

Browse files
Add module docs and restrict visibility
1 parent 59c7460 commit 34dfbc3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/librustc_middle/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub struct Body<'tcx> {
164164
/// FIXME(oli-obk): rewrite the promoted during promotion to eliminate the cell components.
165165
pub ignore_interior_mut_in_const_validation: bool,
166166

167-
pub predecessor_cache: PredecessorCache,
167+
predecessor_cache: PredecessorCache,
168168
}
169169

170170
impl<'tcx> Body<'tcx> {

src/librustc_middle/mir/predecessors.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Lazily compute the reverse control-flow graph for the MIR.
2+
13
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
24
use rustc_data_structures::sync::{Lock, Lrc};
35
use rustc_index::vec::IndexVec;
@@ -10,13 +12,13 @@ use crate::mir::{BasicBlock, BasicBlockData};
1012
pub type Predecessors = IndexVec<BasicBlock, SmallVec<[BasicBlock; 4]>>;
1113

1214
#[derive(Clone, Debug)]
13-
pub struct PredecessorCache {
15+
pub(super) struct PredecessorCache {
1416
cache: Lock<Option<Lrc<Predecessors>>>,
1517
}
1618

1719
impl PredecessorCache {
1820
#[inline]
19-
pub fn new() -> Self {
21+
pub(super) fn new() -> Self {
2022
PredecessorCache { cache: Lock::new(None) }
2123
}
2224

@@ -27,7 +29,7 @@ impl PredecessorCache {
2729
/// callers of `invalidate` have a unique reference to the MIR and thus to the predecessor
2830
/// cache. This means we don't actually need to take a lock when `invalidate` is called.
2931
#[inline]
30-
pub fn invalidate(&mut self) {
32+
pub(super) fn invalidate(&mut self) {
3133
*self.cache.get_mut() = None;
3234
}
3335

@@ -37,7 +39,7 @@ impl PredecessorCache {
3739
/// `cache` is only held inside this function. As long as no other locks are taken while
3840
/// computing the predecessor graph, deadlock is impossible.
3941
#[inline]
40-
pub fn compute(
42+
pub(super) fn compute(
4143
&self,
4244
basic_blocks: &IndexVec<BasicBlock, BasicBlockData<'_>>,
4345
) -> Lrc<Predecessors> {

0 commit comments

Comments
 (0)