Reduce pub exposure.

A lot of errors don't need to be visible outside the crate, and some
other things as well.
This commit is contained in:
Nicholas Nethercote 2024-06-04 15:28:09 +10:00
parent 6b47c5e24d
commit 5a5e2489c5
9 changed files with 275 additions and 275 deletions

View File

@ -179,18 +179,18 @@ impl MCDCState {
}
}
pub struct MCDCInfoBuilder {
pub(crate) struct MCDCInfoBuilder {
branch_spans: Vec<MCDCBranchSpan>,
decision_spans: Vec<MCDCDecisionSpan>,
state: MCDCState,
}
impl MCDCInfoBuilder {
pub fn new() -> Self {
pub(crate) fn new() -> Self {
Self { branch_spans: vec![], decision_spans: vec![], state: MCDCState::new() }
}
pub fn visit_evaluated_condition(
pub(crate) fn visit_evaluated_condition(
&mut self,
tcx: TyCtxt<'_>,
source_info: SourceInfo,
@ -243,7 +243,7 @@ impl MCDCInfoBuilder {
});
}
pub fn into_done(self) -> (Vec<MCDCDecisionSpan>, Vec<MCDCBranchSpan>) {
pub(crate) fn into_done(self) -> (Vec<MCDCDecisionSpan>, Vec<MCDCBranchSpan>) {
(self.decision_spans, self.branch_spans)
}
}

View File

@ -91,7 +91,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
}
}
pub fn parse_args(&mut self, params: &IndexSlice<ParamId, Param<'tcx>>) -> PResult<()> {
pub(crate) fn parse_args(&mut self, params: &IndexSlice<ParamId, Param<'tcx>>) -> PResult<()> {
for param in params.iter() {
let (var, span) = {
let pat = param.pat.as_ref().unwrap();
@ -149,7 +149,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
///
/// This allows us to easily parse the basic blocks declarations, local declarations, and
/// basic block definitions in order.
pub fn parse_body(&mut self, expr_id: ExprId) -> PResult<()> {
pub(crate) fn parse_body(&mut self, expr_id: ExprId) -> PResult<()> {
let body = parse_by_kind!(self, expr_id, _, "whole body",
ExprKind::Block { block } => self.thir[*block].expr.unwrap(),
);

View File

@ -12,7 +12,7 @@ use crate::build::expr::as_constant::as_constant_inner;
use super::{parse_by_kind, PResult, ParseCtxt};
impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
pub fn parse_statement(&self, expr_id: ExprId) -> PResult<StatementKind<'tcx>> {
pub(crate) fn parse_statement(&self, expr_id: ExprId) -> PResult<StatementKind<'tcx>> {
parse_by_kind!(self, expr_id, _, "statement",
@call(mir_storage_live, args) => {
Ok(StatementKind::StorageLive(self.parse_local(args[0])?))
@ -46,7 +46,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
)
}
pub fn parse_terminator(&self, expr_id: ExprId) -> PResult<TerminatorKind<'tcx>> {
pub(crate) fn parse_terminator(&self, expr_id: ExprId) -> PResult<TerminatorKind<'tcx>> {
parse_by_kind!(self, expr_id, expr, "terminator",
@call(mir_return, _args) => {
Ok(TerminatorKind::Return)
@ -261,7 +261,7 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
)
}
pub fn parse_operand(&self, expr_id: ExprId) -> PResult<Operand<'tcx>> {
pub(crate) fn parse_operand(&self, expr_id: ExprId) -> PResult<Operand<'tcx>> {
parse_by_kind!(self, expr_id, expr, "operand",
@call(mir_move, args) => self.parse_place(args[0]).map(Operand::Move),
@call(mir_static, args) => self.parse_static(args[0]),

View File

@ -39,7 +39,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
}
pub fn as_constant_inner<'tcx>(
pub(crate) fn as_constant_inner<'tcx>(
expr: &Expr<'tcx>,
push_cuta: impl FnMut(&Box<CanonicalUserType<'tcx>>) -> Option<UserTypeAnnotationIndex>,
tcx: TyCtxt<'tcx>,

View File

@ -62,9 +62,9 @@
pub(crate) mod as_constant;
mod as_operand;
pub mod as_place;
pub(crate) mod as_place;
mod as_rvalue;
mod as_temp;
pub mod category;
pub(crate) mod category;
mod into;
mod stmt;

View File

@ -456,7 +456,7 @@ impl<'a, 'b, 'tcx> FakeBorrowCollector<'a, 'b, 'tcx> {
}
#[must_use]
pub fn ref_pat_borrow_kind(ref_mutability: Mutability) -> BorrowKind {
pub(crate) fn ref_pat_borrow_kind(ref_mutability: Mutability) -> BorrowKind {
match ref_mutability {
Mutability::Mut => BorrowKind::Mut { kind: MutBorrowKind::Default },
Mutability::Not => BorrowKind::Shared,

View File

@ -97,7 +97,7 @@ use rustc_span::{Span, DUMMY_SP};
use tracing::{debug, instrument};
#[derive(Debug)]
pub struct Scopes<'tcx> {
pub(crate) struct Scopes<'tcx> {
scopes: Vec<Scope>,
/// The current set of breakable scopes. See module comment for more details.

View File

@ -597,7 +597,7 @@ enum UnsafeOpKind {
use UnsafeOpKind::*;
impl UnsafeOpKind {
pub fn emit_unsafe_op_in_unsafe_fn_lint(
fn emit_unsafe_op_in_unsafe_fn_lint(
&self,
tcx: TyCtxt<'_>,
hir_id: HirId,
@ -737,7 +737,7 @@ impl UnsafeOpKind {
}
}
pub fn emit_requires_unsafe_err(
fn emit_requires_unsafe_err(
&self,
tcx: TyCtxt<'_>,
span: Span,

File diff suppressed because it is too large Load Diff