Add unreachable_pub
to RUSTC_LINT_FLAGS
for compiler/
crates.
And fix the new errors in the handful of crates that didn't have a `#![warn(unreachable_pub)]`.
This commit is contained in:
parent
c9c8387955
commit
55505ab1d3
9 changed files with 16 additions and 14 deletions
|
@ -23,6 +23,7 @@
|
||||||
// tidy-alphabetical-start
|
// tidy-alphabetical-start
|
||||||
#![allow(elided_lifetimes_in_paths)]
|
#![allow(elided_lifetimes_in_paths)]
|
||||||
#![allow(internal_features)]
|
#![allow(internal_features)]
|
||||||
|
#![allow(unreachable_pub)] // because this crate is mostly generated code
|
||||||
#![doc(rust_logo)]
|
#![doc(rust_logo)]
|
||||||
#![feature(rustdoc_internals)]
|
#![feature(rustdoc_internals)]
|
||||||
// #![warn(unreachable_pub)] // don't use because this crate is mostly generated code
|
// #![warn(unreachable_pub)] // don't use because this crate is mostly generated code
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::cmp::max;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::fx::FxHashMap;
|
use crate::fx::FxHashMap;
|
||||||
|
|
||||||
pub struct TestGraph {
|
pub(super) struct TestGraph {
|
||||||
num_nodes: usize,
|
num_nodes: usize,
|
||||||
start_node: usize,
|
start_node: usize,
|
||||||
successors: FxHashMap<usize, Vec<usize>>,
|
successors: FxHashMap<usize, Vec<usize>>,
|
||||||
|
@ -11,7 +11,7 @@ pub struct TestGraph {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TestGraph {
|
impl TestGraph {
|
||||||
pub fn new(start_node: usize, edges: &[(usize, usize)]) -> Self {
|
pub(super) fn new(start_node: usize, edges: &[(usize, usize)]) -> Self {
|
||||||
let mut graph = TestGraph {
|
let mut graph = TestGraph {
|
||||||
num_nodes: start_node + 1,
|
num_nodes: start_node + 1,
|
||||||
start_node,
|
start_node,
|
||||||
|
|
|
@ -313,7 +313,7 @@ pub struct Error<O, E> {
|
||||||
|
|
||||||
mod helper {
|
mod helper {
|
||||||
use super::*;
|
use super::*;
|
||||||
pub type ObligationTreeIdGenerator = impl Iterator<Item = ObligationTreeId>;
|
pub(super) type ObligationTreeIdGenerator = impl Iterator<Item = ObligationTreeId>;
|
||||||
impl<O: ForestObligation> ObligationForest<O> {
|
impl<O: ForestObligation> ObligationForest<O> {
|
||||||
pub fn new() -> ObligationForest<O> {
|
pub fn new() -> ObligationForest<O> {
|
||||||
ObligationForest {
|
ObligationForest {
|
||||||
|
|
|
@ -88,7 +88,7 @@ mod mode {
|
||||||
|
|
||||||
// Whether thread safety might be enabled.
|
// Whether thread safety might be enabled.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn might_be_dyn_thread_safe() -> bool {
|
pub(super) fn might_be_dyn_thread_safe() -> bool {
|
||||||
DYN_THREAD_SAFE_MODE.load(Ordering::Relaxed) != DYN_NOT_THREAD_SAFE
|
DYN_THREAD_SAFE_MODE.load(Ordering::Relaxed) != DYN_NOT_THREAD_SAFE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ pub fn parallel_guard<R>(f: impl FnOnce(&ParallelGuard) -> R) -> R {
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn serial_join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
|
fn serial_join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
|
||||||
where
|
where
|
||||||
A: FnOnce() -> RA,
|
A: FnOnce() -> RA,
|
||||||
B: FnOnce() -> RB,
|
B: FnOnce() -> RB,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::stable_hasher::{HashStable, StableHasher};
|
||||||
|
|
||||||
/// A tag type used in [`TaggedRef`] tests.
|
/// A tag type used in [`TaggedRef`] tests.
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum Tag2 {
|
enum Tag2 {
|
||||||
B00 = 0b00,
|
B00 = 0b00,
|
||||||
B01 = 0b01,
|
B01 = 0b01,
|
||||||
B10 = 0b10,
|
B10 = 0b10,
|
||||||
|
|
|
@ -305,7 +305,7 @@ impl Parse for Newtype {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn newtype(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
pub(crate) fn newtype(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||||
let input = parse_macro_input!(input as Newtype);
|
let input = parse_macro_input!(input as Newtype);
|
||||||
input.0.into()
|
input.0.into()
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ use rustc_pattern_analysis::usefulness::{PlaceValidity, UsefulnessReport};
|
||||||
use rustc_pattern_analysis::{MatchArm, PatCx, PrivateUninhabitedField};
|
use rustc_pattern_analysis::{MatchArm, PatCx, PrivateUninhabitedField};
|
||||||
|
|
||||||
/// Sets up `tracing` for easier debugging. Tries to look like the `rustc` setup.
|
/// Sets up `tracing` for easier debugging. Tries to look like the `rustc` setup.
|
||||||
pub fn init_tracing() {
|
fn init_tracing() {
|
||||||
use tracing_subscriber::Layer;
|
use tracing_subscriber::Layer;
|
||||||
use tracing_subscriber::layer::SubscriberExt;
|
use tracing_subscriber::layer::SubscriberExt;
|
||||||
use tracing_subscriber::util::SubscriberInitExt;
|
use tracing_subscriber::util::SubscriberInitExt;
|
||||||
|
@ -24,7 +24,7 @@ pub fn init_tracing() {
|
||||||
/// A simple set of types.
|
/// A simple set of types.
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum Ty {
|
pub(super) enum Ty {
|
||||||
/// Booleans
|
/// Booleans
|
||||||
Bool,
|
Bool,
|
||||||
/// 8-bit unsigned integers
|
/// 8-bit unsigned integers
|
||||||
|
@ -41,7 +41,7 @@ pub enum Ty {
|
||||||
|
|
||||||
/// The important logic.
|
/// The important logic.
|
||||||
impl Ty {
|
impl Ty {
|
||||||
pub fn sub_tys(&self, ctor: &Constructor<Cx>) -> Vec<Self> {
|
pub(super) fn sub_tys(&self, ctor: &Constructor<Cx>) -> Vec<Self> {
|
||||||
use Constructor::*;
|
use Constructor::*;
|
||||||
match (ctor, *self) {
|
match (ctor, *self) {
|
||||||
(Struct, Ty::Tuple(tys)) => tys.iter().copied().collect(),
|
(Struct, Ty::Tuple(tys)) => tys.iter().copied().collect(),
|
||||||
|
@ -63,7 +63,7 @@ impl Ty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ctor_set(&self) -> ConstructorSet<Cx> {
|
fn ctor_set(&self) -> ConstructorSet<Cx> {
|
||||||
match *self {
|
match *self {
|
||||||
Ty::Bool => ConstructorSet::Bool,
|
Ty::Bool => ConstructorSet::Bool,
|
||||||
Ty::U8 => ConstructorSet::Integers {
|
Ty::U8 => ConstructorSet::Integers {
|
||||||
|
@ -104,7 +104,7 @@ impl Ty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write_variant_name(
|
fn write_variant_name(
|
||||||
&self,
|
&self,
|
||||||
f: &mut std::fmt::Formatter<'_>,
|
f: &mut std::fmt::Formatter<'_>,
|
||||||
ctor: &Constructor<Cx>,
|
ctor: &Constructor<Cx>,
|
||||||
|
@ -120,7 +120,7 @@ impl Ty {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute usefulness in our simple context (and set up tracing for easier debugging).
|
/// Compute usefulness in our simple context (and set up tracing for easier debugging).
|
||||||
pub fn compute_match_usefulness<'p>(
|
pub(super) fn compute_match_usefulness<'p>(
|
||||||
arms: &[MatchArm<'p, Cx>],
|
arms: &[MatchArm<'p, Cx>],
|
||||||
ty: Ty,
|
ty: Ty,
|
||||||
scrut_validity: PlaceValidity,
|
scrut_validity: PlaceValidity,
|
||||||
|
@ -137,7 +137,7 @@ pub fn compute_match_usefulness<'p>(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Cx;
|
pub(super) struct Cx;
|
||||||
|
|
||||||
/// The context for pattern analysis. Forwards anything interesting to `Ty` methods.
|
/// The context for pattern analysis. Forwards anything interesting to `Ty` methods.
|
||||||
impl PatCx for Cx {
|
impl PatCx for Cx {
|
||||||
|
|
|
@ -1071,6 +1071,7 @@ impl Builder<'_> {
|
||||||
// FIXME(edition_2024): Change this to `-Wrust_2024_idioms` when all
|
// FIXME(edition_2024): Change this to `-Wrust_2024_idioms` when all
|
||||||
// of the individual lints are satisfied.
|
// of the individual lints are satisfied.
|
||||||
lint_flags.push("-Wkeyword_idents_2024");
|
lint_flags.push("-Wkeyword_idents_2024");
|
||||||
|
lint_flags.push("-Wunreachable_pub");
|
||||||
lint_flags.push("-Wunsafe_op_in_unsafe_fn");
|
lint_flags.push("-Wunsafe_op_in_unsafe_fn");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue