You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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,
159
-
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.
<!--TODO:Ithinkitwouldbenicetoextendthistoexplainalittlemoreaboutwhythisisuseful, andthekindsofscenarioswhereyouwouldwantonevstheother.Seehttps://github.com/rust-lang/rfcs/pull/2117 for some guidance. -->
160
174
161
175
r[attributes.debugger.collapse_debuginfo.syntax]
162
-
The attribute uses the [MetaListIdents] syntax to specify its inputs, and can only be applied to macro definitions.
The `collapse_debuginfo` attribute may used only once on a macro.
163
192
164
193
r[attributes.debugger.collapse_debuginfo.options]
165
-
Accepted options:
166
-
-`#[collapse_debuginfo(yes)]` --- code locations in debuginfo are collapsed.
167
-
-`#[collapse_debuginfo(no)]` --- code locations in debuginfo are not collapsed.
168
-
-`#[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.
169
199
170
200
r[attributes.debugger.collapse_debuginfo.default]
171
-
The `external` behavior is the default for macros that don't have this attribute, unless they are built-in macros.
172
-
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`.
173
202
174
203
> [!NOTE]
175
-
> `rustc` has a `-C collapse-macro-debuginfo` CLI option to override both the default collapsing behavior and `#[collapse_debuginfo]` attributes.
176
-
177
-
```rust
178
-
#[collapse_debuginfo(yes)]
179
-
macro_rules!example {
180
-
() => {
181
-
println!("hello!");
182
-
};
183
-
}
184
-
```
204
+
> `rustc` has a [`-C collapse-macro-debuginfo`] CLI option to override both the default behavior and the values of any `#[collapse_debuginfo]` attributes.
0 commit comments