Skip to content

Commit 6af470e

Browse files
committed
Reduce visibilities, and add warn(unreachable_pub).
Lots of unnecessary `pub`s in this crate. Most are downgraded to `pub(super)`, though some don't need any visibility.
1 parent adf8d16 commit 6af470e

65 files changed

Lines changed: 125 additions & 120 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎compiler/rustc_mir_transform/src/abort_unwinding_calls.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_target::spec::PanicStrategy;
2020
/// This forces all unwinds, in panic=abort mode happening in foreign code, to
2121
/// trigger a process abort.
2222
#[derive(PartialEq)]
23-
pubstructAbortUnwindingCalls;
23+
pub(super)structAbortUnwindingCalls;
2424

2525
impl<'tcx>crate::MirPass<'tcx>forAbortUnwindingCalls{
2626
fnrun_pass(&self,tcx:TyCtxt<'tcx>,body:&mutBody<'tcx>){

‎compiler/rustc_mir_transform/src/add_call_guards.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use rustc_middle::ty::TyCtxt;
44
use tracing::debug;
55

66
#[derive(PartialEq)]
7-
pubenumAddCallGuards{
7+
pub(super)enumAddCallGuards{
88
AllCallEdges,
99
CriticalCallEdges,
1010
}
11-
pubuseself::AddCallGuards::*;
11+
pub(super)useself::AddCallGuards::*;
1212

1313
/**
1414
* Breaks outgoing critical edges for call terminators in the MIR.
@@ -37,7 +37,7 @@ impl<'tcx> crate::MirPass<'tcx> for AddCallGuards {
3737
}
3838

3939
implAddCallGuards{
40-
pubfnadd_call_guards(&self,body:&mutBody<'_>){
40+
pub(super)fnadd_call_guards(&self,body:&mutBody<'_>){
4141
letmut pred_count:IndexVec<_,_> =
4242
body.basic_blocks.predecessors().iter().map(|ps| ps.len()).collect();
4343
pred_count[START_BLOCK] += 1;

‎compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::util;
3535
///
3636
/// The storage instructions are required to avoid stack space
3737
/// blowup.
38-
pubstructAddMovesForPackedDrops;
38+
pub(super)structAddMovesForPackedDrops;
3939

4040
impl<'tcx>crate::MirPass<'tcx>forAddMovesForPackedDrops{
4141
fnrun_pass(&self,tcx:TyCtxt<'tcx>,body:&mutBody<'tcx>){
@@ -44,7 +44,7 @@ impl<'tcx> crate::MirPass<'tcx> for AddMovesForPackedDrops {
4444
}
4545
}
4646

47-
pubfnadd_moves_for_packed_drops<'tcx>(tcx:TyCtxt<'tcx>,body:&mutBody<'tcx>){
47+
fnadd_moves_for_packed_drops<'tcx>(tcx:TyCtxt<'tcx>,body:&mutBody<'tcx>){
4848
let patch = add_moves_for_packed_drops_patch(tcx, body);
4949
patch.apply(body);
5050
}

‎compiler/rustc_mir_transform/src/add_retag.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_hir::LangItem;
88
use rustc_middle::mir::*;
99
use rustc_middle::ty::{self,Ty,TyCtxt};
1010

11-
pubstructAddRetag;
11+
pub(super)structAddRetag;
1212

1313
/// Determine whether this type may contain a reference (or box), and thus needs retagging.
1414
/// We will only recurse `depth` times into Tuples/ADTs to bound the cost of this.

‎compiler/rustc_mir_transform/src/add_subtyping_projections.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use rustc_middle::mir::visit::MutVisitor;
44
use rustc_middle::mir::*;
55
use rustc_middle::ty::TyCtxt;
66

7-
pubstructSubtyper;
7+
pub(super)structSubtyper;
88

9-
pubstructSubTypeChecker<'a,'tcx>{
9+
structSubTypeChecker<'a,'tcx>{
1010
tcx:TyCtxt<'tcx>,
1111
patcher:MirPatch<'tcx>,
1212
local_decls:&'aIndexVec<Local,LocalDecl<'tcx>>,
@@ -52,7 +52,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for SubTypeChecker<'a, 'tcx> {
5252
// // gets transformed to
5353
// let temp: rval_ty = rval;
5454
// let place: place_ty = temp as place_ty;
55-
pubfnsubtype_finder<'tcx>(tcx:TyCtxt<'tcx>,body:&mutBody<'tcx>){
55+
fnsubtype_finder<'tcx>(tcx:TyCtxt<'tcx>,body:&mutBody<'tcx>){
5656
let patch = MirPatch::new(body);
5757
letmut checker = SubTypeChecker{ tcx,patcher: patch,local_decls:&body.local_decls};
5858

‎compiler/rustc_mir_transform/src/check_alignment.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt};
77
use rustc_session::Session;
88
use tracing::{debug, trace};
99

10-
pubstructCheckAlignment;
10+
pub(super)structCheckAlignment;
1111

1212
impl<'tcx>crate::MirPass<'tcx>forCheckAlignment{
1313
fnis_enabled(&self,sess:&Session) -> bool{

‎compiler/rustc_mir_transform/src/check_const_item_mutation.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_span::Span;
88

99
usecrate::errors;
1010

11-
pubstructCheckConstItemMutation;
11+
pub(super)structCheckConstItemMutation;
1212

1313
impl<'tcx>crate::MirLint<'tcx>forCheckConstItemMutation{
1414
fnrun_lint(&self,tcx:TyCtxt<'tcx>,body:&Body<'tcx>){

‎compiler/rustc_mir_transform/src/check_packed_ref.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_middle::ty::{self, TyCtxt};
55

66
usecrate::{errors, util};
77

8-
pubstructCheckPackedRef;
8+
pub(super)structCheckPackedRef;
99

1010
impl<'tcx>crate::MirLint<'tcx>forCheckPackedRef{
1111
fnrun_lint(&self,tcx:TyCtxt<'tcx>,body:&Body<'tcx>){

‎compiler/rustc_mir_transform/src/cleanup_post_borrowck.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use rustc_middle::mir::{Body, BorrowKind, CastKind, Rvalue, StatementKind, Termi
2121
use rustc_middle::ty::adjustment::PointerCoercion;
2222
use rustc_middle::ty::TyCtxt;
2323

24-
pubstructCleanupPostBorrowck;
24+
pub(super)structCleanupPostBorrowck;
2525

2626
impl<'tcx>crate::MirPass<'tcx>forCleanupPostBorrowck{
2727
fnrun_pass(&self,_tcx:TyCtxt<'tcx>,body:&mutBody<'tcx>){

‎compiler/rustc_mir_transform/src/copy_prop.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::ssa::SsaLocals;
1717
/// where each of the locals is only assigned once.
1818
///
1919
/// We want to replace all those locals by `_a`, either copied or moved.
20-
pubstructCopyProp;
20+
pub(super)structCopyProp;
2121

2222
impl<'tcx>crate::MirPass<'tcx>forCopyProp{
2323
fnis_enabled(&self,sess:&rustc_session::Session) -> bool{

0 commit comments

Comments
 (0)