Skip to main content

rustc_feature/
builtin_attrs.rs

1//! Built-in attributes and `cfg` flag gating.
2
3use std::sync::LazyLock;
4
5use AttributeGate::*;
6use rustc_data_structures::fx::FxHashMap;
7use rustc_hir::AttrStyle;
8use rustc_span::{Symbol, sym};
9
10use crate::Features;
11
12type GateFn = fn(&Features) -> bool;
13
14pub type GatedCfg = (Symbol, Symbol, GateFn);
15
16/// `cfg(...)`'s that are feature gated.
17const GATED_CFGS: &[GatedCfg] = &[
18    // (name in cfg, feature, function to check if the feature is enabled)
19    (sym::overflow_checks, sym::cfg_overflow_checks, Features::cfg_overflow_checks),
20    (sym::ub_checks, sym::cfg_ub_checks, Features::cfg_ub_checks),
21    (sym::contract_checks, sym::cfg_contract_checks, Features::cfg_contract_checks),
22    (sym::target_thread_local, sym::cfg_target_thread_local, Features::cfg_target_thread_local),
23    (
24        sym::target_has_atomic_load_store,
25        sym::cfg_target_has_atomic,
26        Features::cfg_target_has_atomic,
27    ),
28    (sym::sanitize, sym::cfg_sanitize, Features::cfg_sanitize),
29    (sym::version, sym::cfg_version, Features::cfg_version),
30    (sym::relocation_model, sym::cfg_relocation_model, Features::cfg_relocation_model),
31    (sym::sanitizer_cfi_generalize_pointers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi),
32    (sym::sanitizer_cfi_normalize_integers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi),
33    // this is consistent with naming of the compiler flag it's for
34    (sym::fmt_debug, sym::fmt_debug, Features::fmt_debug),
35    (sym::emscripten_wasm_eh, sym::cfg_emscripten_wasm_eh, Features::cfg_emscripten_wasm_eh),
36    (
37        sym::target_has_reliable_f16,
38        sym::cfg_target_has_reliable_f16_f128,
39        Features::cfg_target_has_reliable_f16_f128,
40    ),
41    (
42        sym::target_has_reliable_f16_math,
43        sym::cfg_target_has_reliable_f16_f128,
44        Features::cfg_target_has_reliable_f16_f128,
45    ),
46    (
47        sym::target_has_reliable_f128,
48        sym::cfg_target_has_reliable_f16_f128,
49        Features::cfg_target_has_reliable_f16_f128,
50    ),
51    (
52        sym::target_has_reliable_f128_math,
53        sym::cfg_target_has_reliable_f16_f128,
54        Features::cfg_target_has_reliable_f16_f128,
55    ),
56    (sym::target_object_format, sym::cfg_target_object_format, Features::cfg_target_object_format),
57];
58
59/// Find a gated cfg determined by the `pred`icate which is given the cfg's name.
60pub fn find_gated_cfg(pred: impl Fn(Symbol) -> bool) -> Option<&'static GatedCfg> {
61    GATED_CFGS.iter().find(|(cfg_sym, ..)| pred(*cfg_sym))
62}
63
64#[derive(#[automatically_derived]
impl ::core::clone::Clone for AttributeGate {
    #[inline]
    fn clone(&self) -> AttributeGate {
        let _: ::core::clone::AssertParamIsClone<Symbol>;
        let _: ::core::clone::AssertParamIsClone<&'static str>;
        let _: ::core::clone::AssertParamIsClone<fn(&Features) -> bool>;
        let _: ::core::clone::AssertParamIsClone<&'static [&'static str]>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AttributeGate {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            AttributeGate::Gated {
                feature: __self_0,
                message: __self_1,
                check: __self_2,
                notes: __self_3 } =>
                ::core::fmt::Formatter::debug_struct_field4_finish(f, "Gated",
                    "feature", __self_0, "message", __self_1, "check", __self_2,
                    "notes", &__self_3),
            AttributeGate::Ungated =>
                ::core::fmt::Formatter::write_str(f, "Ungated"),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for AttributeGate { }Copy)]
65pub enum AttributeGate {
66    /// A gated attribute which requires a feature gate to be enabled.
67    Gated {
68        /// The feature gate, for example `#![feature(rustc_attrs)]` for rustc_* attributes.
69        feature: Symbol,
70        /// The error message displayed when an attempt is made to use the attribute without its feature gate.
71        message: &'static str,
72        /// Check function to be called during the `PostExpansionVisitor` pass.
73        check: fn(&Features) -> bool,
74        /// Notes to be displayed when an attempt is made to use the attribute without its feature gate.
75        notes: &'static [&'static str],
76    },
77    /// Ungated attribute, can be used on all release channels
78    Ungated,
79}
80
81// FIXME(jdonszelmann): move to rustc_hir::attrs
82/// A template that the attribute input must match.
83/// Only top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is considered now.
84#[derive(#[automatically_derived]
impl ::core::clone::Clone for AttributeTemplate {
    #[inline]
    fn clone(&self) -> AttributeTemplate {
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _:
                ::core::clone::AssertParamIsClone<Option<&'static [&'static str]>>;
        let _: ::core::clone::AssertParamIsClone<&'static [Symbol]>;
        let _:
                ::core::clone::AssertParamIsClone<Option<&'static [&'static str]>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'static str>>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for AttributeTemplate { }Copy, #[automatically_derived]
impl ::core::default::Default for AttributeTemplate {
    #[inline]
    fn default() -> AttributeTemplate {
        AttributeTemplate {
            word: ::core::default::Default::default(),
            list: ::core::default::Default::default(),
            one_of: ::core::default::Default::default(),
            name_value_str: ::core::default::Default::default(),
            docs: ::core::default::Default::default(),
        }
    }
}Default)]
85pub struct AttributeTemplate {
86    /// If `true`, the attribute is allowed to be a bare word like `#[test]`.
87    pub word: bool,
88    /// If `Some`, the attribute is allowed to take a list of items like `#[allow(..)]`.
89    pub list: Option<&'static [&'static str]>,
90    /// If non-empty, the attribute is allowed to take a list containing exactly
91    /// one of the listed words, like `#[coverage(off)]`.
92    pub one_of: &'static [Symbol],
93    /// If `Some`, the attribute is allowed to be a name/value pair where the
94    /// value is a string, like `#[must_use = "reason"]`.
95    pub name_value_str: Option<&'static [&'static str]>,
96    /// A link to the document for this attribute.
97    pub docs: Option<&'static str>,
98}
99
100pub enum AttrSuggestionStyle {
101    /// The suggestion is styled for a normal attribute.
102    /// The `AttrStyle` determines whether this is an inner or outer attribute.
103    Attribute(AttrStyle),
104    /// The suggestion is styled for an attribute embedded into another attribute.
105    /// For example, attributes inside `#[cfg_attr(true, attr(...)]`.
106    EmbeddedAttribute,
107    /// The suggestion is styled for macros that are parsed with attribute parsers.
108    /// For example, the `cfg!(predicate)` macro.
109    Macro,
110}
111
112impl AttributeTemplate {
113    pub fn suggestions(
114        &self,
115        style: AttrSuggestionStyle,
116        name: impl std::fmt::Display,
117    ) -> Vec<String> {
118        let (start, macro_call, end) = match style {
119            AttrSuggestionStyle::Attribute(AttrStyle::Outer) => ("#[", "", "]"),
120            AttrSuggestionStyle::Attribute(AttrStyle::Inner) => ("#![", "", "]"),
121            AttrSuggestionStyle::Macro => ("", "!", ""),
122            AttrSuggestionStyle::EmbeddedAttribute => ("", "", ""),
123        };
124
125        let mut suggestions = ::alloc::vec::Vec::new()vec![];
126
127        if self.word {
128            if true {
    if !macro_call.is_empty() {
        {
            ::core::panicking::panic_fmt(format_args!("Macro suggestions use list style"));
        }
    };
};debug_assert!(macro_call.is_empty(), "Macro suggestions use list style");
129            suggestions.push(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}{2}", start, name, end))
    })format!("{start}{name}{end}"));
