diff options
| author | Michael Goulet <michael@errs.io> | 2022-10-27 15:40:30 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-10-27 15:43:33 +0000 |
| commit | ce11ae5d0de03d23b770f4d7ee912c792678f09d (patch) | |
| tree | 84e3b2b4cf1e9786636fa3c09e055dd04dd570c2 /compiler/rustc_trait_selection/src/traits/engine.rs | |
| parent | d793d80cf7e60d1bdaefffb221dd45875ed9574a (diff) | |
| download | rust-ce11ae5d0de03d23b770f4d7ee912c792678f09d.tar.gz rust-ce11ae5d0de03d23b770f4d7ee912c792678f09d.zip | |
Address some more nits
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/engine.rs')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/engine.rs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/engine.rs b/compiler/rustc_trait_selection/src/traits/engine.rs index 18ad99b4935..c760ce1fed9 100644 --- a/compiler/rustc_trait_selection/src/traits/engine.rs +++ b/compiler/rustc_trait_selection/src/traits/engine.rs @@ -6,6 +6,7 @@ use super::{ChalkFulfillmentContext, FulfillmentContext}; use crate::infer::InferCtxtExt; use rustc_data_structures::fx::FxHashSet; use rustc_hir::def_id::{DefId, LocalDefId}; +use rustc_infer::infer::at::ToTrace; use rustc_infer::infer::canonical::{ Canonical, CanonicalVarValues, CanonicalizedQueryResponse, QueryResponse, }; @@ -111,12 +112,12 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> { self.register_infer_ok_obligations(infer_ok) } - pub fn equate_types( + pub fn equate_types<T: ToTrace<'tcx>>( &self, cause: &ObligationCause<'tcx>, param_env: ty::ParamEnv<'tcx>, - expected: Ty<'tcx>, - actual: Ty<'tcx>, + expected: T, + actual: T, ) -> Result<(), TypeError<'tcx>> { match self.infcx.at(cause, param_env).eq(expected, actual) { Ok(InferOk { obligations, value: () }) => { @@ -127,6 +128,22 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> { } } + pub fn sup_types<T: ToTrace<'tcx>>( + &self, + cause: &ObligationCause<'tcx>, + param_env: ty::ParamEnv<'tcx>, + expected: T, + actual: T, + ) -> Result<(), TypeError<'tcx>> { + match self.infcx.at(cause, param_env).sup(expected, actual) { + Ok(InferOk { obligations, value: () }) => { + self.register_obligations(obligations); + Ok(()) + } + Err(e) => Err(e), + } + } + pub fn select_all_or_error(&self) -> Vec<FulfillmentError<'tcx>> { self.engine.borrow_mut().select_all_or_error(self.infcx) } |
