@@ -7,6 +7,7 @@ use rustc::mir::{
7
7
} ;
8
8
use rustc:: ty:: { self , subst:: SubstsRef , RegionVid , Ty , TyCtxt , TypeFoldable } ;
9
9
use rustc_data_structures:: binary_search_util;
10
+ use rustc_data_structures:: frozen:: Frozen ;
10
11
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
11
12
use rustc_data_structures:: graph:: scc:: Sccs ;
12
13
use rustc_hir:: def_id:: DefId ;
@@ -54,12 +55,12 @@ pub struct RegionInferenceContext<'tcx> {
54
55
liveness_constraints : LivenessValues < RegionVid > ,
55
56
56
57
/// The outlives constraints computed by the type-check.
57
- constraints : Rc < OutlivesConstraintSet > ,
58
+ constraints : Frozen < OutlivesConstraintSet > ,
58
59
59
60
/// The constraint-set, but in graph form, making it easy to traverse
60
61
/// the constraints adjacent to a particular region. Used to construct
61
62
/// the SCC (see `constraint_sccs`) and for error reporting.
62
- constraint_graph : Rc < NormalConstraintGraph > ,
63
+ constraint_graph : Frozen < NormalConstraintGraph > ,
63
64
64
65
/// The SCC computed from `constraints` and the constraint
65
66
/// graph. We have an edge from SCC A to SCC B if `A: B`. Used to
@@ -112,7 +113,7 @@ pub struct RegionInferenceContext<'tcx> {
112
113
113
114
/// Information about how the universally quantified regions in
114
115
/// scope on this function relate to one another.
115
- universal_region_relations : Rc < UniversalRegionRelations < ' tcx > > ,
116
+ universal_region_relations : Frozen < UniversalRegionRelations < ' tcx > > ,
116
117
}
117
118
118
119
/// Each time that `apply_member_constraint` is successful, it appends
@@ -242,11 +243,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
242
243
///
243
244
/// The `outlives_constraints` and `type_tests` are an initial set
244
245
/// of constraints produced by the MIR type check.
245
- pub ( crate ) fn new (
246
+ pub ( in crate :: borrow_check ) fn new (
246
247
var_infos : VarInfos ,
247
248
universal_regions : Rc < UniversalRegions < ' tcx > > ,
248
249
placeholder_indices : Rc < PlaceholderIndices > ,
249
- universal_region_relations : Rc < UniversalRegionRelations < ' tcx > > ,
250
+ universal_region_relations : Frozen < UniversalRegionRelations < ' tcx > > ,
250
251
outlives_constraints : OutlivesConstraintSet ,
251
252
member_constraints_in : MemberConstraintSet < ' tcx , RegionVid > ,
252
253
closure_bounds_mapping : FxHashMap <
@@ -263,8 +264,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
263
264
. map ( |info| RegionDefinition :: new ( info. universe , info. origin ) )
264
265
. collect ( ) ;
265
266
266
- let constraints = Rc :: new ( outlives_constraints) ; // freeze constraints
267
- let constraint_graph = Rc :: new ( constraints. graph ( definitions. len ( ) ) ) ;
267
+ let constraints = Frozen :: freeze ( outlives_constraints) ;
268
+ let constraint_graph = Frozen :: freeze ( constraints. graph ( definitions. len ( ) ) ) ;
268
269
let fr_static = universal_regions. fr_static ;
269
270
let constraint_sccs = Rc :: new ( constraints. compute_sccs ( & constraint_graph, fr_static) ) ;
270
271
0 commit comments