@@ -8,7 +8,7 @@ use rustc_infer::infer::outlives::env::RegionBoundPairs;
88use  rustc_infer:: infer:: { InferCtxt ,  NllRegionVariableOrigin ,  OpaqueTypeStorageEntries } ; 
99use  rustc_infer:: traits:: ObligationCause ; 
1010use  rustc_macros:: extension; 
11- use  rustc_middle:: mir:: { Body ,  ConstraintCategory ,  HiddenTypes } ; 
11+ use  rustc_middle:: mir:: { Body ,  ConstraintCategory ,  DefinitionSiteHiddenTypes } ; 
1212use  rustc_middle:: ty:: { 
1313    self ,  DefiningScopeKind ,  EarlyBinder ,  FallibleTypeFolder ,  GenericArg ,  GenericArgsRef , 
1414    OpaqueHiddenType ,  OpaqueTypeKey ,  Region ,  RegionVid ,  Ty ,  TyCtxt ,  TypeFoldable , 
@@ -131,7 +131,7 @@ fn nll_var_to_universal_region<'tcx>(
131131/// and errors if we end up with distinct hidden types. 
132132fn  add_hidden_type < ' tcx > ( 
133133    tcx :  TyCtxt < ' tcx > , 
134-     hidden_types :  & mut  HiddenTypes < ' tcx > , 
134+     hidden_types :  & mut  DefinitionSiteHiddenTypes < ' tcx > , 
135135    def_id :  LocalDefId , 
136136    hidden_ty :  OpaqueHiddenType < ' tcx > , 
137137)  { 
@@ -156,7 +156,7 @@ fn add_hidden_type<'tcx>(
156156} 
157157
158158fn  get_hidden_type < ' tcx > ( 
159-     hidden_types :  & HiddenTypes < ' tcx > , 
159+     hidden_types :  & DefinitionSiteHiddenTypes < ' tcx > , 
160160    def_id :  LocalDefId , 
161161)  -> Option < EarlyBinder < ' tcx ,  OpaqueHiddenType < ' tcx > > >  { 
162162    hidden_types. 0 . get ( & def_id) . map ( |ty| EarlyBinder :: bind ( * ty) ) 
@@ -183,12 +183,12 @@ struct DefiningUse<'tcx> {
183183/// 
184184/// It also means that this whole function is not really soundness critical as we 
185185/// 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 > ( 
187187    infcx :  & BorrowckInferCtxt < ' tcx > , 
188188    universal_region_relations :  & Frozen < UniversalRegionRelations < ' tcx > > , 
189189    constraints :  & MirTypeckRegionConstraints < ' tcx > , 
190190    location_map :  Rc < DenseLocationMap > , 
191-     hidden_types :  & mut  HiddenTypes < ' tcx > , 
191+     hidden_types :  & mut  DefinitionSiteHiddenTypes < ' tcx > , 
192192    opaque_types :  & [ ( OpaqueTypeKey < ' tcx > ,  OpaqueHiddenType < ' tcx > ) ] , 
193193)  -> Vec < DeferredOpaqueTypeError < ' tcx > >  { 
194194    let  mut  errors = Vec :: new ( ) ; 
@@ -211,14 +211,19 @@ pub(crate) fn compute_hidden_types<'tcx>(
211211    // After applying member constraints, we now check whether all member regions ended 
212212    // up equal to one of their choice regions and compute the actual hidden type of 
213213    // 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 ( 
215+         & rcx, 
216+         hidden_types, 
217+         & defining_uses, 
218+         & mut  errors, 
219+     ) ; 
215220    errors
216221} 
217222
218223#[ instrument( level = "debug" ,  skip_all,  ret) ]  
219224fn  collect_defining_uses < ' tcx > ( 
220225    rcx :  & mut  RegionCtxt < ' _ ,  ' tcx > , 
221-     hidden_types :  & mut  HiddenTypes < ' tcx > , 
226+     hidden_types :  & mut  DefinitionSiteHiddenTypes < ' tcx > , 
222227    opaque_types :  & [ ( OpaqueTypeKey < ' tcx > ,  OpaqueHiddenType < ' tcx > ) ] , 
223228    errors :  & mut  Vec < DeferredOpaqueTypeError < ' tcx > > , 
224229)  -> Vec < DefiningUse < ' tcx > >  { 
@@ -271,9 +276,9 @@ fn collect_defining_uses<'tcx>(
271276    defining_uses
272277} 
273278
274- fn  compute_hidden_types_from_defining_uses < ' tcx > ( 
279+ fn  compute_definition_site_hidden_types_from_defining_uses < ' tcx > ( 
275280    rcx :  & RegionCtxt < ' _ ,  ' tcx > , 
276-     hidden_types :  & mut  HiddenTypes < ' tcx > , 
281+     hidden_types :  & mut  DefinitionSiteHiddenTypes < ' tcx > , 
277282    defining_uses :  & [ DefiningUse < ' tcx > ] , 
278283    errors :  & mut  Vec < DeferredOpaqueTypeError < ' tcx > > , 
279284)  { 
@@ -483,14 +488,14 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for ToArgRegionsFolder<'_, 'tcx> {
483488/// 
484489/// It does this by equating the hidden type of each use with the instantiated final 
485490/// hidden type of the opaque. 
486- pub ( crate )  fn  apply_hidden_types < ' tcx > ( 
491+ pub ( crate )  fn  apply_definition_site_hidden_types < ' tcx > ( 
487492    infcx :  & BorrowckInferCtxt < ' tcx > , 
488493    body :  & Body < ' tcx > , 
489494    universal_regions :  & UniversalRegions < ' tcx > , 
490495    region_bound_pairs :  & RegionBoundPairs < ' tcx > , 
491496    known_type_outlives_obligations :  & [ ty:: PolyTypeOutlivesPredicate < ' tcx > ] , 
492497    constraints :  & mut  MirTypeckRegionConstraints < ' tcx > , 
493-     hidden_types :  & mut  HiddenTypes < ' tcx > , 
498+     hidden_types :  & mut  DefinitionSiteHiddenTypes < ' tcx > , 
494499    opaque_types :  & [ ( OpaqueTypeKey < ' tcx > ,  OpaqueHiddenType < ' tcx > ) ] , 
495500)  -> Vec < DeferredOpaqueTypeError < ' tcx > >  { 
496501    let  tcx = infcx. tcx ; 
@@ -561,7 +566,7 @@ pub(crate) fn apply_hidden_types<'tcx>(
561566    errors
562567} 
563568
564- /// In theory `apply_hidden_types ` could introduce new uses of opaque types. 
569+ /// In theory `apply_definition_site_hidden_types ` could introduce new uses of opaque types. 
565570/// We do not check these new uses so this could be unsound. 
566571/// 
567572/// We detect any new uses and simply delay a bug if they occur. If this results in 
0 commit comments