@@ -37,7 +37,7 @@ pub use self::object_safety::MethodViolationCode;
3737pub use self :: select:: { EvaluationCache , SelectionContext , SelectionCache } ;
3838pub use self :: select:: { MethodMatchResult , MethodMatched , MethodAmbiguous , MethodDidNotMatch } ;
3939pub use self :: select:: { MethodMatchedData } ; // intentionally don't export variants
40- pub use self :: specialize:: { Overlap , specialization_graph, specializes, translate_substs} ;
40+ pub use self :: specialize:: { OverlapError , specialization_graph, specializes, translate_substs} ;
4141pub use self :: util:: elaborate_predicates;
4242pub use self :: util:: supertraits;
4343pub use self :: util:: Supertraits ;
@@ -422,42 +422,43 @@ pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
422422
423423 let elaborated_env = unnormalized_env. with_caller_bounds ( predicates) ;
424424
425- let infcx = InferCtxt :: new ( tcx, & tcx . tables , Some ( elaborated_env) ,
426- ProjectionMode :: AnyFinal ) ;
427- let predicates = match fully_normalize ( & infcx,
428- cause ,
429- & infcx . parameter_environment . caller_bounds ) {
430- Ok ( predicates ) => predicates ,
431- Err ( errors ) => {
432- infcx. report_fulfillment_errors ( & errors ) ;
433- return infcx . parameter_environment ; // an unnormalized env is better than nothing
434- }
435- } ;
436-
437- debug ! ( "normalize_param_env_or_error: normalized predicates={:?}" ,
438- predicates ) ;
439-
440- let free_regions = FreeRegionMap :: new ( ) ;
441- infcx. resolve_regions_and_report_errors ( & free_regions , body_id ) ;
442- let predicates = match infcx . fully_resolve ( & predicates) {
443- Ok ( predicates ) => predicates ,
444- Err ( fixup_err ) => {
445- // If we encounter a fixup error, it means that some type
446- // variable wound up unconstrained. I actually don't know
447- // if this can happen, and I certainly don't expect it to
448- // happen often, but if it did happen it probably
449- // represents a legitimate failure due to some kind of
450- // unconstrained variable, and it seems better not to ICE,
451- // all things considered.
452- tcx . sess . span_err ( span , & fixup_err . to_string ( ) ) ;
453- return infcx. parameter_environment ; // an unnormalized env is better than nothing
454- }
455- } ;
425+ InferCtxt :: enter ( tcx, None , Some ( elaborated_env) , ProjectionMode :: AnyFinal , |infcx| {
426+ let predicates = match fully_normalize ( & infcx , cause ,
427+ & infcx. parameter_environment . caller_bounds ) {
428+ Ok ( predicates ) => predicates ,
429+ Err ( errors ) => {
430+ infcx . report_fulfillment_errors ( & errors ) ;
431+ // An unnormalized env is better than nothing.
432+ return infcx. parameter_environment ;
433+ }
434+ } ;
435+
436+ debug ! ( "normalize_param_env_or_error: normalized predicates={:?}" ,
437+ predicates) ;
438+
439+ let free_regions = FreeRegionMap :: new ( ) ;
440+ infcx . resolve_regions_and_report_errors ( & free_regions , body_id ) ;
441+ let predicates = match infcx. fully_resolve ( & predicates ) {
442+ Ok ( predicates) => predicates ,
443+ Err ( fixup_err ) => {
444+ // If we encounter a fixup error, it means that some type
445+ // variable wound up unconstrained. I actually don't know
446+ // if this can happen, and I certainly don't expect it to
447+ // happen often, but if it did happen it probably
448+ // represents a legitimate failure due to some kind of
449+ // unconstrained variable, and it seems better not to ICE,
450+ // all things considered.
451+ tcx . sess . span_err ( span , & fixup_err . to_string ( ) ) ;
452+ // An unnormalized env is better than nothing.
453+ return infcx. parameter_environment ;
454+ }
455+ } ;
456456
457- debug ! ( "normalize_param_env_or_error: resolved predicates={:?}" ,
458- predicates) ;
457+ debug ! ( "normalize_param_env_or_error: resolved predicates={:?}" ,
458+ predicates) ;
459459
460- infcx. parameter_environment . with_caller_bounds ( predicates)
460+ infcx. parameter_environment . with_caller_bounds ( predicates)
461+ } )
461462}
462463
463464pub fn fully_normalize < ' a , ' tcx , T > ( infcx : & InferCtxt < ' a , ' tcx , ' tcx > ,
0 commit comments