Rollup merge of #120204 - azhogin:azhogin/collapse_debuginfo_for_builtin, r=petrochenkov

Builtin macros effectively have implicit #[collapse_debuginfo(yes)]

If collapse_debuginfo attribute for builtin macro is not specified explicitly, it will be effectively set to `#[collapse_debuginfo(yes)]`.
This commit is contained in:
Matthias Krüger 2024-01-26 06:36:38 +01:00 committed by GitHub
commit 626797b61d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -796,9 +796,15 @@ fn collapse_debuginfo_by_name(sess: &Session, attr: &Attribute) -> CollapseMacro
/// | external | no | if-ext | if-ext | yes |
/// | yes | yes | yes | yes | yes |
fn get_collapse_debuginfo(sess: &Session, attrs: &[ast::Attribute], is_local: bool) -> bool {
let collapse_debuginfo_attr = attr::find_by_name(attrs, sym::collapse_debuginfo)
let mut collapse_debuginfo_attr = attr::find_by_name(attrs, sym::collapse_debuginfo)
.map(|v| Self::collapse_debuginfo_by_name(sess, v))
.unwrap_or(CollapseMacroDebuginfo::Unspecified);
if collapse_debuginfo_attr == CollapseMacroDebuginfo::Unspecified
&& attr::contains_name(attrs, sym::rustc_builtin_macro)
{
collapse_debuginfo_attr = CollapseMacroDebuginfo::Yes;
}
let flag = sess.opts.unstable_opts.collapse_macro_debuginfo;
let attr = collapse_debuginfo_attr;
let ext = !is_local;