]> git.proxmox.com Git - rustc.git/blob - tests/ui/macros/macro-backtrace-invalid-internals.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / macros / macro-backtrace-invalid-internals.rs
1 // Macros in statement vs expression position handle backtraces differently.
2
3 macro_rules! fake_method_stmt {
4 () => {
5 1.fake() //~ ERROR no method
6 }
7 }
8
9 macro_rules! fake_field_stmt {
10 () => {
11 1.fake //~ ERROR doesn't have fields
12 }
13 }
14
15 macro_rules! fake_anon_field_stmt {
16 () => {
17 (1).0 //~ ERROR doesn't have fields
18 }
19 }
20
21 macro_rules! fake_method_expr {
22 () => {
23 1.fake() //~ ERROR no method
24 }
25 }
26
27 macro_rules! fake_field_expr {
28 () => {
29 1.fake //~ ERROR doesn't have fields
30 }
31 }
32
33 macro_rules! fake_anon_field_expr {
34 () => {
35 (1).0 //~ ERROR doesn't have fields
36 }
37 }
38
39 macro_rules! real_method_stmt {
40 () => {
41 2.0.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}`
42 }
43 }
44
45 macro_rules! real_method_expr {
46 () => {
47 2.0.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}`
48 }
49 }
50
51 fn main() {
52 fake_method_stmt!();
53 fake_field_stmt!();
54 fake_anon_field_stmt!();
55 real_method_stmt!();
56
57 let _ = fake_method_expr!();
58 let _ = fake_field_expr!();
59 let _ = fake_anon_field_expr!();
60 let _ = real_method_expr!();
61 }