pub(crate) fn cannot_move_when_borrowed(
&self,
span: Span,
- desc: &str,
+ borrow_span: Span,
+ place: &str,
+ borrow_place: &str,
+ value_place: &str,
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
- struct_span_err!(self, span, E0505, "cannot move out of {} because it is borrowed", desc,)
+ self.infcx.tcx.sess.create_err(crate::session_diagnostics::MoveBorrow {
+ place,
+ span,
+ borrow_place,
+ value_place,
+ borrow_span,
+ })
}
pub(crate) fn cannot_use_when_mutably_borrowed(
err
}
- pub(crate) fn cannot_act_on_uninitialized_variable(
- &self,
- span: Span,
- verb: &str,
- desc: &str,
- ) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
- struct_span_err!(
- self,
- span,
- E0381,
- "{} of possibly-uninitialized variable: `{}`",
- verb,
- desc,
- )
- }
-
pub(crate) fn cannot_mutably_borrow_multiply(
&self,
new_loan_span: Span,
self,
new_loan_span,
E0501,
- "cannot borrow {}{} as {} because previous closure \
- requires unique access",
+ "cannot borrow {}{} as {} because previous closure requires unique access",
desc_new,
opt_via,
kind_new,
self,
closure_span,
E0373,
- "{} may outlive the current function, \
- but it borrows {}, \
- which is owned by the current function",
+ "{} may outlive the current function, but it borrows {}, which is owned by the current \
+ function",
closure_kind,
borrowed_path,
);
}
#[rustc_lint_diagnostics]
- fn struct_span_err_with_code<S: Into<MultiSpan>>(
+ pub(crate) fn struct_span_err_with_code<S: Into<MultiSpan>>(
&self,
sp: S,
msg: impl Into<DiagnosticMessage>,