about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/tests.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-22 11:53:40 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-22 13:46:33 +1100
commit326b44e4d371644e8d48469087d763085b6c7711 (patch)
tree05ee3d916aacdb0c53d722e8958237ab177df5ee /compiler/rustc_mir_transform/src/coverage/tests.rs
parentf8131a48a46ac3bc8a3d0fe0477055b132cffdc3 (diff)
downloadrust-326b44e4d371644e8d48469087d763085b6c7711.tar.gz
rust-326b44e4d371644e8d48469087d763085b6c7711.zip
Fix panic when compiling `Rocket`.
`Rustc::emit_diagnostic` reconstructs a diagnostic passed in from the
macro machinery. Currently it uses the type `DiagnosticBuilder<'_,
ErrorGuaranteed>`, which is incorrect, because the diagnostic might be a
warning. And if it is a warning, because of the `ErrorGuaranteed` we end
up calling into `emit_producing_error_guaranteed` and the assertion
within that function (correctly) fails because the level is not an error
level.

The fix is simple: change the type to `DiagnosticBuilder<'_, ()>`. Using
`()` works no matter what the diagnostic level is, and we don't need an
`ErrorGuaranteed` here.

The panic was reported in #120576.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/tests.rs')
0 files changed, 0 insertions, 0 deletions