@@ -750,6 +750,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
750
750
let kind_place = kind. filter ( |_| place_desc. is_some ( ) ) . map ( |k| ( k, place_span. 0 ) ) ;
751
751
let explanation = self . explain_why_borrow_contains_point ( location, & borrow, kind_place) ;
752
752
753
+ debug ! (
754
+ "report_borrowed_value_does_not_live_long_enough(place_desc: {:?}, explanation: {:?})" ,
755
+ place_desc,
756
+ explanation
757
+ ) ;
753
758
let err = match ( place_desc, explanation) {
754
759
( Some ( _) , _) if self . is_place_thread_local ( root_place) => {
755
760
self . report_thread_local_value_does_not_live_long_enough ( drop_span, borrow_span)
@@ -790,6 +795,24 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
790
795
span,
791
796
& format ! ( "`{}`" , name) ,
792
797
) ,
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
+ ) ,
793
816
(
794
817
ref name,
795
818
BorrowExplanation :: MustBeValidFor {
@@ -1214,6 +1237,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1214
1237
ConstraintCategory :: Return => {
1215
1238
err. span_note ( constraint_span, "closure is returned here" ) ;
1216
1239
}
1240
+ ConstraintCategory :: OpaqueType => {
1241
+ err. span_note ( constraint_span, "generator is returned here" ) ;
1242
+ }
1217
1243
ConstraintCategory :: CallArgument => {
1218
1244
fr_name. highlight_region_name ( & mut err) ;
1219
1245
err. span_note (
0 commit comments