@@ -355,7 +355,7 @@ pub fn type_known_to_meet_builtin_bound<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
355
355
// this function's result remains infallible, we must confirm
356
356
// that guess. While imperfect, I believe this is sound.
357
357
358
- let mut fulfill_cx = FulfillmentContext :: new ( false ) ;
358
+ let mut fulfill_cx = FulfillmentContext :: new ( ) ;
359
359
360
360
// We can use a dummy node-id here because we won't pay any mind
361
361
// to region obligations that arise (there shouldn't really be any
@@ -433,8 +433,9 @@ pub fn normalize_param_env_or_error<'a,'tcx>(unnormalized_env: ty::ParameterEnvi
433
433
434
434
let elaborated_env = unnormalized_env. with_caller_bounds ( predicates) ;
435
435
436
- let infcx = infer:: new_infer_ctxt ( tcx, & tcx. tables , Some ( elaborated_env) , false ) ;
437
- let predicates = match fully_normalize ( & infcx, cause,
436
+ let infcx = infer:: new_infer_ctxt ( tcx, & tcx. tables , Some ( elaborated_env) ) ;
437
+ let predicates = match fully_normalize ( & infcx,
438
+ cause,
438
439
& infcx. parameter_environment . caller_bounds ) {
439
440
Ok ( predicates) => predicates,
440
441
Err ( errors) => {
@@ -443,6 +444,9 @@ pub fn normalize_param_env_or_error<'a,'tcx>(unnormalized_env: ty::ParameterEnvi
443
444
}
444
445
} ;
445
446
447
+ debug ! ( "normalize_param_env_or_error: normalized predicates={:?}" ,
448
+ predicates) ;
449
+
446
450
let free_regions = FreeRegionMap :: new ( ) ;
447
451
infcx. resolve_regions_and_report_errors ( & free_regions, body_id) ;
448
452
let predicates = match infcx. fully_resolve ( & predicates) {
@@ -461,6 +465,9 @@ pub fn normalize_param_env_or_error<'a,'tcx>(unnormalized_env: ty::ParameterEnvi
461
465
}
462
466
} ;
463
467
468
+ debug ! ( "normalize_param_env_or_error: resolved predicates={:?}" ,
469
+ predicates) ;
470
+
464
471
infcx. parameter_environment . with_caller_bounds ( predicates)
465
472
}
466
473
@@ -470,7 +477,7 @@ pub fn fully_normalize<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
470
477
-> Result < T , Vec < FulfillmentError < ' tcx > > >
471
478
where T : TypeFoldable < ' tcx > + HasTypeFlags
472
479
{
473
- debug ! ( "normalize_param_env (value={:?})" , value) ;
480
+ debug ! ( "fully_normalize (value={:?})" , value) ;
474
481
475
482
let mut selcx = & mut SelectionContext :: new ( infcx) ;
476
483
// FIXME (@jroesch) ISSUE 26721
@@ -486,20 +493,28 @@ pub fn fully_normalize<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
486
493
//
487
494
// I think we should probably land this refactor and then come
488
495
// back to this is a follow-up patch.
489
- let mut fulfill_cx = FulfillmentContext :: new ( false ) ;
496
+ let mut fulfill_cx = FulfillmentContext :: new ( ) ;
490
497
491
498
let Normalized { value : normalized_value, obligations } =
492
499
project:: normalize ( selcx, cause, value) ;
493
- debug ! ( "normalize_param_env : normalized_value={:?} obligations={:?}" ,
500
+ debug ! ( "fully_normalize : normalized_value={:?} obligations={:?}" ,
494
501
normalized_value,
495
502
obligations) ;
496
503
for obligation in obligations {
497
504
fulfill_cx. register_predicate_obligation ( selcx. infcx ( ) , obligation) ;
498
505
}
499
506
500
- try!( fulfill_cx. select_all_or_error ( infcx) ) ;
507
+ debug ! ( "fully_normalize: select_all_or_error start" ) ;
508
+ match fulfill_cx. select_all_or_error ( infcx) {
509
+ Ok ( ( ) ) => { }
510
+ Err ( e) => {
511
+ debug ! ( "fully_normalize: error={:?}" , e) ;
512
+ return Err ( e) ;
513
+ }
514
+ }
515
+ debug ! ( "fully_normalize: select_all_or_error complete" ) ;
501
516
let resolved_value = infcx. resolve_type_vars_if_possible ( & normalized_value) ;
502
- debug ! ( "normalize_param_env : resolved_value={:?}" , resolved_value) ;
517
+ debug ! ( "fully_normalize : resolved_value={:?}" , resolved_value) ;
503
518
Ok ( resolved_value)
504
519
}
505
520
0 commit comments