Skip to content

Commit bb73f17

Browse files
committed
Inline DebruijnIndex methods
1 parent 41419e7 commit bb73f17

File tree

1 file changed

+5
-0
lines changed
  • compiler/rustc_type_ir/src

1 file changed

+5
-0
lines changed

compiler/rustc_type_ir/src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -310,25 +310,29 @@ impl DebruijnIndex {
310310
/// for<'a> fn(for<'b> fn(&'a x))
311311
///
312312
/// you would need to shift the index for `'a` into a new binder.
313+
#[inline]
313314
#[must_use]
314315
pub fn shifted_in(self, amount: u32) -> DebruijnIndex {
315316
DebruijnIndex::from_u32(self.as_u32() + amount)
316317
}
317318

318319
/// Update this index in place by shifting it "in" through
319320
/// `amount` number of binders.
321+
#[inline]
320322
pub fn shift_in(&mut self, amount: u32) {
321323
*self = self.shifted_in(amount);
322324
}
323325

324326
/// Returns the resulting index when this value is moved out from
325327
/// `amount` number of new binders.
328+
#[inline]
326329
#[must_use]
327330
pub fn shifted_out(self, amount: u32) -> DebruijnIndex {
328331
DebruijnIndex::from_u32(self.as_u32() - amount)
329332
}
330333

331334
/// Update in place by shifting out from `amount` binders.
335+
#[inline]
332336
pub fn shift_out(&mut self, amount: u32) {
333337
*self = self.shifted_out(amount);
334338
}
@@ -353,6 +357,7 @@ impl DebruijnIndex {
353357
/// If we invoke `shift_out_to_binder` and the region is in fact
354358
/// bound by one of the binders we are shifting out of, that is an
355359
/// error (and should fail an assertion failure).
360+
#[inline]
356361
pub fn shifted_out_to_binder(self, to_binder: DebruijnIndex) -> Self {
357362
self.shifted_out(to_binder.as_u32() - INNERMOST.as_u32())
358363
}

0 commit comments

Comments
 (0)