130        }
131        if let Some(descr) = self.list {
132            for descr in descr {
133                suggestions.push(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}{2}({3}){4}", start, name,
                macro_call, descr, end))
    })format!("{start}{name}{macro_call}({descr}){end}"));
134            }
135        }
136        suggestions.extend(self.one_of.iter().map(|&word| ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}({2}){3}", start, name, word,
                end))
    })format!("{start}{name}({word}){end}")));
137        if let Some(descr) = self.name_value_str {
138            if true {
    if !macro_call.is_empty() {
        {
            ::core::panicking::panic_fmt(format_args!("Macro suggestions use list style"));
        }
    };
};debug_assert!(macro_call.is_empty(), "Macro suggestions use list style");
139            for descr in descr {
140                suggestions.push(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1} = \"{2}\"{3}", start, name,
                descr, end))
    })format!("{start}{name} = \"{descr}\"{end}"));
141            }
142        }
143        suggestions.sort();
144
145        suggestions
146    }
147}
148
149/// A convenience macro for constructing attribute templates.
150/// E.g., `template!(Word, List: "description")` means that the attribute
151/// supports forms `#[attr]` and `#[attr(description)]`.
152#[macro_export]
153macro_rules! template {
154    (Word) => { $crate::template!(@ true, None, &[], None, None) };
155    (Word, $link: literal) => { $crate::template!(@ true, None, &[], None, Some($link)) };
156    (List: $descr: expr) => { $crate::template!(@ false, Some($descr), &[], None, None) };
157    (List: $descr: expr, $link: literal) => { $crate::template!(@ false, Some($descr), &[], None, Some($link)) };
158    (OneOf: $one_of: expr) => { $crate::template!(@ false, None, $one_of, None, None) };
159    (NameValueStr: [$($descr: literal),* $(,)?]) => { $crate::template!(@ false, None, &[], Some(&[$($descr,)*]), None) };
160    (NameValueStr: [$($descr: literal),* $(,)?], $link: literal) => { $crate::template!(@ false, None, &[], Some(&[$($descr,)*]), Some($link)) };
161    (NameValueStr: $descr: literal) => { $crate::template!(@ false, None, &[], Some(&[$descr]), None) };
162    (NameValueStr: $descr: literal, $link: literal) => { $crate::template!(@ false, None, &[], Some(&[$descr]), Some($link)) };
163    (Word, List: $descr: expr) => { $crate::template!(@ true, Some($descr), &[], None, None) };
164    (Word, List: $descr: expr, $link: literal) => { $crate::template!(@ true, Some($descr), &[], None, Some($link)) };
165    (Word, NameValueStr: $descr: expr) => { $crate::template!(@ true, None, &[], Some(&[$descr]), None) };
166    (Word, NameValueStr: $descr: expr, $link: literal) => { $crate::template!(@ true, None, &[], Some(&[$descr]), Some($link)) };
167    (List: $descr1: expr, NameValueStr: $descr2: expr) => {
168        $crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), None)
169    };
170    (List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
171        $crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), Some($link))
172    };
173    (Word, List: $descr1: expr, NameValueStr: $descr2: expr) => {
174        $crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), None)
175    };
176    (Word, List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
177        $crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), Some($link))
178    };
179    (@ $word: expr, $list: expr, $one_of: expr, $name_value_str: expr, $link: expr) => { $crate::AttributeTemplate {
180        word: $word, list: $list, one_of: $one_of, name_value_str: $name_value_str, docs: $link,
181    } };
182}
183
184macro_rules! ungated {
185    ($attr:ident $(,)?) => {
186        BuiltinAttribute { name: sym::$attr, gate: Ungated }
187    };
188}
189
190macro_rules! gated {
191    ($attr:ident, $gate:ident, $message:expr $(,)?) => {
192        BuiltinAttribute {
193            name: sym::$attr,
194            gate: Gated {
195                feature: sym::$gate,
196                message: $message,
197                check: Features::$gate,
198                notes: &[],
199            },
200        }
201    };
202    ($attr:ident, $message:expr $(,)?) => {
203        BuiltinAttribute {
204            name: sym::$attr,
205            gate: Gated {
206                feature: sym::$attr,
207                message: $message,
208                check: Features::$attr,
209                notes: &[],
210            },
211        }
212    };
213}
214
215macro_rules! rustc_attr {
216    (TEST, $attr:ident $(,)?) => {
217        rustc_attr!(
218            $attr,
219            concat!(
220                "the `#[",
221                stringify!($attr),
222                "]` attribute is used for rustc unit tests"
223            ),
224        )
225    };
226    ($attr:ident $(, $notes:expr)* $(,)?) => {
227        BuiltinAttribute {
228            name: sym::$attr,
229            gate: Gated {
230                feature: sym::rustc_attrs,
231                message: "use of an internal attribute",
232                check: Features::rustc_attrs,
233                notes: &[
234                    concat!("the `#[",
235                    stringify!($attr),
236                    "]` attribute is an internal implementation detail that will never be stable"),
237                    $($notes),*
238                ]
239            },
240        }
241    };
242}
243
244macro_rules! experimental {
245    ($attr:ident) => {
246        concat!("the `#[", stringify!($attr), "]` attribute is an experimental feature")
247    };
248}
249
250pub struct BuiltinAttribute {
251    pub name: Symbol,
252    pub gate: AttributeGate,
253}
254
255/// Attributes that have a special meaning to rustc or rustdoc.
256#[rustfmt::skip]
257pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
258    // ==========================================================================
259    // Stable attributes:
260    // ==========================================================================
261
262    // Conditional compilation:
263    BuiltinAttribute { name: sym::cfg, gate: Ungated }ungated!(cfg),
264    BuiltinAttribute { name: sym::cfg_attr, gate: Ungated }ungated!(cfg_attr),
265
266    // Testing:
267    BuiltinAttribute { name: sym::ignore, gate: Ungated }ungated!(ignore),
268    BuiltinAttribute { name: sym::should_panic, gate: Ungated }ungated!(should_panic),
269
270    // Macros:
271    BuiltinAttribute { name: sym::automatically_derived, gate: Ungated }ungated!(automatically_derived),
272    BuiltinAttribute { name: sym::macro_use, gate: Ungated }ungated!(macro_use),
273    BuiltinAttribute { name: sym::macro_escape, gate: Ungated }ungated!(macro_escape), // Deprecated synonym for `macro_use`.
274    BuiltinAttribute { name: sym::macro_export, gate: Ungated }ungated!(macro_export),
275    BuiltinAttribute { name: sym::proc_macro, gate: Ungated }ungated!(proc_macro),
276    BuiltinAttribute { name: sym::proc_macro_derive, gate: Ungated }ungated!(proc_macro_derive),
277    BuiltinAttribute { name: sym::proc_macro_attribute, gate: Ungated }ungated!(proc_macro_attribute),
278
279    // Lints:
280    BuiltinAttribute { name: sym::warn, gate: Ungated }ungated!(warn),
281    BuiltinAttribute { name: sym::allow, gate: Ungated }ungated!(allow),
282    BuiltinAttribute { name: sym::expect, gate: Ungated }ungated!(expect),
283    BuiltinAttribute { name: sym::forbid, gate: Ungated }ungated!(forbid),
284    BuiltinAttribute { name: sym::deny, gate: Ungated }ungated!(deny),
285    BuiltinAttribute { name: sym::must_use, gate: Ungated }ungated!(must_use),
286    BuiltinAttribute {
    name: sym::must_not_suspend,
    gate: Gated {
        feature: sym::must_not_suspend,
        message: "the `#[must_not_suspend]` attribute is an experimental feature",
        check: Features::must_not_suspend,
        notes: &[],
    },
}gated!(must_not_suspend, experimental!(must_not_suspend)),
287    BuiltinAttribute { name: sym::deprecated, gate: Ungated }ungated!(deprecated),
288
289    // Crate properties:
290    BuiltinAttribute { name: sym::crate_name, gate: Ungated }ungated!(crate_name),
291    BuiltinAttribute { name: sym::crate_type, gate: Ungated }ungated!(crate_type),
292
293    // ABI, linking, symbols, and FFI
294    BuiltinAttribute { name: sym::link, gate: Ungated }ungated!(link),
295    BuiltinAttribute { name: sym::link_name, gate: Ungated }ungated!(link_name),
296    BuiltinAttribute { name: sym::no_link, gate: Ungated }ungated!(no_link),
297    BuiltinAttribute { name: sym::repr, gate: Ungated }ungated!(repr),
298    // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
299    BuiltinAttribute {
    name: sym::rustc_align,
    gate: Gated {
        feature: sym::fn_align,
        message: "the `#[rustc_align]` attribute is an experimental feature",
        check: Features::fn_align,
        notes: &[],
    },
}gated!(rustc_align, fn_align, experimental!(rustc_align)),
300    BuiltinAttribute {
    name: sym::rustc_align_static,
    gate: Gated {
        feature: sym::static_align,
        message: "the `#[rustc_align_static]` attribute is an experimental feature",
        check: Features::static_align,
        notes: &[],
    },
}gated!(rustc_align_static, static_align, experimental!(rustc_align_static)),
301    BuiltinAttribute { name: sym::export_name, gate: Ungated }ungated!(export_name),
302    BuiltinAttribute { name: sym::link_section, gate: Ungated }ungated!(link_section),
303    BuiltinAttribute { name: sym::no_mangle, gate: Ungated }ungated!(no_mangle),
304    BuiltinAttribute { name: sym::used, gate: Ungated }ungated!(used),
305    BuiltinAttribute { name: sym::link_ordinal, gate: Ungated }ungated!(link_ordinal),
306    BuiltinAttribute { name: sym::naked, gate: Ungated }ungated!(naked),
307    // See `TyAndLayout::pass_indirectly_in_non_rustic_abis` for details.
308    BuiltinAttribute {
    name: sym::rustc_pass_indirectly_in_non_rustic_abis,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_pass_indirectly_in_non_rustic_abis]` attribute is an internal implementation detail that will never be stable",
                    "types marked with `#[rustc_pass_indirectly_in_non_rustic_abis]` are always passed indirectly by non-Rustic ABIs"],
    },
}rustc_attr!(rustc_pass_indirectly_in_non_rustic_abis, "types marked with `#[rustc_pass_indirectly_in_non_rustic_abis]` are always passed indirectly by non-Rustic ABIs"),
309
310    // Limits:
311    BuiltinAttribute { name: sym::recursion_limit, gate: Ungated }ungated!(recursion_limit),
312    BuiltinAttribute { name: sym::type_length_limit, gate: Ungated }ungated!(type_length_limit),
313    BuiltinAttribute {
    name: sym::move_size_limit,
    gate: Gated {
        feature: sym::large_assignments,
        message: "the `#[move_size_limit]` attribute is an experimental feature",
        check: Features::large_assignments,
        notes: &[],
    },
}gated!(move_size_limit, large_assignments, experimental!(move_size_limit)),
314
315    // Entry point:
316    BuiltinAttribute { name: sym::no_main, gate: Ungated }ungated!(no_main),
317
318    // Modules, prelude, and resolution:
319    BuiltinAttribute { name: sym::path, gate: Ungated }ungated!(path),
320    BuiltinAttribute { name: sym::no_std, gate: Ungated }ungated!(no_std),
321    BuiltinAttribute { name: sym::no_implicit_prelude, gate: Ungated }ungated!(no_implicit_prelude),
322    BuiltinAttribute { name: sym::non_exhaustive, gate: Ungated }ungated!(non_exhaustive),
323
324    // Runtime
325    BuiltinAttribute { name: sym::windows_subsystem, gate: Ungated }ungated!(windows_subsystem),
326    BuiltinAttribute { name: sym::panic_handler, gate: Ungated }ungated!(panic_handler), // RFC 2070
327
328    // Code generation:
329    BuiltinAttribute { name: sym::inline, gate: Ungated }ungated!(inline),
330    BuiltinAttribute { name: sym::cold, gate: Ungated }ungated!(cold),
331    BuiltinAttribute { name: sym::no_builtins, gate: Ungated }ungated!(no_builtins),
332    BuiltinAttribute { name: sym::target_feature, gate: Ungated }ungated!(target_feature),
333    BuiltinAttribute { name: sym::track_caller, gate: Ungated }ungated!(track_caller),
334    BuiltinAttribute { name: sym::instruction_set, gate: Ungated }ungated!(instruction_set),
335    BuiltinAttribute {
    name: sym::force_target_feature,
    gate: Gated {
        feature: sym::effective_target_features,
        message: "the `#[force_target_feature]` attribute is an experimental feature",
        check: Features::effective_target_features,
        notes: &[],
    },
}gated!(force_target_feature, effective_target_features, experimental!(force_target_feature)),
336    BuiltinAttribute {
    name: sym::sanitize,
    gate: Gated {
        feature: sym::sanitize,
        message: "the `#[sanitize]` attribute is an experimental feature",
        check: Features::sanitize,
        notes: &[],
    },
}gated!(sanitize, sanitize, experimental!(sanitize)),
337    BuiltinAttribute {
    name: sym::coverage,
    gate: Gated {
        feature: sym::coverage_attribute,
        message: "the `#[coverage]` attribute is an experimental feature",
        check: Features::coverage_attribute,
        notes: &[],
    },
}gated!(coverage, coverage_attribute, experimental!(coverage)),
338
339    BuiltinAttribute { name: sym::doc, gate: Ungated }ungated!(doc),
340
341    // Debugging
342    BuiltinAttribute { name: sym::debugger_visualizer, gate: Ungated }ungated!(debugger_visualizer),
343    BuiltinAttribute { name: sym::collapse_debuginfo, gate: Ungated }ungated!(collapse_debuginfo),
344
345    // ==========================================================================
346    // Unstable attributes:
347    // ==========================================================================
348
349    // Linking:
350    BuiltinAttribute {
    name: sym::export_stable,
    gate: Gated {
        feature: sym::export_stable,
        message: "the `#[export_stable]` attribute is an experimental feature",
        check: Features::export_stable,
        notes: &[],
    },
}gated!(export_stable, experimental!(export_stable)),
351
352    // Testing:
353    BuiltinAttribute {
    name: sym::test_runner,
    gate: Gated {
        feature: sym::custom_test_frameworks,
        message: "custom test frameworks are an unstable feature",
        check: Features::custom_test_frameworks,
        notes: &[],
    },
}gated!(test_runner, custom_test_frameworks, "custom test frameworks are an unstable feature"),
354
355    BuiltinAttribute {
    name: sym::reexport_test_harness_main,
    gate: Gated {
        feature: sym::custom_test_frameworks,
        message: "custom test frameworks are an unstable feature",
        check: Features::custom_test_frameworks,
        notes: &[],
    },
}gated!(reexport_test_harness_main, custom_test_frameworks, "custom test frameworks are an unstable feature"),
356
357    // RFC #1268
358    BuiltinAttribute {
    name: sym::marker,
    gate: Gated {
        feature: sym::marker_trait_attr,
        message: "the `#[marker]` attribute is an experimental feature",
        check: Features::marker_trait_attr,
        notes: &[],
    },
}gated!(marker, marker_trait_attr, experimental!(marker)),
359    BuiltinAttribute {
    name: sym::thread_local,
    gate: Gated {
        feature: sym::thread_local,
        message: "`#[thread_local]` is an experimental feature, and does not currently handle destructors",
        check: Features::thread_local,
        notes: &[],
    },
}gated!(thread_local, "`#[thread_local]` is an experimental feature, and does not currently handle destructors"),
360    BuiltinAttribute {
    name: sym::no_core,
    gate: Gated {
        feature: sym::no_core,
        message: "the `#[no_core]` attribute is an experimental feature",
        check: Features::no_core,
        notes: &[],
    },
}gated!(no_core, experimental!(no_core)),
361    // RFC 2412
362    BuiltinAttribute {
    name: sym::optimize,
    gate: Gated {
        feature: sym::optimize_attribute,
        message: "the `#[optimize]` attribute is an experimental feature",
        check: Features::optimize_attribute,
        notes: &[],
    },
}gated!(optimize, optimize_attribute, experimental!(optimize)),
363
364    BuiltinAttribute {
    name: sym::ffi_pure,
    gate: Gated {
        feature: sym::ffi_pure,
        message: "the `#[ffi_pure]` attribute is an experimental feature",
        check: Features::ffi_pure,
        notes: &[],
    },
}gated!(ffi_pure, experimental!(ffi_pure)),
365    BuiltinAttribute {
    name: sym::ffi_const,
    gate: Gated {
        feature: sym::ffi_const,
        message: "the `#[ffi_const]` attribute is an experimental feature",
        check: Features::ffi_const,
        notes: &[],
    },
}gated!(ffi_const, experimental!(ffi_const)),
366    BuiltinAttribute {
    name: sym::register_tool,
    gate: Gated {
        feature: sym::register_tool,
        message: "the `#[register_tool]` attribute is an experimental feature",
        check: Features::register_tool,
        notes: &[],
    },
}gated!(register_tool, experimental!(register_tool)),
367    // `#[cfi_encoding = ""]`
368    BuiltinAttribute {
    name: sym::cfi_encoding,
    gate: Gated {
        feature: sym::cfi_encoding,
        message: "the `#[cfi_encoding]` attribute is an experimental feature",
        check: Features::cfi_encoding,
        notes: &[],
    },
}gated!(cfi_encoding, experimental!(cfi_encoding)),
369
370    // `#[coroutine]` attribute to be applied to closures to make them coroutines instead
371    BuiltinAttribute {
    name: sym::coroutine,
    gate: Gated {
        feature: sym::coroutines,
        message: "the `#[coroutine]` attribute is an experimental feature",
        check: Features::coroutines,
        notes: &[],
    },
}gated!(coroutine, coroutines, experimental!(coroutine)),
372
373    // RFC 3543
374    // `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
375    BuiltinAttribute {
    name: sym::patchable_function_entry,
    gate: Gated {
        feature: sym::patchable_function_entry,
        message: "the `#[patchable_function_entry]` attribute is an experimental feature",
        check: Features::patchable_function_entry,
        notes: &[],
    },
}gated!(patchable_function_entry, experimental!(patchable_function_entry)),
376
377    // The `#[loop_match]` and `#[const_continue]` attributes are part of the
378    // lang experiment for RFC 3720 tracked in:
379    //
380    // - https://github.com/rust-lang/rust/issues/132306
381    BuiltinAttribute {
    name: sym::const_continue,
    gate: Gated {
        feature: sym::loop_match,
        message: "the `#[const_continue]` attribute is an experimental feature",
        check: Features::loop_match,
        notes: &[],
    },
}gated!(const_continue, loop_match, experimental!(const_continue)),
382    BuiltinAttribute {
    name: sym::loop_match,
    gate: Gated {
        feature: sym::loop_match,
        message: "the `#[loop_match]` attribute is an experimental feature",
        check: Features::loop_match,
        notes: &[],
    },
}gated!(loop_match, loop_match, experimental!(loop_match)),
383
384    // The `#[pin_v2]` attribute is part of the `pin_ergonomics` experiment
385    // that allows structurally pinning, tracked in:
386    //
387    // - https://github.com/rust-lang/rust/issues/130494
388    BuiltinAttribute {
    name: sym::pin_v2,
    gate: Gated {
        feature: sym::pin_ergonomics,
        message: "the `#[pin_v2]` attribute is an experimental feature",
        check: Features::pin_ergonomics,
        notes: &[],
    },
}gated!(pin_v2, pin_ergonomics, experimental!(pin_v2)),
389
390    // ==========================================================================
391    // Internal attributes: Stability, deprecation, and unsafe:
392    // ==========================================================================
393
394    BuiltinAttribute { name: sym::feature, gate: Ungated }ungated!(feature),
395    // DuplicatesOk since it has its own validation
396    BuiltinAttribute { name: sym::stable, gate: Ungated }ungated!(stable),
397    BuiltinAttribute { name: sym::unstable, gate: Ungated }ungated!(unstable),
398    BuiltinAttribute { name: sym::unstable_feature_bound, gate: Ungated }ungated!(unstable_feature_bound),
399    BuiltinAttribute { name: sym::unstable_removed, gate: Ungated }ungated!(unstable_removed),
400    BuiltinAttribute { name: sym::rustc_const_unstable, gate: Ungated }ungated!(rustc_const_unstable),
401    BuiltinAttribute { name: sym::rustc_const_stable, gate: Ungated }ungated!(rustc_const_stable),
402    BuiltinAttribute { name: sym::rustc_default_body_unstable, gate: Ungated }ungated!(rustc_default_body_unstable),
403    BuiltinAttribute {
    name: sym::allow_internal_unstable,
    gate: Gated {
        feature: sym::allow_internal_unstable,
        message: "allow_internal_unstable side-steps feature gating and stability checks",
        check: Features::allow_internal_unstable,
        notes: &[],
    },
}gated!(
404        allow_internal_unstable,
405        "allow_internal_unstable side-steps feature gating and stability checks",
406    ),
407    BuiltinAttribute {
    name: sym::allow_internal_unsafe,
    gate: Gated {
        feature: sym::allow_internal_unsafe,
        message: "allow_internal_unsafe side-steps the unsafe_code lint",
        check: Features::allow_internal_unsafe,
        notes: &[],
    },
}gated!(
408        allow_internal_unsafe,
409        "allow_internal_unsafe side-steps the unsafe_code lint",
410    ),
411    BuiltinAttribute {
    name: sym::rustc_eii_foreign_item,
    gate: Gated {
        feature: sym::eii_internals,
        message: "used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
        check: Features::eii_internals,
        notes: &[],
    },
}gated!(
412        rustc_eii_foreign_item,
413        eii_internals,
414        "used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
415    ),
416    BuiltinAttribute {
    name: sym::rustc_allowed_through_unstable_modules,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_allowed_through_unstable_modules]` attribute is an internal implementation detail that will never be stable",
                    "rustc_allowed_through_unstable_modules special cases accidental stabilizations of stable items \
        through unstable paths"],
    },
}rustc_attr!(
417        rustc_allowed_through_unstable_modules,
418        "rustc_allowed_through_unstable_modules special cases accidental stabilizations of stable items \
419        through unstable paths"
420    ),
421    BuiltinAttribute {
    name: sym::rustc_deprecated_safe_2024,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_deprecated_safe_2024]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_deprecated_safe_2024]` is used to declare functions unsafe across the edition 2024 boundary"],
    },
}rustc_attr!(
422        rustc_deprecated_safe_2024,
423        "`#[rustc_deprecated_safe_2024]` is used to declare functions unsafe across the edition 2024 boundary",
424    ),
425    BuiltinAttribute {
    name: sym::rustc_pub_transparent,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_pub_transparent]` attribute is an internal implementation detail that will never be stable",
                    "used internally to mark types with a `transparent` representation when it is guaranteed by the documentation"],
    },
}rustc_attr!(
426        rustc_pub_transparent,
427        "used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
428    ),
429
430
431    // ==========================================================================
432    // Internal attributes: Type system related:
433    // ==========================================================================
434
435    BuiltinAttribute {
    name: sym::fundamental,
    gate: Gated {
        feature: sym::fundamental,
        message: "the `#[fundamental]` attribute is an experimental feature",
        check: Features::fundamental,
        notes: &[],
    },
}gated!(fundamental, experimental!(fundamental)),
436    BuiltinAttribute {
    name: sym::may_dangle,
    gate: Gated {
        feature: sym::dropck_eyepatch,
        message: "`may_dangle` has unstable semantics and may be removed in the future",
        check: Features::dropck_eyepatch,
        notes: &[],
    },
}gated!(
437        may_dangle,
438        dropck_eyepatch,
439        "`may_dangle` has unstable semantics and may be removed in the future",
440    ),
441
442    BuiltinAttribute {
    name: sym::rustc_never_type_options,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_never_type_options]` attribute is an internal implementation detail that will never be stable",
                    "`rustc_never_type_options` is used to experiment with never type fallback and work on \
         never type stabilization"],
    },
}rustc_attr!(
443        rustc_never_type_options,
444        "`rustc_never_type_options` is used to experiment with never type fallback and work on \
445         never type stabilization"
446    ),
447
448    // ==========================================================================
449    // Internal attributes: Runtime related:
450    // ==========================================================================
451
452    BuiltinAttribute {
    name: sym::rustc_allocator,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_allocator]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_allocator),
453    BuiltinAttribute {
    name: sym::rustc_nounwind,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_nounwind]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_nounwind),
454    BuiltinAttribute {
    name: sym::rustc_reallocator,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_reallocator]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_reallocator),
455    BuiltinAttribute {
    name: sym::rustc_deallocator,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_deallocator]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_deallocator),
456    BuiltinAttribute {
    name: sym::rustc_allocator_zeroed,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_allocator_zeroed]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_allocator_zeroed),
457    BuiltinAttribute {
    name: sym::rustc_allocator_zeroed_variant,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_allocator_zeroed_variant]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_allocator_zeroed_variant),
458    BuiltinAttribute {
    name: sym::default_lib_allocator,
    gate: Gated {
        feature: sym::allocator_internals,
        message: "the `#[default_lib_allocator]` attribute is an experimental feature",
        check: Features::allocator_internals,
        notes: &[],
    },
}gated!(
459        default_lib_allocator,
460        allocator_internals, experimental!(default_lib_allocator),
461    ),
462    BuiltinAttribute {
    name: sym::needs_allocator,
    gate: Gated {
        feature: sym::allocator_internals,
        message: "the `#[needs_allocator]` attribute is an experimental feature",
        check: Features::allocator_internals,
        notes: &[],
    },
}gated!(
463        needs_allocator,
464        allocator_internals, experimental!(needs_allocator),
465    ),
466    BuiltinAttribute {
    name: sym::panic_runtime,
    gate: Gated {
        feature: sym::panic_runtime,
        message: "the `#[panic_runtime]` attribute is an experimental feature",
        check: Features::panic_runtime,
        notes: &[],
    },
}gated!(
467        panic_runtime,
468        experimental!(panic_runtime)
469    ),
470    BuiltinAttribute {
    name: sym::needs_panic_runtime,
    gate: Gated {
        feature: sym::needs_panic_runtime,
        message: "the `#[needs_panic_runtime]` attribute is an experimental feature",
        check: Features::needs_panic_runtime,
        notes: &[],
    },
}gated!(
471        needs_panic_runtime,
472        experimental!(needs_panic_runtime)
473    ),
474    BuiltinAttribute {
    name: sym::compiler_builtins,
    gate: Gated {
        feature: sym::compiler_builtins,
        message: "the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate \
        which contains compiler-rt intrinsics and will never be stable",
        check: Features::compiler_builtins,
        notes: &[],
    },
}gated!(
475        compiler_builtins,
476        "the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate \
477        which contains compiler-rt intrinsics and will never be stable",
478    ),
479    BuiltinAttribute {
    name: sym::profiler_runtime,
    gate: Gated {
        feature: sym::profiler_runtime,
        message: "the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \
        which contains the profiler runtime and will never be stable",
        check: Features::profiler_runtime,
        notes: &[],
    },
}gated!(
480        profiler_runtime,
481        "the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \
482        which contains the profiler runtime and will never be stable",
483    ),
484
485    // ==========================================================================
486    // Internal attributes, Linkage:
487    // ==========================================================================
488
489    BuiltinAttribute {
    name: sym::linkage,
    gate: Gated {
        feature: sym::linkage,
        message: "the `linkage` attribute is experimental and not portable across platforms",
        check: Features::linkage,
        notes: &[],
    },
}gated!(
490        linkage,
491        "the `linkage` attribute is experimental and not portable across platforms",
492    ),
493    BuiltinAttribute {
    name: sym::rustc_std_internal_symbol,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_std_internal_symbol]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_std_internal_symbol),
