]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/gated-attr-literals.rs
Auto merge of #35856 - phimuemue:master, r=brson
[rust.git] / src / test / compile-fail / gated-attr-literals.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 // Check that literals in attributes don't parse without the feature gate.
12
13 #![feature(rustc_attrs)]
14 #![allow(dead_code)]
15 #![allow(unused_variables)]
16
17 #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown
18 #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown
19     //~^ ERROR non-string literals in attributes
20 #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown
21     //~^ ERROR non-string literals in attributes
22 #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown
23     //~^ ERROR string literals in top-level positions, are experimental
24 #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown
25 #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown
26     //~^ ERROR non-string literals in attributes, or string literals in top-level positions
27 #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown
28     //~^ ERROR non-string literals in attributes
29 #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown
30     //~^ ERROR non-string literals in attributes, or string literals in top-level positions
31 #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown
32     //~^ ERROR non-string literals in attributes
33 #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown
34     //~^ ERROR non-string literals in attributes
35 #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown
36     //~^ ERROR non-string literals in attributes
37 #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown
38     //~^ ERROR string literals in top-level positions, are experimental
39 #[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown
40     //~^ ERROR string literals in top-level positions, are experimental
41 struct Q {  }
42
43 #[rustc_error]
44 fn main() { }