@@ -1269,8 +1269,8 @@ impl DebruijnIndex {
1269
1269
///
1270
1270
/// you would need to shift the index for `'a` into 1 new binder.
1271
1271
#[ must_use]
1272
- pub fn shifted_in ( self , amount : u32 ) -> DebruijnIndex {
1273
- DebruijnIndex :: new ( self . index ( ) + amount as usize )
1272
+ pub const fn shifted_in ( self , amount : u32 ) -> DebruijnIndex {
1273
+ DebruijnIndex ( self . 0 + amount)
1274
1274
}
1275
1275
1276
1276
/// Update this index in place by shifting it "in" through
@@ -1282,8 +1282,8 @@ impl DebruijnIndex {
1282
1282
/// Returns the resulting index when this value is moved out from
1283
1283
/// `amount` number of new binders.
1284
1284
#[ must_use]
1285
- pub fn shifted_out ( self , amount : u32 ) -> DebruijnIndex {
1286
- DebruijnIndex :: new ( self . index ( ) - amount as usize )
1285
+ pub const fn shifted_out ( self , amount : u32 ) -> DebruijnIndex {
1286
+ DebruijnIndex ( self . 0 - amount)
1287
1287
}
1288
1288
1289
1289
/// Update in place by shifting out from `amount` binders.
@@ -1312,7 +1312,7 @@ impl DebruijnIndex {
1312
1312
/// bound by one of the binders we are shifting out of, that is an
1313
1313
/// error (and should fail an assertion failure).
1314
1314
pub fn shifted_out_to_binder ( self , to_binder : DebruijnIndex ) -> Self {
1315
- self . shifted_out ( ( to_binder. index ( ) - INNERMOST . index ( ) ) as u32 )
1315
+ self . shifted_out ( ( to_binder. 0 - INNERMOST . 0 ) as u32 )
1316
1316
}
1317
1317
}
1318
1318
0 commit comments