Skip to content

ICE when quasi-quoting ?Sized trait bound #22957

Closed
@rschifflin

Description

@rschifflin

Looks like when using #![feature(quote)], invoking quote_item! with a type bounded by ?Sized throws an internal compiler error.

I tried this code:

#![feature(quote)]
extern crate syntax;

use syntax::ext::base::ExtCtxt;
use syntax::ptr::P;
use syntax::ast::Item;

fn create_item(context: &mut ExtCtxt) -> Option<P<Item>> {
  quote_item!(context,
    fn foo<T: ?Sized>() { }
  )
}

I expected to see the same kind of output as the exact same code, but using the Sized bound:

#![feature(quote)]
extern crate syntax;

use syntax::ext::base::ExtCtxt;
use syntax::ptr::P;
use syntax::ast::Item;

fn create_item(context: &mut ExtCtxt) -> Option<P<Item>> {
  quote_item!(context,
    fn foo<T: Sized>() { }
  )
}

But instead, the former ICE's and the latter compiles just fine.

Meta

rustc --version --verbose:

rustc 1.0.0-nightly (e233987ce 2015-02-27) (built 2015-02-27)
binary: rustc
commit-hash: e233987ce1de88a48db2ce612019ba644d3cf5dd
commit-date: 2015-02-27
build-date: 2015-02-27
host: x86_64-apple-darwin
release: 1.0.0-nightly

Backtrace:

thread 'rustc' panicked at 'explicit panic', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/ext/quote.rs:640

stack backtrace:
   1:         0x12a15fe3 - sys::backtrace::write::hb3b51289927be9aflmA
   2:         0x12a42f65 - panicking::on_panic::h0306c1498949d4d4X4I
   3:         0x1296c818 - rt::unwind::begin_unwind_inner::h55bf82c2d60bb553TNI
   4:         0x11f677e5 - rt::unwind::begin_unwind::h17653505613502601944
   5:         0x1229feb0 - ext::quote::mk_token::he254548538a307b2gXd
   6:         0x122a27b9 - ext::quote::mk_tt::ha7795ef1896c9e55P9d
   7:         0x122a3263 - ext::quote::mk_tts::hce9806a248bdb55eree
   8:         0x1229cfde - ext::quote::expand_tts::hb0642e8af84d1df2jfe
   9:         0x1229de6b - ext::quote::expand_parse_call::h044a69775e7fbe53aje
  10:         0x12183d88 - ext::quote::expand_quote_item::hd4119d1deced932eQOd
  11:         0x12186c10 - ext::base::F.TTMacroExpander::expand::h5249812734344092700
  12:         0x121d829e - ext::expand::expand_expr::closure.59368
  13:         0x121d5ef2 - ext::expand::expand_expr::h50e262962b9cdb1dwwa
  14:         0x12186d07 - ext::expand::MacroExpander<'a, 'b>.Folder::fold_expr::h575753e63c1823260Ib
  15:         0x1222af41 - ext::expand::expand_block_elts::closure.59960
  16:         0x1222944a - ext::expand::expand_block_elts::closure.59945
  17:         0x121e2dc2 - ext::expand::expand_block_elts::hec4c08ea423187201hb
  18:         0x12228d28 - ext::expand::expand_block::ha3b6bc1af360039cmhb
  19:         0x121e1d97 - ext::expand::MacroExpander<'a, 'b>.Folder::fold_block::hd3abe2902689c3351Kb
  20:         0x121e287b - ext::expand::expand_and_rename_fn_decl_and_block::h98b7f7dcc9e532245Gb
  21:         0x121ecef0 - ext::expand::expand_item_underscore::hcf5a3615bce025bcQWa
  22:         0x12254122 - fold::Folder::fold_item_simple::h15113887917141331462
  23:         0x122538a3 - ptr::P<T>::map::h3996768931285986864
  24:         0x121e8350 - ext::expand::expand_annotatable::hc29966229e4d8804lsb
  25:         0x121e2f70 - ext::expand::expand_item::h46ad11869d4d5cd8bTa
  26:         0x121f25b5 - ext::expand::MacroExpander<'a, 'b>.Folder::fold_item::h93a5df8409b098e8wJb
  27:         0x121f2378 - fold::noop_fold_mod::closure.59525
  28:         0x121f2116 - iter::FlatMap<I, U, F>.Iterator::next::h5348942706720091560
  29:         0x121f1d60 - vec::Vec<T>.FromIterator<T>::from_iter::h17381127239759809368
  30:         0x121f199f - fold::noop_fold_mod::h3500212460602705731
  31:         0x121ed7b9 - ext::expand::expand_item_underscore::hcf5a3615bce025bcQWa
  32:         0x12254122 - fold::Folder::fold_item_simple::h15113887917141331462
  33:         0x122538a3 - ptr::P<T>::map::h3996768931285986864
  34:         0x121e88d5 - ext::expand::expand_annotatable::hc29966229e4d8804lsb
  35:         0x121e2f70 - ext::expand::expand_item::h46ad11869d4d5cd8bTa
  36:         0x121f25b5 - ext::expand::MacroExpander<'a, 'b>.Folder::fold_item::h93a5df8409b098e8wJb
  37:         0x12260ac4 - ext::expand::expand_crate::hde71209051590b8ccPb
  38:          0xedbfa14 - driver::phase_2_configure_and_expand::closure.18923
  39:          0xed7308b - driver::phase_2_configure_and_expand::h9e4875d4573a9bbbCsa
  40:          0xed62e76 - driver::compile_input::hf09b55bf6562020bHba
  41:          0xee38077 - run_compiler::h5e74fcf00338d9fdE5b
  42:          0xee354f1 - thunk::F.Invoke<A, R>::invoke::h14410064886368080395
  43:          0xee34150 - rt::unwind::try::try_fn::h9227424996074964567
  44:         0x12abbd69 - rust_try_inner
  45:         0x12abbd56 - rust_try
  46:          0xee348b5 - thunk::F.Invoke<A, R>::invoke::h7948097163614817145
  47:         0x12a2c343 - sys::thread::thread_start::h6bab8dc98adbaf071HE
  48:         0x93c1d772 - _pthread_start

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensionsI-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