fn cannot_uniquely_borrow_by_one_closure(
self,
new_loan_span: Span,
+ container_name: &str,
desc_new: &str,
opt_via: &str,
old_loan_span: Span,
);
err.span_label(
new_loan_span,
- format!("closure construction occurs here{}", opt_via),
+ format!("{} construction occurs here{}", container_name, opt_via),
);
err.span_label(old_loan_span, format!("borrow occurs here{}", old_opt_via));
if let Some(previous_end_span) = previous_end_span {
fn cannot_reborrow_already_uniquely_borrowed(
self,
new_loan_span: Span,
+ container_name: &str,
desc_new: &str,
opt_via: &str,
kind_new: &str,
err.span_label(new_loan_span, format!("borrow occurs here{}", opt_via));
err.span_label(
old_loan_span,
- format!("closure construction occurs here{}", old_opt_via),
+ format!("{} construction occurs here{}", container_name, old_opt_via),
);
if let Some(previous_end_span) = previous_end_span {
err.span_label(previous_end_span, "borrow from closure ends here");
) -> DiagnosticBuilder<'cx> {
let moved_path = moved_path
.map(|mp| format!(": `{}`", mp))
- .unwrap_or(String::new());
+ .unwrap_or_default();
let err = struct_span_err!(
self,
self.cancel_if_wrong_origin(err, o)
}
+ fn borrowed_data_escapes_closure(
+ self,
+ escape_span: Span,
+ escapes_from: &str,
+ o: Origin,
+ ) -> DiagnosticBuilder<'cx> {
+ let err = struct_span_err!(
+ self,
+ escape_span,
+ E0521,
+ "borrowed data escapes outside of {}{OGN}",
+ escapes_from,
+ OGN = o
+ );
+
+ self.cancel_if_wrong_origin(err, o)
+ }
+
fn thread_local_value_does_not_live_long_enough(
self,
span: Span,
self.cancel_if_wrong_origin(err, o)
}
+
+ fn temporary_value_borrowed_for_too_long(
+ self,
+ span: Span,
+ o: Origin,
+ ) -> DiagnosticBuilder<'cx> {
+ let err = struct_span_err!(
+ self,
+ span,
+ E0716,
+ "temporary value dropped while borrowed{OGN}",
+ OGN = o
+ );
+
+ self.cancel_if_wrong_origin(err, o)
+ }
}
impl<'cx, 'gcx, 'tcx> BorrowckErrors<'cx> for TyCtxt<'cx, 'gcx, 'tcx> {