@@ -651,7 +651,7 @@ pub(crate) fn incremental_verify_ich<Tcx, V: Debug>(
651
651
let old_hash = dep_graph_data. prev_fingerprint_of ( prev_index) ;
652
652
653
653
if new_hash != old_hash {
654
- incremental_verify_ich_failed :: < Tcx > ( prev_index, DebugArg :: from ( & result) ) ;
654
+ incremental_verify_ich_failed :: < Tcx > ( prev_index, result) ;
655
655
}
656
656
}
657
657
@@ -669,50 +669,12 @@ where
669
669
} )
670
670
}
671
671
672
- // This DebugArg business is largely a mirror of std::fmt::ArgumentV1, which is
673
- // currently not exposed publicly.
674
- //
675
- // The PR which added this attempted to use `&dyn Debug` instead, but that
676
- // showed statistically significant worse compiler performance. It's not
677
- // actually clear what the cause there was -- the code should be cold. If this
678
- // can be replaced with `&dyn Debug` with on perf impact, then it probably
679
- // should be.
680
- extern "C" {
681
- type Opaque ;
682
- }
683
-
684
- struct DebugArg < ' a > {
685
- value : & ' a Opaque ,
686
- fmt : fn ( & Opaque , & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result ,
687
- }
688
-
689
- impl < ' a , T > From < & ' a T > for DebugArg < ' a >
690
- where
691
- T : std:: fmt:: Debug ,
692
- {
693
- fn from ( value : & ' a T ) -> DebugArg < ' a > {
694
- DebugArg {
695
- value : unsafe { std:: mem:: transmute ( value) } ,
696
- fmt : unsafe {
697
- std:: mem:: transmute ( <T as std:: fmt:: Debug >:: fmt as fn ( _, _) -> std:: fmt:: Result )
698
- } ,
699
- }
700
- }
701
- }
702
-
703
- impl std:: fmt:: Debug for DebugArg < ' _ > {
704
- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
705
- ( self . fmt ) ( self . value , f)
706
- }
707
- }
708
-
709
- // Note that this is marked #[cold] and intentionally takes the equivalent of
710
- // `dyn Debug` for its arguments, as we want to avoid generating a bunch of
711
- // different implementations for LLVM to chew on (and filling up the final
712
- // binary, too).
672
+ // Note that this is marked #[cold] and intentionally takes `dyn Debug` for `result`,
673
+ // as we want to avoid generating a bunch of different implementations for LLVM to
674
+ // chew on (and filling up the final binary, too).
713
675
#[ cold]
714
676
#[ inline( never) ]
715
- fn incremental_verify_ich_failed < Tcx > ( prev_index : SerializedDepNodeIndex , result : DebugArg < ' _ > )
677
+ fn incremental_verify_ich_failed < Tcx > ( prev_index : SerializedDepNodeIndex , result : & dyn Debug )
716
678
where
717
679
Tcx : DepContext ,
718
680
{
0 commit comments