diff options
| author | David Wood <david.wood@huawei.com> | 2022-06-28 11:27:26 +0100 |
|---|---|---|
| committer | David Wood <david.wood@huawei.com> | 2022-06-30 08:59:22 +0100 |
| commit | 284ec37810f7d93cee6fd0a177220fc55afb7755 (patch) | |
| tree | cd2b6dde28d3138e8be61242c70e0ce79e85b9ee | |
| parent | 28655bc95537efa467dde736b9c1ded59b95b564 (diff) | |
| download | rust-284ec37810f7d93cee6fd0a177220fc55afb7755.tar.gz rust-284ec37810f7d93cee6fd0a177220fc55afb7755.zip | |
lint: port missing debug impl diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
| -rw-r--r-- | compiler/rustc_error_messages/locales/en-US/lint.ftl | 3 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 9 |
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_error_messages/locales/en-US/lint.ftl b/compiler/rustc_error_messages/locales/en-US/lint.ftl index 7375e4fcadb..fd1d1a8dc2f 100644 --- a/compiler/rustc_error_messages/locales/en-US/lint.ftl +++ b/compiler/rustc_error_messages/locales/en-US/lint.ftl @@ -328,3 +328,6 @@ lint-builtin-impl-unsafe-method = implementation of an `unsafe` method lint-builtin-missing-doc = missing documentation for {$article} {$desc} lint-builtin-missing-copy-impl = type could implement `Copy`; consider adding `impl Copy` + +lint-builtin-missing-debug-impl = + type does not implement `{$debug}`; consider adding `#[derive(Debug)]` or a manual implementation diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index c33e9561c1a..82b283ad4b5 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -857,12 +857,9 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations { if !self.impling_types.as_ref().unwrap().contains(&item.def_id) { cx.struct_span_lint(MISSING_DEBUG_IMPLEMENTATIONS, item.span, |lint| { - lint.build(&format!( - "type does not implement `{}`; consider adding `#[derive(Debug)]` \ - or a manual implementation", - cx.tcx.def_path_str(debug) - )) - .emit(); + lint.build(fluent::lint::builtin_missing_debug_impl) + .set_arg("debug", cx.tcx.def_path_str(debug)) + .emit(); }); } } |
