File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -510,10 +510,6 @@ impl SpanData {
510510 pub fn is_dummy ( self ) -> bool {
511511 self . lo . 0 == 0 && self . hi . 0 == 0
512512 }
513- #[ inline]
514- pub fn is_visible ( self , sm : & SourceMap ) -> bool {
515- !self . is_dummy ( ) && sm. is_span_accessible ( self . span ( ) )
516- }
517513 /// Returns `true` if `self` fully encloses `other`.
518514 pub fn contains ( self , other : Self ) -> bool {
519515 self . lo <= other. lo && other. hi <= self . hi
@@ -573,15 +569,9 @@ impl Span {
573569 self . data ( ) . with_parent ( ctxt)
574570 }
575571
576- /// Returns `true` if this is a dummy span with any hygienic context.
577- #[ inline]
578- pub fn is_dummy ( self ) -> bool {
579- self . data_untracked ( ) . is_dummy ( )
580- }
581-
582572 #[ inline]
583573 pub fn is_visible ( self , sm : & SourceMap ) -> bool {
584- self . data_untracked ( ) . is_visible ( sm )
574+ ! self . is_dummy ( ) && sm . is_span_accessible ( self )
585575 }
586576
587577 /// Returns `true` if this span comes from any kind of macro, desugaring or inlining.
Original file line number Diff line number Diff line change @@ -193,6 +193,23 @@ impl Span {
193193 }
194194 }
195195
196+ /// Returns `true` if this is a dummy span with any hygienic context.
197+ #[ inline]
198+ pub fn is_dummy ( self ) -> bool {
199+ if self . len_with_tag_or_marker != BASE_LEN_INTERNED_MARKER {
200+ // Inline-context or inline-parent format.
201+ let lo = self . lo_or_index ;
202+ let len = ( self . len_with_tag_or_marker & !PARENT_TAG ) as u32 ;
203+ debug_assert ! ( len <= MAX_LEN ) ;
204+ lo == 0 && len == 0
205+ } else {
206+ // Fully-interned or partially-interned format.
207+ let index = self . lo_or_index ;
208+ let data = with_span_interner ( |interner| interner. spans [ index as usize ] ) ;
209+ data. lo == BytePos ( 0 ) && data. hi == BytePos ( 0 )
210+ }
211+ }
212+
196213 /// This function is used as a fast path when decoding the full `SpanData` is not necessary.
197214 /// It's a cut-down version of `data_untracked`.
198215 #[ inline]
You can’t perform that action at this time.
0 commit comments