diff options
| author | Ellen <supbscripter@gmail.com> | 2021-08-19 21:04:04 +0100 |
|---|---|---|
| committer | Ellen <supbscripter@gmail.com> | 2021-08-19 21:04:09 +0100 |
| commit | c2b61fbafe53d655ec010471d8f4a3bf34c724bd (patch) | |
| tree | 2aa18abea50d092d1c3fdc176d658f903a70d0d9 /compiler/rustc_infer | |
| parent | ab61e722eeb6c37b19f6ad6f53fc8a05a79859f5 (diff) | |
| download | rust-c2b61fbafe53d655ec010471d8f4a3bf34c724bd.tar.gz rust-c2b61fbafe53d655ec010471d8f4a3bf34c724bd.zip | |
move code to `InferCtxt` method
Diffstat (limited to 'compiler/rustc_infer')
| -rw-r--r-- | compiler/rustc_infer/src/infer/mod.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index 10217a5f574..1bc20180f04 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -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() } |
