@@ -331,10 +331,7 @@ fn exported_symbols_provider_local(
331
331
rustc_middle:: ty:: Coroutine ( def_id, _) => * def_id,
332
332
rustc_middle:: ty:: CoroutineClosure ( def_id, _) => * def_id,
333
333
rustc_middle:: ty:: CoroutineWitness ( def_id, _) => * def_id,
334
- rustc_middle:: ty:: Foreign ( def_id) => * def_id,
335
- _ => {
336
- return false ;
337
- }
334
+ _ => return false ,
338
335
} ;
339
336
let Some ( root_def_id) = root_def_id. as_local ( ) else {
340
337
return false ;
@@ -346,12 +343,7 @@ fn exported_symbols_provider_local(
346
343
347
344
let is_instantiable_downstream = |did, type_args| {
348
345
std:: iter:: once ( tcx. type_of ( did) . skip_binder ( ) ) . chain ( type_args) . all ( |arg| {
349
- arg. walk ( ) . all ( |ty| {
350
- let Some ( ty) = ty. as_type ( ) else {
351
- return true ;
352
- } ;
353
- !is_local_to_current_crate ( ty)
354
- } )
346
+ arg. walk ( ) . all ( |ty| ty. as_type ( ) . map_or ( true , |ty| !is_local_to_current_crate ( ty) ) )
355
347
} )
356
348
} ;
357
349
// The symbols created in this loop are sorted below it
@@ -400,20 +392,17 @@ fn exported_symbols_provider_local(
400
392
}
401
393
}
402
394
MonoItem :: Fn ( Instance { def : InstanceKind :: DropGlue ( _, Some ( ty) ) , args } ) => {
403
- let Some ( GenericArgKind :: Type ( typ) ) = args. non_erasable_generics ( ) . next ( )
404
- else {
405
- bug ! ( "Expected a type argument for drop glue" ) ;
406
- } ;
407
- let should_export = {
408
- let root_identifier = match typ. kind ( ) {
409
- rustc_middle:: ty:: Adt ( def, args) => Some ( ( def. did ( ) , args) ) ,
410
- rustc_middle:: ty:: Closure ( id, args) => Some ( ( * id, args) ) ,
411
- _ => None ,
412
- } ;
413
- root_identifier. map_or ( true , |( did, args) | {
414
- is_instantiable_downstream ( did, args. types ( ) )
415
- } )
395
+ // A little sanity-check
396
+ assert_eq ! ( args. non_erasable_generics( ) . next( ) , Some ( GenericArgKind :: Type ( ty) ) ) ;
397
+
398
+ let root_identifier = match ty. kind ( ) {
399
+ rustc_middle:: ty:: Adt ( def, args) => Some ( ( def. did ( ) , args) ) ,
400
+ rustc_middle:: ty:: Closure ( id, args) => Some ( ( * id, args) ) ,
401
+ _ => None ,
416
402
} ;
403
+ let should_export = root_identifier
404
+ . map_or ( true , |( did, args) | is_instantiable_downstream ( did, args. types ( ) ) ) ;
405
+
417
406
if should_export {
418
407
symbols. push ( (
419
408
ExportedSymbol :: DropGlue ( ty) ,
0 commit comments