Skip to content

Commit e79e01c

Browse files
committed
Implement DesugaringKind::FormatLiteral
1 parent d14f659 commit e79e01c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

core/src/fmt/mod.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -855,11 +855,13 @@ impl Display for Arguments<'_> {
855855
#[rustc_on_unimplemented(
856856
on(
857857
crate_local,
858-
label = "`{Self}` cannot be formatted using `{{:?}}`",
859858
note = "add `#[derive(Debug)]` to `{Self}` or manually `impl {This} for {Self}`"
860859
),
861-
message = "`{Self}` doesn't implement `{This}`",
862-
label = "`{Self}` cannot be formatted using `{{:?}}` because it doesn't implement `{This}`"
860+
on(
861+
from_desugaring = "FormatLiteral",
862+
label = "`{Self}` cannot be formatted using `{{:?}}` because it doesn't implement `{This}`"
863+
),
864+
message = "`{Self}` doesn't implement `{This}`"
863865
)]
864866
#[doc(alias = "{:?}")]
865867
#[rustc_diagnostic_item = "Debug"]
@@ -986,11 +988,14 @@ pub use macros::Debug;
986988
any(Self = "std::path::Path", Self = "std::path::PathBuf"),
987989
label = "`{Self}` cannot be formatted with the default formatter; call `.display()` on it",
988990
note = "call `.display()` or `.to_string_lossy()` to safely print paths, \
989-
as they may contain non-Unicode data"
991+
as they may contain non-Unicode data",
992+
),
993+
on(
994+
from_desugaring = "FormatLiteral",
995+
note = "in format strings you may be able to use `{{:?}}` (or {{:#?}} for pretty-print) instead",
996+
label = "`{Self}` cannot be formatted with the default formatter",
990997
),
991-
message = "`{Self}` doesn't implement `{This}`",
992-
label = "`{Self}` cannot be formatted with the default formatter",
993-
note = "in format strings you may be able to use `{{:?}}` (or {{:#?}} for pretty-print) instead"
998+
message = "`{Self}` doesn't implement `{This}`"
994999
)]
9951000
#[doc(alias = "{}")]
9961001
#[rustc_diagnostic_item = "Display"]

0 commit comments

Comments
 (0)