Skip to content

Commit 800b92a

Browse files
committed
Add deny(unreachable_pub) to rustc_codegen_ssa.
1 parent 79c3377 commit 800b92a

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ mod win {
11691169

11701170
/// Get the Windows system OEM code page. This is most notably the code page
11711171
/// used for link.exe's output.
1172-
pub fn oem_code_page() -> u32 {
1172+
pub(super) fn oem_code_page() -> u32 {
11731173
unsafe {
11741174
let mut cp: u32 = 0;
11751175
// We're using the `LOCALE_RETURN_NUMBER` flag to return a u32.
@@ -1192,7 +1192,7 @@ mod win {
11921192
///
11931193
/// It will fail if the multi-byte string is longer than `i32::MAX` or if it contains
11941194
/// any invalid bytes for the expected encoding.
1195-
pub fn locale_byte_str_to_string(s: &[u8], code_page: u32) -> Option<String> {
1195+
pub(super) fn locale_byte_str_to_string(s: &[u8], code_page: u32) -> Option<String> {
11961196
// `MultiByteToWideChar` requires a length to be a "positive integer".
11971197
if s.len() > isize::MAX as usize {
11981198
return None;

compiler/rustc_codegen_ssa/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ pub(crate) enum WorkItem<B: WriteBackendMethods> {
758758
}
759759

760760
impl<B: WriteBackendMethods> WorkItem<B> {
761-
pub fn module_kind(&self) -> ModuleKind {
761+
fn module_kind(&self) -> ModuleKind {
762762
match *self {
763763
WorkItem::Optimize(ref m) => m.kind,
764764
WorkItem::CopyPostLtoArtifacts(_) | WorkItem::LTO(_) => ModuleKind::Regular,

compiler/rustc_codegen_ssa/src/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl<'a> CopyPath<'a> {
149149
}
150150
}
151151

152-
struct DebugArgPath<'a>(pub &'a Path);
152+
struct DebugArgPath<'a>(&'a Path);
153153

154154
impl IntoDiagArg for DebugArgPath<'_> {
155155
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {

compiler/rustc_codegen_ssa/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#![allow(internal_features)]
55
#![allow(rustc::diagnostic_outside_of_impl)]
66
#![allow(rustc::untranslatable_diagnostic)]
7+
#![deny(unreachable_pub)]
78
#![feature(box_patterns)]
89
#![feature(if_let_guard)]
910
#![feature(let_chains)]

compiler/rustc_codegen_ssa/src/mir/analyze.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
1313
use rustc_middle::{bug, span_bug};
1414
use tracing::debug;
1515

16-
pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
16+
pub(crate) fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
1717
fx: &FunctionCx<'a, 'tcx, Bx>,
1818
) -> BitSet<mir::Local> {
1919
let mir = fx.mir;
@@ -251,14 +251,14 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
251251
}
252252

253253
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
254-
pub enum CleanupKind {
254+
pub(crate) enum CleanupKind {
255255
NotCleanup,
256256
Funclet,
257257
Internal { funclet: mir::BasicBlock },
258258
}
259259

260260
impl CleanupKind {
261-
pub fn funclet_bb(self, for_bb: mir::BasicBlock) -> Option<mir::BasicBlock> {
261+
pub(crate) fn funclet_bb(self, for_bb: mir::BasicBlock) -> Option<mir::BasicBlock> {
262262
match self {
263263
CleanupKind::NotCleanup => None,
264264
CleanupKind::Funclet => Some(for_bb),
@@ -270,7 +270,7 @@ impl CleanupKind {
270270
/// MSVC requires unwinding code to be split to a tree of *funclets*, where each funclet can only
271271
/// branch to itself or to its parent. Luckily, the code we generates matches this pattern.
272272
/// Recover that structure in an analyze pass.
273-
pub fn cleanup_kinds(mir: &mir::Body<'_>) -> IndexVec<mir::BasicBlock, CleanupKind> {
273+
pub(crate) fn cleanup_kinds(mir: &mir::Body<'_>) -> IndexVec<mir::BasicBlock, CleanupKind> {
274274
fn discover_masters<'tcx>(
275275
result: &mut IndexSlice<mir::BasicBlock, CleanupKind>,
276276
mir: &mir::Body<'tcx>,

0 commit comments

Comments
 (0)