11use crate :: infer:: InferCtxt ;
22use crate :: traits:: Obligation ;
33use rustc_hir:: def_id:: DefId ;
4- use rustc_macros:: extension;
54use rustc_middle:: ty:: { self , Ty , Upcast } ;
65
76use super :: FulfillmentError ;
@@ -37,34 +36,21 @@ pub trait TraitEngine<'tcx>: 'tcx {
3736 obligation : PredicateObligation < ' tcx > ,
3837 ) ;
3938
40- #[ must_use]
41- fn select_where_possible ( & mut self , infcx : & InferCtxt < ' tcx > ) -> Vec < FulfillmentError < ' tcx > > ;
42-
43- fn collect_remaining_errors ( & mut self , infcx : & InferCtxt < ' tcx > ) -> Vec < FulfillmentError < ' tcx > > ;
44-
45- fn pending_obligations ( & self ) -> Vec < PredicateObligation < ' tcx > > ;
46-
47- /// Among all pending obligations, collect those are stalled on a inference variable which has
48- /// changed since the last call to `select_where_possible`. Those obligations are marked as
49- /// successful and returned.
50- fn drain_unstalled_obligations (
51- & mut self ,
52- infcx : & InferCtxt < ' tcx > ,
53- ) -> Vec < PredicateObligation < ' tcx > > ;
54- }
55-
56- #[ extension( pub trait TraitEngineExt <' tcx>) ]
57- impl < ' tcx , T : ?Sized + TraitEngine < ' tcx > > T {
5839 fn register_predicate_obligations (
5940 & mut self ,
6041 infcx : & InferCtxt < ' tcx > ,
61- obligations : impl IntoIterator < Item = PredicateObligation < ' tcx > > ,
42+ obligations : Vec < PredicateObligation < ' tcx > > ,
6243 ) {
6344 for obligation in obligations {
6445 self . register_predicate_obligation ( infcx, obligation) ;
6546 }
6647 }
6748
49+ #[ must_use]
50+ fn select_where_possible ( & mut self , infcx : & InferCtxt < ' tcx > ) -> Vec < FulfillmentError < ' tcx > > ;
51+
52+ fn collect_remaining_errors ( & mut self , infcx : & InferCtxt < ' tcx > ) -> Vec < FulfillmentError < ' tcx > > ;
53+
6854 #[ must_use]
6955 fn select_all_or_error ( & mut self , infcx : & InferCtxt < ' tcx > ) -> Vec < FulfillmentError < ' tcx > > {
7056 let errors = self . select_where_possible ( infcx) ;
@@ -74,4 +60,14 @@ impl<'tcx, T: ?Sized + TraitEngine<'tcx>> T {
7460
7561 self . collect_remaining_errors ( infcx)
7662 }
63+
64+ fn pending_obligations ( & self ) -> Vec < PredicateObligation < ' tcx > > ;
65+
66+ /// Among all pending obligations, collect those are stalled on a inference variable which has
67+ /// changed since the last call to `select_where_possible`. Those obligations are marked as
68+ /// successful and returned.
69+ fn drain_unstalled_obligations (
70+ & mut self ,
71+ infcx : & InferCtxt < ' tcx > ,
72+ ) -> Vec < PredicateObligation < ' tcx > > ;
7773}
0 commit comments