Merge pull request #20545 from ChayimFriedman2/ns-foreign
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
metrics / generate_final_metrics (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run

fix: Remove `SolverDefId::ForeignId`
This commit is contained in:
Laurențiu Nicola 2025-08-26 17:40:24 +00:00 committed by GitHub
commit 1f4e5e82ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 4 additions and 7 deletions

View file

@ -1473,7 +1473,7 @@ impl<'db> HirDisplay for crate::next_solver::Ty<'db> {
}
TyKind::Foreign(type_alias) => {
let alias = match type_alias {
SolverDefId::ForeignId(id) => id,
SolverDefId::TypeAliasId(id) => id,
_ => unreachable!(),
};
let type_alias = db.type_alias_signature(alias);

View file

@ -155,7 +155,7 @@ impl TyFingerprint {
rustc_ast_ir::Mutability::Not => TyFingerprint::RawPtr(Mutability::Not),
},
TyKind::Foreign(def) => {
let SolverDefId::ForeignId(def) = def else { unreachable!() };
let SolverDefId::TypeAliasId(def) = def else { unreachable!() };
TyFingerprint::ForeignType(crate::to_foreign_def_id(def))
}
TyKind::Dynamic(bounds, _, _) => {

View file

@ -26,7 +26,6 @@ pub enum SolverDefId {
StaticId(StaticId),
TraitId(TraitId),
TypeAliasId(TypeAliasId),
ForeignId(TypeAliasId),
InternedClosureId(InternedClosureId),
InternedCoroutineId(InternedCoroutineId),
InternedOpaqueTyId(InternedOpaqueTyId),
@ -73,7 +72,6 @@ impl TryFrom<SolverDefId> for GenericDefId {
SolverDefId::StaticId(static_id) => GenericDefId::StaticId(static_id),
SolverDefId::TraitId(trait_id) => GenericDefId::TraitId(trait_id),
SolverDefId::TypeAliasId(type_alias_id) => GenericDefId::TypeAliasId(type_alias_id),
SolverDefId::ForeignId(_) => return Err(value),
SolverDefId::InternedClosureId(_) => return Err(value),
SolverDefId::InternedCoroutineId(_) => return Err(value),
SolverDefId::InternedOpaqueTyId(_) => return Err(value),

View file

@ -1148,7 +1148,6 @@ impl<'db> rustc_type_ir::Interner for DbInterner<'db> {
let container = match def_id {
SolverDefId::FunctionId(it) => it.lookup(self.db()).container,
SolverDefId::TypeAliasId(it) => it.lookup(self.db()).container,
SolverDefId::ForeignId(it) => it.lookup(self.db()).container,
SolverDefId::ConstId(it) => it.lookup(self.db()).container,
SolverDefId::InternedClosureId(it) => {
return self

View file

@ -271,7 +271,7 @@ impl<'db> ChalkToNextSolver<'db, Ty<'db>> for chalk_ir::Ty<Interner> {
)
}
chalk_ir::TyKind::Foreign(foreign_def_id) => rustc_type_ir::TyKind::Foreign(
SolverDefId::ForeignId(crate::from_foreign_def_id(*foreign_def_id)),
SolverDefId::TypeAliasId(crate::from_foreign_def_id(*foreign_def_id)),
),
chalk_ir::TyKind::Error => rustc_type_ir::TyKind::Error(ErrorGuaranteed),
chalk_ir::TyKind::Placeholder(placeholder_index) => {
@ -1262,7 +1262,7 @@ pub(crate) fn convert_ty_for_result<'db>(interner: DbInterner<'db>, ty: Ty<'db>)
rustc_type_ir::TyKind::Foreign(foreign) => {
let def_id = match foreign {
SolverDefId::ForeignId(id) => id,
SolverDefId::TypeAliasId(id) => id,
_ => unreachable!(),
};
TyKind::Foreign(to_foreign_def_id(def_id))