// need a mono item.
fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx>, instance: &Instance<'tcx>) -> bool {
let def_id = match instance.def {
- ty::InstanceDef::Item(def_id) => def_id,
+ ty::InstanceDef::Item(def_id) | ty::InstanceDef::DropGlue(def_id, Some(_)) => def_id,
+
ty::InstanceDef::VtableShim(..)
| ty::InstanceDef::ReifyShim(..)
| ty::InstanceDef::ClosureOnceShim { .. }
};
if tcx.is_foreign_item(def_id) {
- // We can always link to foreign items.
+ // Foreign items are always linked against, there's no way of
+ // instantiating them.
return false;
}
if def_id.is_local() {
- // Local items cannot be referred to locally without monomorphizing them locally.
+ // Local items cannot be referred to locally without
+ // monomorphizing them locally.
return true;
}
if !tcx.is_mir_available(def_id) {
bug!("cannot create local mono-item for {:?}", def_id)
}
+
return true;
fn is_available_upstream_generic<'tcx>(
// Nothing to do, just keep recursing.
}
- hir::ItemKind::Impl(..) => {
+ hir::ItemKind::Impl { .. } => {
if self.mode == MonoItemCollectionMode::Eager {
create_mono_items_for_default_impls(self.tcx, item, self.output);
}
output: &mut Vec<MonoItem<'tcx>>,
) {
match item.kind {
- hir::ItemKind::Impl(_, _, _, ref generics, .., ref impl_item_refs) => {
+ hir::ItemKind::Impl { ref generics, ref items, .. } => {
for param in generics.params {
match param.kind {
hir::GenericParamKind::Lifetime { .. } => {}
let param_env = ty::ParamEnv::reveal_all();
let trait_ref = tcx.normalize_erasing_regions(param_env, trait_ref);
let overridden_methods: FxHashSet<_> =
- impl_item_refs.iter().map(|iiref| iiref.ident.modern()).collect();
+ items.iter().map(|iiref| iiref.ident.modern()).collect();
for method in tcx.provided_trait_methods(trait_ref.def_id) {
if overridden_methods.contains(&method.ident.modern()) {
continue;