@@ -331,10 +331,7 @@ fn exported_symbols_provider_local(
331331 rustc_middle:: ty:: Coroutine ( def_id, _) => * def_id,
332332 rustc_middle:: ty:: CoroutineClosure ( def_id, _) => * def_id,
333333 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 ,
338335 } ;
339336 let Some ( root_def_id) = root_def_id. as_local ( ) else {
340337 return false ;
@@ -346,12 +343,7 @@ fn exported_symbols_provider_local(
346343
347344 let is_instantiable_downstream = |did, type_args| {
348345 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) ) )
355347 } )
356348 } ;
357349 // The symbols created in this loop are sorted below it
@@ -404,16 +396,16 @@ fn exported_symbols_provider_local(
404396 else {
405397 bug ! ( "Expected a type argument for drop glue" ) ;
406398 } ;
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- } )
399+ assert_eq ! ( typ, ty) ;
400+
401+ let root_identifier = match typ. kind ( ) {
402+ rustc_middle:: ty:: Adt ( def, args) => Some ( ( def. did ( ) , args) ) ,
403+ rustc_middle:: ty:: Closure ( id, args) => Some ( ( * id, args) ) ,
404+ _ => None ,
416405 } ;
406+ let should_export = root_identifier
407+ . map_or ( true , |( did, args) | is_instantiable_downstream ( did, args. types ( ) ) ) ;
408+
417409 if should_export {
418410 symbols. push ( (
419411 ExportedSymbol :: DropGlue ( ty) ,
0 commit comments