@@ -31,7 +31,6 @@ use rustc_hir::def::DefKind;
3131pub use rustc_infer:: traits:: * ;
3232use rustc_macros:: TypeVisitable ;
3333use rustc_middle:: query:: Providers ;
34- use rustc_middle:: span_bug;
3534use rustc_middle:: ty:: error:: { ExpectedFound , TypeError } ;
3635use rustc_middle:: ty:: {
3736 self , Clause , GenericArgs , GenericArgsRef , Ty , TyCtxt , TypeFoldable , TypeFolder ,
@@ -473,69 +472,6 @@ pub fn normalize_param_env_or_error<'tcx>(
473472 ty:: ParamEnv :: new ( tcx. mk_clauses ( & predicates) )
474473}
475474
476- /// Deeply normalize the param env using the next solver ignoring
477- /// region errors.
478- ///
479- /// FIXME(-Zhigher-ranked-assumptions): this is a hack to work around
480- /// the fact that we don't support placeholder assumptions right now
481- /// and is necessary for `compare_method_predicate_entailment`, see the
482- /// use of this function for more info. We should remove this once we
483- /// have proper support for implied bounds on binders.
484- #[ instrument( level = "debug" , skip( tcx) ) ]
485- pub fn deeply_normalize_param_env_ignoring_regions < ' tcx > (
486- tcx : TyCtxt < ' tcx > ,
487- unnormalized_env : ty:: ParamEnv < ' tcx > ,
488- cause : ObligationCause < ' tcx > ,
489- ) -> ty:: ParamEnv < ' tcx > {
490- let predicates: Vec < _ > =
491- util:: elaborate ( tcx, unnormalized_env. caller_bounds ( ) . into_iter ( ) ) . collect ( ) ;
492-
493- debug ! ( "normalize_param_env_or_error: elaborated-predicates={:?}" , predicates) ;
494-
495- let elaborated_env = ty:: ParamEnv :: new ( tcx. mk_clauses ( & predicates) ) ;
496- if !elaborated_env. has_aliases ( ) {
497- return elaborated_env;
498- }
499-
500- let span = cause. span ;
501- let infcx = tcx
502- . infer_ctxt ( )
503- . with_next_trait_solver ( true )
504- . ignoring_regions ( )
505- . build ( TypingMode :: non_body_analysis ( ) ) ;
506- let predicates = match crate :: solve:: deeply_normalize :: < _ , FulfillmentError < ' tcx > > (
507- infcx. at ( & cause, elaborated_env) ,
508- Unnormalized :: new_wip ( predicates) ,
509- ) {
510- Ok ( predicates) => predicates,
511- Err ( errors) => {
512- infcx. err_ctxt ( ) . report_fulfillment_errors ( errors) ;
513- // An unnormalized env is better than nothing.
514- debug ! ( "normalize_param_env_or_error: errored resolving predicates" ) ;
515- return elaborated_env;
516- }
517- } ;
518-
519- debug ! ( "do_normalize_predicates: normalized predicates = {:?}" , predicates) ;
520- // FIXME(-Zhigher-ranked-assumptions): We're ignoring region errors for now.
521- // There're placeholder constraints `leaking` out.
522- // See the fixme in the enclosing function's docs for more.
523- let _errors = infcx. resolve_regions ( cause. body_id , elaborated_env, [ ] ) ;
524-
525- let predicates = match infcx. fully_resolve ( predicates) {
526- Ok ( predicates) => predicates,
527- Err ( fixup_err) => {
528- span_bug ! (
529- span,
530- "inference variables in normalized parameter environment: {}" ,
531- fixup_err
532- )
533- }
534- } ;
535- debug ! ( "normalize_param_env_or_error: final predicates={:?}" , predicates) ;
536- ty:: ParamEnv :: new ( tcx. mk_clauses ( & predicates) )
537- }
538-
539475#[ derive( Debug ) ]
540476pub enum EvaluateConstErr {
541477 /// The constant being evaluated was either a generic parameter or inference variable, *or*,
0 commit comments