@@ -917,22 +917,32 @@ impl<'a, 'tcx> CrateMetadata {
917
917
self . maybe_entry ( id) . and_then ( |item| item. decode ( self ) . mir ) . is_some ( )
918
918
}
919
919
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
+ } )
925
930
}
926
931
927
- pub fn maybe_get_promoted_mir (
932
+ pub fn get_promoted_mir (
928
933
& self ,
929
934
tcx : TyCtxt < ' tcx > ,
930
935
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
+ } )
936
946
}
937
947
938
948
pub fn mir_const_qualif ( & self , id : DefIndex ) -> u8 {
0 commit comments