Skip to content

Commit 71d1762

Browse files
committed
How to call this bug?
1 parent c480d9a commit 71d1762

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,14 @@ impl<'tcx> BorrowExplanation<'tcx> {
305305
};
306306
err.subdiagnostic(sub_label);
307307
} else {
308-
err.span_label(
308+
//FIXME: src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.rs
309+
let sub_label = MustValidFor::Lasts {
310+
category: category.description(),
311+
borrow_desc,
312+
region_name,
309313
span,
310-
format!(
311-
"{}requires that {}borrow lasts for `{}`",
312-
category.description(),
313-
borrow_desc,
314-
region_name,
315-
),
316-
);
314+
};
315+
err.subdiagnostic(sub_label);
317316
};
318317

319318
self.add_lifetime_bound_suggestion_to_diagnostic(err, &category, span, region_name);

compiler/rustc_borrowck/src/session_diagnostics.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,13 @@ pub(crate) enum MustValidFor<'a> {
321321
#[primary_span]
322322
span: Span,
323323
},
324+
325+
#[label(borrowck::outlive_constraint_need_borrow_lasts_for)]
326+
Lasts {
327+
category: &'a str,
328+
borrow_desc: &'a str,
329+
region_name: &'a RegionName,
330+
#[primary_span]
331+
span: Span,
332+
},
324333
}

0 commit comments

Comments
 (0)