File tree 3 files changed +11
-21
lines changed
rustc_middle/src/ty/print
3 files changed +11
-21
lines changed Original file line number Diff line number Diff line change @@ -350,4 +350,8 @@ where
350
350
Ok ( ( ) )
351
351
} )
352
352
}
353
+
354
+ fn print_debug ( t : & T , fmt : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
355
+ with_no_trimmed_paths ! ( Self :: print( t, fmt) )
356
+ }
353
357
}
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use crate::{Interner, TraitRef};
4
4
5
5
pub trait IrPrint < T > {
6
6
fn print ( t : & T , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result ;
7
+ fn print_debug ( t : & T , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result ;
7
8
}
8
9
9
10
macro_rules! define_display_via_print {
@@ -14,6 +15,12 @@ macro_rules! define_display_via_print {
14
15
<I as IrPrint <$ty<I >>>:: print( self , fmt)
15
16
}
16
17
}
18
+
19
+ impl <I : Interner > fmt:: Debug for $ty<I > {
20
+ fn fmt( & self , fmt: & mut fmt:: Formatter <' _>) -> fmt:: Result {
21
+ <I as IrPrint <$ty<I >>>:: print_debug( self , fmt)
22
+ }
23
+ }
17
24
) *
18
25
}
19
26
}
Original file line number Diff line number Diff line change 1
- use std:: fmt;
2
-
3
1
use rustc_macros:: { HashStable_NoContext , TyDecodable , TyEncodable } ;
4
2
5
3
use crate :: fold:: { FallibleTypeFolder , TypeFoldable } ;
@@ -71,25 +69,6 @@ impl<I: Interner> TraitRef<I> {
71
69
}
72
70
}
73
71
74
- impl < I : Interner > fmt:: Debug for TraitRef < I > {
75
- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
76
- let TraitRef { def_id, args, _use_trait_ref_new_instead : ( ) } = self ;
77
- let mut args = args. into_iter ( ) . peekable ( ) ;
78
- write ! ( f, "{def_id:?}" ) ?;
79
- if args. peek ( ) . is_some ( ) {
80
- write ! ( f, "<" ) ?;
81
- for ( i, arg) in args. enumerate ( ) {
82
- if i > 0 {
83
- write ! ( f, ", " ) ?;
84
- }
85
- write ! ( f, "{arg:#?}" ) ?;
86
- }
87
- write ! ( f, ">" ) ?;
88
- }
89
- Ok ( ( ) )
90
- }
91
- }
92
-
93
72
// FIXME(compiler-errors): Make this into a `Lift_Generic` impl.
94
73
impl < I : Interner , U : Interner > Lift < U > for TraitRef < I >
95
74
where
You can’t perform that action at this time.
0 commit comments