diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-10-18 14:26:19 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-10-18 14:26:19 +1100 |
| commit | 55c5ab9fbcdae47dbbae8014ecb7c62f78906dea (patch) | |
| tree | 48ef55964b24253385ae2e3aa2381c78e65c2580 /compiler/rustc_monomorphize/src | |
| parent | 42c8803fe86dec00df2f5794e5f57aa78b54c8ee (diff) | |
| download | rust-55c5ab9fbcdae47dbbae8014ecb7c62f78906dea.tar.gz rust-55c5ab9fbcdae47dbbae8014ecb7c62f78906dea.zip | |
Inline and remove `item_requires_monomorphization`.
It's very simple and has a single call site.
Diffstat (limited to 'compiler/rustc_monomorphize/src')
| -rw-r--r-- | compiler/rustc_monomorphize/src/collector.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index e9fbc20f93d..c36010474d5 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -173,7 +173,7 @@ use rustc_hir::lang_items::LangItem; use rustc_middle::mir::interpret::{AllocId, ErrorHandled, GlobalAlloc, Scalar}; use rustc_middle::mir::mono::{InstantiationMode, MonoItem}; use rustc_middle::mir::visit::Visitor as MirVisitor; -use rustc_middle::mir::{self, Local, Location}; +use rustc_middle::mir::{self, Location}; use rustc_middle::query::TyCtxtAt; use rustc_middle::ty::adjustment::{CustomCoerceUnsized, PointerCoercion}; use rustc_middle::ty::print::with_no_trimmed_paths; @@ -1212,7 +1212,7 @@ impl<'v> RootCollector<'_, 'v> { } fn is_root(&self, def_id: LocalDefId) -> bool { - !item_requires_monomorphization(self.tcx, def_id) + !self.tcx.generics_of(def_id).requires_monomorphization(self.tcx) && match self.mode { MonoItemCollectionMode::Eager => true, MonoItemCollectionMode::Lazy => { @@ -1275,11 +1275,6 @@ impl<'v> RootCollector<'_, 'v> { } } -fn item_requires_monomorphization(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { - let generics = tcx.generics_of(def_id); - generics.requires_monomorphization(tcx) -} - #[instrument(level = "debug", skip(tcx, output))] fn create_mono_items_for_default_impls<'tcx>( tcx: TyCtxt<'tcx>, |
