Rollup merge of #125959 - nnethercote:rustc_mir_build-cleanups, r=compiler-errors

Reduce `pub` exposure in `rustc_mir_build`

r? compiler
This commit is contained in:
Michael Goulet 2024-06-04 08:52:14 -04:00 committed by GitHub
commit 8272c6d8cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 275 additions and 277 deletions

View File

@ -179,18 +179,18 @@ fn take_condition(
}
}
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 @@ pub fn visit_evaluated_condition(
});
}
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 @@ fn statement_as_expr(&self, stmt_id: StmtId) -> PResult<ExprId> {
}
}
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 @@ pub fn parse_args(&mut self, params: &IndexSlice<ParamId, Param<'tcx>>) -> PResu
///
/// 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 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 @@ pub fn parse_statement(&self, expr_id: ExprId) -> PResult<StatementKind<'tcx>> {
)
}
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 @@ fn parse_rvalue(&self, expr_id: ExprId) -> PResult<Rvalue<'tcx>> {
)
}
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 @@ pub(crate) fn as_constant(&mut self, expr: &Expr<'tcx>) -> ConstOperand<'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 @@ fn visit_binding(&mut self, Binding { source, .. }: &Binding<'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 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 @@ pub fn emit_unsafe_op_in_unsafe_fn_lint(
}
}
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

View File

@ -1,6 +1,4 @@
//! Construction of MIR from HIR.
//!
//! This crate also contains the match exhaustiveness and usefulness checking.
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]