@@ -595,23 +595,28 @@ fn write_mir_sig(
595595 use rustc:: hir:: def:: Def ;
596596
597597 trace ! ( "write_mir_sig: {:?}" , src. instance) ;
598- let descr = tcx. describe_def ( src. def_id ( ) ) . unwrap ( ) ;
598+ let descr = tcx. describe_def ( src. def_id ( ) ) ;
599599 match ( descr, src. promoted ) {
600- ( _, Some ( i) ) => write ! ( w, "{:?} in" , i) ?,
601- ( Def :: Fn ( _) , _) | ( Def :: Method ( _) , _) => write ! ( w, "fn" ) ?,
602- ( Def :: Const ( _) , _) => write ! ( w, "const" ) ?,
603- ( Def :: Static ( _, /*is_mutbl*/ false ) , _) => write ! ( w, "static" ) ?,
604- ( Def :: Static ( _, /*is_mutbl*/ true ) , _) => write ! ( w, "static mut" ) ?,
600+ ( _, Some ( i) ) => write ! ( w, "{:?} in " , i) ?,
601+ ( Some ( Def :: Fn ( _) ) , _) | ( Some ( Def :: Method ( _) ) , _) => write ! ( w, "fn " ) ?,
602+ ( Some ( Def :: StructCtor ( ..) ) , _) => write ! ( w, "struct " ) ?,
603+ ( Some ( Def :: Const ( _) ) , _) => write ! ( w, "const " ) ?,
604+ ( Some ( Def :: Static ( _, /*is_mutbl*/ false ) ) , _) => write ! ( w, "static " ) ?,
605+ ( Some ( Def :: Static ( _, /*is_mutbl*/ true ) ) , _) => write ! ( w, "static mut " ) ?,
606+ ( None , _) => { } , // things like anon const, not an item
605607 _ => bug ! ( "Unexpected def description {:?}" , descr) ,
606608 }
607609
608610 item_path:: with_forced_impl_filename_line ( || {
609611 // see notes on #41697 elsewhere
610- write ! ( w, " {}" , tcx. item_path_str( src. def_id( ) ) )
612+ write ! ( w, "{}" , tcx. item_path_str( src. def_id( ) ) )
611613 } ) ?;
612614
613615 match ( descr, src. promoted ) {
614- ( Def :: Fn ( _) , None ) | ( Def :: Method ( _) , None ) => {
616+ ( Some ( Def :: Fn ( _) ) , None ) |
617+ ( Some ( Def :: Method ( _) ) , None ) |
618+ ( Some ( Def :: StructCtor ( ..) ) , None ) =>
619+ {
615620 write ! ( w, "(" ) ?;
616621
617622 // fn argument types.
@@ -624,18 +629,20 @@ fn write_mir_sig(
624629
625630 write ! ( w, ") -> {}" , mir. return_ty( ) ) ?;
626631 }
627- ( Def :: Const ( _ ) , _ ) | ( Def :: Static ( _ , _ ) , _ ) | ( _ , Some ( _ ) ) => {
632+ _ => {
628633 assert_eq ! ( mir. arg_count, 0 ) ;
629634 write ! ( w, ": {} =" , mir. return_ty( ) ) ?;
630635 }
631- _ => bug ! ( "Unexpected def description {:?}" , descr) ,
632636 }
633637
634638 if let Some ( yield_ty) = mir. yield_ty {
635639 writeln ! ( w) ?;
636640 writeln ! ( w, "yields {}" , yield_ty) ?;
637641 }
638642
643+ write ! ( w, " " ) ?;
644+ // Next thing that gets printed is the opening {
645+
639646 Ok ( ( ) )
640647}
641648
0 commit comments