Skip to content

Commit b81139a

Browse files
ehusstraviscross
authored andcommitted
Add attribute template rules for collapse_debuginfo
1 parent 180ac4e commit b81139a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/attributes/debugger.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,22 @@ The *`collapse_debuginfo` [attribute]* controls whether code locations from a ma
174174
<!-- 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. -->
175175
176176
r[attributes.debugger.collapse_debuginfo.syntax]
177-
The attribute uses the [MetaListIdents] syntax to specify its inputs, and can only be applied to macro definitions.
177+
The syntax for the `collapse_debuginfo` attribute is:
178+
179+
```grammar,attributes
180+
@root CollapseDebuginfoAttribute -> `collapse_debuginfo` `(` CollapseDebuginfoOption `)`
181+
182+
CollapseDebuginfoOption ->
183+
`yes`
184+
| `no`
185+
| `external`
186+
```
187+
188+
r[attributes.debugger.collapse_debuginfo.allowed-positions]
189+
The `collapse_debuginfo` attribute may only be applied to a [`macro_rules` definition].
190+
191+
r[attributes.debugger.collapse_debuginfo.duplicates]
192+
The `collapse_debuginfo` attribute may only be specified once on a macro.
178193

179194
r[attributes.debugger.collapse_debuginfo.options]
180195
Accepted options:
@@ -188,4 +203,5 @@ The `external` behavior is the default for macros that don't have this attribute
188203
> [!NOTE]
189204
> `rustc` has a `-C collapse-macro-debuginfo` CLI option to override both the default collapsing behavior and `#[collapse_debuginfo]` attributes.
190205
206+
[`macro_rules` definition]: ../macros-by-example.md
191207
[attribute]: ../attributes.md

0 commit comments

Comments
 (0)