Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit b457ab3

Browse files
committed
Add warn(unreachable_pub) to rustc_smir.
1 parent 19ff6e6 commit b457ab3

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

compiler/rustc_smir/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
)]
1616
#![doc(rust_logo)]
1717
#![feature(rustdoc_internals)]
18+
#![warn(unreachable_pub)]
1819
// tidy-alphabetical-end
1920

2021
pub mod rustc_internal;

compiler/rustc_smir/src/rustc_smir/alloc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn new_empty_allocation(align: rustc_target::abi::Align) -> Allocation {
2020
// because we need to get `Ty` of the const we are trying to create, to do that
2121
// we need to have access to `ConstantKind` but we can't access that inside Stable impl.
2222
#[allow(rustc::usage_of_qualified_ty)]
23-
pub fn new_allocation<'tcx>(
23+
pub(crate) fn new_allocation<'tcx>(
2424
ty: rustc_middle::ty::Ty<'tcx>,
2525
const_value: ConstValue<'tcx>,
2626
tables: &mut Tables<'tcx>,
@@ -30,7 +30,7 @@ pub fn new_allocation<'tcx>(
3030
}
3131

3232
#[allow(rustc::usage_of_qualified_ty)]
33-
pub fn try_new_allocation<'tcx>(
33+
pub(crate) fn try_new_allocation<'tcx>(
3434
ty: rustc_middle::ty::Ty<'tcx>,
3535
const_value: ConstValue<'tcx>,
3636
tables: &mut Tables<'tcx>,

compiler/rustc_smir/src/rustc_smir/builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ use rustc_middle::ty::{self, TyCtxt};
1212
use crate::rustc_smir::{Stable, Tables};
1313

1414
/// Builds a monomorphic body for a given instance.
15-
pub struct BodyBuilder<'tcx> {
15+
pub(crate) struct BodyBuilder<'tcx> {
1616
tcx: TyCtxt<'tcx>,
1717
instance: ty::Instance<'tcx>,
1818
}
1919

2020
impl<'tcx> BodyBuilder<'tcx> {
21-
pub fn new(tcx: TyCtxt<'tcx>, instance: ty::Instance<'tcx>) -> Self {
21+
pub(crate) fn new(tcx: TyCtxt<'tcx>, instance: ty::Instance<'tcx>) -> Self {
2222
let instance = match instance.def {
2323
// To get the fallback body of an intrinsic, we need to convert it to an item.
2424
ty::InstanceKind::Intrinsic(def_id) => ty::Instance::new(def_id, instance.args),
@@ -30,7 +30,7 @@ impl<'tcx> BodyBuilder<'tcx> {
3030
/// Build a stable monomorphic body for a given instance based on the MIR body.
3131
///
3232
/// All constants are also evaluated.
33-
pub fn build(mut self, tables: &mut Tables<'tcx>) -> stable_mir::mir::Body {
33+
pub(crate) fn build(mut self, tables: &mut Tables<'tcx>) -> stable_mir::mir::Body {
3434
let body = tables.tcx.instance_mir(self.instance.def).clone();
3535
let mono_body = if !self.instance.args.is_empty()
3636
// Without the `generic_const_exprs` feature gate, anon consts in signatures do not

compiler/rustc_smir/src/rustc_smir/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
784784
}
785785
}
786786

787-
pub struct TablesWrapper<'tcx>(pub RefCell<Tables<'tcx>>);
787+
pub(crate) struct TablesWrapper<'tcx>(pub RefCell<Tables<'tcx>>);
788788

789789
/// Implement error handling for extracting function ABI information.
790790
impl<'tcx> FnAbiOfHelpers<'tcx> for Tables<'tcx> {

compiler/rustc_smir/src/rustc_smir/convert/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mod error;
99
mod mir;
1010
mod ty;
1111

12-
pub use ty::mir_const_from_ty_const;
12+
pub(crate) use ty::mir_const_from_ty_const;
1313

1414
impl<'tcx> Stable<'tcx> for rustc_hir::Safety {
1515
type T = stable_mir::mir::Safety;

compiler/rustc_smir/src/rustc_smir/convert/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ impl<'tcx> Stable<'tcx> for ty::Pattern<'tcx> {
411411
}
412412
}
413413

414-
pub fn mir_const_from_ty_const<'tcx>(
414+
pub(crate) fn mir_const_from_ty_const<'tcx>(
415415
tables: &mut Tables<'tcx>,
416416
ty_const: ty::Const<'tcx>,
417417
ty: Ty<'tcx>,

0 commit comments

Comments
 (0)