Skip to content

Commit ceca8c3

Browse files
committed
remain case: empty fluent string
1 parent b7444c5 commit ceca8c3

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1024,8 +1024,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
10241024
_ => None,
10251025
};
10261026
if let Some(span) = arg {
1027-
err.subdiagnostic(FnMutBumpFn::NotFnHere { span });
1028-
err.subdiagnostic(FnMutBumpFn::NotFnMutHere { span: func.span });
1027+
err.subdiagnostic(FnMutBumpFn::AcceptFnMut { span });
1028+
err.subdiagnostic(FnMutBumpFn::AcceptFn { span: func.span });
10291029
err.subdiagnostic(FnMutBumpFn::Here { span: self.body.span });
10301030
look_at_return = false;
10311031
}
@@ -1047,12 +1047,10 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
10471047
kind: hir::ImplItemKind::Fn(sig, _),
10481048
..
10491049
}) => {
1050+
//FIXME: empty string here don't pass lint
10501051
err.span_label(ident.span, "");
1051-
err.span_label(
1052-
sig.decl.output.span(),
1053-
"change this to return `FnMut` instead of `Fn`",
1054-
);
1055-
err.span_label(self.body.span, "in this closure");
1052+
err.subdiagnostic(FnMutBumpFn::ReturnFnMut { span: sig.decl.output.span() });
1053+
err.subdiagnostic(FnMutBumpFn::Here { span: self.body.span });
10561054
}
10571055
_ => {}
10581056
}

compiler/rustc_borrowck/src/session_diagnostics.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ pub(crate) enum FnMutBumpFn<'a> {
178178
sp: Span,
179179
},
180180
#[label(borrowck::expects_fnmut_not_fn)]
181-
NotFnHere {
181+
AcceptFnMut {
182182
#[primary_span]
183183
span: Span,
184184
},
185185
#[label(borrowck::expects_fn_not_fnmut)]
186-
NotFnMutHere {
186+
AcceptFn {
187187
#[primary_span]
188188
span: Span,
189189
},
@@ -192,4 +192,9 @@ pub(crate) enum FnMutBumpFn<'a> {
192192
#[primary_span]
193193
span: Span,
194194
},
195+
#[label(borrowck::return_fnmut)]
196+
ReturnFnMut {
197+
#[primary_span]
198+
span: Span,
199+
},
195200
}

compiler/rustc_error_messages/locales/en-US/borrowck.ftl

+2
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,5 @@ borrowck_expects_fn_not_fnmut =
7474
borrowck_in_this_closure =
7575
in this closure
7676
77+
borrowck_return_fnmut =
78+
change this to return `FnMut` instead of `Fn`

0 commit comments

Comments
 (0)