Skip to content

"internal compiler error: tried to pop without a push" when trying to use an undefined macro inside an impl block #18270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dzamlo opened this issue Oct 24, 2014 · 1 comment
Labels
A-syntaxext Area: Syntax extensions I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@dzamlo
Copy link
Contributor

dzamlo commented Oct 24, 2014

An internal compiler error happen when using an undefined macro inside an impl block.

Here is a minimal example to reproduce the error:

#![feature(macro_rules)]

impl Foo {
    test!()
}

fn main() {}

Here is the error reported by rustc:

> RUST_BACKTRACE=1 rustc test.rs
test.rs:4:5: 4:9 error: macro undefined: 'test!'
test.rs:4     test!()
              ^~~~
error: internal compiler error: tried to pop without a push
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:175

stack backtrace:
   1:     0x7fab5dad61d0 - rt::backtrace::imp::write::ha0361403f416ccd9Ocq
   2:     0x7fab5dad9360 - failure::on_fail::h4e64388bd642f413byq
   3:     0x7fab5e273ba0 - unwind::begin_unwind_inner::hd273521a0e8ebce8Axd
   4:     0x7fab5c54de70 - unwind::begin_unwind::h6546896763742138129
   5:     0x7fab5c54e620 - diagnostic::Handler::bug::h8760f4cb58cfcfbesTF
   6:     0x7fab5c6478a0 - ext::base::ExtCtxt<'a>::bug::h20fd4470a67ec647hV5
   7:     0x7fab5c60d480 - ext::base::ExtCtxt<'a>::bt_pop::h45e111edeef12f14xR5
   8:     0x7fab5c6beb70 - ext::expand::MacroExpander<'a, 'b>.Folder::fold_method::h60bdff4b615f56d6H9c
   9:     0x7fab5c6b6a70 - fold::noop_fold_item_underscore::h5153028995318274890
  10:     0x7fab5c6b3ac0 - ext::expand::MacroExpander<'a, 'b>.Folder::fold_item_underscore::h64ae51273c5cddbbn8c
  11:     0x7fab5c6b35d0 - fold::noop_fold_item::closure.54351
  12:     0x7fab5c534090 - ptr::P<T>::map::h5845961873979508555
  13:     0x7fab5c6adc70 - ext::expand::expand_item::hb8b38f73e65b975eync
  14:     0x7fab5c6bcb20 - fold::noop_fold_mod::closure.54380
  15:     0x7fab5c5e5800 - iter::Iterator::collect::h5376275078778274821
  16:     0x7fab5c6bb8b0 - fold::Folder::fold_mod::h701201873445886102
  17:     0x7fab5c70a310 - ext::expand::expand_crate::h00d22b8f01ebc040tbd
  18:     0x7fab5ef3e400 - driver::driver::phase_2_configure_and_expand::closure.143392
  19:     0x7fab5ecaf6e0 - driver::driver::phase_2_configure_and_expand::h642b31d00bd1082bUcA
  20:     0x7fab5eefe0c0 - driver::driver::compile_input::h3ae2ce706c1a2c7805z
  21:     0x7fab5ef87360 - driver::run_compiler::h60b334313035cdc4bTD
  22:     0x7fab5ef87210 - driver::run::closure.144858
  23:     0x7fab5e682310 - task::TaskBuilder<S>::try_future::closure.103258
  24:     0x7fab5e6820f0 - task::TaskBuilder<S>::spawn_internal::closure.103229
  25:     0x7fab5f7edbd0 - task::NativeSpawner.Spawner::spawn::closure.8438
  26:     0x7fab5e2ccdf0 - rust_try_inner
  27:     0x7fab5e2ccde0 - rust_try
  28:     0x7fab5e271460 - unwind::try::hd12740a912640cc1imd
  29:     0x7fab5e2712e0 - task::Task::run::ha62f1c0aea75bedcWBc
  30:     0x7fab5f7ed910 - task::NativeSpawner.Spawner::spawn::closure.8378
  31:     0x7fab5e272bb0 - thread::thread_start::h90ae59691b46ad307Vc
  32:     0x7fab5d5a1d40 - start_thread
  33:     0x7fab5df430a9 - clone
  34:                0x0 - <unknown>

The version of rust I'm using:

> rustc -v
rustc 0.13.0-nightly (96991e933 2014-10-22 23:57:11 +0000)

On x86_64, using openSUSE 12.3.

@huonw huonw added A-syntaxext Area: Syntax extensions I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Oct 24, 2014
@ghost
Copy link

ghost commented Dec 12, 2014

Closing as a dupe of #19734.

@ghost ghost closed this as completed Dec 12, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-syntaxext Area: Syntax extensions I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants