]>
Commit | Line | Data |
---|---|---|
9346a6ac AL |
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 | // Macros in statement vs expression position handle backtraces differently. | |
12 | ||
e9174d1e | 13 | macro_rules! fake_method_stmt { |
9346a6ac | 14 | () => { |
d9579d0f | 15 | 1.fake() //~ ERROR no method named `fake` found |
9346a6ac AL |
16 | } |
17 | } | |
18 | ||
e9174d1e | 19 | macro_rules! fake_field_stmt { |
9346a6ac AL |
20 | () => { |
21 | 1.fake //~ ERROR no field with that name | |
22 | } | |
23 | } | |
24 | ||
e9174d1e | 25 | macro_rules! fake_anon_field_stmt { |
9346a6ac AL |
26 | () => { |
27 | (1).0 //~ ERROR type was not a tuple | |
28 | } | |
29 | } | |
30 | ||
e9174d1e | 31 | macro_rules! fake_method_expr { |
9346a6ac | 32 | () => { |
d9579d0f | 33 | 1.fake() //~ ERROR no method named `fake` found |
9346a6ac AL |
34 | } |
35 | } | |
36 | ||
37 | macro_rules! fake_field_expr { | |
38 | () => { | |
a7813a04 | 39 | 1.fake //~ ERROR no field with that name |
9346a6ac AL |
40 | } |
41 | } | |
42 | ||
43 | macro_rules! fake_anon_field_expr { | |
44 | () => { | |
a7813a04 | 45 | (1).0 //~ ERROR type was not a tuple |
9346a6ac AL |
46 | } |
47 | } | |
48 | ||
49 | fn main() { | |
e9174d1e SL |
50 | fake_method_stmt!(); //~ NOTE in this expansion of |
51 | fake_field_stmt!(); //~ NOTE in this expansion of | |
52 | fake_anon_field_stmt!(); //~ NOTE in this expansion of | |
9346a6ac | 53 | |
e9174d1e | 54 | let _ = fake_method_expr!(); //~ NOTE in this expansion of |
a7813a04 XL |
55 | let _ = fake_field_expr!(); //~ NOTE in this expansion of |
56 | let _ = fake_anon_field_expr!(); //~ NOTE in this expansion of | |
9346a6ac | 57 | } |