Skip to content

Commit 4d16a96

Browse files
committed
Fix quoting of ?Sized
1 parent 68740b4 commit 4d16a96

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/libsyntax/ext/quote.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -676,9 +676,10 @@ fn expr_mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P<ast::Expr> {
676676
token::FatArrow => "FatArrow",
677677
token::Pound => "Pound",
678678
token::Dollar => "Dollar",
679+
token::Question => "Question",
679680
token::Underscore => "Underscore",
680681
token::Eof => "Eof",
681-
_ => panic!(),
682+
_ => panic!("unhandled token in quote!"),
682683
};
683684
mk_token_path(cx, sp, name)
684685
}

src/test/run-pass-fulldeps/quote-tokens.rs

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ fn syntax_extension(cx: &ExtCtxt) {
4343

4444
let _m: Vec<syntax::ast::TokenTree> = quote_matcher!(cx, $($foo:tt,)* bar);
4545
let _n: syntax::ast::Attribute = quote_attr!(cx, #![cfg(foo, bar = "baz")]);
46+
47+
let _o: Option<P<syntax::ast::Item>> = quote_item!(cx, fn foo<T: ?Sized>() {});
4648
}
4749

4850
fn main() {

0 commit comments

Comments
 (0)