1
Fork 0

Auto merge of #88166 - BoxyUwU:const-equate-canon, r=lcnr

canonicalize consts before calling try_unify_abstract_consts query

Fixes #88022
Fixes #86953
Fixes #77708
Fixes #82034
Fixes #85031

these ICEs were all caused by calling the `try_unify_abstract_consts` query with inference vars in substs

r? `@lcnr`
This commit is contained in:
bors 2021-08-22 18:00:22 +00:00
commit 91f9806208
12 changed files with 221 additions and 9 deletions

View file

@ -671,6 +671,22 @@ pub struct CombinedSnapshot<'a, 'tcx> {
}
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
/// calls `tcx.try_unify_abstract_consts` after
/// canonicalizing the consts.
pub fn try_unify_abstract_consts(
&self,
a: ty::Unevaluated<'tcx>,
b: ty::Unevaluated<'tcx>,
) -> bool {
let canonical = self.canonicalize_query(
((a.def, a.substs), (b.def, b.substs)),
&mut OriginalQueryValues::default(),
);
debug!("canonical consts: {:?}", &canonical.value);
self.tcx.try_unify_abstract_consts(canonical.value)
}
pub fn is_in_snapshot(&self) -> bool {
self.in_snapshot.get()
}