rust/compiler/rustc_expand/src
Nicholas Nethercote 326b44e4d3 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.
2024-02-22 13:46:33 +11:00
..
mbe Auto merge of #120576 - nnethercote:merge-Diagnostic-DiagnosticBuilder, r=davidtwco 2024-02-20 12:05:09 +00:00
mut_visit rustc_ast: Turn MutVisitor::token_visiting_enabled into a constant 2021-10-18 00:23:24 +03:00
parse Add spacing information to delimiters. 2023-12-11 09:36:40 +11:00
tokenstream Remove TokenStreamBuilder. 2022-10-05 12:42:54 +11:00
base.rs Auto merge of #120576 - nnethercote:merge-Diagnostic-DiagnosticBuilder, r=davidtwco 2024-02-20 12:05:09 +00:00
build.rs Add async bound modifier to enable async Fn bounds 2024-01-31 16:59:19 +00:00
config.rs Reduce capabilities of Diagnostic. 2024-02-20 13:22:17 +11:00
errors.rs Rollup merge of #121288 - tshepang:make-expand-translatable, r=michaelwoerister 2024-02-21 08:55:56 +00:00
expand.rs Allow AST and HIR visitors to return ControlFlow 2024-02-18 03:49:28 -05:00
lib.rs macro_rules: Preserve all metavariable spans in a global side table 2024-02-18 11:19:24 +03:00
mbe.rs Add spacing information to delimiters. 2023-12-11 09:36:40 +11:00
module.rs Make DiagnosticBuilder::emit consuming. 2024-01-08 15:24:49 +11:00
placeholders.rs Give VariantData::Struct named fields, to clairfy recovered. 2023-12-20 00:07:34 +00:00
proc_macro.rs make "proc-macro derive panicked" translatable 2024-02-20 08:31:13 +02:00
proc_macro_server.rs Fix panic when compiling Rocket. 2024-02-22 13:46:33 +11:00
tests.rs Rename EmitterWriter as HumanEmitter. 2024-01-05 10:02:40 +11:00