From 9dd4e4cad1a683d2319471c4025aed41341110c3 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Fri, 14 Mar 2025 20:34:43 +0300 Subject: expand: Leave traces when expanding `cfg_attr` attributes --- compiler/rustc_feature/src/builtin_attrs.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler/rustc_feature/src') diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 40857e0066e..5430bfde785 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -752,6 +752,14 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ template!(Word, List: r#""...""#), DuplicatesOk, EncodeCrossCrate::Yes, INTERNAL_UNSTABLE ), + // Trace that is left when a `cfg_attr` attribute is expanded. + // The attribute is not gated, to avoid stability errors, but it cannot be used in stable or + // unstable code directly because `sym::cfg_attr_trace` is not a valid identifier, it can only + // be generated by the compiler. + ungated!( + cfg_attr_trace, Normal, template!(Word /* irrelevant */), DuplicatesOk, + EncodeCrossCrate::No + ), // ========================================================================== // Internal attributes, Diagnostics related: -- cgit 1.4.1-3-g733a5