494    BuiltinAttribute {
    name: sym::rustc_objc_class,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_objc_class]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_objc_class),
495    BuiltinAttribute {
    name: sym::rustc_objc_selector,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_objc_selector]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_objc_selector),
496
497    // ==========================================================================
498    // Internal attributes, Macro related:
499    // ==========================================================================
500
501    BuiltinAttribute {
    name: sym::rustc_builtin_macro,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_builtin_macro]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_builtin_macro),
502    BuiltinAttribute {
    name: sym::rustc_proc_macro_decls,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_proc_macro_decls]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_proc_macro_decls),
503    BuiltinAttribute {
    name: sym::rustc_macro_transparency,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_macro_transparency]` attribute is an internal implementation detail that will never be stable",
                    "used internally for testing macro hygiene"],
    },
}rustc_attr!(
504        rustc_macro_transparency,
505        "used internally for testing macro hygiene",
506    ),
507    BuiltinAttribute {
    name: sym::rustc_autodiff,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_autodiff]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_autodiff),
508    BuiltinAttribute {
    name: sym::rustc_offload_kernel,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_offload_kernel]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_offload_kernel),
509    // Traces that are left when `cfg` and `cfg_attr` attributes are expanded.
510    // The attributes are not gated, to avoid stability errors, but they cannot be used in stable
511    // or unstable code directly because `sym::cfg_(attr_)trace` are not valid identifiers, they
512    // can only be generated by the compiler.
513    BuiltinAttribute { name: sym::cfg_trace, gate: Ungated }ungated!(cfg_trace),
514    BuiltinAttribute { name: sym::cfg_attr_trace, gate: Ungated }ungated!(cfg_attr_trace),
515
516    // ==========================================================================
517    // Internal attributes, Diagnostics related:
518    // ==========================================================================
519
520    BuiltinAttribute {
    name: sym::rustc_on_unimplemented,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_on_unimplemented]` attribute is an internal implementation detail that will never be stable",
                    "see `#[diagnostic::on_unimplemented]` for the stable equivalent of this attribute"],
    },
}rustc_attr!(
521        rustc_on_unimplemented,
522        "see `#[diagnostic::on_unimplemented]` for the stable equivalent of this attribute"
523    ),
524    BuiltinAttribute {
    name: sym::rustc_confusables,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_confusables]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_confusables),
