about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-05 14:29:42 +0000
committerbors <bors@rust-lang.org>2018-05-05 14:29:42 +0000
commitfa30ae5c7ec5f097fb7b82dd6eb4c0d8d1d3f76a (patch)
tree1a974e37608b8b9047f13019591673af03fa5c36 /src/libcore
parent2d847dc90fd9dcfeb549bad91a306096dbe08f2d (diff)
parent1e38eee63b0a0a3429a59dd756c852116b4d3615 (diff)
downloadrust-fa30ae5c7ec5f097fb7b82dd6eb4c0d8d1d3f76a.tar.gz
rust-fa30ae5c7ec5f097fb7b82dd6eb4c0d8d1d3f76a.zip
Auto merge of #50441 - kornelski:debughint, r=kornelski
Suggest more helpful formatting string

Based on [user feedback](https://users.rust-lang.org/t/ux-feedback-from-a-rust-newbie/17220) the minimal suggestion of `:?` is unclear.

Also `{:#?}` is much more readable than the standard debug, so this PR suggests it to help surface this nice feature.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/fmt/mod.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 99e3012c9bf..5820fe58932 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -542,10 +542,10 @@ impl<'a> Display for Arguments<'a> {
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 #[rustc_on_unimplemented(
-    on(crate_local, label="`{Self}` cannot be formatted using `:?`; \
-                            add `#[derive(Debug)]` or manually implement `{Debug}`"),
+    on(crate_local, label="`{Self}` cannot be formatted using `{{:?}}`",
+                    note="add `#[derive(Debug)]` or manually implement `{Debug}`"),
     message="`{Self}` doesn't implement `{Debug}`",
-    label="`{Self}` cannot be formatted using `:?` because it doesn't implement `{Debug}`",
+    label="`{Self}` cannot be formatted using `{{:?}}` because it doesn't implement `{Debug}`",
 )]
 #[doc(alias = "{:?}")]
 #[lang = "debug_trait"]
@@ -610,8 +610,9 @@ pub trait Debug {
 /// ```
 #[rustc_on_unimplemented(
     message="`{Self}` doesn't implement `{Display}`",
-    label="`{Self}` cannot be formatted with the default formatter; \
-           try using `:?` instead if you are using a format string",
+    label="`{Self}` cannot be formatted with the default formatter",
+    note="in format strings you may be able to use `{{:?}}` \
+          (or {{:#?}} for pretty-print) instead",
 )]
 #[doc(alias = "{}")]
 #[stable(feature = "rust1", since = "1.0.0")]