Auto merge of #111221 - compiler-errors:yeet-generalizer, r=lcnr

Combine three generalizer implementations

Fixes #111092
Fixes #109505

This code is a bit delicate and there were subtle changes between them, so I'll leave inline comments where further inspection is needed.

Regarding this comment from #109813 -- "add tests triggering all codepaths: at least the combine and the const generalizer", can't really do that now, and I don't really know how we'd get a higher-ranked const error since non-lifetime binders doesn't *really* support `for<const ..>` (it errors out when you try to use it).

r? `@lcnr`
This commit is contained in:
bors
2023-05-15 22:16:50 +00:00
13 changed files with 627 additions and 831 deletions

View File

@@ -1072,6 +1072,24 @@ impl ParamTerm {
}
}
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum TermVid<'tcx> {
Ty(ty::TyVid),
Const(ty::ConstVid<'tcx>),
}
impl From<ty::TyVid> for TermVid<'_> {
fn from(value: ty::TyVid) -> Self {
TermVid::Ty(value)
}
}
impl<'tcx> From<ty::ConstVid<'tcx>> for TermVid<'tcx> {
fn from(value: ty::ConstVid<'tcx>) -> Self {
TermVid::Const(value)
}
}
/// This kind of predicate has no *direct* correspondent in the
/// syntax, but it roughly corresponds to the syntactic forms:
///