From 72c54c53cdc543eab40fc5d4593e6a7f57c94755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 5 Apr 2021 15:38:28 +0300 Subject: [PATCH] Rename TyKind::ForeignType to Foreign --- crates/hir/src/lib.rs | 2 +- crates/hir_ty/src/display.rs | 2 +- crates/hir_ty/src/lib.rs | 4 ++-- crates/hir_ty/src/lower.rs | 2 +- crates/hir_ty/src/method_resolution.rs | 4 ++-- crates/hir_ty/src/traits/chalk/mapping.rs | 4 ++-- crates/hir_ty/src/types.rs | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 76d0e98af8d..b14c9a67509 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1900,7 +1900,7 @@ impl Type { | TyKind::Dyn(_) | TyKind::Function(_) | TyKind::Alias(_) - | TyKind::ForeignType(_) => false, + | TyKind::Foreign(_) => false, } } } diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs index 83d09a8c794..5ff70c893a2 100644 --- a/crates/hir_ty/src/display.rs +++ b/crates/hir_ty/src/display.rs @@ -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)?; } diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 9e030e7753a..d1513df1f95 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs @@ -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, ..)) => { diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index dd40eb5c33e..ba48be4ad0f 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs @@ -1145,7 +1145,7 @@ fn type_for_type_alias(db: &dyn HirDatabase, t: TypeAliasId) -> Binders { 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)); diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index dc6324780ec..6ace970d1c1 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -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()), ); diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index c5654f17b75..59aaa556040 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs @@ -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 } diff --git a/crates/hir_ty/src/types.rs b/crates/hir_ty/src/types.rs index 9853ab3beaa..bac086318f2 100644 --- a/crates/hir_ty/src/types.rs +++ b/crates/hir_ty/src/types.rs @@ -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`. ///