Skip to content

mutability_errors.rs diag-mig #101301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
empty_label
  • Loading branch information
AndyJado committed Sep 3, 2022
commit 8e04a1c1fc7ac593dd6cd19357a6cd0e417f0b17
7 changes: 3 additions & 4 deletions compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// #![deny(rustc::untranslatable_diagnostic)]
// #![deny(rustc::diagnostic_outside_of_impl)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]

use rustc_errors::{
Applicability, Diagnostic, DiagnosticBuilder, EmissionGuarantee, ErrorGuaranteed,
Expand Down Expand Up @@ -1047,8 +1047,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
kind: hir::ImplItemKind::Fn(sig, _),
..
}) => {
//FIXME: empty string here don't pass lint
err.span_label(ident.span, "");
err.subdiagnostic(FnMutBumpFn::EmptyLabel { span: ident.span });
err.subdiagnostic(FnMutBumpFn::ReturnFnMut { span: sig.decl.output.span() });
err.subdiagnostic(FnMutBumpFn::Here { span: self.body.span });
}
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_borrowck/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub(crate) enum RequireStaticErr {
multi_span: MultiSpan,
},
}
//mutability_errors.rs

#[derive(SessionSubdiagnostic)]
pub(crate) enum ShowMutatingUpvar {
#[label(borrowck::require_mutable_binding)]
Expand Down Expand Up @@ -187,6 +187,11 @@ pub(crate) enum FnMutBumpFn<'a> {
#[primary_span]
span: Span,
},
#[label(borrowck::empty_label)]
EmptyLabel {
#[primary_span]
span: Span,
},
#[label(borrowck::in_this_closure)]
Here {
#[primary_span]
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_error_messages/locales/en-US/borrowck.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ borrowck_expects_fnmut_not_fn =
borrowck_expects_fn_not_fnmut =
expects `Fn` instead of `FnMut`

borrowck_empty_label = {""}

borrowck_in_this_closure =
in this closure

Expand Down