@@ -633,21 +633,31 @@ fn characteristic_def_id_of_mono_item<'tcx>(
633
633
match mono_item {
634
634
MonoItem :: Fn ( instance) => {
635
635
let def_id = match instance. def {
636
- ty:: InstanceKind :: Item ( def ) => def ,
636
+ ty:: InstanceKind :: Item ( .. ) => instance . def_id ( ) ,
637
637
ty:: InstanceKind :: VTableShim ( ..)
638
638
| ty:: InstanceKind :: ReifyShim ( ..)
639
- | ty:: InstanceKind :: FnPtrShim ( ..)
639
+ | ty:: InstanceKind :: Virtual ( ..)
640
640
| ty:: InstanceKind :: ClosureOnceShim { .. }
641
641
| ty:: InstanceKind :: ConstructCoroutineInClosureShim { .. }
642
- | ty:: InstanceKind :: Intrinsic ( ..)
643
- | ty:: InstanceKind :: DropGlue ( ..)
644
- | ty:: InstanceKind :: Virtual ( ..)
645
- | ty:: InstanceKind :: CloneShim ( ..)
646
- | ty:: InstanceKind :: ThreadLocalShim ( ..)
642
+ | ty:: InstanceKind :: CloneShim ( ..) => {
643
+ let def_id = instance. def_id ( ) ;
644
+ if def_id. is_local ( ) {
645
+ def_id
646
+ } else {
647
+ return None ;
648
+ }
649
+ }
650
+ ty:: InstanceKind :: ThreadLocalShim ( def_id) => def_id,
651
+ ty:: InstanceKind :: Intrinsic ( ..)
652
+ | ty:: InstanceKind :: FnPtrShim ( ..)
647
653
| ty:: InstanceKind :: FnPtrAddrShim ( ..)
648
654
| ty:: InstanceKind :: FutureDropPollShim ( ..)
649
655
| ty:: InstanceKind :: AsyncDropGlue ( ..)
650
- | ty:: InstanceKind :: AsyncDropGlueCtorShim ( ..) => return None ,
656
+ | ty:: InstanceKind :: AsyncDropGlueCtorShim ( ..)
657
+ | ty:: InstanceKind :: DropGlue ( _, None ) => return None ,
658
+ ty:: InstanceKind :: DropGlue ( _, Some ( ty) ) => {
659
+ return characteristic_def_id_of_type ( ty) ;
660
+ }
651
661
} ;
652
662
653
663
// If this is a method, we want to put it into the same module as
@@ -661,17 +671,6 @@ fn characteristic_def_id_of_mono_item<'tcx>(
661
671
}
662
672
663
673
if let Some ( impl_def_id) = tcx. impl_of_method ( def_id) {
664
- if tcx. sess . opts . incremental . is_some ( )
665
- && tcx
666
- . trait_id_of_impl ( impl_def_id)
667
- . is_some_and ( |def_id| tcx. is_lang_item ( def_id, LangItem :: Drop ) )
668
- {
669
- // Put `Drop::drop` into the same cgu as `drop_in_place`
670
- // since `drop_in_place` is the only thing that can
671
- // call it.
672
- return None ;
673
- }
674
-
675
674
// This is a method within an impl, find out what the self-type is:
676
675
let impl_self_ty = tcx. instantiate_and_normalize_erasing_regions (
677
676
instance. args ,
0 commit comments