Skip to content

Commit 8935a1b

Browse files
committed
update type flags
- `HAS_RE_LATE_BOUND` -> `HAS_RE_BOUND` - `HAS_TY_LATE_BOUND` -> `HAS_TY_BOUND` - `HAS_CT_LATE_BOUND` -> `HAS_CT_BOUND` - `HAS_LATE_BOUND` -> `HAS_BOUND_VARS` - `fn has_late_bound_regions` -> `fn has_bound_regions` - `fnhas_non_region_late_bound` -> `fn has_non_region_bound_vars` - `fn has_late_bound_vars` -> `fn has_bound_vars`
1 parent dd0739a commit 8935a1b

File tree

11 files changed

+25
-25
lines changed

11 files changed

+25
-25
lines changed

compiler/rustc_hir_typeck/src/method/probe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
801801
// a `&self` method will wind up with an argument type like `&dyn Trait`.
802802
let trait_ref = principal.with_self_ty(self.tcx, self_ty);
803803
self.elaborate_bounds(iter::once(trait_ref), |this, new_trait_ref, item| {
804-
if new_trait_ref.has_non_region_late_bound() {
804+
if new_trait_ref.has_non_region_bound_vars() {
805805
this.tcx.sess.delay_span_bug(
806806
this.span,
807807
"tried to select method from HRTB with non-lifetime bound vars",

compiler/rustc_middle/src/ty/flags.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl FlagComputation {
137137

138138
&ty::Bound(debruijn, _) => {
139139
self.add_bound_var(debruijn);
140-
self.add_flags(TypeFlags::HAS_TY_LATE_BOUND);
140+
self.add_flags(TypeFlags::HAS_TY_BOUND);
141141
}
142142

143143
&ty::Placeholder(..) => {
@@ -317,7 +317,7 @@ impl FlagComputation {
317317
}
318318
ty::ConstKind::Bound(debruijn, _) => {
319319
self.add_bound_var(debruijn);
320-
self.add_flags(TypeFlags::HAS_CT_LATE_BOUND);
320+
self.add_flags(TypeFlags::HAS_CT_BOUND);
321321
}
322322
ty::ConstKind::Param(_) => {
323323
self.add_flags(TypeFlags::HAS_CT_PARAM);

compiler/rustc_middle/src/ty/sty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,7 @@ impl<'tcx> Region<'tcx> {
18151815
flags = flags | TypeFlags::HAS_FREE_REGIONS;
18161816
}
18171817
ty::ReBound(..) => {
1818-
flags = flags | TypeFlags::HAS_RE_LATE_BOUND;
1818+
flags = flags | TypeFlags::HAS_RE_BOUND;
18191819
}
18201820
ty::ReErased => {
18211821
flags = flags | TypeFlags::HAS_RE_ERASED;

compiler/rustc_middle/src/ty/visit.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,16 @@ pub trait TypeVisitableExt<'tcx>: TypeVisitable<TyCtxt<'tcx>> {
111111
}
112112

113113
/// True if there are any late-bound regions
114-
fn has_late_bound_regions(&self) -> bool {
115-
self.has_type_flags(TypeFlags::HAS_RE_LATE_BOUND)
114+
fn has_bound_regions(&self) -> bool {
115+
self.has_type_flags(TypeFlags::HAS_RE_BOUND)
116116
}
117117
/// True if there are any late-bound non-region variables
118-
fn has_non_region_late_bound(&self) -> bool {
119-
self.has_type_flags(TypeFlags::HAS_LATE_BOUND - TypeFlags::HAS_RE_LATE_BOUND)
118+
fn has_non_region_bound_vars(&self) -> bool {
119+
self.has_type_flags(TypeFlags::HAS_BOUND_VARS - TypeFlags::HAS_RE_BOUND)
120120
}
121-
/// True if there are any late-bound variables
122-
fn has_late_bound_vars(&self) -> bool {
123-
self.has_type_flags(TypeFlags::HAS_LATE_BOUND)
121+
/// True if there are any bound variables
122+
fn has_bound_vars(&self) -> bool {
123+
self.has_type_flags(TypeFlags::HAS_BOUND_VARS)
124124
}
125125

126126
/// Indicates whether this value still has parameters/placeholders/inference variables

compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub(in crate::solve) fn replace_erased_lifetimes_with_bound_vars<'tcx>(
9191
tcx: TyCtxt<'tcx>,
9292
ty: Ty<'tcx>,
9393
) -> ty::Binder<'tcx, Ty<'tcx>> {
94-
debug_assert!(!ty.has_late_bound_regions());
94+
debug_assert!(!ty.has_bound_regions());
9595
let mut counter = 0;
9696
let ty = tcx.fold_regions(ty, |r, current_depth| match r.kind() {
9797
ty::ReErased => {

compiler/rustc_trait_selection/src/traits/object_safety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn super_predicates_have_non_lifetime_binders(
329329
tcx.super_predicates_of(trait_def_id)
330330
.predicates
331331
.iter()
332-
.filter_map(|(pred, span)| pred.has_non_region_late_bound().then_some(*span))
332+
.filter_map(|(pred, span)| pred.has_non_region_bound_vars().then_some(*span))
333333
.collect()
334334
}
335335

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
12771277
let tcx = self.tcx();
12781278
stack.extend(tcx.coroutine_hidden_types(def_id).map(|bty| {
12791279
let ty = bty.instantiate(tcx, args);
1280-
debug_assert!(!ty.has_late_bound_regions());
1280+
debug_assert!(!ty.has_bound_regions());
12811281
ty
12821282
}))
12831283
}

compiler/rustc_trait_selection/src/traits/select/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
799799
// A global type with no free lifetimes or generic parameters
800800
// outlives anything.
801801
if pred.0.has_free_regions()
802-
|| pred.0.has_late_bound_regions()
802+
|| pred.0.has_bound_regions()
803803
|| pred.0.has_non_region_infer()
804804
|| pred.0.has_non_region_infer()
805805
{
@@ -1841,7 +1841,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
18411841
// the param_env so that it can be given the lowest priority. See
18421842
// #50825 for the motivation for this.
18431843
let is_global =
1844-
|cand: &ty::PolyTraitPredicate<'tcx>| cand.is_global() && !cand.has_late_bound_vars();
1844+
|cand: &ty::PolyTraitPredicate<'tcx>| cand.is_global() && !cand.has_bound_vars();
18451845

18461846
// (*) Prefer `BuiltinCandidate { has_nested: false }`, `PointeeCandidate`,
18471847
// `DiscriminantKindCandidate`, `ConstDestructCandidate`

compiler/rustc_type_ir/src/flags.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ bitflags! {
8989
const HAS_FREE_REGIONS = 1 << 15;
9090

9191
/// Does this have any `ReBound` regions?
92-
const HAS_RE_LATE_BOUND = 1 << 16;
92+
const HAS_RE_BOUND = 1 << 16;
9393
/// Does this have any `Bound` types?
94-
const HAS_TY_LATE_BOUND = 1 << 17;
94+
const HAS_TY_BOUND = 1 << 17;
9595
/// Does this have any `ConstKind::Bound` consts?
96-
const HAS_CT_LATE_BOUND = 1 << 18;
96+
const HAS_CT_BOUND = 1 << 18;
9797
/// Does this have any bound variables?
9898
/// Used to check if a global bound is safe to evaluate.
99-
const HAS_LATE_BOUND = TypeFlags::HAS_RE_LATE_BOUND.bits
100-
| TypeFlags::HAS_TY_LATE_BOUND.bits
101-
| TypeFlags::HAS_CT_LATE_BOUND.bits;
99+
const HAS_BOUND_VARS = TypeFlags::HAS_RE_BOUND.bits
100+
| TypeFlags::HAS_TY_BOUND.bits
101+
| TypeFlags::HAS_CT_BOUND.bits;
102102

103103
/// Does this have any `ReErased` regions?
104104
const HAS_RE_ERASED = 1 << 19;

src/tools/clippy/clippy_lints/src/eta_reduction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ fn has_late_bound_to_non_late_bound_regions(from_sig: FnSig<'_>, to_sig: FnSig<'
290290
.zip(to_tys)
291291
.any(|(from_ty, to_ty)| check_ty(from_ty, to_ty))
292292
},
293-
_ => from_ty.has_late_bound_regions(),
293+
_ => from_ty.has_bound_regions(),
294294
}
295295
}
296296

src/tools/clippy/clippy_utils/src/ty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ pub fn make_normalized_projection<'tcx>(
11601160
) -> Option<Ty<'tcx>> {
11611161
fn helper<'tcx>(tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: AliasTy<'tcx>) -> Option<Ty<'tcx>> {
11621162
#[cfg(debug_assertions)]
1163-
if let Some((i, arg)) = ty.args.iter().enumerate().find(|(_, arg)| arg.has_late_bound_regions()) {
1163+
if let Some((i, arg)) = ty.args.iter().enumerate().find(|(_, arg)| arg.has_bound_regions()) {
11641164
debug_assert!(
11651165
false,
11661166
"args contain late-bound region at index `{i}` which can't be normalized.\n\
@@ -1233,7 +1233,7 @@ pub fn make_normalized_projection_with_regions<'tcx>(
12331233
) -> Option<Ty<'tcx>> {
12341234
fn helper<'tcx>(tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: AliasTy<'tcx>) -> Option<Ty<'tcx>> {
12351235
#[cfg(debug_assertions)]
1236-
if let Some((i, arg)) = ty.args.iter().enumerate().find(|(_, arg)| arg.has_late_bound_regions()) {
1236+
if let Some((i, arg)) = ty.args.iter().enumerate().find(|(_, arg)| arg.has_bound_regions()) {
12371237
debug_assert!(
12381238
false,
12391239
"args contain late-bound region at index `{i}` which can't be normalized.\n\

0 commit comments

Comments
 (0)