@@ -124,6 +124,7 @@ enum Fmt<'a> {
124
124
}
125
125
126
126
impl InlineCtxt {
127
+ #[ inline]
127
128
fn data ( self ) -> SpanData {
128
129
let len = self . len as u32 ;
129
130
debug_assert ! ( len <= MAX_LEN ) ;
@@ -134,12 +135,14 @@ impl InlineCtxt {
134
135
parent : None ,
135
136
}
136
137
}
138
+ #[ inline]
137
139
fn to_span ( self ) -> Span {
138
140
unsafe { transmute ( self ) }
139
141
}
140
142
}
141
143
142
144
impl InlineParent {
145
+ #[ inline]
143
146
fn data ( self ) -> SpanData {
144
147
let len = ( self . len_with_tag & !PARENT_TAG ) as u32 ;
145
148
debug_assert ! ( len <= MAX_LEN ) ;
@@ -150,33 +153,39 @@ impl InlineParent {
150
153
parent : Some ( LocalDefId { local_def_index : DefIndex :: from_u32 ( self . parent as u32 ) } ) ,
151
154
}
152
155
}
156
+ #[ inline]
153
157
fn to_span ( self ) -> Span {
154
158
unsafe { transmute ( self ) }
155
159
}
156
160
}
157
161
158
162
impl PartiallyInterned {
163
+ #[ inline]
159
164
fn data ( self ) -> SpanData {
160
165
SpanData {
161
166
ctxt : SyntaxContext :: from_u32 ( self . ctxt as u32 ) ,
162
167
..with_span_interner ( |interner| interner. spans [ self . index as usize ] )
163
168
}
164
169
}
170
+ #[ inline]
165
171
fn to_span ( self ) -> Span {
166
172
unsafe { transmute ( self ) }
167
173
}
168
174
}
169
175
170
176
impl Interned {
177
+ #[ inline]
171
178
fn data ( self ) -> SpanData {
172
179
with_span_interner ( |interner| interner. spans [ self . index as usize ] )
173
180
}
181
+ #[ inline]
174
182
fn to_span ( self ) -> Span {
175
183
unsafe { transmute ( self ) }
176
184
}
177
185
}
178
186
179
187
impl Fmt < ' _ > {
188
+ #[ inline]
180
189
fn data ( self ) -> SpanData {
181
190
match self {
182
191
Fmt :: InlineCtxt ( span) => span. data ( ) ,
@@ -241,6 +250,7 @@ impl Span {
241
250
}
242
251
}
243
252
253
+ #[ inline]
244
254
fn fmt ( & mut self ) -> Fmt < ' _ > {
245
255
if self . len_with_tag_or_marker != BASE_LEN_INTERNED_MARKER {
246
256
if self . len_with_tag_or_marker & PARENT_TAG == 0 {
@@ -291,6 +301,7 @@ impl Span {
291
301
// For optimization we are interested in cases in which the context is inline and the context
292
302
// update doesn't change format. All non-inline or format changing scenarios require accessing
293
303
// interner and can fall back to `Span::new`.
304
+ #[ inline]
294
305
pub fn update_ctxt ( & mut self , update : impl FnOnce ( SyntaxContext ) -> SyntaxContext ) {
295
306
// FIXME(#125017): Update ctxt inline without touching interner when possible.
296
307
let data = self . data ( ) ;
@@ -299,6 +310,7 @@ impl Span {
299
310
300
311
// Returns either syntactic context, if it can be retrieved without taking the interner lock,
301
312
// or an index into the interner if it cannot.
313
+ #[ inline]
302
314
fn inline_ctxt ( mut self ) -> Result < SyntaxContext , usize > {
303
315
match self . fmt ( ) {
304
316
Fmt :: InlineCtxt ( InlineCtxt { ctxt, .. } )
0 commit comments