]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail-fulldeps/gated-quote.rs
Move parse-fail tests to UI
[rust.git] / src / test / compile-fail-fulldeps / gated-quote.rs
1 // Copyright 2015 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 // Test that `quote`-related macro are gated by `quote` feature gate.
12
13 // (To sanity-check the code, uncomment this.)
14 // #![feature(quote)]
15
16 // FIXME the error message that is current emitted seems pretty bad.
17
18 // gate-test-quote
19
20 #![feature(rustc_private)]
21 #![allow(dead_code, unused_imports, unused_variables)]
22
23 #[macro_use]
24 extern crate syntax;
25
26 use syntax::ast;
27 use syntax::parse;
28
29 struct ParseSess;
30
31 impl ParseSess {
32     fn cfg(&self) -> ast::CrateConfig { loop { } }
33     fn parse_sess<'a>(&'a self) -> &'a parse::ParseSess { loop { } }
34     fn call_site(&self) -> () { loop { } }
35     fn ident_of(&self, st: &str) -> ast::Ident { loop { } }
36     fn name_of(&self, st: &str) -> ast::Name { loop { } }
37 }
38
39 pub fn main() {
40     let ecx = &ParseSess;
41     let x = quote_tokens!(ecx, 3);
42     //~^ ERROR cannot find macro `quote_tokens!` in this scope
43     let x = quote_expr!(ecx, 3);
44     //~^ ERROR cannot find macro `quote_expr!` in this scope
45     let x = quote_ty!(ecx, 3);
46     //~^ ERROR cannot find macro `quote_ty!` in this scope
47     let x = quote_method!(ecx, 3);
48     //~^ ERROR cannot find macro `quote_method!` in this scope
49     let x = quote_item!(ecx, 3);
50     //~^ ERROR cannot find macro `quote_item!` in this scope
51     let x = quote_pat!(ecx, 3);
52     //~^ ERROR cannot find macro `quote_pat!` in this scope
53     let x = quote_arm!(ecx, 3);
54     //~^ ERROR cannot find macro `quote_arm!` in this scope
55     let x = quote_stmt!(ecx, 3);
56     //~^ ERROR cannot find macro `quote_stmt!` in this scope
57     let x = quote_attr!(ecx, 3);
58     //~^ ERROR cannot find macro `quote_attr!` in this scope
59     let x = quote_arg!(ecx, 3);
60     //~^ ERROR cannot find macro `quote_arg!` in this scope
61     let x = quote_block!(ecx, 3);
62     //~^ ERROR cannot find macro `quote_block!` in this scope
63     let x = quote_meta_item!(ecx, 3);
64     //~^ ERROR cannot find macro `quote_meta_item!` in this scope
65     let x = quote_path!(ecx, 3);
66     //~^ ERROR cannot find macro `quote_path!` in this scope
67 }