]> git.lizzy.rs Git - rust.git/blob - src/test/ui/proc-macro/span-preservation.rs
ast: Keep `extern` qualifiers in functions more precisely
[rust.git] / src / test / ui / proc-macro / span-preservation.rs
1 // For each of these, we should get the appropriate type mismatch error message,
2 // and the function should be echoed.
3
4 // aux-build:test-macros.rs
5
6 #[macro_use]
7 extern crate test_macros;
8
9 #[recollect_attr]
10 fn a() {
11     let x: usize = "hello"; //~ ERROR mismatched types
12 }
13
14 #[recollect_attr]
15 fn b(x: Option<isize>) -> usize {
16     match x {
17         Some(x) => { return x }, //~ ERROR mismatched types
18         None => 10
19     }
20 }
21
22 #[recollect_attr]
23 fn c() {
24     struct Foo {
25         a: usize
26     }
27
28     struct Bar {
29         a: usize,
30         b: usize
31     }
32
33     let x = Foo { a: 10isize }; //~ ERROR mismatched types
34     let y = Foo { a: 10, b: 10isize }; //~ ERROR has no field named `b`
35 }
36
37 #[recollect_attr]
38 extern fn bar() {
39     0 //~ ERROR mismatched types
40 }
41
42 #[recollect_attr]
43 extern "C" fn baz() {
44     0 //~ ERROR mismatched types
45 }
46
47 fn main() {}