525    // Enumerates "identity-like" conversion methods to suggest on type mismatch.
526    BuiltinAttribute {
    name: sym::rustc_conversion_suggestion,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_conversion_suggestion]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_conversion_suggestion),
527    // Prevents field reads in the marked trait or method to be considered
528    // during dead code analysis.
529    BuiltinAttribute {
    name: sym::rustc_trivial_field_reads,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_trivial_field_reads]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_trivial_field_reads),
530    // Used by the `rustc::potential_query_instability` lint to warn methods which
531    // might not be stable during incremental compilation.
532    BuiltinAttribute {
    name: sym::rustc_lint_query_instability,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_lint_query_instability]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_lint_query_instability),
533    // Used by the `rustc::untracked_query_information` lint to warn methods which
534    // might not be stable during incremental compilation.
535    BuiltinAttribute {
    name: sym::rustc_lint_untracked_query_information,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_lint_untracked_query_information]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_lint_untracked_query_information),
536    // Used by the `rustc::bad_opt_access` lint to identify `DebuggingOptions` and `CodegenOptions`
537    // types (as well as any others in future).
538    BuiltinAttribute {
    name: sym::rustc_lint_opt_ty,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_lint_opt_ty]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_lint_opt_ty),
539    // Used by the `rustc::bad_opt_access` lint on fields
540    // types (as well as any others in future).
541    BuiltinAttribute {
    name: sym::rustc_lint_opt_deny_field_access,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_lint_opt_deny_field_access]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_lint_opt_deny_field_access),
