You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #117205 - weiznich:multiple_notes_for_on_unimplemented, r=compiler-errors
Allows `#[diagnostic::on_unimplemented]` attributes to have multiple
notes
This commit extends the `#[diagnostic::on_unimplemented]` (and `#[rustc_on_unimplemented]`) attributes to allow multiple `note` options. This enables emitting multiple notes for custom error messages. For now I've opted to not change any of the existing usages of `#[rustc_on_unimplemented]` and just updated the relevant compile tests.
r? `@compiler-errors`
I'm happy to adjust any of the existing changed location to emit the old error message if that's desired.
Copy file name to clipboardexpand all lines: tests/ui/diagnostic_namespace/on_unimplemented/ignore_unsupported_options_and_continue_to_use_fallback.stderr
+1
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ LL | takes_foo(());
26
26
|
27
27
= help: the trait `Foo` is not implemented for `()`
28
28
= note: custom note
29
+
= note: fallback note
29
30
help: this trait has no implementations, consider adding one
Copy file name to clipboardexpand all lines: tests/ui/suggestions/path-display.stderr
+2
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ LL | println!("{}", path);
5
5
| ^^^^ `Path` cannot be formatted with the default formatter; call `.display()` on it
6
6
|
7
7
= help: the trait `std::fmt::Display` is not implemented for `Path`
8
+
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
8
9
= note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data
9
10
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
10
11
@@ -15,6 +16,7 @@ LL | println!("{}", path);
15
16
| ^^^^ `PathBuf` cannot be formatted with the default formatter; call `.display()` on it
16
17
|
17
18
= help: the trait `std::fmt::Display` is not implemented for `PathBuf`
19
+
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
18
20
= note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data
19
21
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
0 commit comments