Rename TyKind::ForeignType to Foreign

This commit is contained in:
Laurențiu Nicola 2021-04-05 15:38:28 +03:00
parent 65c2e51940
commit 72c54c53cd
7 changed files with 10 additions and 10 deletions

View File

@ -1900,7 +1900,7 @@ impl Type {
| TyKind::Dyn(_)
| TyKind::Function(_)
| TyKind::Alias(_)
| TyKind::ForeignType(_) => false,
| TyKind::Foreign(_) => false,
}
}
}

View File

@ -529,7 +529,7 @@ impl HirDisplay for Ty {
projection_ty.hir_fmt(f)?;
}
}
TyKind::ForeignType(type_alias) => {
TyKind::Foreign(type_alias) => {
let type_alias = f.db.type_alias_data(from_foreign_def_id(*type_alias));
write!(f, "{}", type_alias.name)?;
}

View File

@ -290,7 +290,7 @@ impl Ty {
Some(db.lookup_intern_callable_def(callable.into()).into())
}
TyKind::AssociatedType(type_alias, ..) => Some(from_assoc_type_id(type_alias).into()),
TyKind::ForeignType(type_alias, ..) => Some(from_foreign_def_id(type_alias).into()),
TyKind::Foreign(type_alias, ..) => Some(from_foreign_def_id(type_alias).into()),
_ => None,
}
}
@ -312,7 +312,7 @@ impl Ty {
(TyKind::AssociatedType(ty_id, ..), TyKind::AssociatedType(ty_id2, ..)) => {
ty_id == ty_id2
}
(TyKind::ForeignType(ty_id, ..), TyKind::ForeignType(ty_id2, ..)) => ty_id == ty_id2,
(TyKind::Foreign(ty_id, ..), TyKind::Foreign(ty_id2, ..)) => ty_id == ty_id2,
(TyKind::Closure(id1, _), TyKind::Closure(id2, _)) => id1 == id2,
(TyKind::Ref(mutability, ..), TyKind::Ref(mutability2, ..))
| (TyKind::Raw(mutability, ..), TyKind::Raw(mutability2, ..)) => {

View File

@ -1145,7 +1145,7 @@ fn type_for_type_alias(db: &dyn HirDatabase, t: TypeAliasId) -> Binders<Ty> {
let ctx =
TyLoweringContext::new(db, &resolver).with_type_param_mode(TypeParamLoweringMode::Variable);
if db.type_alias_data(t).is_extern {
Binders::new(0, TyKind::ForeignType(crate::to_foreign_def_id(t)).intern(&Interner))
Binders::new(0, TyKind::Foreign(crate::to_foreign_def_id(t)).intern(&Interner))
} else {
let type_ref = &db.type_alias_data(t).type_ref;
let inner = ctx.lower_ty(type_ref.as_deref().unwrap_or(&TypeRef::Error));

View File

@ -55,7 +55,7 @@ impl TyFingerprint {
TyKind::Adt(AdtId(adt), _) => TyFingerprint::Adt(adt),
TyKind::Tuple(cardinality, _) => TyFingerprint::Tuple(cardinality),
TyKind::Raw(mutability, ..) => TyFingerprint::RawPtr(mutability),
TyKind::ForeignType(alias_id, ..) => TyFingerprint::ForeignType(alias_id),
TyKind::Foreign(alias_id, ..) => TyFingerprint::ForeignType(alias_id),
TyKind::Function(FnPointer { num_args, sig, .. }) => {
TyFingerprint::FnPtr(num_args, sig)
}
@ -246,7 +246,7 @@ impl Ty {
TyKind::Adt(AdtId(def_id), _) => {
return mod_to_crate_ids(def_id.module(db.upcast()));
}
TyKind::ForeignType(id) => {
TyKind::Foreign(id) => {
return mod_to_crate_ids(
from_foreign_def_id(*id).lookup(db.upcast()).module(db.upcast()),
);

View File

@ -43,7 +43,7 @@ impl ToChalk for Ty {
chalk_ir::TyKind::OpaqueType(id, substitution).intern(&Interner)
}
TyKind::ForeignType(id) => chalk_ir::TyKind::Foreign(id).intern(&Interner),
TyKind::Foreign(id) => chalk_ir::TyKind::Foreign(id).intern(&Interner),
TyKind::Scalar(scalar) => chalk_ir::TyKind::Scalar(scalar).intern(&Interner),
@ -181,7 +181,7 @@ impl ToChalk for Ty {
chalk_ir::TyKind::Closure(id, subst) => TyKind::Closure(id, from_chalk(db, subst)),
chalk_ir::TyKind::Foreign(foreign_def_id) => TyKind::ForeignType(foreign_def_id),
chalk_ir::TyKind::Foreign(foreign_def_id) => TyKind::Foreign(foreign_def_id),
chalk_ir::TyKind::Generator(_, _) => unimplemented!(), // FIXME
chalk_ir::TyKind::GeneratorWitness(_, _) => unimplemented!(), // FIXME
}

View File

@ -132,7 +132,7 @@ pub enum TyKind {
Closure(ClosureId, Substitution),
/// Represents a foreign type declared in external blocks.
ForeignType(ForeignDefId),
Foreign(ForeignDefId),
/// A pointer to a function. Written as `fn() -> i32`.
///