@@ -239,7 +239,7 @@ impl Ord for Span {
239
239
}
240
240
}
241
241
242
- #[ derive( Copy , Clone , Debug , Hash , PartialEq , Eq , PartialOrd , Ord , RustcEncodable , RustcDecodable ) ]
242
+ #[ derive( Copy , Clone , Hash , PartialEq , Eq , PartialOrd , Ord , RustcEncodable , RustcDecodable ) ]
243
243
#[ derive( HashStable_Generic ) ]
244
244
pub enum SpanId {
245
245
Span ( Span ) ,
@@ -685,23 +685,33 @@ impl rustc_serialize::UseSpecializedDecodable for Span {
685
685
}
686
686
}
687
687
688
- pub fn default_span_debug ( span : Span , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
689
- f. debug_struct ( "Span" )
690
- . field ( "lo" , & span. lo ( ) )
691
- . field ( "hi" , & span. hi ( ) )
692
- . field ( "ctxt" , & span. ctxt ( ) )
693
- . finish ( )
688
+ pub fn default_span_debug ( span : SpanId , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
689
+ match span {
690
+ SpanId :: Span ( span) => f
691
+ . debug_struct ( "Span" )
692
+ . field ( "lo" , & span. lo ( ) )
693
+ . field ( "hi" , & span. hi ( ) )
694
+ . field ( "ctxt" , & span. ctxt ( ) )
695
+ . finish ( ) ,
696
+ SpanId :: DefId ( did) => f. debug_tuple ( "DefId" ) . field ( & did) . finish ( ) ,
697
+ }
694
698
}
695
699
696
700
impl fmt:: Debug for Span {
697
701
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
698
- ( * SPAN_DEBUG ) ( * self , f)
702
+ ( * SPAN_DEBUG ) ( SpanId :: Span ( * self ) , f)
699
703
}
700
704
}
701
705
702
706
impl fmt:: Debug for SpanData {
703
707
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
704
- ( * SPAN_DEBUG ) ( Span :: new ( self . lo , self . hi , self . ctxt ) , f)
708
+ ( * SPAN_DEBUG ) ( SpanId :: Span ( Span :: new ( self . lo , self . hi , self . ctxt ) ) , f)
709
+ }
710
+ }
711
+
712
+ impl fmt:: Debug for SpanId {
713
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
714
+ ( * SPAN_DEBUG ) ( * self , f)
705
715
}
706
716
}
707
717
@@ -1637,7 +1647,7 @@ pub struct FileLines {
1637
1647
pub lines : Vec < LineInfo > ,
1638
1648
}
1639
1649
1640
- pub static SPAN_DEBUG : AtomicRef < fn ( Span , & mut fmt:: Formatter < ' _ > ) -> fmt:: Result > =
1650
+ pub static SPAN_DEBUG : AtomicRef < fn ( SpanId , & mut fmt:: Formatter < ' _ > ) -> fmt:: Result > =
1641
1651
AtomicRef :: new ( & ( default_span_debug as fn ( _, & mut fmt:: Formatter < ' _ > ) -> _ ) ) ;
1642
1652
1643
1653
// _____________________________________________________________________________
0 commit comments