Reduce pub usage.

This commit is contained in:
Nicholas Nethercote 2023-11-22 14:01:52 +11:00
parent c16d3f32a4
commit 64a8c4ddda
3 changed files with 10 additions and 12 deletions

View File

@ -15,7 +15,7 @@ use super::fmt::{DebugDiffWithAdapter, DebugWithAdapter, DebugWithContext};
use super::{Analysis, CallReturnPlaces, Direction, Results, ResultsRefCursor, ResultsVisitor}; use super::{Analysis, CallReturnPlaces, Direction, Results, ResultsRefCursor, ResultsVisitor};
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OutputStyle { pub(crate) enum OutputStyle {
AfterOnly, AfterOnly,
BeforeAndAfter, BeforeAndAfter,
} }
@ -29,7 +29,7 @@ impl OutputStyle {
} }
} }
pub struct Formatter<'res, 'mir, 'tcx, A> pub(crate) struct Formatter<'res, 'mir, 'tcx, A>
where where
A: Analysis<'tcx>, A: Analysis<'tcx>,
{ {
@ -43,7 +43,7 @@ impl<'res, 'mir, 'tcx, A> Formatter<'res, 'mir, 'tcx, A>
where where
A: Analysis<'tcx>, A: Analysis<'tcx>,
{ {
pub fn new( pub(crate) fn new(
body: &'mir Body<'tcx>, body: &'mir Body<'tcx>,
results: &'res mut Results<'tcx, A>, results: &'res mut Results<'tcx, A>,
style: OutputStyle, style: OutputStyle,
@ -55,7 +55,7 @@ where
/// A pair of a basic block and an index into that basic blocks `successors`. /// A pair of a basic block and an index into that basic blocks `successors`.
#[derive(Copy, Clone, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct CfgEdge { pub(crate) struct CfgEdge {
source: BasicBlock, source: BasicBlock,
index: usize, index: usize,
} }

View File

@ -21,7 +21,7 @@ use rustc_span::Span;
pub struct SanityCheck; pub struct SanityCheck;
pub fn has_rustc_mir_with(tcx: TyCtxt<'_>, def_id: DefId, name: Symbol) -> Option<MetaItem> { fn has_rustc_mir_with(tcx: TyCtxt<'_>, def_id: DefId, name: Symbol) -> Option<MetaItem> {
for attr in tcx.get_attrs(def_id, sym::rustc_mir) { for attr in tcx.get_attrs(def_id, sym::rustc_mir) {
let items = attr.meta_item_list(); let items = attr.meta_item_list();
for item in items.iter().flat_map(|l| l.iter()) { for item in items.iter().flat_map(|l| l.iter()) {
@ -101,10 +101,8 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
/// (If there are any calls to `rustc_peek` that do not match the /// (If there are any calls to `rustc_peek` that do not match the
/// expression form above, then that emits an error as well, but those /// expression form above, then that emits an error as well, but those
/// errors are not intended to be used for unit tests.) /// errors are not intended to be used for unit tests.)
pub fn sanity_check_via_rustc_peek<'tcx, A>( fn sanity_check_via_rustc_peek<'tcx, A>(tcx: TyCtxt<'tcx>, mut cursor: ResultsCursor<'_, 'tcx, A>)
tcx: TyCtxt<'tcx>, where
mut cursor: ResultsCursor<'_, 'tcx, A>,
) where
A: RustcPeekAt<'tcx>, A: RustcPeekAt<'tcx>,
{ {
let def_id = cursor.body().source.def_id(); let def_id = cursor.body().source.def_id();
@ -185,7 +183,7 @@ impl PeekCallKind {
} }
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub struct PeekCall { struct PeekCall {
arg: Local, arg: Local,
kind: PeekCallKind, kind: PeekCallKind,
span: Span, span: Span,
@ -233,7 +231,7 @@ impl PeekCall {
} }
} }
pub trait RustcPeekAt<'tcx>: Analysis<'tcx> { trait RustcPeekAt<'tcx>: Analysis<'tcx> {
fn peek_at( fn peek_at(
&self, &self,
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,

View File

@ -921,7 +921,7 @@ impl Map {
} }
/// Locates the given place, if it exists in the tree. /// Locates the given place, if it exists in the tree.
pub fn find_extra( fn find_extra(
&self, &self,
place: PlaceRef<'_>, place: PlaceRef<'_>,
extra: impl IntoIterator<Item = TrackElem>, extra: impl IntoIterator<Item = TrackElem>,