@@ -11,11 +11,11 @@ use rustc_data_structures::indexed_vec::IndexVec;
11
11
use rustc_data_structures:: unify as ut;
12
12
use crate :: ty:: ReStatic ;
13
13
use crate :: ty:: { self , Ty , TyCtxt } ;
14
- use crate :: ty:: { BrFresh , ReLateBound , ReVar } ;
14
+ use crate :: ty:: { ReLateBound , ReVar } ;
15
15
use crate :: ty:: { Region , RegionVid } ;
16
16
17
17
use std:: collections:: BTreeMap ;
18
- use std:: { cmp, fmt, mem, u32 } ;
18
+ use std:: { cmp, fmt, mem} ;
19
19
use std:: ops:: Range ;
20
20
21
21
mod leak_check;
@@ -37,10 +37,6 @@ pub struct RegionConstraintCollector<'tcx> {
37
37
/// exist). This prevents us from making many such regions.
38
38
glbs : CombineMap < ' tcx > ,
39
39
40
- /// Global counter used during the GLB algorithm to create unique
41
- /// names for fresh bound regions
42
- bound_count : u32 ,
43
-
44
40
/// The undo log records actions that might later be undone.
45
41
///
46
42
/// Note: `num_open_snapshots` is used to track if we are actively
@@ -392,7 +388,6 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
392
388
data,
393
389
lubs,
394
390
glbs,
395
- bound_count : _,
396
391
undo_log : _,
397
392
num_open_snapshots : _,
398
393
unification_table,
@@ -579,39 +574,6 @@ impl<'tcx> RegionConstraintCollector<'tcx> {
579
574
}
580
575
}
581
576
582
- pub fn new_bound (
583
- & mut self ,
584
- tcx : TyCtxt < ' _ , ' _ , ' tcx > ,
585
- debruijn : ty:: DebruijnIndex ,
586
- ) -> Region < ' tcx > {
587
- // Creates a fresh bound variable for use in GLB computations.
588
- // See discussion of GLB computation in the large comment at
589
- // the top of this file for more details.
590
- //
591
- // This computation is potentially wrong in the face of
592
- // rollover. It's conceivable, if unlikely, that one might
593
- // wind up with accidental capture for nested functions in
594
- // that case, if the outer function had bound regions created
595
- // a very long time before and the inner function somehow
596
- // wound up rolling over such that supposedly fresh
597
- // identifiers were in fact shadowed. For now, we just assert
598
- // that there is no rollover -- eventually we should try to be
599
- // robust against this possibility, either by checking the set
600
- // of bound identifiers that appear in a given expression and
601
- // ensure that we generate one that is distinct, or by
602
- // changing the representation of bound regions in a fn
603
- // declaration
604
-
605
- let sc = self . bound_count ;
606
- self . bound_count = sc + 1 ;
607
-
608
- if sc >= self . bound_count {
609
- bug ! ( "rollover in RegionInference new_bound()" ) ;
610
- }
611
-
612
- tcx. mk_region ( ReLateBound ( debruijn, BrFresh ( sc) ) )
613
- }
614
-
615
577
fn add_constraint ( & mut self , constraint : Constraint < ' tcx > , origin : SubregionOrigin < ' tcx > ) {
616
578
// cannot add constraints once regions are resolved
617
579
debug ! (
0 commit comments