Skip to content

Commit 1f4e5e8

Browse files
authored
Merge pull request #20545 from ChayimFriedman2/ns-foreign
fix: Remove `SolverDefId::ForeignId`
2 parents 1260457 + 6bcfbbe commit 1f4e5e8

File tree

5 files changed

+4
-7
lines changed

5 files changed

+4
-7
lines changed

crates/hir-ty/src/display.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ impl<'db> HirDisplay for crate::next_solver::Ty<'db> {
14731473
}
14741474
TyKind::Foreign(type_alias) => {
14751475
let alias = match type_alias {
1476-
SolverDefId::ForeignId(id) => id,
1476+
SolverDefId::TypeAliasId(id) => id,
14771477
_ => unreachable!(),
14781478
};
14791479
let type_alias = db.type_alias_signature(alias);

crates/hir-ty/src/method_resolution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl TyFingerprint {
155155
rustc_ast_ir::Mutability::Not => TyFingerprint::RawPtr(Mutability::Not),
156156
},
157157
TyKind::Foreign(def) => {
158-
let SolverDefId::ForeignId(def) = def else { unreachable!() };
158+
let SolverDefId::TypeAliasId(def) = def else { unreachable!() };
159159
TyFingerprint::ForeignType(crate::to_foreign_def_id(def))
160160
}
161161
TyKind::Dynamic(bounds, _, _) => {

crates/hir-ty/src/next_solver/def_id.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub enum SolverDefId {
2626
StaticId(StaticId),
2727
TraitId(TraitId),
2828
TypeAliasId(TypeAliasId),
29-
ForeignId(TypeAliasId),
3029
InternedClosureId(InternedClosureId),
3130
InternedCoroutineId(InternedCoroutineId),
3231
InternedOpaqueTyId(InternedOpaqueTyId),
@@ -73,7 +72,6 @@ impl TryFrom<SolverDefId> for GenericDefId {
7372
SolverDefId::StaticId(static_id) => GenericDefId::StaticId(static_id),
7473
SolverDefId::TraitId(trait_id) => GenericDefId::TraitId(trait_id),
7574
SolverDefId::TypeAliasId(type_alias_id) => GenericDefId::TypeAliasId(type_alias_id),
76-
SolverDefId::ForeignId(_) => return Err(value),
7775
SolverDefId::InternedClosureId(_) => return Err(value),
7876
SolverDefId::InternedCoroutineId(_) => return Err(value),
7977
SolverDefId::InternedOpaqueTyId(_) => return Err(value),

crates/hir-ty/src/next_solver/interner.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,6 @@ impl<'db> rustc_type_ir::Interner for DbInterner<'db> {
11481148
let container = match def_id {
11491149
SolverDefId::FunctionId(it) => it.lookup(self.db()).container,
11501150
SolverDefId::TypeAliasId(it) => it.lookup(self.db()).container,
1151-
SolverDefId::ForeignId(it) => it.lookup(self.db()).container,
11521151
SolverDefId::ConstId(it) => it.lookup(self.db()).container,
11531152
SolverDefId::InternedClosureId(it) => {
11541153
return self

crates/hir-ty/src/next_solver/mapping.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ impl<'db> ChalkToNextSolver<'db, Ty<'db>> for chalk_ir::Ty<Interner> {
271271
)
272272
}
273273
chalk_ir::TyKind::Foreign(foreign_def_id) => rustc_type_ir::TyKind::Foreign(
274-
SolverDefId::ForeignId(crate::from_foreign_def_id(*foreign_def_id)),
274+
SolverDefId::TypeAliasId(crate::from_foreign_def_id(*foreign_def_id)),
275275
),
276276
chalk_ir::TyKind::Error => rustc_type_ir::TyKind::Error(ErrorGuaranteed),
277277
chalk_ir::TyKind::Placeholder(placeholder_index) => {
@@ -1262,7 +1262,7 @@ pub(crate) fn convert_ty_for_result<'db>(interner: DbInterner<'db>, ty: Ty<'db>)
12621262

12631263
rustc_type_ir::TyKind::Foreign(foreign) => {
12641264
let def_id = match foreign {
1265-
SolverDefId::ForeignId(id) => id,
1265+
SolverDefId::TypeAliasId(id) => id,
12661266
_ => unreachable!(),
12671267
};
12681268
TyKind::Foreign(to_foreign_def_id(def_id))

0 commit comments

Comments
 (0)