@@ -8,7 +8,7 @@ use rustc_infer::infer::outlives::env::RegionBoundPairs;
8
8
use rustc_infer:: infer:: { InferCtxt , NllRegionVariableOrigin , OpaqueTypeStorageEntries } ;
9
9
use rustc_infer:: traits:: ObligationCause ;
10
10
use rustc_macros:: extension;
11
- use rustc_middle:: mir:: { Body , ConstraintCategory , HiddenTypes } ;
11
+ use rustc_middle:: mir:: { Body , ConstraintCategory , DefinitionSiteHiddenTypes } ;
12
12
use rustc_middle:: ty:: {
13
13
self , DefiningScopeKind , EarlyBinder , FallibleTypeFolder , GenericArg , GenericArgsRef ,
14
14
OpaqueHiddenType , OpaqueTypeKey , Region , RegionVid , Ty , TyCtxt , TypeFoldable ,
@@ -131,7 +131,7 @@ fn nll_var_to_universal_region<'tcx>(
131
131
/// and errors if we end up with distinct hidden types.
132
132
fn add_hidden_type < ' tcx > (
133
133
tcx : TyCtxt < ' tcx > ,
134
- hidden_types : & mut HiddenTypes < ' tcx > ,
134
+ hidden_types : & mut DefinitionSiteHiddenTypes < ' tcx > ,
135
135
def_id : LocalDefId ,
136
136
hidden_ty : OpaqueHiddenType < ' tcx > ,
137
137
) {
@@ -156,7 +156,7 @@ fn add_hidden_type<'tcx>(
156
156
}
157
157
158
158
fn get_hidden_type < ' tcx > (
159
- hidden_types : & HiddenTypes < ' tcx > ,
159
+ hidden_types : & DefinitionSiteHiddenTypes < ' tcx > ,
160
160
def_id : LocalDefId ,
161
161
) -> Option < EarlyBinder < ' tcx , OpaqueHiddenType < ' tcx > > > {
162
162
hidden_types. 0 . get ( & def_id) . map ( |ty| EarlyBinder :: bind ( * ty) )
@@ -183,12 +183,12 @@ struct DefiningUse<'tcx> {
183
183
///
184
184
/// It also means that this whole function is not really soundness critical as we
185
185
/// recheck all uses of the opaques regardless.
186
- pub ( crate ) fn compute_hidden_types < ' tcx > (
186
+ pub ( crate ) fn compute_definition_site_hidden_types < ' tcx > (
187
187
infcx : & BorrowckInferCtxt < ' tcx > ,
188
188
universal_region_relations : & Frozen < UniversalRegionRelations < ' tcx > > ,
189
189
constraints : & MirTypeckRegionConstraints < ' tcx > ,
190
190
location_map : Rc < DenseLocationMap > ,
191
- hidden_types : & mut HiddenTypes < ' tcx > ,
191
+ hidden_types : & mut DefinitionSiteHiddenTypes < ' tcx > ,
192
192
opaque_types : & [ ( OpaqueTypeKey < ' tcx > , OpaqueHiddenType < ' tcx > ) ] ,
193
193
) -> Vec < DeferredOpaqueTypeError < ' tcx > > {
194
194
let mut errors = Vec :: new ( ) ;
@@ -211,14 +211,14 @@ pub(crate) fn compute_hidden_types<'tcx>(
211
211
// After applying member constraints, we now check whether all member regions ended
212
212
// up equal to one of their choice regions and compute the actual hidden type of
213
213
// the opaque type definition. This is stored in the `root_cx`.
214
- compute_hidden_types_from_defining_uses ( & rcx, hidden_types, & defining_uses, & mut errors) ;
214
+ compute_definition_site_hidden_types_from_defining_uses ( & rcx, hidden_types, & defining_uses, & mut errors) ;
215
215
errors
216
216
}
217
217
218
218
#[ instrument( level = "debug" , skip_all, ret) ]
219
219
fn collect_defining_uses < ' tcx > (
220
220
rcx : & mut RegionCtxt < ' _ , ' tcx > ,
221
- hidden_types : & mut HiddenTypes < ' tcx > ,
221
+ hidden_types : & mut DefinitionSiteHiddenTypes < ' tcx > ,
222
222
opaque_types : & [ ( OpaqueTypeKey < ' tcx > , OpaqueHiddenType < ' tcx > ) ] ,
223
223
errors : & mut Vec < DeferredOpaqueTypeError < ' tcx > > ,
224
224
) -> Vec < DefiningUse < ' tcx > > {
@@ -271,9 +271,9 @@ fn collect_defining_uses<'tcx>(
271
271
defining_uses
272
272
}
273
273
274
- fn compute_hidden_types_from_defining_uses < ' tcx > (
274
+ fn compute_definition_site_hidden_types_from_defining_uses < ' tcx > (
275
275
rcx : & RegionCtxt < ' _ , ' tcx > ,
276
- hidden_types : & mut HiddenTypes < ' tcx > ,
276
+ hidden_types : & mut DefinitionSiteHiddenTypes < ' tcx > ,
277
277
defining_uses : & [ DefiningUse < ' tcx > ] ,
278
278
errors : & mut Vec < DeferredOpaqueTypeError < ' tcx > > ,
279
279
) {
@@ -483,14 +483,14 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for ToArgRegionsFolder<'_, 'tcx> {
483
483
///
484
484
/// It does this by equating the hidden type of each use with the instantiated final
485
485
/// hidden type of the opaque.
486
- pub ( crate ) fn apply_hidden_types < ' tcx > (
486
+ pub ( crate ) fn apply_definition_site_hidden_types < ' tcx > (
487
487
infcx : & BorrowckInferCtxt < ' tcx > ,
488
488
body : & Body < ' tcx > ,
489
489
universal_regions : & UniversalRegions < ' tcx > ,
490
490
region_bound_pairs : & RegionBoundPairs < ' tcx > ,
491
491
known_type_outlives_obligations : & [ ty:: PolyTypeOutlivesPredicate < ' tcx > ] ,
492
492
constraints : & mut MirTypeckRegionConstraints < ' tcx > ,
493
- hidden_types : & mut HiddenTypes < ' tcx > ,
493
+ hidden_types : & mut DefinitionSiteHiddenTypes < ' tcx > ,
494
494
opaque_types : & [ ( OpaqueTypeKey < ' tcx > , OpaqueHiddenType < ' tcx > ) ] ,
495
495
) -> Vec < DeferredOpaqueTypeError < ' tcx > > {
496
496
let tcx = infcx. tcx ;
@@ -561,7 +561,7 @@ pub(crate) fn apply_hidden_types<'tcx>(
561
561
errors
562
562
}
563
563
564
- /// In theory `apply_hidden_types ` could introduce new uses of opaque types.
564
+ /// In theory `apply_definition_site_hidden_types ` could introduce new uses of opaque types.
565
565
/// We do not check these new uses so this could be unsound.
566
566
///
567
567
/// We detect any new uses and simply delay a bug if they occur. If this results in
0 commit comments