Skip to content

Commit

Permalink
How to call this bug?
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyJado committed Sep 1, 2022
1 parent c480d9a commit 71d1762
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
15 changes: 7 additions & 8 deletions compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,14 @@ impl<'tcx> BorrowExplanation<'tcx> {
};
err.subdiagnostic(sub_label);
} else {
err.span_label(
//FIXME: src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.rs
let sub_label = MustValidFor::Lasts {
category: category.description(),
borrow_desc,
region_name,
span,
format!(
"{}requires that {}borrow lasts for `{}`",
category.description(),
borrow_desc,
region_name,
),
);
};
err.subdiagnostic(sub_label);
};

self.add_lifetime_bound_suggestion_to_diagnostic(err, &category, span, region_name);
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_borrowck/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,13 @@ pub(crate) enum MustValidFor<'a> {
#[primary_span]
span: Span,
},

#[label(borrowck::outlive_constraint_need_borrow_lasts_for)]
Lasts {
category: &'a str,
borrow_desc: &'a str,
region_name: &'a RegionName,
#[primary_span]
span: Span,
},
}

0 comments on commit 71d1762

Please sign in to comment.