Skip to content

Commit cdee78c

Browse files
Improve errors for missing Debug and Display impls
1 parent f890596 commit cdee78c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/src/fmt/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ impl Display for Arguments<'_> {
564564
on(
565565
crate_local,
566566
label = "`{Self}` cannot be formatted using `{{:?}}`",
567-
note = "add `#[derive(Debug)]` or manually implement `{Debug}`"
567+
note = "add `#[derive(Debug)]` to `{Self}` or manually implement `{Debug}` for `{Self}`"
568568
),
569569
message = "`{Self}` doesn't implement `{Debug}`",
570570
label = "`{Self}` cannot be formatted using `{{:?}}` because it doesn't implement `{Debug}`"
@@ -662,6 +662,7 @@ pub use macros::Debug;
662662
note = "in format strings you may be able to use `{{:?}}` (or {{:#?}} for pretty-print) instead"
663663
)]
664664
#[doc(alias = "{}")]
665+
#[rustc_diagnostic_item = "display_trait"]
665666
#[stable(feature = "rust1", since = "1.0.0")]
666667
pub trait Display {
667668
/// Formats the value using the given formatter.

0 commit comments

Comments
 (0)