Don't map Chalk's Normalize to next solver's NormalizesTo

`NormalizesTo` is a private predicate that should not be used outside the solver. For normalization, rustc uses `AliasRelate`, so replace with that.
This commit is contained in:
Chayim Refael Friedman 2025-08-25 20:56:45 +03:00
parent 1ff80eefe1
commit fd77af3a78

View file

@ -808,14 +808,24 @@ impl<'db> ChalkToNextSolver<'db, PredicateKind<'db>> for chalk_ir::DomainGoal<In
_ => unimplemented!(),
};
let args: GenericArgs<'db> = proj_ty.substitution.to_nextsolver(interner);
let alias = rustc_type_ir::AliasTerm::new(
let alias = Ty::new(
interner,
from_assoc_type_id(proj_ty.associated_ty_id).into(),
args,
);
rustc_type_ir::TyKind::Alias(
rustc_type_ir::AliasTyKind::Projection,
rustc_type_ir::AliasTy::new(
interner,
from_assoc_type_id(proj_ty.associated_ty_id).into(),
args,
),
),
)
.into();
let term = normalize.ty.to_nextsolver(interner).into();
let normalizes_to = rustc_type_ir::NormalizesTo { alias, term };
PredicateKind::NormalizesTo(normalizes_to)
PredicateKind::AliasRelate(
alias,
term,
rustc_type_ir::AliasRelationDirection::Equate,
)
}
chalk_ir::DomainGoal::WellFormed(well_formed) => {
let term = match well_formed {