rust/tests/ui/diagnostic_namespace/on_unimplemented
Georg Semmler 5568c569c0
Make `#[diagnostic::on_unimplemented]` format string parsing more robust
This commit fixes several issues with the format string parsing of the
`#[diagnostic::on_unimplemented]` attribute that were pointed out by
@ehuss.
In detail it fixes:

* Appearing format specifiers (display, etc). For these we generate a
warning that the specifier is unsupported. Otherwise we ignore them
* Positional arguments. For these we generate a warning that positional
arguments are unsupported in that location and replace them with the
format string equivalent (so `{}` or `{n}` where n is the index of the
positional argument)
* Broken format strings with enclosed }. For these we generate a warning
about the broken format string and set the emitted message literally to
the provided unformatted string
* Unknown format specifiers. For these we generate an additional warning
about the unknown specifier. Otherwise we emit the literal string as
message.

This essentially makes those strings behave like `format!` with the
minor difference that we do not generate hard errors but only warnings.
After that we continue trying to do something unsuprising (mostly either
ignoring the broken parts or falling back to just giving back the
literal string as provided).

Fix #122391
2024-03-21 08:27:26 +01:00
..
auxiliary Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
broken_format.rs Make `#[diagnostic::on_unimplemented]` format string parsing more robust 2024-03-21 08:27:26 +01:00
broken_format.stderr Make `#[diagnostic::on_unimplemented]` format string parsing more robust 2024-03-21 08:27:26 +01:00
do_not_accept_options_of_the_internal_rustc_attribute.rs Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
do_not_accept_options_of_the_internal_rustc_attribute.stderr Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
do_not_fail_parsing_on_invalid_options_1.rs Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
do_not_fail_parsing_on_invalid_options_1.stderr Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
error_is_shown_in_downstream_crates.rs [AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives 2024-02-16 20:02:50 +00:00
error_is_shown_in_downstream_crates.stderr Add a test that emitting diagnostics does not require the crate to use 2024-01-05 15:23:10 +01:00
ignore_unsupported_options_and_continue_to_use_fallback.rs Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
ignore_unsupported_options_and_continue_to_use_fallback.stderr Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
multiple_notes.rs Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
multiple_notes.stderr Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
on_unimplemented_simple.rs Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
on_unimplemented_simple.stderr Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
report_warning_on_duplicated_options.rs Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00
report_warning_on_duplicated_options.stderr Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute 2024-02-27 08:50:56 +01:00