@@ -469,46 +469,23 @@ impl FileName {
469469/// `SpanData` is public because `Span` uses a thread-local interner and can't be
470470/// sent to other threads, but some pieces of performance infra run in a separate thread.
471471/// Using `Span` is generally preferred.
472- #[ derive( Clone , Copy , Hash , PartialEq , Eq ) ]
472+ #[ derive( Clone , Copy , Hash , PartialEq , Eq , derivative:: Derivative ) ]
473+ #[ derivative( PartialOrd , Ord ) ]
473474pub struct SpanData {
474475 pub lo : BytePos ,
475476 pub hi : BytePos ,
476477 /// Information about where the macro came from, if this piece of
477478 /// code was created by a macro expansion.
479+ #[ derivative( PartialOrd = "ignore" , Ord = "ignore" ) ]
480+ // `SyntaxContext` does not implement `Ord`.
481+ // The other fields are enough to determine in-file order.
478482 pub ctxt : SyntaxContext ,
483+ #[ derivative( PartialOrd = "ignore" , Ord = "ignore" ) ]
484+ // `LocalDefId` does not implement `Ord`.
485+ // The other fields are enough to determine in-file order.
479486 pub parent : Option < LocalDefId > ,
480487}
481488
482- // Order spans by position in the file.
483- impl Ord for SpanData {
484- fn cmp ( & self , other : & Self ) -> Ordering {
485- let SpanData {
486- lo : s_lo,
487- hi : s_hi,
488- ctxt : s_ctxt,
489- // `LocalDefId` does not implement `Ord`.
490- // The other fields are enough to determine in-file order.
491- parent : _,
492- } = self ;
493- let SpanData {
494- lo : o_lo,
495- hi : o_hi,
496- ctxt : o_ctxt,
497- // `LocalDefId` does not implement `Ord`.
498- // The other fields are enough to determine in-file order.
499- parent : _,
500- } = other;
501-
502- ( s_lo, s_hi, s_ctxt) . cmp ( & ( o_lo, o_hi, o_ctxt) )
503- }
504- }
505-
506- impl PartialOrd for SpanData {
507- fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
508- Some ( self . cmp ( other) )
509- }
510- }
511-
512489impl SpanData {
513490 #[ inline]
514491 pub fn span ( & self ) -> Span {
0 commit comments