@@ -4,12 +4,12 @@ use rustc_data_structures::obligation_forest::ProcessResult;
44use rustc_data_structures:: obligation_forest:: { Error , ForestObligation , Outcome } ;
55use rustc_data_structures:: obligation_forest:: { ObligationForest , ObligationProcessor } ;
66use rustc_infer:: traits:: ProjectionCacheKey ;
7- use rustc_infer:: traits:: { SelectionError , TraitEngine , TraitEngineExt as _ , TraitObligation } ;
7+ use rustc_infer:: traits:: { SelectionError , TraitEngine , TraitObligation } ;
88use rustc_middle:: mir:: interpret:: ErrorHandled ;
99use rustc_middle:: ty:: abstract_const:: NotConstEvaluatable ;
1010use rustc_middle:: ty:: error:: { ExpectedFound , TypeError } ;
1111use rustc_middle:: ty:: subst:: SubstsRef ;
12- use rustc_middle:: ty:: { self , Binder , Const , Ty , TypeVisitable } ;
12+ use rustc_middle:: ty:: { self , Binder , Const , TypeVisitable } ;
1313use std:: marker:: PhantomData ;
1414
1515use super :: const_evaluatable;
@@ -20,9 +20,9 @@ use super::CodeAmbiguity;
2020use super :: CodeProjectionError ;
2121use super :: CodeSelectionError ;
2222use super :: EvaluationResult ;
23+ use super :: PredicateObligation ;
2324use super :: Unimplemented ;
2425use super :: { FulfillmentError , FulfillmentErrorCode } ;
25- use super :: { ObligationCause , PredicateObligation } ;
2626
2727use crate :: traits:: project:: PolyProjectionObligation ;
2828use crate :: traits:: project:: ProjectionCacheKeyExt as _;
@@ -126,42 +126,6 @@ impl<'a, 'tcx> FulfillmentContext<'tcx> {
126126}
127127
128128impl < ' tcx > TraitEngine < ' tcx > for FulfillmentContext < ' tcx > {
129- /// "Normalize" a projection type `<SomeType as SomeTrait>::X` by
130- /// creating a fresh type variable `$0` as well as a projection
131- /// predicate `<SomeType as SomeTrait>::X == $0`. When the
132- /// inference engine runs, it will attempt to find an impl of
133- /// `SomeTrait` or a where-clause that lets us unify `$0` with
134- /// something concrete. If this fails, we'll unify `$0` with
135- /// `projection_ty` again.
136- #[ instrument( level = "debug" , skip( self , infcx, param_env, cause) ) ]
137- fn normalize_projection_type (
138- & mut self ,
139- infcx : & InferCtxt < ' tcx > ,
140- param_env : ty:: ParamEnv < ' tcx > ,
141- projection_ty : ty:: ProjectionTy < ' tcx > ,
142- cause : ObligationCause < ' tcx > ,
143- ) -> Ty < ' tcx > {
144- debug_assert ! ( !projection_ty. has_escaping_bound_vars( ) ) ;
145-
146- // FIXME(#20304) -- cache
147-
148- let mut selcx = SelectionContext :: new ( infcx) ;
149- let mut obligations = vec ! [ ] ;
150- let normalized_ty = project:: normalize_projection_type (
151- & mut selcx,
152- param_env,
153- projection_ty,
154- cause,
155- 0 ,
156- & mut obligations,
157- ) ;
158- self . register_predicate_obligations ( infcx, obligations) ;
159-
160- debug ! ( ?normalized_ty) ;
161-
162- normalized_ty. ty ( ) . unwrap ( )
163- }
164-
165129 fn register_predicate_obligation (
166130 & mut self ,
167131 infcx : & InferCtxt < ' tcx > ,
0 commit comments