Closed
Description
rustc crashes on the following input, found by fuzz_rustc:
macro_rules!test{($l:expr,$_:r)=>({const:y y)}
fn s(){test!(1,i)}
$ rustc bug.rs
error: mismatched closing delimiter: `)`
--> bug.rs:1:35
|
1 | macro_rules!test{($l:expr,$_:r)=>({const:y y)}
| -^ ^ mismatched closing delimiter
| ||
| |unclosed delimiter
| closing delimiter possibly meant for this
error: invalid fragment specifier `r`
--> bug.rs:1:27
|
1 | macro_rules!test{($l:expr,$_:r)=>({const:y y)}
| ^^^^
|
= help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
error: expected identifier, found keyword `const`
--> bug.rs:1:36
|
1 | macro_rules!test{($l:expr,$_:r)=>({const:y y)}
| ^^^^^ expected identifier, found keyword
2 |
3 | fn s(){test!(1,i)}
| ---------- in this macro invocation
|
= note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
help: escape `const` to use it as an identifier
|
1 | macro_rules!test{($l:expr,$_:r)=>({r#const:y y)}
| ++
thread 'rustc' panicked at 'expected non-translatable diagnostic message', compiler/rustc_error_messages/src/lib.rs:349:18
stack backtrace:
0: 0x7fa3a076c460 - std::backtrace_rs::backtrace::libunwind::trace::hab36ac9237175c04
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
1: 0x7fa3a076c460 - std::backtrace_rs::backtrace::trace_unsynchronized::h1564f1268a5216f0
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fa3a076c460 - std::sys_common::backtrace::_print_fmt::hac27c34a5b2f4ffb
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/sys_common/backtrace.rs:66:5
3: 0x7fa3a076c460 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h465811d7c5d92b76
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/sys_common/backtrace.rs:45:22
4: 0x7fa3a07c842e - core::fmt::write::h54cba5d5c8d6dce9
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/core/src/fmt/mod.rs:1209:17
5: 0x7fa3a075c645 - std::io::Write::write_fmt::h50cc62d6ddf5e7e8
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/io/mod.rs:1679:15
6: 0x7fa3a076f203 - std::sys_common::backtrace::_print::h0cea32817bcb8d62
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/sys_common/backtrace.rs:48:5
7: 0x7fa3a076f203 - std::sys_common::backtrace::print::h6bea8d931fa08f99
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/sys_common/backtrace.rs:35:9
8: 0x7fa3a076f203 - std::panicking::default_hook::{{closure}}::h43a7ba33989c8022
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/panicking.rs:267:22
9: 0x7fa3a076eeda - std::panicking::default_hook::hcf767613975331ea
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/panicking.rs:286:9
10: 0x7fa3a30b2481 - rustc_driver[237e7e66a4131160]::DEFAULT_HOOK::{closure#0}::{closure#0}
11: 0x7fa3a076fa3b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h57ecc49ea7a84529
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/alloc/src/boxed.rs:1952:9
12: 0x7fa3a076fa3b - std::panicking::rust_panic_with_hook::ha9eb3b9804e3ced0
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/panicking.rs:673:13
13: 0x7fa3a076f851 - std::panicking::begin_panic_handler::{{closure}}::h64ee9f3bda89f283
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/panicking.rs:558:13
14: 0x7fa3a076c90c - std::sys_common::backtrace::__rust_end_short_backtrace::hebc6b64e793da45f
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/sys_common/backtrace.rs:138:18
15: 0x7fa3a076f5b2 - rust_begin_unwind
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/panicking.rs:556:5
16: 0x7fa3a07c5003 - core::panicking::panic_fmt::ha04a4224b9300698
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/core/src/panicking.rs:142:14
17: 0x7fa3a42a77ef - <rustc_error_messages[b7722f0beb847c22]::DiagnosticMessage>::expect_str
18: 0x7fa3a24869a4 - <rustc_expand[99b4c1a0d393d44f]::mbe::macro_rules::ParserAnyMacro>::make
19: 0x7fa3a2fe34dd - <rustc_expand[99b4c1a0d393d44f]::mbe::macro_rules::ParserAnyMacro as rustc_expand[99b4c1a0d393d44f]::base::MacResult>::make_expr
20: 0x7fa3a2749992 - <rustc_expand[99b4c1a0d393d44f]::expand::MacroExpander>::fully_expand_fragment
21: 0x7fa3a1d927c3 - <rustc_expand[99b4c1a0d393d44f]::expand::MacroExpander>::expand_crate
22: 0x7fa3a1d919a0 - <rustc_session[2b1647d71bfc4162]::session::Session>::time::<core[2f45054cb0339e39]::result::Result<rustc_ast[ea39079b98d97005]::ast::Crate, rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>, rustc_interface[68feece4527b990]::passes::configure_and_expand::{closure#1}>
23: 0x7fa3a1d5ca53 - rustc_interface[68feece4527b990]::passes::configure_and_expand
24: 0x7fa3a1d56085 - <rustc_interface[68feece4527b990]::queries::Queries>::expansion
25: 0x7fa3a1d53d0c - <rustc_interface[68feece4527b990]::interface::Compiler>::enter::<rustc_driver[237e7e66a4131160]::run_compiler::{closure#1}::{closure#2}, core[2f45054cb0339e39]::result::Result<core[2f45054cb0339e39]::option::Option<rustc_interface[68feece4527b990]::queries::Linker>, rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>>
26: 0x7fa3a1d4ee4c - rustc_span[264e770df865a5e1]::with_source_map::<core[2f45054cb0339e39]::result::Result<(), rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>, rustc_interface[68feece4527b990]::interface::create_compiler_and_run<core[2f45054cb0339e39]::result::Result<(), rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>, rustc_driver[237e7e66a4131160]::run_compiler::{closure#1}>::{closure#1}>
27: 0x7fa3a1d4e84f - rustc_interface[68feece4527b990]::interface::create_compiler_and_run::<core[2f45054cb0339e39]::result::Result<(), rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>, rustc_driver[237e7e66a4131160]::run_compiler::{closure#1}>
28: 0x7fa3a1d4dc92 - <scoped_tls[eac668962b7404b4]::ScopedKey<rustc_span[264e770df865a5e1]::SessionGlobals>>::set::<rustc_interface[68feece4527b990]::interface::run_compiler<core[2f45054cb0339e39]::result::Result<(), rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>, rustc_driver[237e7e66a4131160]::run_compiler::{closure#1}>::{closure#0}, core[2f45054cb0339e39]::result::Result<(), rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>>
29: 0x7fa3a1d4d97f - std[ea69dece37053cb8]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[68feece4527b990]::util::run_in_thread_pool_with_globals<rustc_interface[68feece4527b990]::interface::run_compiler<core[2f45054cb0339e39]::result::Result<(), rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>, rustc_driver[237e7e66a4131160]::run_compiler::{closure#1}>::{closure#0}, core[2f45054cb0339e39]::result::Result<(), rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>>::{closure#0}, core[2f45054cb0339e39]::result::Result<(), rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>>
30: 0x7fa3a2ec6ca0 - <<std[ea69dece37053cb8]::thread::Builder>::spawn_unchecked_<rustc_interface[68feece4527b990]::util::run_in_thread_pool_with_globals<rustc_interface[68feece4527b990]::interface::run_compiler<core[2f45054cb0339e39]::result::Result<(), rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>, rustc_driver[237e7e66a4131160]::run_compiler::{closure#1}>::{closure#0}, core[2f45054cb0339e39]::result::Result<(), rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>>::{closure#0}, core[2f45054cb0339e39]::result::Result<(), rustc_errors[c29306613d1e9c09]::ErrorGuaranteed>>::{closure#1} as core[2f45054cb0339e39]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
31: 0x7fa3a0779643 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h569d106cfed3b1a5
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/alloc/src/boxed.rs:1938:9
32: 0x7fa3a0779643 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha784c779129e61fe
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/alloc/src/boxed.rs:1938:9
33: 0x7fa3a0779643 - std::sys::unix::thread::Thread::new::thread_start::h4108e49084be78e5
at /rustc/81f391930301afbc121b7c468138069daa354bf8/library/std/src/sys/unix/thread.rs:108:17
34: 0x7fa3a0494b43 - start_thread
at ./nptl/./nptl/pthread_create.c:442:8
35: 0x7fa3a0526a00 - clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
36: 0x0 - <unknown>
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.66.0-nightly (81f391930 2022-10-09) running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
error: aborting due to 3 previous errors