1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // ignore-cross-compile
13 // error-pattern:expected identifier, found keyword `let`
15 #![feature(quote, rustc_private)]
20 use syntax::codemap::{self, DUMMY_SP};
22 use syntax::print::pprust;
25 let ps = syntax::parse::ParseSess::new();
26 let mut cx = syntax::ext::base::ExtCtxt::new(
28 syntax::ext::expand::ExpansionConfig::default("qquote".to_string()));
29 cx.bt_push(syntax::codemap::ExpnInfo {
31 callee: syntax::codemap::NameAndSpan {
33 format: syntax::codemap::MacroBang,
34 allow_internal_unstable: false,
40 assert_eq!(pprust::expr_to_string(&*quote_expr!(&cx, 23)), "23");
42 let expr = quote_expr!(&cx, let x isize = 20;);
43 assert_eq!(pprust::expr_to_string(&*expr), "let x isize = 20;");