1
Fork 0

move code to InferCtxt method

This commit is contained in:
Ellen 2021-08-19 21:04:04 +01:00
parent ab61e722ee
commit c2b61fbafe
3 changed files with 18 additions and 16 deletions

View file

@ -670,6 +670,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()
}