@@ -4,13 +4,12 @@ pub mod suggestions;
4
4
5
5
use super :: {
6
6
FulfillmentError , FulfillmentErrorCode , MismatchedProjectionTypes , Obligation , ObligationCause ,
7
- ObligationCauseCode , OutputTypeParameterMismatch , Overflow , PredicateObligation ,
8
- SelectionContext , SelectionError , TraitNotObjectSafe ,
7
+ ObligationCauseCode , ObligationCtxt , OutputTypeParameterMismatch , Overflow ,
8
+ PredicateObligation , SelectionContext , SelectionError , TraitNotObjectSafe ,
9
9
} ;
10
10
use crate :: infer:: error_reporting:: { TyCategory , TypeAnnotationNeeded as ErrorCode } ;
11
11
use crate :: infer:: type_variable:: { TypeVariableOrigin , TypeVariableOriginKind } ;
12
12
use crate :: infer:: { self , InferCtxt , TyCtxtInferExt } ;
13
- use crate :: traits:: engine:: TraitEngineExt as _;
14
13
use crate :: traits:: query:: evaluate_obligation:: InferCtxtExt as _;
15
14
use crate :: traits:: query:: normalize:: AtExt as _;
16
15
use crate :: traits:: specialize:: to_pretty_impl_header;
@@ -29,7 +28,6 @@ use rustc_hir::Item;
29
28
use rustc_hir:: Node ;
30
29
use rustc_infer:: infer:: error_reporting:: TypeErrCtxt ;
31
30
use rustc_infer:: infer:: TypeTrace ;
32
- use rustc_infer:: traits:: TraitEngine ;
33
31
use rustc_middle:: traits:: select:: OverflowError ;
34
32
use rustc_middle:: ty:: abstract_const:: NotConstEvaluatable ;
35
33
use rustc_middle:: ty:: error:: ExpectedFound ;
@@ -353,9 +351,9 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
353
351
} )
354
352
. to_predicate ( self . tcx ) ,
355
353
) ;
356
- let mut fulfill_cx = < dyn TraitEngine < ' tcx > > :: new_in_snapshot ( self . tcx ) ;
357
- fulfill_cx . register_predicate_obligation ( self , obligation) ;
358
- if fulfill_cx . select_all_or_error ( self ) . is_empty ( ) {
354
+ let ocx = ObligationCtxt :: new_in_snapshot ( self ) ;
355
+ ocx . register_obligation ( obligation) ;
356
+ if ocx . select_all_or_error ( ) . is_empty ( ) {
359
357
return Ok ( (
360
358
ty:: ClosureKind :: from_def_id ( self . tcx , trait_def_id)
361
359
. expect ( "expected to map DefId to ClosureKind" ) ,
0 commit comments