Skip to content

bug in parser #33855

Closed
Closed
@eqv

Description

@eqv

The following simple lib.rs file crashes the compiler:

macro_rules! implement_migration{ ( $(update( $($updates:expr),+) );+; ) => (
        fn from_wire_format(v: u64)  {
            match v {
                $(expand_updates!($updates),*)
                _ => {},
            }
        }
    )
}

with the error:

                              ^~
src/lib.rs:6:19: 6:21 error: expected `*` or `+`
src/lib.rs:6                 _ => {},
                               ^~
error: internal compiler error: error: internal compiler error: unexpected panicunexpected panic

note: note: the compiler unexpectedly panicked. this is a bug.
the compiler unexpectedly panicked. this is a bug.note: 
we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reportsrun with `RUST_BACKTRACE=1` for a backtrace
note: 
run with `RUST_BACKTRACE=1` for a backtracethread 'rustc' panicked at 'internal error: entered unreachable code', ../src/libsyntax/parse/parser.rs:2855
stack backtrace:
   1:     0x7f4213f6c3f0 - std::sys::backtrace::tracing::imp::write::h714760a4c8c0cdd8
   2:     0x7f4213f79aab - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hff309ab1d83ffd90
   3:     0x7f4213f7964b - std::panicking::default_hook::h08ad3bb09872855b
   4:     0x7f4213f3d3ef - std::sys_common::unwind::begin_unwind_inner::h406d5f1a330b854b
   5:     0x7f420c563d6f - std::sys_common::unwind::begin_unwind::h51df842978a11a26
   6:     0x7f420c65187d - syntax::parse::parser::Parser::parse_token_tree::h6c668a60b047dd39
   7:     0x7f420c64ff0f - syntax::parse::parser::Parser::parse_token_tree::h6c668a60b047dd39
   8:     0x7f420c64ff0f - syntax::parse::parser::Parser::parse_token_tree::h6c668a60b047dd39
   9:     0x7f420c89ae41 - syntax::ext::tt::macro_parser::parse_nt::h37cf0a71fb5bb85b
  10:     0x7f420c5b07ca - syntax::ext::tt::macro_parser::parse::h95e6e8190353a706
  11:     0x7f420c7cba01 - syntax::ext::tt::macro_rules::compile::h3254e1a46d663b45
  12:     0x7f420c7cae90 - syntax::ext::base::ExtCtxt::insert_macro::he298da362a7b2a97
  13:     0x7f420c8213b5 - syntax::ext::expand::expand_item_mac::h4cbcc9da1cdde24f
  14:     0x7f420c80ee41 - syntax::ext::expand::expand_annotatable::hd0129691b0f8b93d
  15:     0x7f420c80c108 - syntax::ext::expand::expand_item::h56ee539b7cde8407
  16:     0x7f420c81a47e - _<ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_item::hdce1cac1401f2259
  17:     0x7f420c81a0a3 - syntax::fold::noop_fold_mod::h0679922c15e93846
  18:     0x7f420c813588 - syntax::ext::expand::expand_item_kind::ha057f5cdbbf45776
  19:     0x7f420c84f75e - syntax::fold::noop_fold_item_simple::hd97c1ad63a18a2c4
  20:     0x7f420c84f2c0 - syntax::fold::noop_fold_item::h75db078a454ca3ad
  21:     0x7f420c8106b0 - syntax::ext::expand::expand_annotatable::hd0129691b0f8b93d
  22:     0x7f420c80c108 - syntax::ext::expand::expand_item::h56ee539b7cde8407
  23:     0x7f420c81a76e - _<ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_item::hdce1cac1401f2259
  24:     0x7f420c85b66b - _<ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_crate::he184cdd28c91132e
  25:     0x7f420c85cb2a - syntax::ext::expand::expand_crate::h9521fe412e412c78
  26:     0x7f421450669b - rustc_driver::driver::phase_2_configure_and_expand::_$u7b$$u7b$closure$u7d$$u7d$::ha17e10ff1fe4303c
  27:     0x7f42144b1c81 - rustc_driver::driver::phase_2_configure_and_expand::hd8abf650d2d5e04d
  28:     0x7f4214495d7a - rustc_driver::driver::compile_input::h650fe5b01cb8d74d
  29:     0x7f421447e1b4 - rustc_driver::run_compiler::h68d23e0e9b7b247d
  30:     0x7f421447b621 - std::sys_common::unwind::try::try_fn::h67fde221a73148bc
  31:     0x7f4213f69a6b - __rust_try
  32:     0x7f4213f699fd - std::sys_common::unwind::inner_try::h4e97625a08807651
  33:     0x7f421447be6a - _<F as std..boxed..FnBox<A>>::call_box::hc8936fa120642c49
  34:     0x7f4213f77c34 - std::sys::thread::Thread::new::thread_start::h74af400293164137
  35:     0x7f420be26181 - start_thread
  36:     0x7f4213bc447c - __clone
  37:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions