@@ -310,25 +310,29 @@ impl DebruijnIndex {
310
310
/// for<'a> fn(for<'b> fn(&'a x))
311
311
///
312
312
/// you would need to shift the index for `'a` into a new binder.
313
+ #[ inline]
313
314
#[ must_use]
314
315
pub fn shifted_in ( self , amount : u32 ) -> DebruijnIndex {
315
316
DebruijnIndex :: from_u32 ( self . as_u32 ( ) + amount)
316
317
}
317
318
318
319
/// Update this index in place by shifting it "in" through
319
320
/// `amount` number of binders.
321
+ #[ inline]
320
322
pub fn shift_in ( & mut self , amount : u32 ) {
321
323
* self = self . shifted_in ( amount) ;
322
324
}
323
325
324
326
/// Returns the resulting index when this value is moved out from
325
327
/// `amount` number of new binders.
328
+ #[ inline]
326
329
#[ must_use]
327
330
pub fn shifted_out ( self , amount : u32 ) -> DebruijnIndex {
328
331
DebruijnIndex :: from_u32 ( self . as_u32 ( ) - amount)
329
332
}
330
333
331
334
/// Update in place by shifting out from `amount` binders.
335
+ #[ inline]
332
336
pub fn shift_out ( & mut self , amount : u32 ) {
333
337
* self = self . shifted_out ( amount) ;
334
338
}
@@ -353,6 +357,7 @@ impl DebruijnIndex {
353
357
/// If we invoke `shift_out_to_binder` and the region is in fact
354
358
/// bound by one of the binders we are shifting out of, that is an
355
359
/// error (and should fail an assertion failure).
360
+ #[ inline]
356
361
pub fn shifted_out_to_binder ( self , to_binder : DebruijnIndex ) -> Self {
357
362
self . shifted_out ( to_binder. as_u32 ( ) - INNERMOST . as_u32 ( ) )
358
363
}
0 commit comments