@@ -239,7 +239,7 @@ impl Ord for Span {
239239 }
240240}
241241
242- #[ derive( Copy , Clone , Debug , Hash , PartialEq , Eq , PartialOrd , Ord , RustcEncodable , RustcDecodable ) ]
242+ #[ derive( Copy , Clone , Hash , PartialEq , Eq , PartialOrd , Ord , RustcEncodable , RustcDecodable ) ]
243243#[ derive( HashStable_Generic ) ]
244244pub enum SpanId {
245245 Span ( Span ) ,
@@ -685,23 +685,33 @@ impl rustc_serialize::UseSpecializedDecodable for Span {
685685 }
686686}
687687
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+ }
694698}
695699
696700impl fmt:: Debug for Span {
697701 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
698- ( * SPAN_DEBUG ) ( * self , f)
702+ ( * SPAN_DEBUG ) ( SpanId :: Span ( * self ) , f)
699703 }
700704}
701705
702706impl fmt:: Debug for SpanData {
703707 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)
705715 }
706716}
707717
@@ -1637,7 +1647,7 @@ pub struct FileLines {
16371647 pub lines : Vec < LineInfo > ,
16381648}
16391649
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 > =
16411651 AtomicRef :: new ( & ( default_span_debug as fn ( _, & mut fmt:: Formatter < ' _ > ) -> _ ) ) ;
16421652
16431653// _____________________________________________________________________________
0 commit comments