File: macro-stepping.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 893,176 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; lisp: 29; perl: 29; ruby: 19; sql: 11
file content (132 lines) | stat: -rw-r--r-- 3,083 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//@ ignore-android
//@ ignore-aarch64
//@ min-lldb-version: 1800
//@ min-gdb-version: 13.0
//Debian: broken, see https://github.com/rust-lang/rust/issues/130896
//@ ignore-gdb
//@ aux-build:macro-stepping.rs

#![allow(unused)]

#[macro_use]
extern crate macro_stepping; // exports new_scope!()

//@ compile-flags:-g -Zmir-enable-passes=-SingleUseConsts
// SingleUseConsts shouldn't need to be disabled, see #128945

// === GDB TESTS ===================================================================================

// gdb-command:run
// gdb-command:next
// gdb-command:frame
// gdb-check:[...]#loc1[...]
// gdb-command:next
// gdb-command:frame
// gdb-check:[...]#loc2[...]
// gdb-command:next
// gdb-command:frame
// gdb-check:[...]#loc3[...]
// gdb-command:next
// gdb-command:frame
// gdb-check:[...]#loc4[...]
// gdb-command:next
// gdb-command:frame
// gdb-check:[...]#loc5[...]
// gdb-command:next
// gdb-command:frame
// gdb-check:[...]#loc6[...]

// gdb-command:continue
// gdb-command:step
// gdb-command:frame
// gdb-check:[...]#inc-loc1[...]
// gdb-command:next
// gdb-command:frame
// gdb-check:[...]#inc-loc2[...]
// gdb-command:next
// gdb-command:frame
// gdb-check:[...]#inc-loc3[...]

// === LLDB TESTS ==================================================================================

// lldb-command:set set stop-line-count-before 0
// lldb-command:set set stop-line-count-after 1
// Can't set both to zero or lldb will stop printing source at all.  So it will output the current
// line and the next.  We deal with this by having at least 2 lines between the #loc's

// lldb-command:run
// lldb-command:next
// lldb-command:frame select
// lldb-check:[...] #loc1 [...]
// lldb-command:next
// lldb-command:frame select
// lldb-check:[...] #loc2 [...]
// lldb-command:next
// lldb-command:frame select
// lldb-check:[...] #loc3 [...]
// lldb-command:next
// lldb-command:frame select
// lldb-check:[...] #loc4 [...]
// lldb-command:next
// lldb-command:frame select
// lldb-check:[...] #loc5 [...]

// lldb-command:continue
// lldb-command:step
// lldb-command:frame select
// lldb-check:[...] #inc-loc1 [...]
// lldb-command:next
// lldb-command:frame select
// lldb-check:[...] #inc-loc2 [...]
// lldb-command:next
// lldb-command:frame select
// lldb-check:[...] #inc-loc1 [...]
// lldb-command:next
// lldb-command:frame select
// lldb-check:[...] #inc-loc2 [...]
// lldb-command:next
// lldb-command:frame select
// lldb-check:[...] #inc-loc3 [...]

#[collapse_debuginfo(yes)]
macro_rules! foo {
    () => {
        let a = 1; opaque(a);
        let b = 2; opaque(b);
        let c = 3; opaque(c);
    };
}

#[collapse_debuginfo(yes)]
macro_rules! foo2 {
    () => {
        foo!();
        let x = 1; opaque(x);
        foo!();
    };
}

fn main() {
    zzz(); // #break

    foo!(); // #loc1

    foo2!(); // #loc2

    let x = vec![42]; // #loc3

    new_scope!(); // #loc4

    println!("Hello {}", // #loc5
             "world");

    zzz(); // #loc6

    included(); // #break
}

fn zzz() {()}

fn opaque(_: u32) {}

include!("macro-stepping.inc");