@@ -750,6 +750,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
750750 let kind_place = kind. filter ( |_| place_desc. is_some ( ) ) . map ( |k| ( k, place_span. 0 ) ) ;
751751 let explanation = self . explain_why_borrow_contains_point ( location, & borrow, kind_place) ;
752752
753+ debug ! (
754+ "report_borrowed_value_does_not_live_long_enough(place_desc: {:?}, explanation: {:?})" ,
755+ place_desc,
756+ explanation
757+ ) ;
753758 let err = match ( place_desc, explanation) {
754759 ( Some ( _) , _) if self . is_place_thread_local ( root_place) => {
755760 self . report_thread_local_value_does_not_live_long_enough ( drop_span, borrow_span)
@@ -790,6 +795,24 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
790795 span,
791796 & format ! ( "`{}`" , name) ,
792797 ) ,
798+ (
799+ Some ( ref name) ,
800+ BorrowExplanation :: MustBeValidFor {
801+ category : category @ ConstraintCategory :: OpaqueType ,
802+ from_closure : false ,
803+ ref region_name,
804+ span,
805+ ..
806+ } ,
807+
808+ ) if borrow_spans. for_generator ( ) => self . report_escaping_closure_capture (
809+ borrow_spans. args_or_use ( ) ,
810+ borrow_span,
811+ region_name,
812+ category,
813+ span,
814+ & format ! ( "`{}`" , name) ,
815+ ) ,
793816 (
794817 ref name,
795818 BorrowExplanation :: MustBeValidFor {
@@ -1214,6 +1237,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12141237 ConstraintCategory :: Return => {
12151238 err. span_note ( constraint_span, "closure is returned here" ) ;
12161239 }
1240+ ConstraintCategory :: OpaqueType => {
1241+ err. span_note ( constraint_span, "generator is returned here" ) ;
1242+ }
12171243 ConstraintCategory :: CallArgument => {
12181244 fr_name. highlight_region_name ( & mut err) ;
12191245 err. span_note (
0 commit comments