Skip to content

Commit f452be0

Browse files
committed
Add deny(unreachable_pub) to rustc_codegen_ssa.
1 parent 78cddc0 commit f452be0

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ mod win {
12071207

12081208
/// Get the Windows system OEM code page. This is most notably the code page
12091209
/// used for link.exe's output.
1210-
pub fn oem_code_page() -> u32 {
1210+
pub(super) fn oem_code_page() -> u32 {
12111211
unsafe {
12121212
let mut cp: u32 = 0;
12131213
// We're using the `LOCALE_RETURN_NUMBER` flag to return a u32.
@@ -1230,7 +1230,7 @@ mod win {
12301230
///
12311231
/// It will fail if the multi-byte string is longer than `i32::MAX` or if it contains
12321232
/// any invalid bytes for the expected encoding.
1233-
pub fn locale_byte_str_to_string(s: &[u8], code_page: u32) -> Option<String> {
1233+
pub(super) fn locale_byte_str_to_string(s: &[u8], code_page: u32) -> Option<String> {
12341234
// `MultiByteToWideChar` requires a length to be a "positive integer".
12351235
if s.len() > isize::MAX as usize {
12361236
return None;

compiler/rustc_codegen_ssa/src/back/write.rs

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

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

compiler/rustc_codegen_ssa/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![allow(internal_features)]
33
#![allow(rustc::diagnostic_outside_of_impl)]
44
#![allow(rustc::untranslatable_diagnostic)]
5+
#![deny(unreachable_pub)]
56
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
67
#![doc(rust_logo)]
78
#![feature(assert_matches)]

compiler/rustc_codegen_ssa/src/mir/analyze.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use tracing::debug;
1313
use super::FunctionCx;
1414
use crate::traits::*;
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)