@@ -301,50 +301,6 @@ impl<'tcx> InstanceKind<'tcx> {
301
301
)
302
302
}
303
303
304
- /// Returns `true` if the machine code for this instance is instantiated in
305
- /// each codegen unit that references it.
306
- /// Note that this is only a hint! The compiler can globally decide to *not*
307
- /// do this in order to speed up compilation. CGU-internal copies are
308
- /// only exist to enable inlining. If inlining is not performed (e.g. at
309
- /// `-Copt-level=0`) then the time for generating them is wasted and it's
310
- /// better to create a single copy with external linkage.
311
- pub fn generates_cgu_internal_copy ( & self , tcx : TyCtxt < ' tcx > ) -> bool {
312
- if self . requires_inline ( tcx) {
313
- return true ;
314
- }
315
- if let ty:: InstanceKind :: DropGlue ( .., Some ( ty) )
316
- | ty:: InstanceKind :: AsyncDropGlueCtorShim ( .., Some ( ty) ) = * self
317
- {
318
- // Drop glue generally wants to be instantiated at every codegen
319
- // unit, but without an #[inline] hint. We should make this
320
- // available to normal end-users.
321
- if tcx. sess . opts . incremental . is_none ( ) {
322
- return true ;
323
- }
324
- // When compiling with incremental, we can generate a *lot* of
325
- // codegen units. Including drop glue into all of them has a
326
- // considerable compile time cost.
327
- //
328
- // We include enums without destructors to allow, say, optimizing
329
- // drops of `Option::None` before LTO. We also respect the intent of
330
- // `#[inline]` on `Drop::drop` implementations.
331
- return ty. ty_adt_def ( ) . is_none_or ( |adt_def| {
332
- match * self {
333
- ty:: InstanceKind :: DropGlue ( ..) => adt_def. destructor ( tcx) . map ( |dtor| dtor. did ) ,
334
- ty:: InstanceKind :: AsyncDropGlueCtorShim ( ..) => {
335
- adt_def. async_destructor ( tcx) . map ( |dtor| dtor. ctor )
336
- }
337
- _ => unreachable ! ( ) ,
338
- }
339
- . map_or_else ( || adt_def. is_enum ( ) , |did| tcx. cross_crate_inlinable ( did) )
340
- } ) ;
341
- }
342
- if let ty:: InstanceKind :: ThreadLocalShim ( ..) = * self {
343
- return false ;
344
- }
345
- tcx. cross_crate_inlinable ( self . def_id ( ) )
346
- }
347
-
348
304
pub fn requires_caller_location ( & self , tcx : TyCtxt < ' _ > ) -> bool {
349
305
match * self {
350
306
InstanceKind :: Item ( def_id) | InstanceKind :: Virtual ( def_id, _) => {
0 commit comments