diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 544fb15dcde7b..00bd6f69e184e 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -635,9 +635,10 @@ fn 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!("Expected valid token, found {:?}", *tok), }; mk_token_path(cx, sp, name) } diff --git a/src/test/run-pass-fulldeps/issue-22957.rs b/src/test/run-pass-fulldeps/issue-22957.rs new file mode 100644 index 0000000000000..858fe1f385fc1 --- /dev/null +++ b/src/test/run-pass-fulldeps/issue-22957.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test quasiquoting `?Sized` trait bound. + +#![feature(quote)] + +extern crate syntax; + +use syntax::ext::base::ExtCtxt; + +#[allow(dead_code)] +fn create_item(context: &mut ExtCtxt) { + quote_item!(context, + fn foo() { } + ); +} + +fn main() { }