Skip to content

Commit 6f17b7f

Browse files
committed
Rename HAS_PROJECTIONS to HAS_ALIASES etc.
1 parent 5dbaafd commit 6f17b7f

File tree

12 files changed

+21
-17
lines changed

12 files changed

+21
-17
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
460460
where
461461
T: TypeVisitable<TyCtxt<'tcx>>,
462462
{
463-
t.has_free_regions() || t.has_projections() || t.has_infer_types()
463+
t.has_free_regions() || t.has_aliases() || t.has_infer_types()
464464
}
465465

466466
pub fn node_ty(&self, id: hir::HirId) -> Ty<'tcx> {

compiler/rustc_middle/src/ty/normalize_erasing_regions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'tcx> TyCtxt<'tcx> {
4949
let value = self.erase_regions(value);
5050
debug!(?value);
5151

52-
if !value.has_projections() {
52+
if !value.has_aliases() {
5353
value
5454
} else {
5555
value.fold_with(&mut NormalizeAfterErasingRegionsFolder { tcx: self, param_env })
@@ -81,7 +81,7 @@ impl<'tcx> TyCtxt<'tcx> {
8181
let value = self.erase_regions(value);
8282
debug!(?value);
8383

84-
if !value.has_projections() {
84+
if !value.has_aliases() {
8585
Ok(value)
8686
} else {
8787
let mut folder = TryNormalizeAfterErasingRegionsFolder::new(self, param_env);

compiler/rustc_mir_transform/src/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ fn try_instance_mir<'tcx>(
10771077
let fields = def.all_fields();
10781078
for field in fields {
10791079
let field_ty = field.ty(tcx, args);
1080-
if field_ty.has_param() && field_ty.has_projections() {
1080+
if field_ty.has_param() && field_ty.has_aliases() {
10811081
return Err("cannot build drop shim for polymorphic type");
10821082
}
10831083
}

compiler/rustc_trait_selection/src/solve/normalize.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for NormalizationFolder<'_, 'tcx> {
177177
fn try_fold_ty(&mut self, ty: Ty<'tcx>) -> Result<Ty<'tcx>, Self::Error> {
178178
let infcx = self.at.infcx;
179179
debug_assert_eq!(ty, infcx.shallow_resolve(ty));
180-
if !ty.has_projections() {
180+
if !ty.has_aliases() {
181181
return Ok(ty);
182182
}
183183

@@ -204,7 +204,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for NormalizationFolder<'_, 'tcx> {
204204
fn try_fold_const(&mut self, ct: ty::Const<'tcx>) -> Result<ty::Const<'tcx>, Self::Error> {
205205
let infcx = self.at.infcx;
206206
debug_assert_eq!(ct, infcx.shallow_resolve(ct));
207-
if !ct.has_projections() {
207+
if !ct.has_aliases() {
208208
return Ok(ct);
209209
}
210210

compiler/rustc_trait_selection/src/traits/fulfill.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
311311

312312
let infcx = self.selcx.infcx;
313313

314-
if obligation.predicate.has_projections() {
314+
if obligation.predicate.has_aliases() {
315315
let mut obligations = Vec::new();
316316
let predicate = normalize_with_depth_to(
317317
&mut self.selcx,

compiler/rustc_trait_selection/src/traits/normalize.rs

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ pub(super) fn needs_normalization<'tcx, T: TypeVisitable<TyCtxt<'tcx>>>(
101101
value: &T,
102102
reveal: Reveal,
103103
) -> bool {
104+
// This mirrors `ty::TypeFlags::HAS_ALIASES` except that we take `Reveal` into account.
105+
104106
let mut flags = ty::TypeFlags::HAS_TY_PROJECTION
105107
| ty::TypeFlags::HAS_TY_WEAK
106108
| ty::TypeFlags::HAS_TY_INHERENT

compiler/rustc_trait_selection/src/traits/project.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ pub(super) fn opt_normalize_projection_type<'a, 'b, 'tcx>(
432432

433433
let projected_term = selcx.infcx.resolve_vars_if_possible(projected_term);
434434

435-
let mut result = if projected_term.has_projections() {
435+
let mut result = if projected_term.has_aliases() {
436436
let normalized_ty = normalize_with_depth_to(
437437
selcx,
438438
param_env,
@@ -596,7 +596,7 @@ pub fn normalize_inherent_projection<'a, 'b, 'tcx>(
596596
let ty = tcx.type_of(alias_ty.def_id).instantiate(tcx, args);
597597

598598
let mut ty = selcx.infcx.resolve_vars_if_possible(ty);
599-
if ty.has_projections() {
599+
if ty.has_aliases() {
600600
ty = normalize_with_depth_to(selcx, param_env, cause.clone(), depth + 1, ty, obligations);
601601
}
602602

compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ where
1515
type QueryResponse = T;
1616

1717
fn try_fast_path(_tcx: TyCtxt<'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<T> {
18-
if !key.value.value.has_projections() { Some(key.value.value) } else { None }
18+
if !key.value.value.has_aliases() { Some(key.value.value) } else { None }
1919
}
2020

2121
fn perform_query(

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10661066
// so we will try to normalize the obligation and evaluate again.
10671067
// we will replace it with new solver in the future.
10681068
if EvaluationResult::EvaluatedToErr == result
1069-
&& fresh_trait_pred.has_projections()
1069+
&& fresh_trait_pred.has_aliases()
10701070
&& fresh_trait_pred.is_global()
10711071
{
10721072
let mut nested_obligations = Vec::new();

compiler/rustc_ty_utils/src/layout.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ fn layout_of_uncached<'tcx>(
239239

240240
// Arrays and slices.
241241
ty::Array(element, mut count) => {
242-
if count.has_projections() {
242+
if count.has_aliases() {
243243
count = tcx.normalize_erasing_regions(param_env, count);
244-
if count.has_projections() {
244+
if count.has_aliases() {
245245
return Err(error(cx, LayoutError::Unknown(ty)));
246246
}
247247
}

compiler/rustc_type_ir/src/flags.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ bitflags! {
7878
/// Does this have `ConstKind::Unevaluated`?
7979
const HAS_CT_PROJECTION = 1 << 14;
8080

81-
/// Could this type be normalized further?
82-
const HAS_PROJECTION = TypeFlags::HAS_TY_PROJECTION.bits()
81+
/// Does this have `Alias` or `ConstKind::Unevaluated`?
82+
///
83+
/// Rephrased, could this term be normalized further?
84+
const HAS_ALIASES = TypeFlags::HAS_TY_PROJECTION.bits()
8385
| TypeFlags::HAS_TY_WEAK.bits()
8486
| TypeFlags::HAS_TY_OPAQUE.bits()
8587
| TypeFlags::HAS_TY_INHERENT.bits()

compiler/rustc_type_ir/src/visit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ pub trait TypeVisitableExt<I: Interner>: TypeVisitable<I> {
223223
self.has_vars_bound_at_or_above(ty::INNERMOST)
224224
}
225225

226-
fn has_projections(&self) -> bool {
227-
self.has_type_flags(TypeFlags::HAS_PROJECTION)
226+
fn has_aliases(&self) -> bool {
227+
self.has_type_flags(TypeFlags::HAS_ALIASES)
228228
}
229229

230230
fn has_inherent_projections(&self) -> bool {

0 commit comments

Comments
 (0)