Skip to content

Commit

Permalink
Inline and remove item_requires_monomorphization.
Browse files Browse the repository at this point in the history
It's very simple and has a single call site.
  • Loading branch information
nnethercote committed Oct 18, 2023
1 parent 42c8803 commit 55c5ab9
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions compiler/rustc_monomorphize/src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -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>,
Expand Down

0 comments on commit 55c5ab9

Please sign in to comment.