@@ -225,8 +225,8 @@ use rustc_middle::ty::adjustment::{CustomCoerceUnsized, PointerCoercion};
225225use rustc_middle:: ty:: layout:: ValidityRequirement ;
226226use rustc_middle:: ty:: print:: { shrunk_instance_name, with_no_trimmed_paths} ;
227227use rustc_middle:: ty:: {
228- self , GenericArgs , GenericParamDefKind , Instance , InstanceKind , Ty , TyCtxt , TypeFoldable ,
229- TypeVisitableExt , VtblEntry ,
228+ self , GenericArgs , GenericParamDefKind , Instance , InstanceKind , Interner , Ty , TyCtxt ,
229+ TypeFoldable , TypeVisitableExt , VtblEntry ,
230230} ;
231231use rustc_middle:: util:: Providers ;
232232use rustc_middle:: { bug, span_bug} ;
@@ -965,7 +965,7 @@ fn should_codegen_locally<'tcx>(tcx: TyCtxtAt<'tcx>, instance: Instance<'tcx>) -
965965 {
966966 // `#[rustc_force_inline]` items should never be codegened. This should be caught by
967967 // the MIR validator.
968- return false ;
968+ tcx . delay_bug ( "attempt to codegen `#[rustc_force_inline]` item" ) ;
969969 }
970970
971971 if def_id. is_local ( ) {
@@ -1462,7 +1462,9 @@ impl<'v> RootCollector<'_, 'v> {
14621462 fn is_root ( & self , def_id : LocalDefId ) -> bool {
14631463 !self . tcx . generics_of ( def_id) . requires_monomorphization ( self . tcx )
14641464 && match self . strategy {
1465- MonoItemCollectionStrategy :: Eager => true ,
1465+ MonoItemCollectionStrategy :: Eager => {
1466+ !matches ! ( self . tcx. codegen_fn_attrs( def_id) . inline, InlineAttr :: Force { .. } )
1467+ }
14661468 MonoItemCollectionStrategy :: Lazy => {
14671469 self . entry_fn . and_then ( |( id, _) | id. as_local ( ) ) == Some ( def_id)
14681470 || self . tcx . is_reachable_non_generic ( def_id)
0 commit comments