about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-02-06 15:37:46 +0100
committerGitHub <noreply@github.com>2020-02-06 15:37:46 +0100
commit16e4e8f2de21601fb40e0419579a6126df8a1607 (patch)
tree3752b9398417ed46a631171dab013da5a57f81ab /src
parent226a8e2932c2280941de89341aa0d2aca4a40c9f (diff)
parentc0a110f7e6b8f8eab2d5c8c9cfc3e86c37ef2fd8 (diff)
downloadrust-16e4e8f2de21601fb40e0419579a6126df8a1607.tar.gz
rust-16e4e8f2de21601fb40e0419579a6126df8a1607.zip
Rollup merge of #68844 - euclio:debug-impl-def-path, r=petrochenkov
use def_path_str for missing_debug_impls message

The lint message will now use the full, correct path to the `Debug`
trait, even in `no_std`.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_lint/builtin.rs11
-rw-r--r--src/test/ui/missing_debug_impls.rs4
-rw-r--r--src/test/ui/missing_debug_impls.stderr4
3 files changed, 11 insertions, 8 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index f024bb0e8b5..ca66717ac5e 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -555,7 +555,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations {
 declare_lint! {
     MISSING_DEBUG_IMPLEMENTATIONS,
     Allow,
-    "detects missing implementations of fmt::Debug"
+    "detects missing implementations of Debug"
 }
 
 #[derive(Default)]
@@ -599,9 +599,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations {
             cx.span_lint(
                 MISSING_DEBUG_IMPLEMENTATIONS,
                 item.span,
-                "type does not implement `fmt::Debug`; consider adding `#[derive(Debug)]` \
-                          or a manual implementation",
-            )
+                &format!(
+                    "type does not implement `{}`; consider adding `#[derive(Debug)]` \
+                     or a manual implementation",
+                    cx.tcx.def_path_str(debug)
+                ),
+            );
         }
     }
 }
diff --git a/src/test/ui/missing_debug_impls.rs b/src/test/ui/missing_debug_impls.rs
index ff919292ae2..72fcba51588 100644
--- a/src/test/ui/missing_debug_impls.rs
+++ b/src/test/ui/missing_debug_impls.rs
@@ -4,7 +4,7 @@
 
 use std::fmt;
 
-pub enum A {} //~ ERROR type does not implement `fmt::Debug`
+pub enum A {} //~ ERROR type does not implement `std::fmt::Debug`
 
 #[derive(Debug)]
 pub enum B {}
@@ -17,7 +17,7 @@ impl fmt::Debug for C {
     }
 }
 
-pub struct Foo; //~ ERROR type does not implement `fmt::Debug`
+pub struct Foo; //~ ERROR type does not implement `std::fmt::Debug`
 
 #[derive(Debug)]
 pub struct Bar;
diff --git a/src/test/ui/missing_debug_impls.stderr b/src/test/ui/missing_debug_impls.stderr
index 5f8adb791f6..51c65589b0c 100644
--- a/src/test/ui/missing_debug_impls.stderr
+++ b/src/test/ui/missing_debug_impls.stderr
@@ -1,4 +1,4 @@
-error: type does not implement `fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation
+error: type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation
   --> $DIR/missing_debug_impls.rs:7:1
    |
 LL | pub enum A {}
@@ -10,7 +10,7 @@ note: the lint level is defined here
 LL | #![deny(missing_debug_implementations)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: type does not implement `fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation
+error: type does not implement `std::fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation
   --> $DIR/missing_debug_impls.rs:20:1
    |
 LL | pub struct Foo;