542
543    // ==========================================================================
544    // Internal attributes, Const related:
545    // ==========================================================================
546
547    BuiltinAttribute {
    name: sym::rustc_promotable,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_promotable]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_promotable),
548    BuiltinAttribute {
    name: sym::rustc_legacy_const_generics,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_legacy_const_generics]` attribute is an internal implementation detail that will never be stable"],
    },
}rustc_attr!(rustc_legacy_const_generics),
549    // Do not const-check this function's body. It will always get replaced during CTFE via `hook_special_const_fn`.
550    BuiltinAttribute {
    name: sym::rustc_do_not_const_check,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_do_not_const_check]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_do_not_const_check]` skips const-check for this function's body"],
    },
}rustc_attr!(
551        rustc_do_not_const_check,
552        "`#[rustc_do_not_const_check]` skips const-check for this function's body",
553    ),
554    BuiltinAttribute {
    name: sym::rustc_const_stable_indirect,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_const_stable_indirect]` attribute is an internal implementation detail that will never be stable",
                    "this is an internal implementation detail"],
    },
}rustc_attr!(
555        rustc_const_stable_indirect,
556        "this is an internal implementation detail",
557    ),
558    BuiltinAttribute {
    name: sym::rustc_intrinsic_const_stable_indirect,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_intrinsic_const_stable_indirect]` attribute is an internal implementation detail that will never be stable",
                    "this is an internal implementation detail"],
    },
}rustc_attr!(
559        rustc_intrinsic_const_stable_indirect,
560         "this is an internal implementation detail",
561    ),
562    BuiltinAttribute {
    name: sym::rustc_allow_const_fn_unstable,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_allow_const_fn_unstable]` attribute is an internal implementation detail that will never be stable",
                    "rustc_allow_const_fn_unstable side-steps feature gating and stability checks"],
    },
}rustc_attr!(
563        rustc_allow_const_fn_unstable,
564        "rustc_allow_const_fn_unstable side-steps feature gating and stability checks"
565    ),
566
567    // ==========================================================================
568    // Internal attributes, Layout related:
569    // ==========================================================================
570
571    BuiltinAttribute {
    name: sym::rustc_simd_monomorphize_lane_limit,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_simd_monomorphize_lane_limit]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_simd_monomorphize_lane_limit]` attribute is just used by std::simd \
        for better error messages"],
    },
}rustc_attr!(
572        rustc_simd_monomorphize_lane_limit,
573        "the `#[rustc_simd_monomorphize_lane_limit]` attribute is just used by std::simd \
574        for better error messages",
575    ),
576    BuiltinAttribute {
    name: sym::rustc_nonnull_optimization_guaranteed,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_nonnull_optimization_guaranteed]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to document \
        guaranteed niche optimizations in the standard library",
                    "the compiler does not even check whether the type indeed is being non-null-optimized; \
        it is your responsibility to ensure that the attribute is only used on types that are optimized"],
    },
}rustc_attr!(
577        rustc_nonnull_optimization_guaranteed,
578        "the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to document \
579        guaranteed niche optimizations in the standard library",
580        "the compiler does not even check whether the type indeed is being non-null-optimized; \
581        it is your responsibility to ensure that the attribute is only used on types that are optimized",
582    ),
583
584    // ==========================================================================
585    // Internal attributes, Misc:
586    // ==========================================================================
587    BuiltinAttribute {
    name: sym::lang,
    gate: Gated {
        feature: sym::lang_items,
        message: "lang items are subject to change",
        check: Features::lang_items,
        notes: &[],
    },
}gated!(
588        lang, lang_items,
589        "lang items are subject to change",
590    ),
591    BuiltinAttribute {
    name: sym::rustc_as_ptr,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_as_ptr]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_as_ptr]` is used to mark functions returning pointers to their inner allocations"],
    },
}rustc_attr!(
592        rustc_as_ptr,
593        "`#[rustc_as_ptr]` is used to mark functions returning pointers to their inner allocations"
594    ),
595    BuiltinAttribute {
    name: sym::rustc_should_not_be_called_on_const_items,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_should_not_be_called_on_const_items]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_should_not_be_called_on_const_items]` is used to mark methods that don't make sense to be called on interior mutable consts"],
    },
}rustc_attr!(
596        rustc_should_not_be_called_on_const_items,
597        "`#[rustc_should_not_be_called_on_const_items]` is used to mark methods that don't make sense to be called on interior mutable consts"
598    ),
599    BuiltinAttribute {
    name: sym::rustc_pass_by_value,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_pass_by_value]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_pass_by_value]` is used to mark types that must be passed by value instead of reference"],
    },
}rustc_attr!(
600        rustc_pass_by_value,
601        "`#[rustc_pass_by_value]` is used to mark types that must be passed by value instead of reference"
602    ),
603    BuiltinAttribute {
    name: sym::rustc_never_returns_null_ptr,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_never_returns_null_ptr]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_never_returns_null_ptr]` is used to mark functions returning non-null pointers"],
    },
}rustc_attr!(
604        rustc_never_returns_null_ptr,
605        "`#[rustc_never_returns_null_ptr]` is used to mark functions returning non-null pointers"
606    ),
607    BuiltinAttribute {
    name: sym::rustc_no_implicit_autorefs,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_no_implicit_autorefs]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_no_implicit_autorefs]` is used to mark functions for which an autoref to the dereference of a raw pointer should not be used as an argument"],
    },
}rustc_attr!(
608        rustc_no_implicit_autorefs,
609        "`#[rustc_no_implicit_autorefs]` is used to mark functions for which an autoref to the dereference of a raw pointer should not be used as an argument"
610    ),
611    BuiltinAttribute {
    name: sym::rustc_coherence_is_core,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_coherence_is_core]` attribute is an internal implementation detail that will never be stable",
                    "`#![rustc_coherence_is_core]` allows inherent methods on builtin types, only intended to be used in `core`"],
    },
}rustc_attr!(
612        rustc_coherence_is_core,
613        "`#![rustc_coherence_is_core]` allows inherent methods on builtin types, only intended to be used in `core`"
614    ),
615    BuiltinAttribute {
    name: sym::rustc_coinductive,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_coinductive]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_coinductive]` changes a trait to be coinductive, allowing cycles in the trait solver"],
    },
}rustc_attr!(
616        rustc_coinductive,
617        "`#[rustc_coinductive]` changes a trait to be coinductive, allowing cycles in the trait solver"
618    ),
619    BuiltinAttribute {
    name: sym::rustc_allow_incoherent_impl,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_allow_incoherent_impl]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_allow_incoherent_impl]` has to be added to all impl items of an incoherent inherent impl"],
    },
}rustc_attr!(
620        rustc_allow_incoherent_impl,
621        "`#[rustc_allow_incoherent_impl]` has to be added to all impl items of an incoherent inherent impl"
622    ),
623    BuiltinAttribute {
    name: sym::rustc_preserve_ub_checks,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_preserve_ub_checks]` attribute is an internal implementation detail that will never be stable",
                    "`#![rustc_preserve_ub_checks]` prevents the designated crate from evaluating whether UB checks are enabled when optimizing MIR"],
    },
}rustc_attr!(
624        rustc_preserve_ub_checks,
625        "`#![rustc_preserve_ub_checks]` prevents the designated crate from evaluating whether UB checks are enabled when optimizing MIR",
626    ),
627    BuiltinAttribute {
    name: sym::rustc_deny_explicit_impl,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_deny_explicit_impl]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_deny_explicit_impl]` enforces that a trait can have no user-provided impls"],
    },
}rustc_attr!(
628        rustc_deny_explicit_impl,
629        "`#[rustc_deny_explicit_impl]` enforces that a trait can have no user-provided impls"
630    ),
631    BuiltinAttribute {
    name: sym::rustc_dyn_incompatible_trait,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dyn_incompatible_trait]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_dyn_incompatible_trait]` marks a trait as dyn-incompatible, \
        even if it otherwise satisfies the requirements to be dyn-compatible."],
    },
}rustc_attr!(
632        rustc_dyn_incompatible_trait,
633        "`#[rustc_dyn_incompatible_trait]` marks a trait as dyn-incompatible, \
634        even if it otherwise satisfies the requirements to be dyn-compatible."
635    ),
636    BuiltinAttribute {
    name: sym::rustc_has_incoherent_inherent_impls,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_has_incoherent_inherent_impls]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_has_incoherent_inherent_impls]` allows the addition of incoherent inherent impls for \
         the given type by annotating all impl items with `#[rustc_allow_incoherent_impl]`"],
    },
}rustc_attr!(
637        rustc_has_incoherent_inherent_impls,
638        "`#[rustc_has_incoherent_inherent_impls]` allows the addition of incoherent inherent impls for \
639         the given type by annotating all impl items with `#[rustc_allow_incoherent_impl]`"
640    ),
641    BuiltinAttribute {
    name: sym::rustc_non_const_trait_method,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_non_const_trait_method]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_non_const_trait_method]` should only used by the standard library to mark trait methods \
        as non-const to allow large traits an easier transition to const"],
    },
}rustc_attr!(
642        rustc_non_const_trait_method,
643        "`#[rustc_non_const_trait_method]` should only used by the standard library to mark trait methods \
644        as non-const to allow large traits an easier transition to const"
645    ),
646
647    BuiltinAttribute {
648        name: sym::rustc_diagnostic_item,
649        gate: Gated {
650            feature: sym::rustc_attrs,
651            message: "use of an internal attribute",
652            check: Features::rustc_attrs,
653            notes: &["the `#[rustc_diagnostic_item]` attribute allows the compiler to reference types \
654            from the standard library for diagnostic purposes"],
655        },
656    },
657    BuiltinAttribute {
    name: sym::prelude_import,
    gate: Gated {
        feature: sym::prelude_import,
        message: "`#[prelude_import]` is for use by rustc only",
        check: Features::prelude_import,
        notes: &[],
    },
}gated!(
658        // Used in resolve:
659        prelude_import,
660        "`#[prelude_import]` is for use by rustc only",
661    ),
662    BuiltinAttribute {
    name: sym::rustc_paren_sugar,
    gate: Gated {
        feature: sym::unboxed_closures,
        message: "unboxed_closures are still evolving",
        check: Features::unboxed_closures,
        notes: &[],
    },
}gated!(
663        rustc_paren_sugar,
664        unboxed_closures, "unboxed_closures are still evolving",
665    ),
666    BuiltinAttribute {
    name: sym::rustc_inherit_overflow_checks,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_inherit_overflow_checks]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_inherit_overflow_checks]` attribute is just used to control \
        overflow checking behavior of several functions in the standard library that are inlined \
        across crates"],
    },
}rustc_attr!(
667        rustc_inherit_overflow_checks,
668        "the `#[rustc_inherit_overflow_checks]` attribute is just used to control \
669        overflow checking behavior of several functions in the standard library that are inlined \
670        across crates",
671    ),
672    BuiltinAttribute {
    name: sym::rustc_reservation_impl,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_reservation_impl]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_reservation_impl]` attribute is internally used \
        for reserving `impl<T> From<!> for T` as part of the effort to stabilize `!`"],
    },
}rustc_attr!(
673        rustc_reservation_impl,
674        "the `#[rustc_reservation_impl]` attribute is internally used \
675        for reserving `impl<T> From<!> for T` as part of the effort to stabilize `!`"
676    ),
677    BuiltinAttribute {
    name: sym::rustc_test_marker,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_test_marker]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_test_marker]` attribute is used internally to track tests"],
    },
}rustc_attr!(
678        rustc_test_marker,
679        "the `#[rustc_test_marker]` attribute is used internally to track tests",
680    ),
681    BuiltinAttribute {
    name: sym::rustc_unsafe_specialization_marker,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_unsafe_specialization_marker]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_unsafe_specialization_marker]` attribute is used to check specializations"],
    },
}rustc_attr!(
682        rustc_unsafe_specialization_marker,
683        "the `#[rustc_unsafe_specialization_marker]` attribute is used to check specializations"
684    ),
685    BuiltinAttribute {
    name: sym::rustc_specialization_trait,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_specialization_trait]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_specialization_trait]` attribute is used to check specializations"],
    },
}rustc_attr!(
686        rustc_specialization_trait,
687        "the `#[rustc_specialization_trait]` attribute is used to check specializations"
688    ),
689    BuiltinAttribute {
    name: sym::rustc_main,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_main]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_main]` attribute is used internally to specify test entry point function"],
    },
}rustc_attr!(
690        rustc_main,
691        "the `#[rustc_main]` attribute is used internally to specify test entry point function",
692    ),
693    BuiltinAttribute {
    name: sym::rustc_skip_during_method_dispatch,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_skip_during_method_dispatch]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_skip_during_method_dispatch]` attribute is used to exclude a trait \
        from method dispatch when the receiver is of the following type, for compatibility in \
        editions < 2021 (array) or editions < 2024 (boxed_slice)"],
    },
}rustc_attr!(
694        rustc_skip_during_method_dispatch,
695        "the `#[rustc_skip_during_method_dispatch]` attribute is used to exclude a trait \
696        from method dispatch when the receiver is of the following type, for compatibility in \
697        editions < 2021 (array) or editions < 2024 (boxed_slice)"
698    ),
699    BuiltinAttribute {
    name: sym::rustc_must_implement_one_of,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_must_implement_one_of]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete \
        definition of a trait. Its syntax and semantics are highly experimental and will be \
        subject to change before stabilization"],
    },
}rustc_attr!(
700        rustc_must_implement_one_of,
701        "the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete \
702        definition of a trait. Its syntax and semantics are highly experimental and will be \
703        subject to change before stabilization",
704    ),
705    BuiltinAttribute {
    name: sym::rustc_doc_primitive,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_doc_primitive]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_doc_primitive]` attribute is used by the standard library \
        to provide a way to generate documentation for primitive types"],
    },
}rustc_attr!(
706        rustc_doc_primitive,
707        "the `#[rustc_doc_primitive]` attribute is used by the standard library \
708        to provide a way to generate documentation for primitive types",
709    ),
710    BuiltinAttribute {
    name: sym::rustc_intrinsic,
    gate: Gated {
        feature: sym::intrinsics,
        message: "the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items",
        check: Features::intrinsics,
        notes: &[],
    },
}gated!(
711        rustc_intrinsic, intrinsics,
712        "the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items",
713    ),
714    BuiltinAttribute {
    name: sym::rustc_no_mir_inline,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_no_mir_inline]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_no_mir_inline]` prevents the MIR inliner from inlining a function while not affecting codegen"],
    },
}rustc_attr!(
715        rustc_no_mir_inline,
716        "`#[rustc_no_mir_inline]` prevents the MIR inliner from inlining a function while not affecting codegen"
717    ),
718    BuiltinAttribute {
    name: sym::rustc_force_inline,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_force_inline]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_force_inline]` forces a free function to be inlined"],
    },
}rustc_attr!(
719        rustc_force_inline,
720        "`#[rustc_force_inline]` forces a free function to be inlined"
721    ),
722    BuiltinAttribute {
    name: sym::rustc_scalable_vector,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_scalable_vector]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_scalable_vector]` defines a scalable vector type"],
    },
}rustc_attr!(
723        rustc_scalable_vector,
724        "`#[rustc_scalable_vector]` defines a scalable vector type"
725    ),
726    BuiltinAttribute {
    name: sym::rustc_must_match_exhaustively,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_must_match_exhaustively]` attribute is an internal implementation detail that will never be stable",
                    "enums with `#[rustc_must_match_exhaustively]` must be matched on with a match block that mentions all variants explicitly"],
    },
}rustc_attr!(
727        rustc_must_match_exhaustively,
728        "enums with `#[rustc_must_match_exhaustively]` must be matched on with a match block that mentions all variants explicitly"
729    ),
730    BuiltinAttribute {
    name: sym::rustc_no_writable,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_no_writable]` attribute is an internal implementation detail that will never be stable",
                    "`#[rustc_no_writable]` stops the compiler from considering mutable reference arguments of this function as implicitly writable"],
    },
}rustc_attr!(
731        rustc_no_writable,
732        "`#[rustc_no_writable]` stops the compiler from considering mutable reference arguments of this function as implicitly writable"
733    ),
734
735    // ==========================================================================
736    // Internal attributes, Testing:
737    // ==========================================================================
738
739    BuiltinAttribute {
    name: sym::rustc_effective_visibility,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_effective_visibility]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_effective_visibility]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_effective_visibility),
