Skip to content

Commit c012986

Browse files
ehusstraviscross
authored andcommitted
Move collapse_debuginfo example to the intro and an example block
1 parent d335d34 commit c012986

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/attributes/debugger.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ r[attributes.debugger.collapse_debuginfo]
157157
r[attributes.debugger.collapse_debuginfo.intro]
158158
The *`collapse_debuginfo` [attribute]* controls whether code locations from a macro definition are collapsed into a single location associated with the macro's call site, when generating debuginfo for code calling this macro.
159159

160+
> [!EXAMPLE]
161+
> ```rust
162+
> #[collapse_debuginfo(yes)]
163+
> macro_rules! example {
164+
> () => {
165+
> println!("hello!");
166+
> };
167+
> }
168+
> ```
169+
160170
r[attributes.debugger.collapse_debuginfo.syntax]
161171
The attribute uses the [MetaListIdents] syntax to specify its inputs, and can only be applied to macro definitions.
162172
@@ -172,13 +182,4 @@ The `external` behavior is the default for macros that don't have this attribute
172182
> [!NOTE]
173183
> `rustc` has a `-C collapse-macro-debuginfo` CLI option to override both the default collapsing behavior and `#[collapse_debuginfo]` attributes.
174184
175-
```rust
176-
#[collapse_debuginfo(yes)]
177-
macro_rules! example {
178-
() => {
179-
println!("hello!");
180-
};
181-
}
182-
```
183-
184185
[attribute]: ../attributes.md

0 commit comments

Comments
 (0)