]> git.lizzy.rs Git - rust.git/blob - src/test/ui/gated-attr-literals.rs
Merged migrated compile-fail tests and ui tests. Fixes #46841.
[rust.git] / src / test / ui / 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 // gate-test-attr_literals
14
15 #![feature(custom_attribute)]
16
17 #[fake_attr] // OK
18 #[fake_attr(100)]
19     //~^ ERROR non-string literals in attributes
20 #[fake_attr(1, 2, 3)]
21     //~^ ERROR non-string literals in attributes
22 #[fake_attr("hello")]
23     //~^ ERROR string literals in top-level positions, are experimental
24 #[fake_attr(name = "hello")] // OK
25 #[fake_attr(1, "hi", key = 12, true, false)]
26     //~^ ERROR non-string literals in attributes, or string literals in top-level positions
27 #[fake_attr(key = "hello", val = 10)]
28     //~^ ERROR non-string literals in attributes
29 #[fake_attr(key("hello"), val(10))]
30     //~^ ERROR non-string literals in attributes, or string literals in top-level positions
31 #[fake_attr(enabled = true, disabled = false)]
32     //~^ ERROR non-string literals in attributes
33 #[fake_attr(true)]
34     //~^ ERROR non-string literals in attributes
35 #[fake_attr(pi = 3.14159)]
36     //~^ ERROR non-string literals in attributes
37 #[fake_attr(b"hi")]
38     //~^ ERROR string literals in top-level positions, are experimental
39 #[fake_doc(r"doc")]
40     //~^ ERROR string literals in top-level positions, are experimental
41 struct Q {  }
42
43 fn main() { }