740    BuiltinAttribute {
    name: sym::rustc_dump_inferred_outlives,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_inferred_outlives]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_inferred_outlives]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_inferred_outlives),
741    BuiltinAttribute {
    name: sym::rustc_capture_analysis,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_capture_analysis]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_capture_analysis]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_capture_analysis,),
742    BuiltinAttribute {
    name: sym::rustc_insignificant_dtor,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_insignificant_dtor]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_insignificant_dtor]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_insignificant_dtor),
743    BuiltinAttribute {
    name: sym::rustc_no_implicit_bounds,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_no_implicit_bounds]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_no_implicit_bounds]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_no_implicit_bounds),
744    BuiltinAttribute {
    name: sym::rustc_strict_coherence,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_strict_coherence]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_strict_coherence]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_strict_coherence),
745    BuiltinAttribute {
    name: sym::rustc_dump_variances,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_variances]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_variances]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_variances),
746    BuiltinAttribute {
    name: sym::rustc_dump_variances_of_opaques,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_variances_of_opaques]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_variances_of_opaques]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_variances_of_opaques),
747    BuiltinAttribute {
    name: sym::rustc_dump_hidden_type_of_opaques,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_hidden_type_of_opaques]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_hidden_type_of_opaques]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_hidden_type_of_opaques),
