@@ -378,6 +378,7 @@ pub(super) fn opt_normalize_projection_term<'a, 'b, 'tcx>(
378
378
term : projected_term,
379
379
obligations : mut projected_obligations,
380
380
} ) ) => {
381
+ debug ! ( "opt_normalize_projection_type: progress" ) ;
381
382
// if projection succeeded, then what we get out of this
382
383
// is also non-normalized (consider: it was derived from
383
384
// an impl, where-clause etc) and hence we must
@@ -408,6 +409,7 @@ pub(super) fn opt_normalize_projection_term<'a, 'b, 'tcx>(
408
409
Ok ( Some ( result. value ) )
409
410
}
410
411
Ok ( Projected :: NoProgress ( projected_ty) ) => {
412
+ debug ! ( "opt_normalize_projection_type: no progress" ) ;
411
413
let result =
412
414
Normalized { value : projected_ty, obligations : PredicateObligations :: new ( ) } ;
413
415
infcx. inner . borrow_mut ( ) . projection_cache ( ) . insert_term ( cache_key, result. clone ( ) ) ;
@@ -621,8 +623,13 @@ struct Progress<'tcx> {
621
623
}
622
624
623
625
impl < ' tcx > Progress < ' tcx > {
624
- fn error ( tcx : TyCtxt < ' tcx > , guar : ErrorGuaranteed ) -> Self {
625
- Progress { term : Ty :: new_error ( tcx, guar) . into ( ) , obligations : PredicateObligations :: new ( ) }
626
+ fn error ( tcx : TyCtxt < ' tcx > , alias_term : ty:: AliasTerm < ' tcx > , guar : ErrorGuaranteed ) -> Self {
627
+ let err_term = if alias_term. kind ( tcx) . is_type ( ) {
628
+ Ty :: new_error ( tcx, guar) . into ( )
629
+ } else {
630
+ ty:: Const :: new_error ( tcx, guar) . into ( )
631
+ } ;
632
+ Progress { term : err_term, obligations : PredicateObligations :: new ( ) }
626
633
}
627
634
628
635
fn with_addl_obligations ( mut self , mut obligations : PredicateObligations < ' tcx > ) -> Self {
@@ -650,7 +657,7 @@ fn project<'cx, 'tcx>(
650
657
}
651
658
652
659
if let Err ( guar) = obligation. predicate . error_reported ( ) {
653
- return Ok ( Projected :: Progress ( Progress :: error ( selcx. tcx ( ) , guar) ) ) ;
660
+ return Ok ( Projected :: Progress ( Progress :: error ( selcx. tcx ( ) , obligation . predicate , guar) ) ) ;
654
661
}
655
662
656
663
let mut candidates = ProjectionCandidateSet :: None ;
@@ -1965,7 +1972,9 @@ fn confirm_impl_candidate<'cx, 'tcx>(
1965
1972
let param_env = obligation. param_env ;
1966
1973
let assoc_term = match specialization_graph:: assoc_def ( tcx, impl_def_id, assoc_item_id) {
1967
1974
Ok ( assoc_term) => assoc_term,
1968
- Err ( guar) => return Ok ( Projected :: Progress ( Progress :: error ( tcx, guar) ) ) ,
1975
+ Err ( guar) => {
1976
+ return Ok ( Projected :: Progress ( Progress :: error ( tcx, obligation. predicate , guar) ) ) ;
1977
+ }
1969
1978
} ;
1970
1979
1971
1980
// This means that the impl is missing a definition for the
0 commit comments