Skip to content

ICE on bad macro definition syntax #23102

Closed
@dmo2118

Description

@dmo2118

(Not exactly a show stopper here, but the message did say to file a bug report.)

I tried this code:

macro_rules! mack_row {
    hello => ()
}

I expected to see a syntax error happen. Instead, this happened:

hello.rs:1:1: 3:2 error: internal compiler error: wrong-structured lhs for follow check (didn't find a TtDelimited or TtSequence)
hello.rs:1 macro_rules! mack_row {
hello.rs:2  hello => ()
hello.rs:3 }
note: 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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:129

Meta

$ rustc --version --verbose
rustc 1.0.0-nightly (3b3bb0e68 2015-03-04) (built 2015-03-05)
binary: rustc
commit-hash: 3b3bb0e682c2d252e9f62dd9df5cff9552af91ad
commit-date: 2015-03-04
build-date: 2015-03-05
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly
$ RUST_BACKTRACE=1 rustc hello.rs 
hello.rs:1:1: 3:2 error: internal compiler error: wrong-structured lhs for follow check (didn't find a TtDelimited or TtSequence)
hello.rs:1 macro_rules! mack_row {
hello.rs:2  hello => ()
hello.rs:3 }
note: 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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:129

stack backtrace:
   1:     0x7feb32680f1f - sys::backtrace::write::hf79a3da4fdecb8a0OBA
   2:     0x7feb326abc32 - panicking::on_panic::h9f64f4c69e19f194hHJ
   3:     0x7feb325e0eda - rt::unwind::begin_unwind_inner::h37f4496c980fe936knJ
   4:     0x7feb2fa4babd - rt::unwind::begin_unwind::h8320268356453106285
   5:     0x7feb2fa4ba63 - diagnostic::SpanHandler::span_bug::h83c8af232eaba6a9h0D
   6:     0x7feb2fb8b4cf - ext::base::ExtCtxt<'a>::span_bug::h57adb13cf16fc804GA5
   7:     0x7feb2fb8afa2 - ext::tt::macro_rules::compile::h873b32c3d4368ef635f
   8:     0x7feb2fb8a373 - ext::base::ExtCtxt<'a>::insert_macro::haaccd9e27f928901yy5
   9:     0x7feb2fbf64ce - ext::expand::expand_item_mac::hd3b165c5aff186110rb
  10:     0x7feb2fbe444a - ext::expand::expand_annotatable::h378d1c124c198a916Ub
  11:     0x7feb2fbe05e1 - ext::expand::expand_item::h8a962e5f8fafea81Wlb
  12:     0x7feb2fbee09f - ext::expand::MacroExpander<'a, 'b>.Folder::fold_item::h556c21a26b784fb1hcc
  13:     0x7feb2fbede2f - iter::FlatMap<I, U, F>.Iterator::next::closure.60138
  14:     0x7feb2fbedbac - iter::FlatMap<I, U, F>.Iterator::next::h6910105070373715398
  15:     0x7feb2fbed817 - vec::Vec<T>.FromIterator<T>::from_iter::h8529730263212573627
  16:     0x7feb2fbed43e - fold::noop_fold_mod::h13574430500869506708
  17:     0x7feb2fbe9a48 - ext::expand::expand_item_underscore::h04b059e96977a16fBpb
  18:     0x7feb2fc484f2 - fold::noop_fold_item_simple::h11525352532286500933
  19:     0x7feb2fc4799e - ptr::P<T>::map::h14542742277292937439
  20:     0x7feb2fbe5f47 - ext::expand::expand_annotatable::h378d1c124c198a916Ub
  21:     0x7feb2fbe05e1 - ext::expand::expand_item::h8a962e5f8fafea81Wlb
  22:     0x7feb2fbee09f - ext::expand::MacroExpander<'a, 'b>.Folder::fold_item::h556c21a26b784fb1hcc
  23:     0x7feb2fc53954 - ext::expand::expand_crate::hbbabb26fe27c96b6Xhc
  24:     0x7feb32cec980 - driver::phase_2_configure_and_expand::closure.18893
  25:     0x7feb32ca3ca3 - driver::phase_2_configure_and_expand::h1b105a3027b471ffDsa
  26:     0x7feb32c94888 - driver::compile_input::h3913ff7013f0c056Iba
  27:     0x7feb32d5dcb7 - run_compiler::h28a4446bae1034e7H5b
  28:     0x7feb32d5b829 - thunk::F.Invoke<A, R>::invoke::h6503055919709693733
  29:     0x7feb32d5a4a0 - rt::unwind::try::try_fn::h1384674024000742916
  30:     0x7feb3271bde8 - rust_try_inner
  31:     0x7feb3271bdd5 - rust_try
  32:     0x7feb32d5ac3f - thunk::F.Invoke<A, R>::invoke::h5780663349966142752
  33:     0x7feb32696965 - sys::thread::thread_start::h4ab695857833a5dar8E
  34:     0x7feb2c52bb4f - start_thread
  35:     0x7feb3226ce6c - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)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