about summary refs log tree commit diff
path: root/compiler/rustc_traits/src/codegen.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-05-01 17:22:39 -0400
committerMichael Goulet <michael@errs.io>2024-05-02 22:03:01 -0400
commitd9eb5232b6fea1d902650727f71b4c1bbf69079a (patch)
tree7edb973179d60878b6327434b90d065fd3b29df3 /compiler/rustc_traits/src/codegen.rs
parent79734f1db8dbe322192dea32c0f6b80ab14c4c1d (diff)
downloadrust-d9eb5232b6fea1d902650727f71b4c1bbf69079a.tar.gz
rust-d9eb5232b6fea1d902650727f71b4c1bbf69079a.zip
Use ObligationCtxt in favor of TraitEngine in many places
Diffstat (limited to 'compiler/rustc_traits/src/codegen.rs')
-rw-r--r--compiler/rustc_traits/src/codegen.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/compiler/rustc_traits/src/codegen.rs b/compiler/rustc_traits/src/codegen.rs
index 51f38964415..b96b1b67a74 100644
--- a/compiler/rustc_traits/src/codegen.rs
+++ b/compiler/rustc_traits/src/codegen.rs
@@ -4,14 +4,13 @@
 // general routines.
 
 use rustc_infer::infer::TyCtxtInferExt;
-use rustc_infer::traits::{FulfillmentErrorCode, TraitEngineExt as _};
+use rustc_infer::traits::FulfillmentErrorCode;
 use rustc_middle::bug;
 use rustc_middle::traits::CodegenObligationError;
 use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
 use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt;
 use rustc_trait_selection::traits::{
-    ImplSource, Obligation, ObligationCause, SelectionContext, TraitEngine, TraitEngineExt,
-    Unimplemented,
+    ImplSource, Obligation, ObligationCause, ObligationCtxt, SelectionContext, Unimplemented,
 };
 use tracing::debug;
 
@@ -51,15 +50,15 @@ pub fn codegen_select_candidate<'tcx>(
     // Currently, we use a fulfillment context to completely resolve
     // all nested obligations. This is because they can inform the
     // inference of the impl's type parameters.
-    let mut fulfill_cx = <dyn TraitEngine<'tcx>>::new(&infcx);
-    let impl_source = selection.map(|predicate| {
-        fulfill_cx.register_predicate_obligation(&infcx, predicate);
+    let ocx = ObligationCtxt::new(&infcx);
+    let impl_source = selection.map(|obligation| {
+        ocx.register_obligation(obligation);
     });
 
     // In principle, we only need to do this so long as `impl_source`
     // contains unbound type parameters. It could be a slight
     // optimization to stop iterating early.
-    let errors = fulfill_cx.select_all_or_error(&infcx);
+    let errors = ocx.select_all_or_error();
     if !errors.is_empty() {
         // `rustc_monomorphize::collector` assumes there are no type errors.
         // Cycle errors are the only post-monomorphization errors possible; emit them now so