748    BuiltinAttribute {
    name: sym::rustc_dump_layout,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_layout]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_layout]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_layout),
749    BuiltinAttribute {
    name: sym::rustc_abi,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_abi]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_abi]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_abi),
750    BuiltinAttribute {
    name: sym::rustc_regions,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_regions]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_regions]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_regions),
751    BuiltinAttribute {
    name: sym::rustc_delayed_bug_from_inside_query,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_delayed_bug_from_inside_query]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_delayed_bug_from_inside_query]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_delayed_bug_from_inside_query),
752    BuiltinAttribute {
    name: sym::rustc_dump_user_args,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_user_args]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_user_args]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_user_args),
753    BuiltinAttribute {
    name: sym::rustc_evaluate_where_clauses,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_evaluate_where_clauses]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_evaluate_where_clauses]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_evaluate_where_clauses),
754    BuiltinAttribute {
    name: sym::rustc_if_this_changed,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_if_this_changed]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_if_this_changed]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_if_this_changed),
755    BuiltinAttribute {
    name: sym::rustc_then_this_would_need,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_then_this_would_need]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_then_this_would_need]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_then_this_would_need),
756    BuiltinAttribute {
    name: sym::rustc_clean,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_clean]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_clean]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_clean),
757    BuiltinAttribute {
    name: sym::rustc_partition_reused,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_partition_reused]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_partition_reused]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_partition_reused),
