From 19843bba64adda8194aa983fd7d1397517f5efe6 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 30 Aug 2024 10:28:52 +1000 Subject: [PATCH] Add `warn(unreachable_pub)` to `rustc_sanitizers`. --- .../src/cfi/typeid/itanium_cxx_abi/encode.rs | 6 +++--- .../src/cfi/typeid/itanium_cxx_abi/transform.rs | 6 +++--- compiler/rustc_sanitizers/src/lib.rs | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs index a4e4f50e8f2..45057a3530c 100644 --- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs +++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs @@ -26,11 +26,11 @@ use crate::cfi::typeid::TypeIdOptions; /// Options for encode_ty. -pub type EncodeTyOptions = TypeIdOptions; +pub(crate) type EncodeTyOptions = TypeIdOptions; /// Substitution dictionary key. #[derive(Eq, Hash, PartialEq)] -pub enum DictKey<'tcx> { +pub(crate) enum DictKey<'tcx> { Ty(Ty<'tcx>, TyQ), Region(Region<'tcx>), Const(Const<'tcx>), @@ -39,7 +39,7 @@ pub enum DictKey<'tcx> { /// Type and extended type qualifiers. #[derive(Eq, Hash, PartialEq)] -pub enum TyQ { +pub(crate) enum TyQ { None, Const, Mut, diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs index 2f43199796c..8db0d358537 100644 --- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs +++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs @@ -23,16 +23,16 @@ use crate::cfi::typeid::TypeIdOptions; /// Options for transform_ty. -pub type TransformTyOptions = TypeIdOptions; +pub(crate) type TransformTyOptions = TypeIdOptions; -pub struct TransformTy<'tcx> { +pub(crate) struct TransformTy<'tcx> { tcx: TyCtxt<'tcx>, options: TransformTyOptions, parents: Vec>, } impl<'tcx> TransformTy<'tcx> { - pub fn new(tcx: TyCtxt<'tcx>, options: TransformTyOptions) -> Self { + pub(crate) fn new(tcx: TyCtxt<'tcx>, options: TransformTyOptions) -> Self { TransformTy { tcx, options, parents: Vec::new() } } } diff --git a/compiler/rustc_sanitizers/src/lib.rs b/compiler/rustc_sanitizers/src/lib.rs index e4792563e71..55be931bcd6 100644 --- a/compiler/rustc_sanitizers/src/lib.rs +++ b/compiler/rustc_sanitizers/src/lib.rs @@ -5,6 +5,7 @@ // tidy-alphabetical-start #![feature(let_chains)] +#![warn(unreachable_pub)] // tidy-alphabetical-end pub mod cfi;