Skip to content

Commit d46b555

Browse files
Merge #3132
3132: Rename Ty::Param => Ty::Placeholder r=matklad a=flodiebold This aligns more with Chalk. Co-authored-by: Florian Diebold <[email protected]>
2 parents a19f52f + a324d06 commit d46b555

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

crates/ra_hir_ty/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ pub enum Ty {
291291
/// {}` when we're type-checking the body of that function. In this
292292
/// situation, we know this stands for *some* type, but don't know the exact
293293
/// type.
294-
Param(TypeParamId),
294+
Placeholder(TypeParamId),
295295

296296
/// A bound type variable. This is used in various places: when representing
297297
/// some polymorphic type like the type of function `fn f<T>`, the type
@@ -365,7 +365,7 @@ impl Substs {
365365

366366
/// Return Substs that replace each parameter by itself (i.e. `Ty::Param`).
367367
pub(crate) fn type_params_for_generics(generic_params: &Generics) -> Substs {
368-
Substs(generic_params.iter().map(|(id, _)| Ty::Param(id)).collect())
368+
Substs(generic_params.iter().map(|(id, _)| Ty::Placeholder(id)).collect())
369369
}
370370

371371
/// Return Substs that replace each parameter by itself (i.e. `Ty::Param`).
@@ -813,7 +813,7 @@ impl TypeWalk for Ty {
813813
p.walk(f);
814814
}
815815
}
816-
Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {}
816+
Ty::Placeholder { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {}
817817
}
818818
f(self);
819819
}
@@ -831,7 +831,7 @@ impl TypeWalk for Ty {
831831
p.walk_mut_binders(f, binders + 1);
832832
}
833833
}
834-
Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {}
834+
Ty::Placeholder { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {}
835835
}
836836
f(self, binders);
837837
}
@@ -1032,7 +1032,7 @@ impl HirDisplay for Ty {
10321032
match self {
10331033
Ty::Apply(a_ty) => a_ty.hir_fmt(f)?,
10341034
Ty::Projection(p_ty) => p_ty.hir_fmt(f)?,
1035-
Ty::Param(id) => {
1035+
Ty::Placeholder(id) => {
10361036
let generics = generics(f.db, id.parent);
10371037
let param_data = &generics.params.types[id.local_id];
10381038
match param_data.provenance {

crates/ra_hir_ty/src/lower.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl Ty {
152152
data.provenance == TypeParamProvenance::ArgumentImplTrait
153153
})
154154
.nth(idx as usize)
155-
.map_or(Ty::Unknown, |(id, _)| Ty::Param(id));
155+
.map_or(Ty::Unknown, |(id, _)| Ty::Placeholder(id));
156156
param
157157
} else {
158158
Ty::Unknown
@@ -270,7 +270,7 @@ impl Ty {
270270
let generics =
271271
generics(ctx.db, ctx.resolver.generic_def().expect("generics in scope"));
272272
match ctx.type_param_mode {
273-
TypeParamLoweringMode::Placeholder => Ty::Param(param_id),
273+
TypeParamLoweringMode::Placeholder => Ty::Placeholder(param_id),
274274
TypeParamLoweringMode::Variable => {
275275
let idx = generics.param_idx(param_id).expect("matching generics");
276276
Ty::Bound(idx)
@@ -339,7 +339,7 @@ impl Ty {
339339
None => return Ty::Unknown, // this can't actually happen
340340
};
341341
let param_id = match self_ty {
342-
Ty::Param(id) if ctx.type_param_mode == TypeParamLoweringMode::Placeholder => id,
342+
Ty::Placeholder(id) if ctx.type_param_mode == TypeParamLoweringMode::Placeholder => id,
343343
Ty::Bound(idx) if ctx.type_param_mode == TypeParamLoweringMode::Variable => {
344344
let generics = generics(ctx.db, def);
345345
let param_id = if let Some((id, _)) = generics.iter().nth(idx as usize) {
@@ -544,7 +544,7 @@ impl GenericPredicate {
544544
let generics = generics(ctx.db, generic_def);
545545
let param_id = hir_def::TypeParamId { parent: generic_def, local_id: *param_id };
546546
match ctx.type_param_mode {
547-
TypeParamLoweringMode::Placeholder => Ty::Param(param_id),
547+
TypeParamLoweringMode::Placeholder => Ty::Placeholder(param_id),
548548
TypeParamLoweringMode::Variable => {
549549
let idx = generics.param_idx(param_id).expect("matching generics");
550550
Ty::Bound(idx)

crates/ra_hir_ty/src/traits/chalk.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl ToChalk for Ty {
142142
let substitution = proj_ty.parameters.to_chalk(db);
143143
chalk_ir::AliasTy { associated_ty_id, substitution }.cast().intern()
144144
}
145-
Ty::Param(id) => {
145+
Ty::Placeholder(id) => {
146146
let interned_id = db.intern_type_param_id(id);
147147
PlaceholderIndex {
148148
ui: UniverseIndex::ROOT,
@@ -184,7 +184,7 @@ impl ToChalk for Ty {
184184
let interned_id = crate::db::GlobalTypeParamId::from_intern_id(
185185
crate::salsa::InternId::from(idx.idx),
186186
);
187-
Ty::Param(db.lookup_intern_type_param_id(interned_id))
187+
Ty::Placeholder(db.lookup_intern_type_param_id(interned_id))
188188
}
189189
chalk_ir::TyData::Alias(proj) => {
190190
let associated_ty = from_chalk(db, proj.associated_ty_id);

0 commit comments

Comments
 (0)