758    BuiltinAttribute {
    name: sym::rustc_partition_codegened,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_partition_codegened]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_partition_codegened]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_partition_codegened),
759    BuiltinAttribute {
    name: sym::rustc_expected_cgu_reuse,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_expected_cgu_reuse]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_expected_cgu_reuse]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_expected_cgu_reuse),
760    BuiltinAttribute {
    name: sym::rustc_dump_symbol_name,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_symbol_name]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_symbol_name]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_symbol_name),
761    BuiltinAttribute {
    name: sym::rustc_dump_def_path,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_def_path]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_def_path]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_def_path),
762    BuiltinAttribute {
    name: sym::rustc_mir,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_mir]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_mir]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_mir),
763    BuiltinAttribute {
    name: sym::custom_mir,
    gate: Gated {
        feature: sym::custom_mir,
        message: "the `#[custom_mir]` attribute is just used for the Rust test suite",
        check: Features::custom_mir,
        notes: &[],
    },
}gated!(
764        custom_mir, "the `#[custom_mir]` attribute is just used for the Rust test suite",
765    ),
766    BuiltinAttribute {
    name: sym::rustc_dump_item_bounds,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_item_bounds]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_item_bounds]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_item_bounds),
767    BuiltinAttribute {
    name: sym::rustc_dump_predicates,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_predicates]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_predicates]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_predicates),
768    BuiltinAttribute {
    name: sym::rustc_dump_def_parents,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_def_parents]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_def_parents]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_def_parents),
769    BuiltinAttribute {
    name: sym::rustc_dump_object_lifetime_defaults,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_object_lifetime_defaults]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_object_lifetime_defaults]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_object_lifetime_defaults),
770    BuiltinAttribute {
    name: sym::rustc_dump_vtable,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dump_vtable]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dump_vtable]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dump_vtable),
771    BuiltinAttribute {
    name: sym::rustc_dummy,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_dummy]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_dummy]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, rustc_dummy),
772    BuiltinAttribute {
    name: sym::pattern_complexity_limit,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[pattern_complexity_limit]` attribute is an internal implementation detail that will never be stable",
                    "the `#[pattern_complexity_limit]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(TEST, pattern_complexity_limit),
773];
774
775pub fn is_builtin_attr_name(name: Symbol) -> bool {
776    BUILTIN_ATTRIBUTE_MAP.get(&name).is_some()
777}
778
779pub static BUILTIN_ATTRIBUTE_MAP: LazyLock<FxHashMap<Symbol, &BuiltinAttribute>> =
780    LazyLock::new(|| {
781        let mut map = FxHashMap::default();
782        for attr in BUILTIN_ATTRIBUTES.iter() {
783            if map.insert(attr.name, attr).is_some() {
784                {
    ::core::panicking::panic_fmt(format_args!("duplicate builtin attribute `{0}`",
            attr.name));
};panic!("duplicate builtin attribute `{}`", attr.name);
785            }
786        }
787        map
788    });