Skip to content

Panic (ICE) in libsyntax/ext/quote.rs #33469

Closed
@SeanRBurton

Description

@SeanRBurton

Using a macro argument (e.g. $x) inside of quote_expr! causes an internal compiler error.

Testcase

#![feature(quote)]                                                              
fn main() {                                                                     
    macro_rules! foo {                                                          
        ($bar:expr)  => {{                                                      
            quote_expr!(cx, {                                                   
                $bar                                                            
            })                                                                  
        }}                                                                      
    }                                                                           
    foo!(0);                                                                    
}                                                                               

Meta

rustc --version --verbose:

rustc 1.10.0-nightly (8da2bcac5 2016-04-28)
binary: rustc
commit-hash: 8da2bcac5db1e091b90cceb19d0496f0f7501c88
commit-date: 2016-04-28
host: x86_64-unknown-linux-gnu
release: 1.10.0-nightly

Backtrace:

thread 'rustc' panicked at 'quote! with interpolated token', ../src/libsyntax/ext/quote.rs:674
stack backtrace:
   1:     0x7f64bcbe8610 - std::sys::backtrace::tracing::imp::write::h9fb600083204ae7f
   2:     0x7f64bcbf5d5b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hca543c34f11229ac
   3:     0x7f64bcbf58fc - std::panicking::default_hook::hc2c969e7453d080c
   4:     0x7f64bcbbb28f - std::sys_common::unwind::begin_unwind_inner::h30e12d15ce2b2e25
   5:     0x7f64b81b307f - std::sys_common::unwind::begin_unwind::h65390c63b501d6ed
   6:     0x7f64b84f44e8 - syntax::ext::quote::expr_mk_token::hf3616fdc8a730f98
   7:     0x7f64b84f73ed - syntax::ext::quote::statements_mk_tt::hf137173b7aaf0343
   8:     0x7f64b84f9899 - _<std..iter..FlatMap<I, U, F> as std..iter..Iterator>::next::h342f312ca16f3456
   9:     0x7f64b84f97d6 - _<std..iter..Chain<A, B> as std..iter..Iterator>::next::hcca5675060ff1468
  10:     0x7f64b84f950a - _<std..iter..Chain<A, B> as std..iter..Iterator>::next::h3b59c19743381054
  11:     0x7f64b84f8f25 - _<std..vec..Vec<T> as std..iter..FromIterator<T>>::from_iter::h6bc6a155bb0e0657
  12:     0x7f64b84f6007 - syntax::ext::quote::statements_mk_tt::hf137173b7aaf0343
  13:     0x7f64b84ef895 - syntax::ext::quote::statements_mk_tts::h8bb66553ad6f815a
  14:     0x7f64b84ecd7c - syntax::ext::quote::expand_tts::h82c25750c4b3f43c
  15:     0x7f64b84ee19e - syntax::ext::quote::expand_parse_call::hd566ae918a5cd00e
  16:     0x7f64b8426c01 - syntax::ext::quote::expand_quote_expr::h22071cf817642021
  17:     0x7f64b842a4f8 - _<F as ext..base..TTMacroExpander>::expand::hea8797243c44e76d
  18:     0x7f64b843dde1 - syntax::ext::expand::expand_expr::_$u7b$$u7b$closure$u7d$$u7d$::h786e3626c423f985
  19:     0x7f64b843c551 - syntax::ext::expand::expand_expr::h4ef21198bf93998f
  20:     0x7f64b8491314 - _<std..option..Option<T>>::map::h06292a7609d09781
  21:     0x7f64b849009f - _<ptr..P<T>>::map::hea6557fd13e26b82
  22:     0x7f64b848feba - syntax::ext::expand::expand_block::h29e53ffe4e9d138a
  23:     0x7f64b8467803 - syntax::fold::noop_fold_expr::h8a99af1f29ab77eb
  24:     0x7f64b843cbec - syntax::ext::expand::expand_expr::_$u7b$$u7b$closure$u7d$$u7d$::h786e3626c423f985
  25:     0x7f64b843c551 - syntax::ext::expand::expand_expr::h4ef21198bf93998f
  26:     0x7f64b848b6be - syntax::fold::noop_fold_stmt::h0a3b2d3a3b789e9d
  27:     0x7f64b84867ea - syntax::ext::expand::expand_stmt::hc327948644bd9e60
  28:     0x7f64b848a06f - _<std..iter..FlatMap<I, U, F> as std..iter..Iterator>::next::ha08776cbda0f1375
  29:     0x7f64b84897fa - _<util..small_vector..SmallVector<T> as std..iter..FromIterator<T>>::from_iter::hc57b9728eb5e9511
  30:     0x7f64b8488244 - syntax::ext::expand::expand_stmt::hc327948644bd9e60
  31:     0x7f64b8490c63 - _<std..iter..FlatMap<I, U, F> as std..iter..Iterator>::next::hc119c9df0b90bc98
  32:     0x7f64b849034e - core::iter::iterator::Iterator::collect::hd0685fa2c544c4d2
  33:     0x7f64b8490094 - _<ptr..P<T>>::map::hea6557fd13e26b82
  34:     0x7f64b848feba - syntax::ext::expand::expand_block::h29e53ffe4e9d138a
  35:     0x7f64b8465d9b - syntax::ext::expand::expand_and_rename_fn_decl_and_block::h1c62ef1401adb7ae
  36:     0x7f64b84758e3 - syntax::ext::expand::expand_item_kind::h0b21c6d930b6a1e4
  37:     0x7f64b84b5623 - syntax::fold::Folder::fold_item_simple::ha749d2ae63b235ad
  38:     0x7f64b84b524a - _<ptr..P<T>>::map::he640c72a9f20f0a4
  39:     0x7f64b8471e27 - syntax::ext::expand::expand_annotatable::hc0f78f406615b5e1
  40:     0x7f64b846eb60 - syntax::ext::expand::expand_item::hb99af7e0c910686e
  41:     0x7f64b847ce11 - _<ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_item::h8c27a95378ad2c28
  42:     0x7f64b847cacf - syntax::fold::noop_fold_mod::hc2718611fc479597
  43:     0x7f64b8475eae - syntax::ext::expand::expand_item_kind::h0b21c6d930b6a1e4
  44:     0x7f64b84b5623 - syntax::fold::Folder::fold_item_simple::ha749d2ae63b235ad
  45:     0x7f64b84b524a - _<ptr..P<T>>::map::he640c72a9f20f0a4
  46:     0x7f64b8472f38 - syntax::ext::expand::expand_annotatable::hc0f78f406615b5e1
  47:     0x7f64b846eb60 - syntax::ext::expand::expand_item::hb99af7e0c910686e
  48:     0x7f64b847cff4 - _<ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_item::h8c27a95378ad2c28
  49:     0x7f64b84c30b2 - _<ext..expand..MacroExpander<'a, 'b> as fold..Folder>::fold_crate::h072fa0f078d6fae0
  50:     0x7f64b84c444a - syntax::ext::expand::expand_crate::h7e9f12d49472476d
  51:     0x7f64bd18083b - rustc_driver::driver::phase_2_configure_and_expand::_$u7b$$u7b$closure$u7d$$u7d$::hcc02923f666dd3df
  52:     0x7f64bd12f14f - rustc_driver::driver::phase_2_configure_and_expand::h70a47be7bf475f39
  53:     0x7f64bd10eba0 - rustc_driver::driver::compile_input::h0629572e6f316b31
  54:     0x7f64bd0f553c - rustc_driver::run_compiler::h8902aebf8b1849a8
  55:     0x7f64bd0f2c41 - std::sys_common::unwind::try::try_fn::h4c74456035d0fcc7
  56:     0x7f64bcbe5deb - __rust_try
  57:     0x7f64bcbe5d7d - std::sys_common::unwind::inner_try::h47a4d9cd4a369dcd
  58:     0x7f64bd0f348a - _<F as std..boxed..FnBox<A>>::call_box::h27f542a39f1d61ef
  59:     0x7f64bcbf3ef4 - std::sys::thread::Thread::new::thread_start::h6f266e069bf4ec2b
  60:     0x7f64b49536f9 - start_thread
  61:     0x7f64bc849b5c - clone
  62:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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