|
9 | 9 | // except according to those terms.
|
10 | 10 |
|
11 | 11 | use borrow_check::location::LocationTable;
|
12 |
| -use borrow_check::nll::ToRegionVid; |
13 | 12 | use borrow_check::nll::facts::AllFacts;
|
14 | 13 | use borrow_check::nll::type_check::constraint_conversion;
|
15 | 14 | use borrow_check::nll::type_check::{Locations, MirTypeckRegionConstraints};
|
16 | 15 | use borrow_check::nll::universal_regions::UniversalRegions;
|
| 16 | +use borrow_check::nll::ToRegionVid; |
17 | 17 | use rustc::hir::def_id::DefId;
|
18 | 18 | use rustc::infer::outlives::free_region_map::FreeRegionRelations;
|
19 | 19 | use rustc::infer::region_constraints::GenericKind;
|
@@ -53,37 +53,37 @@ crate struct UniversalRegionRelations<'tcx> {
|
53 | 53 | inverse_outlives: TransitiveRelation<RegionVid>,
|
54 | 54 | }
|
55 | 55 |
|
56 |
| -impl UniversalRegionRelations<'tcx> { |
57 |
| - crate fn create( |
58 |
| - infcx: &InferCtxt<'_, '_, 'tcx>, |
59 |
| - mir_def_id: DefId, |
60 |
| - param_env: ty::ParamEnv<'tcx>, |
61 |
| - location_table: &LocationTable, |
62 |
| - implicit_region_bound: Option<ty::Region<'tcx>>, |
63 |
| - universal_regions: &Rc<UniversalRegions<'tcx>>, |
64 |
| - constraints: &mut MirTypeckRegionConstraints<'tcx>, |
65 |
| - all_facts: &mut Option<AllFacts>, |
66 |
| - ) -> Self { |
67 |
| - let mir_node_id = infcx.tcx.hir.as_local_node_id(mir_def_id).unwrap(); |
68 |
| - UniversalRegionRelationsBuilder { |
69 |
| - infcx, |
70 |
| - mir_def_id, |
71 |
| - mir_node_id, |
72 |
| - param_env, |
73 |
| - implicit_region_bound, |
74 |
| - constraints, |
75 |
| - location_table, |
76 |
| - all_facts, |
| 56 | +crate fn create( |
| 57 | + infcx: &InferCtxt<'_, '_, 'tcx>, |
| 58 | + mir_def_id: DefId, |
| 59 | + param_env: ty::ParamEnv<'tcx>, |
| 60 | + location_table: &LocationTable, |
| 61 | + implicit_region_bound: Option<ty::Region<'tcx>>, |
| 62 | + universal_regions: &Rc<UniversalRegions<'tcx>>, |
| 63 | + constraints: &mut MirTypeckRegionConstraints<'tcx>, |
| 64 | + all_facts: &mut Option<AllFacts>, |
| 65 | +) -> Rc<UniversalRegionRelations<'tcx>> { |
| 66 | + let mir_node_id = infcx.tcx.hir.as_local_node_id(mir_def_id).unwrap(); |
| 67 | + UniversalRegionRelationsBuilder { |
| 68 | + infcx, |
| 69 | + mir_def_id, |
| 70 | + mir_node_id, |
| 71 | + param_env, |
| 72 | + implicit_region_bound, |
| 73 | + constraints, |
| 74 | + location_table, |
| 75 | + all_facts, |
| 76 | + universal_regions: universal_regions.clone(), |
| 77 | + relations: UniversalRegionRelations { |
77 | 78 | universal_regions: universal_regions.clone(),
|
78 |
| - relations: UniversalRegionRelations { |
79 |
| - universal_regions: universal_regions.clone(), |
80 |
| - region_bound_pairs: Vec::new(), |
81 |
| - outlives: TransitiveRelation::new(), |
82 |
| - inverse_outlives: TransitiveRelation::new(), |
83 |
| - }, |
84 |
| - }.create() |
85 |
| - } |
| 79 | + region_bound_pairs: Vec::new(), |
| 80 | + outlives: TransitiveRelation::new(), |
| 81 | + inverse_outlives: TransitiveRelation::new(), |
| 82 | + }, |
| 83 | + }.create() |
| 84 | +} |
86 | 85 |
|
| 86 | +impl UniversalRegionRelations<'tcx> { |
87 | 87 | /// Records in the `outlives_relation` (and
|
88 | 88 | /// `inverse_outlives_relation`) that `fr_a: fr_b`. Invoked by the
|
89 | 89 | /// builder below.
|
@@ -212,7 +212,7 @@ struct UniversalRegionRelationsBuilder<'this, 'gcx: 'tcx, 'tcx: 'this> {
|
212 | 212 | }
|
213 | 213 |
|
214 | 214 | impl UniversalRegionRelationsBuilder<'cx, 'gcx, 'tcx> {
|
215 |
| - crate fn create(mut self) -> UniversalRegionRelations<'tcx> { |
| 215 | + crate fn create(mut self) -> Rc<UniversalRegionRelations<'tcx>> { |
216 | 216 | let unnormalized_input_output_tys = self
|
217 | 217 | .universal_regions
|
218 | 218 | .unnormalized_input_tys
|
@@ -277,7 +277,7 @@ impl UniversalRegionRelationsBuilder<'cx, 'gcx, 'tcx> {
|
277 | 277 | ).convert_all(&data);
|
278 | 278 | }
|
279 | 279 |
|
280 |
| - self.relations |
| 280 | + Rc::new(self.relations) |
281 | 281 | }
|
282 | 282 |
|
283 | 283 | /// Update the type of a single local, which should represent
|
|
0 commit comments