Skip to content

Commit

Permalink
Add deny(unreachable_pub) to rustc_codegen_ssa.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Jun 5, 2024
1 parent a27da03 commit 312e01b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ pub(crate) enum WorkItem<B: WriteBackendMethods> {
}

impl<B: WriteBackendMethods> WorkItem<B> {
pub fn module_kind(&self) -> ModuleKind {
fn module_kind(&self) -> ModuleKind {
match *self {
WorkItem::Optimize(ref m) => m.kind,
WorkItem::CopyPostLtoArtifacts(_) | WorkItem::LTO(_) => ModuleKind::Regular,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl<'a> CopyPath<'a> {
}
}

struct DebugArgPath<'a>(pub &'a Path);
struct DebugArgPath<'a>(&'a Path);

impl IntoDiagArg for DebugArgPath<'_> {
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#![allow(internal_features)]
#![allow(rustc::diagnostic_outside_of_impl)]
#![allow(rustc::untranslatable_diagnostic)]
#![deny(unreachable_pub)]
#![feature(box_patterns)]
#![feature(if_let_guard)]
#![feature(let_chains)]
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_ssa/src/mir/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
use rustc_middle::{bug, span_bug};
use tracing::debug;

pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
pub(crate) fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
fx: &FunctionCx<'a, 'tcx, Bx>,
) -> BitSet<mir::Local> {
let mir = fx.mir;
Expand Down Expand Up @@ -251,14 +251,14 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
}

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum CleanupKind {
pub(crate) enum CleanupKind {
NotCleanup,
Funclet,
Internal { funclet: mir::BasicBlock },
}

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

0 comments on commit 312e01b

Please sign in to comment.