From 27717dbd4d0df888e66661690199d5dd07078259 Mon Sep 17 00:00:00 2001 From: Andrew Zhogin Date: Mon, 22 Jan 2024 00:58:50 +0700 Subject: [PATCH] Builtin macros effectively have implicit #[collapse_debuginfo(yes)] attribute --- compiler/rustc_expand/src/base.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index 29b70f33a6c..657e19277a7 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -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;