Skip to content

Commit 938daf6

Browse files
committed
Add warn(unreachable_pub) to rustc_middle.
I am surprised the diff is so small for this enormous crate.
1 parent 05e0738 commit 938daf6

File tree

7 files changed

+10
-8
lines changed

7 files changed

+10
-8
lines changed

compiler/rustc_middle/src/dep_graph/dep_node.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalModDefId, ModDefId, LO
6161
use rustc_hir::definitions::DefPathHash;
6262
use rustc_hir::{HirId, ItemLocalId, OwnerId};
6363
pub use rustc_query_system::dep_graph::dep_node::DepKind;
64+
pub use rustc_query_system::dep_graph::DepNode;
6465
use rustc_query_system::dep_graph::FingerprintStyle;
65-
pub use rustc_query_system::dep_graph::{DepContext, DepNode, DepNodeParams};
66+
pub(crate) use rustc_query_system::dep_graph::{DepContext, DepNodeParams};
6667
use rustc_span::symbol::Symbol;
6768

6869
use crate::mir::mono::MonoItem;
@@ -101,7 +102,7 @@ macro_rules! define_dep_nodes {
101102

102103
// This checks that the discriminants of the variants have been assigned consecutively
103104
// from 0 so that they can be used as a dense index.
104-
pub const DEP_KIND_VARIANTS: u16 = {
105+
pub(crate) const DEP_KIND_VARIANTS: u16 = {
105106
let deps = &[$(dep_kinds::$variant,)*];
106107
let mut i = 0;
107108
while i < deps.len() {

compiler/rustc_middle/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#![feature(try_blocks)]
6363
#![feature(type_alias_impl_trait)]
6464
#![feature(yeet_expr)]
65+
#![warn(unreachable_pub)]
6566
// tidy-alphabetical-end
6667

6768
#[cfg(test)]

compiler/rustc_middle/src/mir/basic_blocks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ pub struct BasicBlocks<'tcx> {
1818
}
1919

2020
// Typically 95%+ of basic blocks have 4 or fewer predecessors.
21-
pub type Predecessors = IndexVec<BasicBlock, SmallVec<[BasicBlock; 4]>>;
21+
type Predecessors = IndexVec<BasicBlock, SmallVec<[BasicBlock; 4]>>;
2222

23-
pub type SwitchSources = FxHashMap<(BasicBlock, BasicBlock), SmallVec<[Option<u128>; 1]>>;
23+
type SwitchSources = FxHashMap<(BasicBlock, BasicBlock), SmallVec<[Option<u128>; 1]>>;
2424

2525
#[derive(Clone, Default, Debug)]
2626
struct Cache {

compiler/rustc_middle/src/mir/generic_graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use gsgdt::{Edge, Graph, Node, NodeStyle};
22
use rustc_middle::mir::*;
33

44
/// Convert an MIR function into a gsgdt Graph
5-
pub fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Graph {
5+
pub(crate) fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Graph {
66
let def_id = body.source.def_id();
77
let def_name = graphviz_safe_def_name(def_id);
88
let graph_name = format!("Mir_{def_name}");

compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ impl hash::Hash for InitMaskMaterialized {
243243
}
244244

245245
impl InitMaskMaterialized {
246-
pub const BLOCK_SIZE: u64 = 64;
246+
const BLOCK_SIZE: u64 = 64;
247247

248248
fn new(size: Size, state: bool) -> Self {
249249
let mut m = InitMaskMaterialized { blocks: vec![] };

compiler/rustc_middle/src/mir/mono.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl<'tcx> CodegenUnit<'tcx> {
396396
// The codegen tests rely on items being process in the same order as
397397
// they appear in the file, so for local items, we sort by node_id first
398398
#[derive(PartialEq, Eq, PartialOrd, Ord)]
399-
pub struct ItemSortKey<'tcx>(Option<usize>, SymbolName<'tcx>);
399+
struct ItemSortKey<'tcx>(Option<usize>, SymbolName<'tcx>);
400400

401401
fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx>, item: MonoItem<'tcx>) -> ItemSortKey<'tcx> {
402402
ItemSortKey(

compiler/rustc_middle/src/ty/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2190,7 +2190,7 @@ macro_rules! sty_debug_print {
21902190
all_infer: usize,
21912191
}
21922192

2193-
pub fn go(fmt: &mut std::fmt::Formatter<'_>, tcx: TyCtxt<'_>) -> std::fmt::Result {
2193+
pub(crate) fn go(fmt: &mut std::fmt::Formatter<'_>, tcx: TyCtxt<'_>) -> std::fmt::Result {
21942194
let mut total = DebugStat {
21952195
total: 0,
21962196
lt_infer: 0,

0 commit comments

Comments
 (0)