@@ -31,7 +31,7 @@ use crate::session_diagnostics::{
3131} ;
3232
3333use super :: { OutlivesSuggestionBuilder , RegionName } ;
34- use crate :: region_infer:: BlameConstraint ;
34+ use crate :: region_infer:: { BlameConstraint , ExtraConstraintInfo } ;
3535use crate :: {
3636 nll:: ConstraintDescription ,
3737 region_infer:: { values:: RegionElement , TypeTest } ,
@@ -354,12 +354,11 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
354354 ) {
355355 debug ! ( "report_region_error(fr={:?}, outlived_fr={:?})" , fr, outlived_fr) ;
356356
357- let BlameConstraint { category, cause, variance_info, .. } = self
358- . regioncx
359- . best_blame_constraint ( fr, fr_origin, |r| {
357+ let ( blame_constraint, extra_info) =
358+ self . regioncx . best_blame_constraint ( fr, fr_origin, |r| {
360359 self . regioncx . provides_universal_region ( r, fr, outlived_fr)
361- } )
362- . 0 ;
360+ } ) ;
361+ let BlameConstraint { category , cause , variance_info , .. } = blame_constraint ;
363362
364363 debug ! ( "report_region_error: category={:?} {:?} {:?}" , category, cause, variance_info) ;
365364
@@ -468,6 +467,14 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
468467 }
469468 }
470469
470+ for extra in extra_info {
471+ match extra {
472+ ExtraConstraintInfo :: PlaceholderFromPredicate ( span) => {
473+ diag. span_note ( span, format ! ( "due to current limitations in the borrow checker, this implies a `'static` lifetime" ) ) ;
474+ }
475+ }
476+ }
477+
471478 self . buffer_error ( diag) ;
472479 }
473480
@@ -559,6 +566,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
559566 /// LL | ref_obj(x)
560567 /// | ^^^^^^^^^^ `x` escapes the function body here
561568 /// ```
569+ #[ instrument( level = "debug" , skip( self ) ) ]
562570 fn report_escaping_data_error (
563571 & self ,
564572 errci : & ErrorConstraintInfo < ' tcx > ,
0 commit comments