diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 2599a53e31327..737648cd90c37 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -676,9 +676,10 @@ fn expr_mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P { token::FatArrow => "FatArrow", token::Pound => "Pound", token::Dollar => "Dollar", + token::Question => "Question", token::Underscore => "Underscore", token::Eof => "Eof", - _ => panic!(), + _ => panic!("unhandled token in quote!"), }; mk_token_path(cx, sp, name) } diff --git a/src/test/run-pass-fulldeps/quote-tokens.rs b/src/test/run-pass-fulldeps/quote-tokens.rs index 4e6f9b4640295..9beea9e6e11f0 100644 --- a/src/test/run-pass-fulldeps/quote-tokens.rs +++ b/src/test/run-pass-fulldeps/quote-tokens.rs @@ -43,6 +43,8 @@ fn syntax_extension(cx: &ExtCtxt) { let _m: Vec = quote_matcher!(cx, $($foo:tt,)* bar); let _n: syntax::ast::Attribute = quote_attr!(cx, #![cfg(foo, bar = "baz")]); + + let _o: Option> = quote_item!(cx, fn foo() {}); } fn main() {