@@ -633,21 +633,27 @@ 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
+ def_id. is_local ( ) . then ( def_id)
645
+ }
646
+ ty:: InstanceKind :: ThreadLocalShim ( def_id) => def_id,
647
+ ty:: InstanceKind :: Intrinsic ( ..)
648
+ | ty:: InstanceKind :: FnPtrShim ( ..)
647
649
| ty:: InstanceKind :: FnPtrAddrShim ( ..)
648
650
| ty:: InstanceKind :: FutureDropPollShim ( ..)
649
651
| ty:: InstanceKind :: AsyncDropGlue ( ..)
650
- | ty:: InstanceKind :: AsyncDropGlueCtorShim ( ..) => return None ,
652
+ | ty:: InstanceKind :: AsyncDropGlueCtorShim ( ..)
653
+ | ty:: InstanceKind :: DropGlue ( _, None ) => return None ,
654
+ ty:: InstanceKind :: DropGlue ( _, Some ( ty) ) => {
655
+ return characteristic_def_id_of_type ( ty) ;
656
+ }
651
657
} ;
652
658
653
659
// If this is a method, we want to put it into the same module as
@@ -661,17 +667,6 @@ fn characteristic_def_id_of_mono_item<'tcx>(
661
667
}
662
668
663
669
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
670
// This is a method within an impl, find out what the self-type is:
676
671
let impl_self_ty = tcx. instantiate_and_normalize_erasing_regions (
677
672
instance. args ,
0 commit comments