@@ -223,17 +223,13 @@ pub fn has_attr(tcx: TyCtxt<'_>, item: &stable_mir::CrateItem, attr: symbol::Sym
223
223
}
224
224
225
225
fn mono_item_name ( tcx : TyCtxt < ' _ > , item : & MonoItem ) -> String {
226
- if let MonoItem :: GlobalAsm ( data ) = item {
227
- hash ( data ) . to_string ( )
228
- } else {
229
- mono_item_name_int ( tcx , & rustc_internal :: internal ( tcx , item ) )
226
+ match item {
227
+ MonoItem :: Fn ( instance ) => todo ! ( ) , // <-- Demangle here
228
+ MonoItem :: Static ( _static_def ) => rustc_internal :: internal ( tcx , item ) . symbol_name ( tcx ) . name . into ( ) ,
229
+ MonoItem :: GlobalAsm ( opaque ) => hash ( opaque ) . to_string ( ) ,
230
230
}
231
231
}
232
232
233
- fn mono_item_name_int < ' a > ( tcx : TyCtxt < ' a > , item : & rustc_middle:: mir:: mono:: MonoItem < ' a > ) -> String {
234
- item. symbol_name ( tcx) . name . into ( )
235
- }
236
-
237
233
fn fn_inst_for_ty ( ty : stable_mir:: ty:: Ty , direct_call : bool ) -> Option < Instance > {
238
234
ty. kind ( ) . fn_def ( ) . and_then ( |( fn_def, args) | {
239
235
if direct_call {
@@ -886,7 +882,7 @@ impl MirVisitor for UnevaluatedConstCollector<'_, '_> {
886
882
. flatten ( )
887
883
. unwrap_or_else ( || panic ! ( "Failed to resolve mono item for {:?}" , uconst) ) ;
888
884
let internal_mono_item = rustc_middle:: mir:: mono:: MonoItem :: Fn ( inst) ;
889
- let item_name = mono_item_name_int ( self . tcx , & internal_mono_item ) ;
885
+ let item_name = mono_item_name ( self . tcx , & MonoItem :: Fn ( rustc_internal :: stable ( inst ) ) ) ;
890
886
if !( self . processed_items . contains_key ( & item_name)
891
887
|| self . pending_items . contains_key ( & item_name)
892
888
|| self . current_item == hash ( & item_name) )
0 commit comments