@@ -183,8 +183,13 @@ fn test_env_with_pool<F>(
183
183
} ) ;
184
184
}
185
185
186
- const D1 : ty:: DebruijnIndex = ty:: INNERMOST ;
187
- const D2 : ty:: DebruijnIndex = D1 . shifted_in ( 1 ) ;
186
+ fn d1 ( ) -> ty:: DebruijnIndex {
187
+ ty:: INNERMOST
188
+ }
189
+
190
+ fn d2 ( ) -> ty:: DebruijnIndex {
191
+ d1 ( ) . shifted_in ( 1 )
192
+ }
188
193
189
194
impl < ' a , ' gcx , ' tcx > Env < ' a , ' gcx , ' tcx > {
190
195
pub fn tcx ( & self ) -> TyCtxt < ' a , ' gcx , ' tcx > {
@@ -337,7 +342,7 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
337
342
}
338
343
339
344
pub fn t_rptr_late_bound ( & self , id : u32 ) -> Ty < ' tcx > {
340
- let r = self . re_late_bound_with_debruijn ( id, D1 ) ;
345
+ let r = self . re_late_bound_with_debruijn ( id, d1 ( ) ) ;
341
346
self . infcx . tcx . mk_imm_ref ( r, self . tcx ( ) . types . isize )
342
347
}
343
348
@@ -494,7 +499,7 @@ fn subst_ty_renumber_bound() {
494
499
495
500
// t_expected = fn(&'a isize)
496
501
let t_expected = {
497
- let t_ptr_bound2 = env. t_rptr_late_bound_with_debruijn ( 1 , D2 ) ;
502
+ let t_ptr_bound2 = env. t_rptr_late_bound_with_debruijn ( 1 , d2 ( ) ) ;
498
503
env. t_fn ( & [ t_ptr_bound2] , env. t_nil ( ) )
499
504
} ;
500
505
@@ -531,7 +536,7 @@ fn subst_ty_renumber_some_bounds() {
531
536
//
532
537
// but not that the Debruijn index is different in the different cases.
533
538
let t_expected = {
534
- let t_rptr_bound2 = env. t_rptr_late_bound_with_debruijn ( 1 , D2 ) ;
539
+ let t_rptr_bound2 = env. t_rptr_late_bound_with_debruijn ( 1 , d2 ( ) ) ;
535
540
env. t_pair ( t_rptr_bound1, env. t_fn ( & [ t_rptr_bound2] , env. t_nil ( ) ) )
536
541
} ;
537
542
@@ -559,10 +564,10 @@ fn escaping() {
559
564
let t_rptr_free1 = env. t_rptr_free ( 1 ) ;
560
565
assert ! ( !t_rptr_free1. has_escaping_regions( ) ) ;
561
566
562
- let t_rptr_bound1 = env. t_rptr_late_bound_with_debruijn ( 1 , D1 ) ;
567
+ let t_rptr_bound1 = env. t_rptr_late_bound_with_debruijn ( 1 , d1 ( ) ) ;
563
568
assert ! ( t_rptr_bound1. has_escaping_regions( ) ) ;
564
569
565
- let t_rptr_bound2 = env. t_rptr_late_bound_with_debruijn ( 1 , D2 ) ;
570
+ let t_rptr_bound2 = env. t_rptr_late_bound_with_debruijn ( 1 , d2 ( ) ) ;
566
571
assert ! ( t_rptr_bound2. has_escaping_regions( ) ) ;
567
572
568
573
// t_fn = fn(A)
@@ -578,7 +583,7 @@ fn escaping() {
578
583
#[ test]
579
584
fn subst_region_renumber_region ( ) {
580
585
test_env ( EMPTY_SOURCE_STR , errors ( & [ ] ) , |env| {
581
- let re_bound1 = env. re_late_bound_with_debruijn ( 1 , D1 ) ;
586
+ let re_bound1 = env. re_late_bound_with_debruijn ( 1 , d1 ( ) ) ;
582
587
583
588
// type t_source<'a> = fn(&'a isize)
584
589
let t_source = {
@@ -593,7 +598,7 @@ fn subst_region_renumber_region() {
593
598
//
594
599
// but not that the Debruijn index is different in the different cases.
595
600
let t_expected = {
596
- let t_rptr_bound2 = env. t_rptr_late_bound_with_debruijn ( 1 , D2 ) ;
601
+ let t_rptr_bound2 = env. t_rptr_late_bound_with_debruijn ( 1 , d2 ( ) ) ;
597
602
env. t_fn ( & [ t_rptr_bound2] , env. t_nil ( ) )
598
603
} ;
599
604
0 commit comments