]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail-fulldeps/gated-quote.rs
Auto merge of #38426 - vadimcn:nobundle, r=alexcrichton
[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 use syntax_pos::Span;
29
30 struct ParseSess;
31
32 impl ParseSess {
33     fn cfg(&self) -> ast::CrateConfig { loop { } }
34     fn parse_sess<'a>(&'a self) -> &'a parse::ParseSess { loop { } }
35     fn call_site(&self) -> Span { loop { } }
36     fn ident_of(&self, st: &str) -> ast::Ident { loop { } }
37     fn name_of(&self, st: &str) -> ast::Name { loop { } }
38 }
39
40 pub fn main() {
41     let ecx = &ParseSess;
42     let x = quote_tokens!(ecx, 3);    //~ ERROR macro undefined: 'quote_tokens!'
43     let x = quote_expr!(ecx, 3);      //~ ERROR macro undefined: 'quote_expr!'
44     let x = quote_ty!(ecx, 3);        //~ ERROR macro undefined: 'quote_ty!'
45     let x = quote_method!(ecx, 3);    //~ ERROR macro undefined: 'quote_method!'
46     let x = quote_item!(ecx, 3);      //~ ERROR macro undefined: 'quote_item!'
47     let x = quote_pat!(ecx, 3);       //~ ERROR macro undefined: 'quote_pat!'
48     let x = quote_arm!(ecx, 3);       //~ ERROR macro undefined: 'quote_arm!'
49     let x = quote_stmt!(ecx, 3);      //~ ERROR macro undefined: 'quote_stmt!'
50     let x = quote_matcher!(ecx, 3);   //~ ERROR macro undefined: 'quote_matcher!'
51     let x = quote_attr!(ecx, 3);      //~ ERROR macro undefined: 'quote_attr!'
52     let x = quote_arg!(ecx, 3);       //~ ERROR macro undefined: 'quote_arg!'
53     let x = quote_block!(ecx, 3);     //~ ERROR macro undefined: 'quote_block!'
54     let x = quote_meta_item!(ecx, 3); //~ ERROR macro undefined: 'quote_meta_item!'
55     let x = quote_path!(ecx, 3);      //~ ERROR macro undefined: 'quote_path!'
56 }