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:
commit
8272c6d8cc
@ -179,18 +179,18 @@ fn take_condition(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MCDCInfoBuilder {
|
pub(crate) struct MCDCInfoBuilder {
|
||||||
branch_spans: Vec<MCDCBranchSpan>,
|
branch_spans: Vec<MCDCBranchSpan>,
|
||||||
decision_spans: Vec<MCDCDecisionSpan>,
|
decision_spans: Vec<MCDCDecisionSpan>,
|
||||||
state: MCDCState,
|
state: MCDCState,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MCDCInfoBuilder {
|
impl MCDCInfoBuilder {
|
||||||
pub fn new() -> Self {
|
pub(crate) fn new() -> Self {
|
||||||
Self { branch_spans: vec![], decision_spans: vec![], state: MCDCState::new() }
|
Self { branch_spans: vec![], decision_spans: vec![], state: MCDCState::new() }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn visit_evaluated_condition(
|
pub(crate) fn visit_evaluated_condition(
|
||||||
&mut self,
|
&mut self,
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
source_info: SourceInfo,
|
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)
|
(self.decision_spans, self.branch_spans)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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() {
|
for param in params.iter() {
|
||||||
let (var, span) = {
|
let (var, span) = {
|
||||||
let pat = param.pat.as_ref().unwrap();
|
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
|
/// This allows us to easily parse the basic blocks declarations, local declarations, and
|
||||||
/// basic block definitions in order.
|
/// 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",
|
let body = parse_by_kind!(self, expr_id, _, "whole body",
|
||||||
ExprKind::Block { block } => self.thir[*block].expr.unwrap(),
|
ExprKind::Block { block } => self.thir[*block].expr.unwrap(),
|
||||||
);
|
);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
use super::{parse_by_kind, PResult, ParseCtxt};
|
use super::{parse_by_kind, PResult, ParseCtxt};
|
||||||
|
|
||||||
impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
|
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",
|
parse_by_kind!(self, expr_id, _, "statement",
|
||||||
@call(mir_storage_live, args) => {
|
@call(mir_storage_live, args) => {
|
||||||
Ok(StatementKind::StorageLive(self.parse_local(args[0])?))
|
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",
|
parse_by_kind!(self, expr_id, expr, "terminator",
|
||||||
@call(mir_return, _args) => {
|
@call(mir_return, _args) => {
|
||||||
Ok(TerminatorKind::Return)
|
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",
|
parse_by_kind!(self, expr_id, expr, "operand",
|
||||||
@call(mir_move, args) => self.parse_place(args[0]).map(Operand::Move),
|
@call(mir_move, args) => self.parse_place(args[0]).map(Operand::Move),
|
||||||
@call(mir_static, args) => self.parse_static(args[0]),
|
@call(mir_static, args) => self.parse_static(args[0]),
|
||||||
|
@ -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>,
|
expr: &Expr<'tcx>,
|
||||||
push_cuta: impl FnMut(&Box<CanonicalUserType<'tcx>>) -> Option<UserTypeAnnotationIndex>,
|
push_cuta: impl FnMut(&Box<CanonicalUserType<'tcx>>) -> Option<UserTypeAnnotationIndex>,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
|
@ -62,9 +62,9 @@
|
|||||||
|
|
||||||
pub(crate) mod as_constant;
|
pub(crate) mod as_constant;
|
||||||
mod as_operand;
|
mod as_operand;
|
||||||
pub mod as_place;
|
pub(crate) mod as_place;
|
||||||
mod as_rvalue;
|
mod as_rvalue;
|
||||||
mod as_temp;
|
mod as_temp;
|
||||||
pub mod category;
|
pub(crate) mod category;
|
||||||
mod into;
|
mod into;
|
||||||
mod stmt;
|
mod stmt;
|
||||||
|
@ -456,7 +456,7 @@ fn visit_binding(&mut self, Binding { source, .. }: &Binding<'tcx>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[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 {
|
match ref_mutability {
|
||||||
Mutability::Mut => BorrowKind::Mut { kind: MutBorrowKind::Default },
|
Mutability::Mut => BorrowKind::Mut { kind: MutBorrowKind::Default },
|
||||||
Mutability::Not => BorrowKind::Shared,
|
Mutability::Not => BorrowKind::Shared,
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
use tracing::{debug, instrument};
|
use tracing::{debug, instrument};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Scopes<'tcx> {
|
pub(crate) struct Scopes<'tcx> {
|
||||||
scopes: Vec<Scope>,
|
scopes: Vec<Scope>,
|
||||||
|
|
||||||
/// The current set of breakable scopes. See module comment for more details.
|
/// The current set of breakable scopes. See module comment for more details.
|
||||||
|
@ -597,7 +597,7 @@ enum UnsafeOpKind {
|
|||||||
use UnsafeOpKind::*;
|
use UnsafeOpKind::*;
|
||||||
|
|
||||||
impl UnsafeOpKind {
|
impl UnsafeOpKind {
|
||||||
pub fn emit_unsafe_op_in_unsafe_fn_lint(
|
fn emit_unsafe_op_in_unsafe_fn_lint(
|
||||||
&self,
|
&self,
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
hir_id: HirId,
|
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,
|
&self,
|
||||||
tcx: TyCtxt<'_>,
|
tcx: TyCtxt<'_>,
|
||||||
span: Span,
|
span: Span,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,4 @@
|
|||||||
//! Construction of MIR from HIR.
|
//! Construction of MIR from HIR.
|
||||||
//!
|
|
||||||
//! This crate also contains the match exhaustiveness and usefulness checking.
|
|
||||||
|
|
||||||
#![allow(rustc::diagnostic_outside_of_impl)]
|
#![allow(rustc::diagnostic_outside_of_impl)]
|
||||||
#![allow(rustc::untranslatable_diagnostic)]
|
#![allow(rustc::untranslatable_diagnostic)]
|
||||||
|
Loading…
Reference in New Issue
Block a user