@@ -917,22 +917,32 @@ impl<'a, 'tcx> CrateMetadata {
917917 self . maybe_entry ( id) . and_then ( |item| item. decode ( self ) . mir ) . is_some ( )
918918 }
919919
920- pub fn maybe_get_optimized_mir ( & self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> Option < Body < ' tcx > > {
921- match self . is_proc_macro ( id) {
922- true => None ,
923- false => self . entry ( id) . mir . map ( |mir| mir. decode ( ( self , tcx) ) ) ,
924- }
920+ pub fn get_optimized_mir ( & self , tcx : TyCtxt < ' tcx > , id : DefIndex ) -> Body < ' tcx > {
921+ let mir =
922+ match self . is_proc_macro ( id) {
923+ true => None ,
924+ false => self . entry ( id) . mir . map ( |mir| mir. decode ( ( self , tcx) ) ) ,
925+ } ;
926+
927+ mir. unwrap_or_else ( || {
928+ bug ! ( "get_optimized_mir: missing MIR for `{:?}`" , self . local_def_id( id) )
929+ } )
925930 }
926931
927- pub fn maybe_get_promoted_mir (
932+ pub fn get_promoted_mir (
928933 & self ,
929934 tcx : TyCtxt < ' tcx > ,
930935 id : DefIndex ,
931- ) -> Option < IndexVec < Promoted , Body < ' tcx > > > {
932- match self . is_proc_macro ( id) {
933- true => None ,
934- false => self . entry ( id) . promoted_mir . map ( |promoted| promoted. decode ( ( self , tcx) ) , )
935- }
936+ ) -> IndexVec < Promoted , Body < ' tcx > > {
937+ let promoted =
938+ match self . is_proc_macro ( id) {
939+ true => None ,
940+ false => self . entry ( id) . promoted_mir . map ( |promoted| promoted. decode ( ( self , tcx) ) )
941+ } ;
942+
943+ promoted. unwrap_or_else ( || {
944+ bug ! ( "get_promoted_mir: missing MIR for `{:?}`" , self . local_def_id( id) )
945+ } )
936946 }
937947
938948 pub fn mir_const_qualif ( & self , id : DefIndex ) -> u8 {
0 commit comments