@@ -327,43 +327,25 @@ impl Span {
327327    // interner and can fall back to `Span::new`. 
328328    #[ inline]  
329329    pub  fn  map_ctxt ( self ,  update :  impl  FnOnce ( SyntaxContext )  -> SyntaxContext )  -> Span  { 
330-         let  ( updated_ctxt32,  data) ; 
331330        match_span_kind !  { 
332331            self , 
333332            InlineCtxt ( span)  => { 
334-                 updated_ctxt32 = update( SyntaxContext :: from_u16( span. ctxt) ) . as_u32( ) ; 
335-                 // Any small new context including zero will preserve the format. 
336-                 if  updated_ctxt32 <= MAX_CTXT  { 
337-                     return  InlineCtxt :: span( span. lo,  span. len,  updated_ctxt32 as  u16 ) ; 
338-                 } 
339-                 data = span. data( ) ; 
340-             } , 
341-             InlineParent ( span)  => { 
342-                 updated_ctxt32 = update( SyntaxContext :: root( ) ) . as_u32( ) ; 
343-                 // Only if the new context is zero the format will be preserved. 
344-                 if  updated_ctxt32 == 0  { 
345-                     // Do nothing. 
346-                     return  self ; 
347-                 } 
348-                 data = span. data( ) ; 
349-             } , 
350-             PartiallyInterned ( span)  => { 
351-                 updated_ctxt32 = update( SyntaxContext :: from_u16( span. ctxt) ) . as_u32( ) ; 
352-                 // Any small new context excluding zero will preserve the format. 
353-                 // Zero may change the format to `InlineParent` if parent and len are small enough. 
354-                 if  updated_ctxt32 <= MAX_CTXT  && updated_ctxt32 != 0  { 
355-                     return  PartiallyInterned :: span( span. index,  updated_ctxt32 as  u16 ) ; 
356-                 } 
357-                 data = span. data( ) ; 
358-             } , 
359-             Interned ( span)  => { 
360-                 data = span. data( ) ; 
361-                 updated_ctxt32 = update( data. ctxt) . as_u32( ) ; 
333+                 let  updated_ctxt32 = update( SyntaxContext :: from_u16( span. ctxt) ) . as_u32( ) ; 
334+                 // Any small new context including zero will preserve the format, 
335+                 // any big new context will result in a fully interned format. 
336+                 return  if  updated_ctxt32 <= MAX_CTXT  { 
337+                     InlineCtxt :: span( span. lo,  span. len,  updated_ctxt32 as  u16 ) 
338+                 }  else { 
339+                     Interned :: span( with_span_interner( |interner| interner. intern( & span. data( ) ) ) ) 
340+                 } ; 
362341            } , 
342+             InlineParent ( _span)  => { } , 
343+             PartiallyInterned ( _span)  => { } , 
344+             Interned ( _span)  => { } , 
363345        } 
364346
365-         // We could not keep the span in the same inline format, fall back to the complete logic. 
366-         data. with_ctxt ( SyntaxContext :: from_u32 ( updated_ctxt32 ) ) 
347+         let  data =  self . data_untracked ( ) ; 
348+         data. with_ctxt ( update ( data . ctxt ) ) 
367349    } 
368350
369351    // Returns either syntactic context, if it can be retrieved without taking the interner lock, 
0 commit comments