]> git.lizzy.rs Git - rust.git/blob - src/test/ui/proc-macro/span-preservation.rs
adcb42ab2d1ccc4e3431aefc4b794b0e2e45bf09
[rust.git] / src / test / ui / proc-macro / span-preservation.rs
1 // aux-build:span-preservation.rs
2
3 // For each of these, we should get the appropriate type mismatch error message,
4 // and the function should be echoed.
5
6 extern crate span_preservation as foo;
7
8 use foo::foo;
9
10 #[foo]
11 fn a() {
12     let x: usize = "hello";;;;;
13 }
14
15 #[foo]
16 fn b(x: Option<isize>) -> usize {
17     match x {
18         Some(x) => { return x },
19         None => 10
20     }
21 }
22
23 #[foo]
24 fn c() {
25     struct Foo {
26         a: usize
27     }
28
29     struct Bar {
30         a: usize,
31         b: usize
32     }
33
34     let x = Foo { a: 10isize };
35     let y = Foo { a: 10, b: 10isize };
36 }
37
38 // FIXME: This doesn't work at the moment. See the one below. The pretty-printer
39 // injects a "C" between `extern` and `fn` which causes a "probably_eq"
40 // `TokenStream` mismatch. The lack of `"C"` should be preserved in the AST.
41 #[foo]
42 extern fn bar() {
43     0
44 }
45
46 #[foo]
47 extern "C" fn baz() {
48     0
49 }
50
51 fn main() {}