about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-03-21 17:46:48 +0100
committerGitHub <noreply@github.com>2024-03-21 17:46:48 +0100
commit2e41425de635480bac45c554d5fbdddc34a62bd1 (patch)
tree75a7320bf253e3af8ba8f702673f241dd5901897 /compiler/rustc_codegen_llvm/src
parent2627e9f3012a97d3136b3e11bf6bd0853c38a534 (diff)
parent5568c569c03c8c22ce81185b9e49efcaa6866050 (diff)
downloadrust-2e41425de635480bac45c554d5fbdddc34a62bd1.tar.gz
rust-2e41425de635480bac45c554d5fbdddc34a62bd1.zip
Rollup merge of #122402 - weiznich:fix/122391, r=compiler-errors
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

r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions