Skip to content

Commit 8ac3341

Browse files
committed
Unrot, collapse, and re-enable qquote-{1,2}.rs
Moved to `compile-fail-fulldeps`.
1 parent 4a608e8 commit 8ac3341

File tree

3 files changed

+63
-133
lines changed

3 files changed

+63
-133
lines changed
+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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.
4+
//
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.
10+
11+
// ignore-cross-compile
12+
13+
#![feature(quote, rustc_private)]
14+
15+
extern crate syntax;
16+
17+
use syntax::ast;
18+
use syntax::codemap;
19+
use syntax::parse;
20+
use syntax::print::pprust;
21+
22+
trait FakeExtCtxt {
23+
fn call_site(&self) -> codemap::Span;
24+
fn cfg(&self) -> ast::CrateConfig;
25+
fn ident_of(&self, st: &str) -> ast::Ident;
26+
fn name_of(&self, st: &str) -> ast::Name;
27+
fn parse_sess(&self) -> &parse::ParseSess;
28+
}
29+
30+
impl FakeExtCtxt for parse::ParseSess {
31+
fn call_site(&self) -> codemap::Span {
32+
codemap::Span {
33+
lo: codemap::BytePos(0),
34+
hi: codemap::BytePos(0),
35+
expn_id: codemap::NO_EXPANSION,
36+
}
37+
}
38+
fn cfg(&self) -> ast::CrateConfig { Vec::new() }
39+
fn ident_of(&self, st: &str) -> ast::Ident {
40+
parse::token::str_to_ident(st)
41+
}
42+
fn name_of(&self, st: &str) -> ast::Name {
43+
parse::token::intern(st)
44+
}
45+
fn parse_sess(&self) -> &parse::ParseSess { self }
46+
}
47+
48+
fn main() {
49+
let cx = parse::new_parse_sess();
50+
51+
quote_expr!(&cx, 23).and_then(|expr| {
52+
assert_eq!(pprust::expr_to_string(&expr), "23")
53+
});
54+
55+
quote_expr!(&cx, 2 - $abcd + 7).and_then(|expr| { //~ ERROR unresolved name: abcd
56+
assert_eq!(pprust::expr_to_string(&expr), "2 - $abcd + 7")
57+
});
58+
59+
quote_expr!(&cx, let x isize = 20;).and_then(|expr| {
60+
// FIXME(#24718): ~^ ERROR: expected one of `:`, `;`, `=`, or `@`, found `isize`
61+
assert_eq!(pprust::expr_to_string(&expr), "let x isize = 20;")
62+
});
63+
}

src/test/parse-fail/qquote-1.rs

-70
This file was deleted.

src/test/parse-fail/qquote-2.rs

-63
This file was deleted.

0 commit comments

Comments
 (0)