@@ -595,23 +595,28 @@ fn write_mir_sig(
595
595
use rustc:: hir:: def:: Def ;
596
596
597
597
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 ( ) ) ;
599
599
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
605
607
_ => bug ! ( "Unexpected def description {:?}" , descr) ,
606
608
}
607
609
608
610
item_path:: with_forced_impl_filename_line ( || {
609
611
// 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( ) ) )
611
613
} ) ?;
612
614
613
615
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
+ {
615
620
write ! ( w, "(" ) ?;
616
621
617
622
// fn argument types.
@@ -624,18 +629,20 @@ fn write_mir_sig(
624
629
625
630
write ! ( w, ") -> {}" , mir. return_ty( ) ) ?;
626
631
}
627
- ( Def :: Const ( _ ) , _ ) | ( Def :: Static ( _ , _ ) , _ ) | ( _ , Some ( _ ) ) => {
632
+ _ => {
628
633
assert_eq ! ( mir. arg_count, 0 ) ;
629
634
write ! ( w, ": {} =" , mir. return_ty( ) ) ?;
630
635
}
631
- _ => bug ! ( "Unexpected def description {:?}" , descr) ,
632
636
}
633
637
634
638
if let Some ( yield_ty) = mir. yield_ty {
635
639
writeln ! ( w) ?;
636
640
writeln ! ( w, "yields {}" , yield_ty) ?;
637
641
}
638
642
643
+ write ! ( w, " " ) ?;
644
+ // Next thing that gets printed is the opening {
645
+
639
646
Ok ( ( ) )
640
647
}
641
648
0 commit comments