]> git.proxmox.com Git - rustc.git/blob - src/test/ui/proc-macro/span-preservation.rs
New upstream version 1.41.1+dfsg1
[rustc.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 #[recollect_attr]
48 extern "Rust" fn rust_abi() {
49 0 //~ ERROR mismatched types
50 }
51
52 #[recollect_attr]
53 extern "\x43" fn c_abi_escaped() {
54 0 //~ ERROR mismatched types
55 }
56
57 fn main() {}