diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-08-29 15:08:07 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-08-29 20:13:06 +1000 |
| commit | e3062147deca0399ba533bd967532cbf4f419abf (patch) | |
| tree | 15a43989e4af7322c7f907511b533b14eb6fcfb3 /compiler/rustc_monomorphize/src/collector.rs | |
| parent | 8a8dd3f33e8c79bc5c1f06009e87ff120900b5c0 (diff) | |
| download | rust-e3062147deca0399ba533bd967532cbf4f419abf.tar.gz rust-e3062147deca0399ba533bd967532cbf4f419abf.zip | |
Add `warn(unreachable_pub)` to `rustc_monomorphize`.
Diffstat (limited to 'compiler/rustc_monomorphize/src/collector.rs')
| -rw-r--r-- | compiler/rustc_monomorphize/src/collector.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 36fb2e89af1..9c820b888d9 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -242,12 +242,12 @@ use tracing::{debug, instrument, trace}; use crate::errors::{self, EncounteredErrorWhileInstantiating, NoOptimizedMir, RecursionLimit}; #[derive(PartialEq)] -pub enum MonoItemCollectionStrategy { +pub(crate) enum MonoItemCollectionStrategy { Eager, Lazy, } -pub struct UsageMap<'tcx> { +pub(crate) struct UsageMap<'tcx> { // Maps every mono item to the mono items used by it. used_map: UnordMap<MonoItem<'tcx>, Vec<MonoItem<'tcx>>>, @@ -306,13 +306,17 @@ impl<'tcx> UsageMap<'tcx> { assert!(self.used_map.insert(user_item, used_items).is_none()); } - pub fn get_user_items(&self, item: MonoItem<'tcx>) -> &[MonoItem<'tcx>] { + pub(crate) fn get_user_items(&self, item: MonoItem<'tcx>) -> &[MonoItem<'tcx>] { self.user_map.get(&item).map(|items| items.as_slice()).unwrap_or(&[]) } /// Internally iterate over all inlined items used by `item`. - pub fn for_each_inlined_used_item<F>(&self, tcx: TyCtxt<'tcx>, item: MonoItem<'tcx>, mut f: F) - where + pub(crate) fn for_each_inlined_used_item<F>( + &self, + tcx: TyCtxt<'tcx>, + item: MonoItem<'tcx>, + mut f: F, + ) where F: FnMut(MonoItem<'tcx>), { let used_items = self.used_map.get(&item).unwrap(); @@ -1615,6 +1619,6 @@ pub(crate) fn collect_crate_mono_items<'tcx>( (mono_items, state.usage_map.into_inner()) } -pub fn provide(providers: &mut Providers) { +pub(crate) fn provide(providers: &mut Providers) { providers.hooks.should_codegen_locally = should_codegen_locally; } |
