Skip to content

Commit 843d11b

Browse files
committed
Revise collapse_debuginfo text
1 parent 73de191 commit 843d11b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/attributes/debugger.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@ When the crate's debug executable is passed into GDB[^rust-gdb], `print bob` wil
151151
[Natvis documentation]: https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects
152152
[pretty printing documentation]: https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing.html
153153

154+
<!-- template:attributes -->
154155
r[attributes.debugger.collapse_debuginfo]
155156
## The `collapse_debuginfo` attribute
156157

157158
r[attributes.debugger.collapse_debuginfo.intro]
158-
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.
159+
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.
159160

160161
> [!EXAMPLE]
161162
> ```rust
@@ -167,9 +168,7 @@ The *`collapse_debuginfo` [attribute]* controls whether code locations from a ma
167168
> }
168169
> ```
169170
>
170-
> When using a debugger, invoking the `example` macro may appear like it is calling a function. That is, when you step to the invocation site, it may show the macro invocation as the next instruction.
171-
>
172-
> Without the `collapse_debuginfo` attribute, the invocation site may behave as-if the macro is expanded in place.
171+
> When using a debugger, invoking the `example` macro may appear as though it is calling a function. That is, when you step to the invocation site, it may show the macro invocation rather than the expanded code.
173172
174173
<!-- TODO: I think it would be nice to extend this to explain a little more about why this is useful, and the kinds of scenarios where you would want one vs the other. See https://github.com/rust-lang/rfcs/pull/2117 for some guidance. -->
175174
@@ -189,19 +188,20 @@ r[attributes.debugger.collapse_debuginfo.allowed-positions]
189188
The `collapse_debuginfo` attribute may only be applied to a [`macro_rules` definition].
190189

191190
r[attributes.debugger.collapse_debuginfo.duplicates]
192-
The `collapse_debuginfo` attribute may only be specified once on a macro.
191+
The `collapse_debuginfo` attribute may used only once on a macro.
193192

194193
r[attributes.debugger.collapse_debuginfo.options]
195-
Accepted options:
196-
- `#[collapse_debuginfo(yes)]` --- code locations in debuginfo are collapsed.
197-
- `#[collapse_debuginfo(no)]` --- code locations in debuginfo are not collapsed.
198-
- `#[collapse_debuginfo(external)]` --- code locations in debuginfo are collapsed only if the macro comes from a different crate.
194+
The `collapse_debuginfo` attribute accepts these options:
195+
196+
- `#[collapse_debuginfo(yes)]` --- Code locations in debuginfo are collapsed.
197+
- `#[collapse_debuginfo(no)]` --- Code locations in debuginfo are not collapsed.
198+
- `#[collapse_debuginfo(external)]` --- Code locations in debuginfo are collapsed only if the macro comes from a different crate.
199199

200200
r[attributes.debugger.collapse_debuginfo.default]
201-
The `external` behavior is the default for macros that don't have this attribute, unless they are built-in macros. For built-in macros the default is `yes`.
201+
The `external` behavior is the default for macros that don't have this attribute unless they are built-in macros. For built-in macros the default is `yes`.
202202

203203
> [!NOTE]
204-
> `rustc` has a [`-C collapse-macro-debuginfo`] CLI option to override both the default collapsing behavior and `#[collapse_debuginfo]` attributes.
204+
> `rustc` has a [`-C collapse-macro-debuginfo`] CLI option to override both the default behavior and the values of any `#[collapse_debuginfo]` attributes.
205205
206206
[`-C collapse-macro-debuginfo`]: ../../rustc/codegen-options/index.html#collapse-macro-debuginfo
207207
[`macro_rules` definition]: ../macros-by-example.md

0 commit comments

Comments
 (0)