Skip to content

Commit 284ec37

Browse files
committed
lint: port missing debug impl diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
1 parent 28655bc commit 284ec37

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,6 @@ lint-builtin-impl-unsafe-method = implementation of an `unsafe` method
328328
lint-builtin-missing-doc = missing documentation for {$article} {$desc}
329329
330330
lint-builtin-missing-copy-impl = type could implement `Copy`; consider adding `impl Copy`
331+
332+
lint-builtin-missing-debug-impl =
333+
type does not implement `{$debug}`; consider adding `#[derive(Debug)]` or a manual implementation

compiler/rustc_lint/src/builtin.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -857,12 +857,9 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations {
857857

858858
if !self.impling_types.as_ref().unwrap().contains(&item.def_id) {
859859
cx.struct_span_lint(MISSING_DEBUG_IMPLEMENTATIONS, item.span, |lint| {
860-
lint.build(&format!(
861-
"type does not implement `{}`; consider adding `#[derive(Debug)]` \
862-
or a manual implementation",
863-
cx.tcx.def_path_str(debug)
864-
))
865-
.emit();
860+
lint.build(fluent::lint::builtin_missing_debug_impl)
861+
.set_arg("debug", cx.tcx.def_path_str(debug))
862+
.emit();
866863
});
867864
}
868865
}

0 commit comments

Comments
 (0)