]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/proc-macro/attribute-with-error.rs
Auto merge of #56631 - matthiaskrgr:clippy, r=nikic
[rust.git] / src / test / compile-fail / proc-macro / attribute-with-error.rs
1 // Copyright 2017 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 // aux-build:attribute-with-error.rs
12
13 #![feature(custom_inner_attributes)]
14
15 extern crate attribute_with_error;
16
17 use attribute_with_error::foo;
18
19 #[foo]
20 fn test1() {
21     let a: i32 = "foo";
22     //~^ ERROR: mismatched types
23     let b: i32 = "f'oo";
24     //~^ ERROR: mismatched types
25 }
26
27 fn test2() {
28     #![foo]
29
30     // FIXME: should have a type error here and assert it works but it doesn't
31 }
32
33 trait A {
34     // FIXME: should have a #[foo] attribute here and assert that it works
35     fn foo(&self) {
36         let a: i32 = "foo";
37         //~^ ERROR: mismatched types
38     }
39 }
40
41 struct B;
42
43 impl A for B {
44     #[foo]
45     fn foo(&self) {
46         let a: i32 = "foo";
47         //~^ ERROR: mismatched types
48     }
49 }
50
51 #[foo]
52 fn main() {
53 }