Skip to content

Commit d458f85

Browse files
ty::BrK -> ty::BoundRegionKind::K
1 parent 883f870 commit d458f85

File tree

37 files changed

+164
-139
lines changed

37 files changed

+164
-139
lines changed

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
189189
/// Returns `true` if a closure is inferred to be an `FnMut` closure.
190190
fn is_closure_fn_mut(&self, fr: RegionVid) -> bool {
191191
if let Some(ty::ReLateParam(late_param)) = self.to_error_region(fr).as_deref()
192-
&& let ty::BoundRegionKind::BrEnv = late_param.bound_region
192+
&& let ty::BoundRegionKind::ClosureEnv = late_param.bound_region
193193
&& let DefiningTy::Closure(_, args) = self.regioncx.universal_regions().defining_ty
194194
{
195195
return args.as_closure().kind() == ty::ClosureKind::FnMut;

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
301301
}
302302

303303
ty::ReLateParam(late_param) => match late_param.bound_region {
304-
ty::BoundRegionKind::BrNamed(region_def_id, name) => {
304+
ty::BoundRegionKind::Named(region_def_id, name) => {
305305
// Get the span to point to, even if we don't use the name.
306306
let span = tcx.hir().span_if_local(region_def_id).unwrap_or(DUMMY_SP);
307307
debug!(
@@ -332,7 +332,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
332332
}
333333
}
334334

335-
ty::BoundRegionKind::BrEnv => {
335+
ty::BoundRegionKind::ClosureEnv => {
336336
let def_ty = self.regioncx.universal_regions().defining_ty;
337337

338338
let closure_kind = match def_ty {
@@ -369,7 +369,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
369369
})
370370
}
371371

372-
ty::BoundRegionKind::BrAnon => None,
372+
ty::BoundRegionKind::Anon => None,
373373
},
374374

375375
ty::ReBound(..)

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,9 +1375,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
13751375

13761376
let region_ctxt_fn = || {
13771377
let reg_info = match br.kind {
1378-
ty::BoundRegionKind::BrAnon => sym::anon,
1379-
ty::BoundRegionKind::BrNamed(_, name) => name,
1380-
ty::BoundRegionKind::BrEnv => sym::env,
1378+
ty::BoundRegionKind::Anon => sym::anon,
1379+
ty::BoundRegionKind::Named(_, name) => name,
1380+
ty::BoundRegionKind::ClosureEnv => sym::env,
13811381
};
13821382

13831383
RegionCtxt::LateBound(reg_info)

compiler/rustc_borrowck/src/type_check/relate_tys.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ impl<'a, 'b, 'tcx> NllTypeRelating<'a, 'b, 'tcx> {
271271
.placeholder_region(self.type_checker.infcx, placeholder);
272272

273273
let reg_info = match placeholder.bound.kind {
274-
ty::BoundRegionKind::BrAnon => sym::anon,
275-
ty::BoundRegionKind::BrNamed(_, name) => name,
276-
ty::BoundRegionKind::BrEnv => sym::env,
274+
ty::BoundRegionKind::Anon => sym::anon,
275+
ty::BoundRegionKind::Named(_, name) => name,
276+
ty::BoundRegionKind::ClosureEnv => sym::env,
277277
};
278278

279279
if cfg!(debug_assertions) {

compiler/rustc_borrowck/src/universal_regions.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -696,14 +696,13 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
696696
let closure_sig = args.as_closure().sig();
697697
let inputs_and_output = closure_sig.inputs_and_output();
698698
let bound_vars = tcx.mk_bound_variable_kinds_from_iter(
699-
inputs_and_output
700-
.bound_vars()
701-
.iter()
702-
.chain(iter::once(ty::BoundVariableKind::Region(ty::BrEnv))),
699+
inputs_and_output.bound_vars().iter().chain(iter::once(
700+
ty::BoundVariableKind::Region(ty::BoundRegionKind::ClosureEnv),
701+
)),
703702
);
704703
let br = ty::BoundRegion {
705704
var: ty::BoundVar::from_usize(bound_vars.len() - 1),
706-
kind: ty::BrEnv,
705+
kind: ty::BoundRegionKind::ClosureEnv,
707706
};
708707
let env_region = ty::Region::new_bound(tcx, ty::INNERMOST, br);
709708
let closure_ty = tcx.closure_env_ty(
@@ -751,15 +750,13 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
751750
DefiningTy::CoroutineClosure(def_id, args) => {
752751
assert_eq!(self.mir_def.to_def_id(), def_id);
753752
let closure_sig = args.as_coroutine_closure().coroutine_closure_sig();
754-
let bound_vars = tcx.mk_bound_variable_kinds_from_iter(
755-
closure_sig
756-
.bound_vars()
757-
.iter()
758-
.chain(iter::once(ty::BoundVariableKind::Region(ty::BrEnv))),
759-
);
753+
let bound_vars =
754+
tcx.mk_bound_variable_kinds_from_iter(closure_sig.bound_vars().iter().chain(
755+
iter::once(ty::BoundVariableKind::Region(ty::BoundRegionKind::ClosureEnv)),
756+
));
760757
let br = ty::BoundRegion {
761758
var: ty::BoundVar::from_usize(bound_vars.len() - 1),
762-
kind: ty::BrEnv,
759+
kind: ty::BoundRegionKind::ClosureEnv,
763760
};
764761
let env_region = ty::Region::new_bound(tcx, ty::INNERMOST, br);
765762
let closure_kind = args.as_coroutine_closure().kind();

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,7 @@ fn param_env_with_gat_bounds<'tcx>(
22442244
.into()
22452245
}
22462246
GenericParamDefKind::Lifetime => {
2247-
let kind = ty::BoundRegionKind::BrNamed(param.def_id, param.name);
2247+
let kind = ty::BoundRegionKind::Named(param.def_id, param.name);
22482248
let bound_var = ty::BoundVariableKind::Region(kind);
22492249
bound_vars.push(bound_var);
22502250
ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {

compiler/rustc_hir_analysis/src/check/intrinsic.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,19 @@ pub fn check_intrinsic_type(
178178
let name_str = intrinsic_name.as_str();
179179

180180
let bound_vars = tcx.mk_bound_variable_kinds(&[
181-
ty::BoundVariableKind::Region(ty::BrAnon),
182-
ty::BoundVariableKind::Region(ty::BrAnon),
183-
ty::BoundVariableKind::Region(ty::BrEnv),
181+
ty::BoundVariableKind::Region(ty::BoundRegionKind::Anon),
182+
ty::BoundVariableKind::Region(ty::BoundRegionKind::Anon),
183+
ty::BoundVariableKind::Region(ty::BoundRegionKind::ClosureEnv),
184184
]);
185185
let mk_va_list_ty = |mutbl| {
186186
tcx.lang_items().va_list().map(|did| {
187187
let region = ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
188188
var: ty::BoundVar::ZERO,
189-
kind: ty::BrAnon,
189+
kind: ty::BoundRegionKind::Anon,
190190
});
191191
let env_region = ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
192192
var: ty::BoundVar::from_u32(2),
193-
kind: ty::BrEnv,
193+
kind: ty::BoundRegionKind::ClosureEnv,
194194
});
195195
let va_list_ty = tcx.type_of(did).instantiate(tcx, &[region.into()]);
196196
(Ty::new_ref(tcx, env_region, va_list_ty, mutbl), va_list_ty)
@@ -509,7 +509,8 @@ pub fn check_intrinsic_type(
509509
);
510510
let discriminant_def_id = assoc_items[0];
511511

512-
let br = ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BrAnon };
512+
let br =
513+
ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BoundRegionKind::Anon };
513514
(
514515
1,
515516
0,
@@ -573,10 +574,14 @@ pub fn check_intrinsic_type(
573574
}
574575

575576
sym::raw_eq => {
576-
let br = ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BrAnon };
577+
let br =
578+
ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BoundRegionKind::Anon };
577579
let param_ty_lhs =
578580
Ty::new_imm_ref(tcx, ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0));
579-
let br = ty::BoundRegion { var: ty::BoundVar::from_u32(1), kind: ty::BrAnon };
581+
let br = ty::BoundRegion {
582+
var: ty::BoundVar::from_u32(1),
583+
kind: ty::BoundRegionKind::Anon,
584+
};
580585
let param_ty_rhs =
581586
Ty::new_imm_ref(tcx, ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0));
582587
(1, 0, vec![param_ty_lhs, param_ty_rhs], tcx.types.bool)

compiler/rustc_hir_analysis/src/collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ fn get_new_lifetime_name<'tcx>(
634634
.collect_referenced_late_bound_regions(poly_trait_ref)
635635
.into_iter()
636636
.filter_map(|lt| {
637-
if let ty::BoundRegionKind::BrNamed(_, name) = lt {
637+
if let ty::BoundRegionKind::Named(_, name) = lt {
638638
Some(name.as_str().to_string())
639639
} else {
640640
None

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ fn late_arg_as_bound_arg<'tcx>(
322322
let name = tcx.item_name(def_id);
323323
match param.kind {
324324
GenericParamKind::Lifetime { .. } => {
325-
ty::BoundVariableKind::Region(ty::BrNamed(def_id, name))
325+
ty::BoundVariableKind::Region(ty::BoundRegionKind::Named(def_id, name))
326326
}
327327
GenericParamKind::Type { .. } => {
328328
ty::BoundVariableKind::Ty(ty::BoundTyKind::Param(def_id, name))
@@ -337,7 +337,7 @@ fn late_arg_as_bound_arg<'tcx>(
337337
fn generic_param_def_as_bound_arg(param: &ty::GenericParamDef) -> ty::BoundVariableKind {
338338
match param.kind {
339339
ty::GenericParamDefKind::Lifetime => {
340-
ty::BoundVariableKind::Region(ty::BoundRegionKind::BrNamed(param.def_id, param.name))
340+
ty::BoundVariableKind::Region(ty::BoundRegionKind::Named(param.def_id, param.name))
341341
}
342342
ty::GenericParamDefKind::Type { .. } => {
343343
ty::BoundVariableKind::Ty(ty::BoundTyKind::Param(param.def_id, param.name))

compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
644644
ty::GenericParamDefKind::Lifetime => {
645645
ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
646646
var: ty::BoundVar::from_usize(num_bound_vars),
647-
kind: ty::BoundRegionKind::BrNamed(param.def_id, param.name),
647+
kind: ty::BoundRegionKind::Named(param.def_id, param.name),
648648
})
649649
.into()
650650
}
@@ -830,8 +830,8 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for GenericParamAndBoundVarCollector<'_, 't
830830
}
831831
ty::ReBound(db, br) if db >= self.depth => {
832832
self.vars.insert(match br.kind {
833-
ty::BrNamed(def_id, name) => (def_id, name),
834-
ty::BrAnon | ty::BrEnv => {
833+
ty::BoundRegionKind::Named(def_id, name) => (def_id, name),
834+
ty::BoundRegionKind::Anon | ty::BoundRegionKind::ClosureEnv => {
835835
let guar = self
836836
.cx
837837
.dcx()

0 commit comments

Comments
 (0)