Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions crates/ra_hir_ty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ pub enum Ty {
/// {}` when we're type-checking the body of that function. In this
/// situation, we know this stands for *some* type, but don't know the exact
/// type.
Param(TypeParamId),
Placeholder(TypeParamId),

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

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

/// Return Substs that replace each parameter by itself (i.e. `Ty::Param`).
Expand Down Expand Up @@ -813,7 +813,7 @@ impl TypeWalk for Ty {
p.walk(f);
}
}
Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {}
Ty::Placeholder { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {}
}
f(self);
}
Expand All @@ -831,7 +831,7 @@ impl TypeWalk for Ty {
p.walk_mut_binders(f, binders + 1);
}
}
Ty::Param { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {}
Ty::Placeholder { .. } | Ty::Bound(_) | Ty::Infer(_) | Ty::Unknown => {}
}
f(self, binders);
}
Expand Down Expand Up @@ -1032,7 +1032,7 @@ impl HirDisplay for Ty {
match self {
Ty::Apply(a_ty) => a_ty.hir_fmt(f)?,
Ty::Projection(p_ty) => p_ty.hir_fmt(f)?,
Ty::Param(id) => {
Ty::Placeholder(id) => {
let generics = generics(f.db, id.parent);
let param_data = &generics.params.types[id.local_id];
match param_data.provenance {
Expand Down
8 changes: 4 additions & 4 deletions crates/ra_hir_ty/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl Ty {
data.provenance == TypeParamProvenance::ArgumentImplTrait
})
.nth(idx as usize)
.map_or(Ty::Unknown, |(id, _)| Ty::Param(id));
.map_or(Ty::Unknown, |(id, _)| Ty::Placeholder(id));
param
} else {
Ty::Unknown
Expand Down Expand Up @@ -270,7 +270,7 @@ impl Ty {
let generics =
generics(ctx.db, ctx.resolver.generic_def().expect("generics in scope"));
match ctx.type_param_mode {
TypeParamLoweringMode::Placeholder => Ty::Param(param_id),
TypeParamLoweringMode::Placeholder => Ty::Placeholder(param_id),
TypeParamLoweringMode::Variable => {
let idx = generics.param_idx(param_id).expect("matching generics");
Ty::Bound(idx)
Expand Down Expand Up @@ -339,7 +339,7 @@ impl Ty {
None => return Ty::Unknown, // this can't actually happen
};
let param_id = match self_ty {
Ty::Param(id) if ctx.type_param_mode == TypeParamLoweringMode::Placeholder => id,
Ty::Placeholder(id) if ctx.type_param_mode == TypeParamLoweringMode::Placeholder => id,
Ty::Bound(idx) if ctx.type_param_mode == TypeParamLoweringMode::Variable => {
let generics = generics(ctx.db, def);
let param_id = if let Some((id, _)) = generics.iter().nth(idx as usize) {
Expand Down Expand Up @@ -544,7 +544,7 @@ impl GenericPredicate {
let generics = generics(ctx.db, generic_def);
let param_id = hir_def::TypeParamId { parent: generic_def, local_id: *param_id };
match ctx.type_param_mode {
TypeParamLoweringMode::Placeholder => Ty::Param(param_id),
TypeParamLoweringMode::Placeholder => Ty::Placeholder(param_id),
TypeParamLoweringMode::Variable => {
let idx = generics.param_idx(param_id).expect("matching generics");
Ty::Bound(idx)
Expand Down
4 changes: 2 additions & 2 deletions crates/ra_hir_ty/src/traits/chalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl ToChalk for Ty {
let substitution = proj_ty.parameters.to_chalk(db);
chalk_ir::AliasTy { associated_ty_id, substitution }.cast().intern()
}
Ty::Param(id) => {
Ty::Placeholder(id) => {
let interned_id = db.intern_type_param_id(id);
PlaceholderIndex {
ui: UniverseIndex::ROOT,
Expand Down Expand Up @@ -184,7 +184,7 @@ impl ToChalk for Ty {
let interned_id = crate::db::GlobalTypeParamId::from_intern_id(
crate::salsa::InternId::from(idx.idx),
);
Ty::Param(db.lookup_intern_type_param_id(interned_id))
Ty::Placeholder(db.lookup_intern_type_param_id(interned_id))
}
chalk_ir::TyData::Alias(proj) => {
let associated_ty = from_chalk(db, proj.associated_ty_id);
Expand Down