Skip to main content

rustc_feature/
builtin_attrs.rs

1//! Built-in attributes and `cfg` flag gating.
2
3use std::sync::LazyLock;
4
5use AttributeDuplicates::*;
6use AttributeGate::*;
7use AttributeType::*;
8use rustc_data_structures::fx::FxHashMap;
9use rustc_hir::AttrStyle;
10use rustc_hir::attrs::EncodeCrossCrate;
11use rustc_span::edition::Edition;
12use rustc_span::{Symbol, sym};
13
14use crate::Features;
15
16type GateFn = fn(&Features) -> bool;
17
18pub type GatedCfg = (Symbol, Symbol, GateFn);
19
20/// `cfg(...)`'s that are feature gated.
21const GATED_CFGS: &[GatedCfg] = &[
22    // (name in cfg, feature, function to check if the feature is enabled)
23    (sym::overflow_checks, sym::cfg_overflow_checks, Features::cfg_overflow_checks),
24    (sym::ub_checks, sym::cfg_ub_checks, Features::cfg_ub_checks),
25    (sym::contract_checks, sym::cfg_contract_checks, Features::cfg_contract_checks),
26    (sym::target_thread_local, sym::cfg_target_thread_local, Features::cfg_target_thread_local),
27    (
28        sym::target_has_atomic_equal_alignment,
29        sym::cfg_target_has_atomic_equal_alignment,
30        Features::cfg_target_has_atomic_equal_alignment,
31    ),
32    (
33        sym::target_has_atomic_load_store,
34        sym::cfg_target_has_atomic,
35        Features::cfg_target_has_atomic,
36    ),
37    (sym::sanitize, sym::cfg_sanitize, Features::cfg_sanitize),
38    (sym::version, sym::cfg_version, Features::cfg_version),
39    (sym::relocation_model, sym::cfg_relocation_model, Features::cfg_relocation_model),
40    (sym::sanitizer_cfi_generalize_pointers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi),
41    (sym::sanitizer_cfi_normalize_integers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi),
42    // this is consistent with naming of the compiler flag it's for
43    (sym::fmt_debug, sym::fmt_debug, Features::fmt_debug),
44    (sym::emscripten_wasm_eh, sym::cfg_emscripten_wasm_eh, Features::cfg_emscripten_wasm_eh),
45    (
46        sym::target_has_reliable_f16,
47        sym::cfg_target_has_reliable_f16_f128,
48        Features::cfg_target_has_reliable_f16_f128,
49    ),
50    (
51        sym::target_has_reliable_f16_math,
52        sym::cfg_target_has_reliable_f16_f128,
53        Features::cfg_target_has_reliable_f16_f128,
54    ),
55    (
56        sym::target_has_reliable_f128,
57        sym::cfg_target_has_reliable_f16_f128,
58        Features::cfg_target_has_reliable_f16_f128,
59    ),
60    (
61        sym::target_has_reliable_f128_math,
62        sym::cfg_target_has_reliable_f16_f128,
63        Features::cfg_target_has_reliable_f16_f128,
64    ),
65];
66
67/// Find a gated cfg determined by the `pred`icate which is given the cfg's name.
68pub fn find_gated_cfg(pred: impl Fn(Symbol) -> bool) -> Option<&'static GatedCfg> {
69    GATED_CFGS.iter().find(|(cfg_sym, ..)| pred(*cfg_sym))
70}
71
72// If you change this, please modify `src/doc/unstable-book` as well. You must
73// move that documentation into the relevant place in the other docs, and
74// remove the chapter on the flag.
75
76#[derive(#[automatically_derived]
impl ::core::marker::Copy for AttributeType { }Copy, #[automatically_derived]
impl ::core::clone::Clone for AttributeType {
    #[inline]
    fn clone(&self) -> AttributeType { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for AttributeType {
    #[inline]
    fn eq(&self, other: &AttributeType) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for AttributeType {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                AttributeType::Normal => "Normal",
                AttributeType::CrateLevel => "CrateLevel",
            })
    }
}Debug)]
77pub enum AttributeType {
78    /// Normal, builtin attribute that is consumed
79    /// by the compiler before the unused_attribute check
80    Normal,
81
82    /// Builtin attribute that is only allowed at the crate level
83    CrateLevel,
84}
85
86#[derive(#[automatically_derived]
impl ::core::marker::Copy for AttributeSafety { }Copy, #[automatically_derived]
impl ::core::clone::Clone for AttributeSafety {
    #[inline]
    fn clone(&self) -> AttributeSafety {
        let _: ::core::clone::AssertParamIsClone<Option<Edition>>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for AttributeSafety {
    #[inline]
    fn eq(&self, other: &AttributeSafety) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (AttributeSafety::Unsafe { unsafe_since: __self_0 },
                    AttributeSafety::Unsafe { unsafe_since: __arg1_0 }) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for AttributeSafety {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            AttributeSafety::Normal =>
                ::core::fmt::Formatter::write_str(f, "Normal"),
            AttributeSafety::Unsafe { unsafe_since: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Unsafe", "unsafe_since", &__self_0),
        }
    }
}Debug)]
87pub enum AttributeSafety {
88    /// Normal attribute that does not need `#[unsafe(...)]`
89    Normal,
90
91    /// Unsafe attribute that requires safety obligations to be discharged.
92    ///
93    /// An error is emitted when `#[unsafe(...)]` is omitted, except when the attribute's edition
94    /// is less than the one stored in `unsafe_since`. This handles attributes that were safe in
95    /// earlier editions, but become unsafe in later ones.
96    Unsafe { unsafe_since: Option<Edition> },
97}
98
99#[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)]
100pub enum AttributeGate {
101    /// A gated attribute which requires a feature gate to be enabled.
102    Gated {
103        /// The feature gate, for example `#![feature(rustc_attrs)]` for rustc_* attributes.
104        feature: Symbol,
105        /// The error message displayed when an attempt is made to use the attribute without its feature gate.
106        message: &'static str,
107        /// Check function to be called during the `PostExpansionVisitor` pass.
108        check: fn(&Features) -> bool,
109        /// Notes to be displayed when an attempt is made to use the attribute without its feature gate.
110        notes: &'static [&'static str],
111    },
112    /// Ungated attribute, can be used on all release channels
113    Ungated,
114}
115
116// FIXME(jdonszelmann): move to rustc_hir::attrs
117/// A template that the attribute input must match.
118/// Only top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is considered now.
119#[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)]
120pub struct AttributeTemplate {
121    /// If `true`, the attribute is allowed to be a bare word like `#[test]`.
122    pub word: bool,
123    /// If `Some`, the attribute is allowed to take a list of items like `#[allow(..)]`.
124    pub list: Option<&'static [&'static str]>,
125    /// If non-empty, the attribute is allowed to take a list containing exactly
126    /// one of the listed words, like `#[coverage(off)]`.
127    pub one_of: &'static [Symbol],
128    /// If `Some`, the attribute is allowed to be a name/value pair where the
129    /// value is a string, like `#[must_use = "reason"]`.
130    pub name_value_str: Option<&'static [&'static str]>,
131    /// A link to the document for this attribute.
132    pub docs: Option<&'static str>,
133}
134
135pub enum AttrSuggestionStyle {
136    /// The suggestion is styled for a normal attribute.
137    /// The `AttrStyle` determines whether this is an inner or outer attribute.
138    Attribute(AttrStyle),
139    /// The suggestion is styled for an attribute embedded into another attribute.
140    /// For example, attributes inside `#[cfg_attr(true, attr(...)]`.
141    EmbeddedAttribute,
142    /// The suggestion is styled for macros that are parsed with attribute parsers.
143    /// For example, the `cfg!(predicate)` macro.
144    Macro,
145}
146
147impl AttributeTemplate {
148    pub fn suggestions(
149        &self,
150        style: AttrSuggestionStyle,
151        name: impl std::fmt::Display,
152    ) -> Vec<String> {
153        let (start, macro_call, end) = match style {
154            AttrSuggestionStyle::Attribute(AttrStyle::Outer) => ("#[", "", "]"),
155            AttrSuggestionStyle::Attribute(AttrStyle::Inner) => ("#![", "", "]"),
156            AttrSuggestionStyle::Macro => ("", "!", ""),
157            AttrSuggestionStyle::EmbeddedAttribute => ("", "", ""),
158        };
159
160        let mut suggestions = ::alloc::vec::Vec::new()vec![];
161
162        if self.word {
163            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");
164            suggestions.push(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1}{2}", start, name, end))
    })format!("{start}{name}{end}"));
165        }
166        if let Some(descr) = self.list {
167            for descr in descr {
168                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}"));
169            }
170        }
171        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}")));
172        if let Some(descr) = self.name_value_str {
173            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");
174            for descr in descr {
175                suggestions.push(::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}{1} = \"{2}\"{3}", start, name,
                descr, end))
    })format!("{start}{name} = \"{descr}\"{end}"));
176            }
177        }
178        suggestions.sort();
179
180        suggestions
181    }
182}
183
184/// How to handle multiple duplicate attributes on the same item.
185#[derive(#[automatically_derived]
impl ::core::clone::Clone for AttributeDuplicates {
    #[inline]
    fn clone(&self) -> AttributeDuplicates { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for AttributeDuplicates { }Copy, #[automatically_derived]
impl ::core::default::Default for AttributeDuplicates {
    #[inline]
    fn default() -> AttributeDuplicates { Self::DuplicatesOk }
}Default)]
186pub enum AttributeDuplicates {
187    /// Duplicates of this attribute are allowed.
188    ///
189    /// This should only be used with attributes where duplicates have semantic
190    /// meaning, or some kind of "additive" behavior. For example, `#[warn(..)]`
191    /// can be specified multiple times, and it combines all the entries. Or use
192    /// this if there is validation done elsewhere.
193    #[default]
194    DuplicatesOk,
195    /// Duplicates after the first attribute will be an unused_attribute warning.
196    ///
197    /// This is usually used for "word" attributes, where they are used as a
198    /// boolean marker, like `#[used]`. It is not necessarily wrong that there
199    /// are duplicates, but the others should probably be removed.
200    WarnFollowing,
201    /// Same as `WarnFollowing`, but only issues warnings for word-style attributes.
202    ///
203    /// This is only for special cases, for example multiple `#[macro_use]` can
204    /// be warned, but multiple `#[macro_use(...)]` should not because the list
205    /// form has different meaning from the word form.
206    WarnFollowingWordOnly,
207    /// Duplicates after the first attribute will be an error.
208    ///
209    /// This should be used where duplicates would be ignored, but carry extra
210    /// meaning that could cause confusion. For example, `#[stable(since="1.0")]
211    /// #[stable(since="2.0")]`, which version should be used for `stable`?
212    ErrorFollowing,
213    /// Duplicates preceding the last instance of the attribute will be an error.
214    ///
215    /// This is the same as `ErrorFollowing`, except the last attribute is the
216    /// one that is "used". This is typically used in cases like codegen
217    /// attributes which usually only honor the last attribute.
218    ErrorPreceding,
219    /// Duplicates after the first attribute will be an unused_attribute warning
220    /// with a note that this will be an error in the future.
221    ///
222    /// This should be used for attributes that should be `ErrorFollowing`, but
223    /// because older versions of rustc silently accepted (and ignored) the
224    /// attributes, this is used to transition.
225    FutureWarnFollowing,
226    /// Duplicates preceding the last instance of the attribute will be a
227    /// warning, with a note that this will be an error in the future.
228    ///
229    /// This is the same as `FutureWarnFollowing`, except the last attribute is
230    /// the one that is "used". Ideally these can eventually migrate to
231    /// `ErrorPreceding`.
232    FutureWarnPreceding,
233}
234
235/// A convenience macro for constructing attribute templates.
236/// E.g., `template!(Word, List: "description")` means that the attribute
237/// supports forms `#[attr]` and `#[attr(description)]`.
238#[macro_export]
239macro_rules! template {
240    (Word) => { $crate::template!(@ true, None, &[], None, None) };
241    (Word, $link: literal) => { $crate::template!(@ true, None, &[], None, Some($link)) };
242    (List: $descr: expr) => { $crate::template!(@ false, Some($descr), &[], None, None) };
243    (List: $descr: expr, $link: literal) => { $crate::template!(@ false, Some($descr), &[], None, Some($link)) };
244    (OneOf: $one_of: expr) => { $crate::template!(@ false, None, $one_of, None, None) };
245    (NameValueStr: [$($descr: literal),* $(,)?]) => { $crate::template!(@ false, None, &[], Some(&[$($descr,)*]), None) };
246    (NameValueStr: [$($descr: literal),* $(,)?], $link: literal) => { $crate::template!(@ false, None, &[], Some(&[$($descr,)*]), Some($link)) };
247    (NameValueStr: $descr: literal) => { $crate::template!(@ false, None, &[], Some(&[$descr]), None) };
248    (NameValueStr: $descr: literal, $link: literal) => { $crate::template!(@ false, None, &[], Some(&[$descr]), Some($link)) };
249    (Word, List: $descr: expr) => { $crate::template!(@ true, Some($descr), &[], None, None) };
250    (Word, List: $descr: expr, $link: literal) => { $crate::template!(@ true, Some($descr), &[], None, Some($link)) };
251    (Word, NameValueStr: $descr: expr) => { $crate::template!(@ true, None, &[], Some(&[$descr]), None) };
252    (Word, NameValueStr: $descr: expr, $link: literal) => { $crate::template!(@ true, None, &[], Some(&[$descr]), Some($link)) };
253    (List: $descr1: expr, NameValueStr: $descr2: expr) => {
254        $crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), None)
255    };
256    (List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
257        $crate::template!(@ false, Some($descr1), &[], Some(&[$descr2]), Some($link))
258    };
259    (Word, List: $descr1: expr, NameValueStr: $descr2: expr) => {
260        $crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), None)
261    };
262    (Word, List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => {
263        $crate::template!(@ true, Some($descr1), &[], Some(&[$descr2]), Some($link))
264    };
265    (@ $word: expr, $list: expr, $one_of: expr, $name_value_str: expr, $link: expr) => { $crate::AttributeTemplate {
266        word: $word, list: $list, one_of: $one_of, name_value_str: $name_value_str, docs: $link,
267    } };
268}
269
270macro_rules! ungated {
271    (unsafe($edition:ident) $attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $encode_cross_crate:expr $(,)?) => {
272        BuiltinAttribute {
273            name: sym::$attr,
274            encode_cross_crate: $encode_cross_crate,
275            type_: $typ,
276            safety: AttributeSafety::Unsafe { unsafe_since: Some(Edition::$edition) },
277            template: $tpl,
278            gate: Ungated,
279            duplicates: $duplicates,
280        }
281    };
282    (unsafe $attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $encode_cross_crate:expr $(,)?) => {
283        BuiltinAttribute {
284            name: sym::$attr,
285            encode_cross_crate: $encode_cross_crate,
286            type_: $typ,
287            safety: AttributeSafety::Unsafe { unsafe_since: None },
288            template: $tpl,
289            gate: Ungated,
290            duplicates: $duplicates,
291        }
292    };
293    ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $encode_cross_crate:expr $(,)?) => {
294        BuiltinAttribute {
295            name: sym::$attr,
296            encode_cross_crate: $encode_cross_crate,
297            type_: $typ,
298            safety: AttributeSafety::Normal,
299            template: $tpl,
300            gate: Ungated,
301            duplicates: $duplicates,
302        }
303    };
304}
305
306macro_rules! gated {
307    (unsafe $attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $encode_cross_crate:expr, $gate:ident, $message:expr $(,)?) => {
308        BuiltinAttribute {
309            name: sym::$attr,
310            encode_cross_crate: $encode_cross_crate,
311            type_: $typ,
312            safety: AttributeSafety::Unsafe { unsafe_since: None },
313            template: $tpl,
314            duplicates: $duplicates,
315            gate: Gated {
316                feature: sym::$gate,
317                message: $message,
318                check: Features::$gate,
319                notes: &[],
320            },
321        }
322    };
323    (unsafe $attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $encode_cross_crate:expr, $message:expr $(,)?) => {
324        BuiltinAttribute {
325            name: sym::$attr,
326            encode_cross_crate: $encode_cross_crate,
327            type_: $typ,
328            safety: AttributeSafety::Unsafe { unsafe_since: None },
329            template: $tpl,
330            duplicates: $duplicates,
331            gate: Gated {
332                feature: sym::$attr,
333                message: $message,
334                check: Features::$attr,
335                notes: &[],
336            },
337        }
338    };
339    ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $encode_cross_crate:expr, $gate:ident, $message:expr $(,)?) => {
340        BuiltinAttribute {
341            name: sym::$attr,
342            encode_cross_crate: $encode_cross_crate,
343            type_: $typ,
344            safety: AttributeSafety::Normal,
345            template: $tpl,
346            duplicates: $duplicates,
347            gate: Gated {
348                feature: sym::$gate,
349                message: $message,
350                check: Features::$gate,
351                notes: &[],
352            },
353        }
354    };
355    ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $encode_cross_crate:expr, $message:expr $(,)?) => {
356        BuiltinAttribute {
357            name: sym::$attr,
358            encode_cross_crate: $encode_cross_crate,
359            type_: $typ,
360            safety: AttributeSafety::Normal,
361            template: $tpl,
362            duplicates: $duplicates,
363            gate: Gated {
364                feature: sym::$attr,
365                message: $message,
366                check: Features::$attr,
367                notes: &[],
368            },
369        }
370    };
371}
372
373macro_rules! rustc_attr {
374    (TEST, $attr:ident, $typ:expr, $tpl:expr, $duplicate:expr, $encode_cross_crate:expr $(,)?) => {
375        rustc_attr!(
376            $attr,
377            $typ,
378            $tpl,
379            $duplicate,
380            $encode_cross_crate,
381            concat!(
382                "the `#[",
383                stringify!($attr),
384                "]` attribute is used for rustc unit tests"
385            ),
386        )
387    };
388    ($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $encode_cross_crate:expr, $($notes:expr),* $(,)?) => {
389        BuiltinAttribute {
390            name: sym::$attr,
391            encode_cross_crate: $encode_cross_crate,
392            type_: $typ,
393            safety: AttributeSafety::Normal,
394            template: $tpl,
395            duplicates: $duplicates,
396            gate: Gated {
397                feature: sym::rustc_attrs,
398                message: "use of an internal attribute",
399                check: Features::rustc_attrs,
400                notes: &[
401                    concat!("the `#[",
402                    stringify!($attr),
403                    "]` attribute is an internal implementation detail that will never be stable"),
404                    $($notes),*
405                    ]
406            },
407        }
408    };
409}
410
411macro_rules! experimental {
412    ($attr:ident) => {
413        concat!("the `#[", stringify!($attr), "]` attribute is an experimental feature")
414    };
415}
416
417pub struct BuiltinAttribute {
418    pub name: Symbol,
419    /// Whether this attribute is encode cross crate.
420    ///
421    /// If so, it is encoded in the crate metadata.
422    /// Otherwise, it can only be used in the local crate.
423    pub encode_cross_crate: EncodeCrossCrate,
424    pub type_: AttributeType,
425    pub safety: AttributeSafety,
426    pub template: AttributeTemplate,
427    pub duplicates: AttributeDuplicates,
428    pub gate: AttributeGate,
429}
430
431/// Attributes that have a special meaning to rustc or rustdoc.
432#[rustfmt::skip]
433pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
434    // ==========================================================================
435    // Stable attributes:
436    // ==========================================================================
437
438    // Conditional compilation:
439    BuiltinAttribute {
    name: sym::cfg,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["predicate"]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
440        cfg, Normal,
441        template!(
442            List: &["predicate"],
443            "https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute"
444        ),
445        DuplicatesOk, EncodeCrossCrate::No
446    ),
447    BuiltinAttribute {
    name: sym::cfg_attr,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["predicate, attr1, attr2, ..."]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
448        cfg_attr, Normal,
449        template!(
450            List: &["predicate, attr1, attr2, ..."],
451            "https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute"
452        ),
453        DuplicatesOk, EncodeCrossCrate::No
454    ),
455
456    // Testing:
457    BuiltinAttribute {
    name: sym::ignore,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: Some(&["reason"]),
        docs: Some("https://doc.rust-lang.org/reference/attributes/testing.html#the-ignore-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
458        ignore, Normal,
459        template!(
460            Word,
461            NameValueStr: "reason",
462            "https://doc.rust-lang.org/reference/attributes/testing.html#the-ignore-attribute"
463        ),
464        WarnFollowing, EncodeCrossCrate::No,
465    ),
466    BuiltinAttribute {
    name: sym::should_panic,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&[r#"expected = "reason""#]),
        one_of: &[],
        name_value_str: Some(&["reason"]),
        docs: Some("https://doc.rust-lang.org/reference/attributes/testing.html#the-should_panic-attribute"),
    },
    gate: Ungated,
    duplicates: FutureWarnFollowing,
}ungated!(
467        should_panic, Normal,
468        template!(
469            Word,
470            List: &[r#"expected = "reason""#],
471            NameValueStr: "reason",
472            "https://doc.rust-lang.org/reference/attributes/testing.html#the-should_panic-attribute"
473        ),
474        FutureWarnFollowing, EncodeCrossCrate::No,
475    ),
476
477    // Macros:
478    BuiltinAttribute {
    name: sym::automatically_derived,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/derive.html#the-automatically_derived-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
479        automatically_derived, Normal,
480        template!(
481            Word,
482            "https://doc.rust-lang.org/reference/attributes/derive.html#the-automatically_derived-attribute"
483        ),
484        WarnFollowing, EncodeCrossCrate::Yes
485    ),
486    BuiltinAttribute {
    name: sym::macro_use,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&["name1, name2, ..."]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowingWordOnly,
}ungated!(
487        macro_use, Normal,
488        template!(
489            Word,
490            List: &["name1, name2, ..."],
491            "https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute"
492        ),
493        WarnFollowingWordOnly, EncodeCrossCrate::No,
494    ),
495    BuiltinAttribute {
    name: sym::macro_escape,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(macro_escape, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No), // Deprecated synonym for `macro_use`.
496    BuiltinAttribute {
    name: sym::macro_export,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&["local_inner_macros"]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/macros-by-example.html#path-based-scope"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
497        macro_export, Normal,
498        template!(
499            Word,
500            List: &["local_inner_macros"],
501            "https://doc.rust-lang.org/reference/macros-by-example.html#path-based-scope"
502        ),
503        WarnFollowing, EncodeCrossCrate::Yes
504    ),
505    BuiltinAttribute {
    name: sym::proc_macro,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/procedural-macros.html#function-like-procedural-macros"),
    },
    gate: Ungated,
    duplicates: ErrorFollowing,
}ungated!(
506        proc_macro, Normal,
507        template!(
508            Word,
509            "https://doc.rust-lang.org/reference/procedural-macros.html#function-like-procedural-macros"),
510        ErrorFollowing, EncodeCrossCrate::No
511    ),
512    BuiltinAttribute {
    name: sym::proc_macro_derive,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["TraitName",
                        "TraitName, attributes(name1, name2, ...)"]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros"),
    },
    gate: Ungated,
    duplicates: ErrorFollowing,
}ungated!(
513        proc_macro_derive, Normal,
514        template!(
515            List: &["TraitName", "TraitName, attributes(name1, name2, ...)"],
516            "https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros"
517        ),
518        ErrorFollowing, EncodeCrossCrate::No,
519    ),
520    BuiltinAttribute {
    name: sym::proc_macro_attribute,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/procedural-macros.html#attribute-macros"),
    },
    gate: Ungated,
    duplicates: ErrorFollowing,
}ungated!(
521        proc_macro_attribute, Normal,
522        template!(Word, "https://doc.rust-lang.org/reference/procedural-macros.html#attribute-macros"),
523        ErrorFollowing, EncodeCrossCrate::No
524    ),
525
526    // Lints:
527    BuiltinAttribute {
    name: sym::warn,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["lint1", "lint1, lint2, ...",
                        r#"lint1, lint2, lint3, reason = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
528        warn, Normal,
529        template!(
530            List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
531            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
532        ),
533        DuplicatesOk, EncodeCrossCrate::No,
534    ),
535    BuiltinAttribute {
    name: sym::allow,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["lint1", "lint1, lint2, ...",
                        r#"lint1, lint2, lint3, reason = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
536        allow, Normal,
537        template!(
538            List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
539            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
540        ),
541        DuplicatesOk, EncodeCrossCrate::No,
542    ),
543    BuiltinAttribute {
    name: sym::expect,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["lint1", "lint1, lint2, ...",
                        r#"lint1, lint2, lint3, reason = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
544        expect, Normal,
545        template!(
546            List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
547            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
548        ),
549        DuplicatesOk, EncodeCrossCrate::No,
550    ),
551    BuiltinAttribute {
    name: sym::forbid,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["lint1", "lint1, lint2, ...",
                        r#"lint1, lint2, lint3, reason = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
552        forbid, Normal,
553        template!(
554            List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
555            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
556        ),
557        DuplicatesOk, EncodeCrossCrate::No
558    ),
559    BuiltinAttribute {
    name: sym::deny,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["lint1", "lint1, lint2, ...",
                        r#"lint1, lint2, lint3, reason = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
560        deny, Normal,
561        template!(
562            List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
563            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
564        ),
565        DuplicatesOk, EncodeCrossCrate::No
566    ),
567    BuiltinAttribute {
    name: sym::must_use,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: Some(&["reason"]),
        docs: Some("https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"),
    },
    gate: Ungated,
    duplicates: FutureWarnFollowing,
}ungated!(
568        must_use, Normal,
569        template!(
570            Word,
571            NameValueStr: "reason",
572            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"
573        ),
574        FutureWarnFollowing, EncodeCrossCrate::Yes
575    ),
576    BuiltinAttribute {
    name: sym::must_not_suspend,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: Some(&["reason"]),
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::must_not_suspend,
        message: "the `#[must_not_suspend]` attribute is an experimental feature",
        check: Features::must_not_suspend,
        notes: &[],
    },
}gated!(
577        must_not_suspend, Normal, template!(Word, NameValueStr: "reason"), WarnFollowing,
578        EncodeCrossCrate::Yes, experimental!(must_not_suspend)
579    ),
580    BuiltinAttribute {
    name: sym::deprecated,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&[r#"/*opt*/ since = "version", /*opt*/ note = "reason""#]),
        one_of: &[],
        name_value_str: Some(&["reason"]),
        docs: Some("https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute"),
    },
    gate: Ungated,
    duplicates: ErrorFollowing,
}ungated!(
581        deprecated, Normal,
582        template!(
583            Word,
584            List: &[r#"/*opt*/ since = "version", /*opt*/ note = "reason""#],
585            NameValueStr: "reason",
586            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute"
587        ),
588        ErrorFollowing, EncodeCrossCrate::Yes
589    ),
590
591    // Crate properties:
592    BuiltinAttribute {
    name: sym::crate_name,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["name"]),
        docs: Some("https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute"),
    },
    gate: Ungated,
    duplicates: FutureWarnFollowing,
}ungated!(
593        crate_name, CrateLevel,
594        template!(
595            NameValueStr: "name",
596            "https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute"
597        ),
598        FutureWarnFollowing, EncodeCrossCrate::No,
599    ),
600    BuiltinAttribute {
    name: sym::crate_type,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["bin", "lib", "dylib", "cdylib", "rlib",
                        "staticlib", "sdylib", "proc-macro"]),
        docs: Some("https://doc.rust-lang.org/reference/linkage.html"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
601        crate_type, CrateLevel,
602        template!(
603            NameValueStr: ["bin", "lib", "dylib", "cdylib", "rlib", "staticlib", "sdylib", "proc-macro"],
604            "https://doc.rust-lang.org/reference/linkage.html"
605        ),
606        DuplicatesOk, EncodeCrossCrate::No,
607    ),
608
609    // ABI, linking, symbols, and FFI
610    BuiltinAttribute {
    name: sym::link,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"name = "...""#,
                        r#"name = "...", kind = "dylib|static|...""#,
                        r#"name = "...", wasm_import_module = "...""#,
                        r#"name = "...", import_name_type = "decorated|noprefix|undecorated""#,
                        r#"name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated""#]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
611        link, Normal,
612        template!(List: &[
613            r#"name = "...""#,
614            r#"name = "...", kind = "dylib|static|...""#,
615            r#"name = "...", wasm_import_module = "...""#,
616            r#"name = "...", import_name_type = "decorated|noprefix|undecorated""#,
617            r#"name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated""#,
618        ], "https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute"),
619        DuplicatesOk, EncodeCrossCrate::No,
620    ),
621    BuiltinAttribute {
    name: sym::link_name,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["name"]),
        docs: Some("https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute"),
    },
    gate: Ungated,
    duplicates: FutureWarnPreceding,
}ungated!(
622        link_name, Normal,
623        template!(NameValueStr: "name", "https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute"),
624        FutureWarnPreceding, EncodeCrossCrate::Yes
625    ),
626    BuiltinAttribute {
    name: sym::no_link,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/items/extern-crates.html#the-no_link-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
627        no_link, Normal,
628        template!(Word, "https://doc.rust-lang.org/reference/items/extern-crates.html#the-no_link-attribute"),
629        WarnFollowing, EncodeCrossCrate::No
630    ),
631    BuiltinAttribute {
    name: sym::repr,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["C", "Rust", "transparent", "align(...)", "packed(...)",
                        "<integer type>"]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/type-layout.html#representations"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
632        repr, Normal,
633        template!(
634            List: &["C", "Rust", "transparent", "align(...)", "packed(...)", "<integer type>"],
635            "https://doc.rust-lang.org/reference/type-layout.html#representations"
636        ),
637        DuplicatesOk, EncodeCrossCrate::No
638    ),
639    // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
640    BuiltinAttribute {
    name: sym::rustc_align,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["alignment"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    gate: Gated {
        feature: sym::fn_align,
        message: "the `#[rustc_align]` attribute is an experimental feature",
        check: Features::fn_align,
        notes: &[],
    },
}gated!(rustc_align, Normal, template!(List: &["alignment"]), DuplicatesOk, EncodeCrossCrate::No, fn_align, experimental!(rustc_align)),
641    BuiltinAttribute {
    name: sym::rustc_align_static,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["alignment"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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, Normal, template!(List: &["alignment"]), DuplicatesOk, EncodeCrossCrate::No, static_align, experimental!(rustc_align_static)),
642    BuiltinAttribute {
    name: sym::export_name,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Unsafe {
        unsafe_since: Some(Edition::Edition2024),
    },
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["name"]),
        docs: Some("https://doc.rust-lang.org/reference/abi.html#the-export_name-attribute"),
    },
    gate: Ungated,
    duplicates: FutureWarnPreceding,
}ungated!(
643        unsafe(Edition2024) export_name, Normal,
644        template!(NameValueStr: "name", "https://doc.rust-lang.org/reference/abi.html#the-export_name-attribute"),
645        FutureWarnPreceding, EncodeCrossCrate::No
646    ),
647    BuiltinAttribute {
    name: sym::link_section,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Unsafe {
        unsafe_since: Some(Edition::Edition2024),
    },
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["name"]),
        docs: Some("https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute"),
    },
    gate: Ungated,
    duplicates: FutureWarnPreceding,
}ungated!(
648        unsafe(Edition2024) link_section, Normal,
649        template!(NameValueStr: "name", "https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute"),
650        FutureWarnPreceding, EncodeCrossCrate::No
651    ),
652    BuiltinAttribute {
    name: sym::no_mangle,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Unsafe {
        unsafe_since: Some(Edition::Edition2024),
    },
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/abi.html#the-no_mangle-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
653        unsafe(Edition2024) no_mangle, Normal,
654        template!(Word, "https://doc.rust-lang.org/reference/abi.html#the-no_mangle-attribute"),
655        WarnFollowing, EncodeCrossCrate::No
656    ),
657    BuiltinAttribute {
    name: sym::used,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&["compiler", "linker"]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/abi.html#the-used-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
658        used, Normal,
659        template!(Word, List: &["compiler", "linker"], "https://doc.rust-lang.org/reference/abi.html#the-used-attribute"),
660        WarnFollowing, EncodeCrossCrate::No
661    ),
662    BuiltinAttribute {
    name: sym::link_ordinal,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["ordinal"]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute"),
    },
    gate: Ungated,
    duplicates: ErrorPreceding,
}ungated!(
663        link_ordinal, Normal,
664        template!(List: &["ordinal"], "https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute"),
665        ErrorPreceding, EncodeCrossCrate::Yes
666    ),
667    BuiltinAttribute {
    name: sym::naked,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Unsafe { unsafe_since: None },
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/codegen.html#the-naked-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
668        unsafe naked, Normal,
669        template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-naked-attribute"),
670        WarnFollowing, EncodeCrossCrate::No
671    ),
672    // See `TyAndLayout::pass_indirectly_in_non_rustic_abis` for details.
673    BuiltinAttribute {
    name: sym::rustc_pass_indirectly_in_non_rustic_abis,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
674        rustc_pass_indirectly_in_non_rustic_abis, Normal, template!(Word), ErrorFollowing,
675        EncodeCrossCrate::No,
676        "types marked with `#[rustc_pass_indirectly_in_non_rustic_abis]` are always passed indirectly by non-Rustic ABIs"
677    ),
678
679    // Limits:
680    BuiltinAttribute {
    name: sym::recursion_limit,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["N"]),
        docs: Some("https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute"),
    },
    gate: Ungated,
    duplicates: FutureWarnFollowing,
}ungated!(
681        recursion_limit, CrateLevel,
682        template!(NameValueStr: "N", "https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute"),
683        FutureWarnFollowing, EncodeCrossCrate::No
684    ),
685    BuiltinAttribute {
    name: sym::type_length_limit,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["N"]),
        docs: Some("https://doc.rust-lang.org/reference/attributes/limits.html#the-type_length_limit-attribute"),
    },
    gate: Ungated,
    duplicates: FutureWarnFollowing,
}ungated!(
686        type_length_limit, CrateLevel,
687        template!(NameValueStr: "N", "https://doc.rust-lang.org/reference/attributes/limits.html#the-type_length_limit-attribute"),
688        FutureWarnFollowing, EncodeCrossCrate::No
689    ),
690    BuiltinAttribute {
    name: sym::move_size_limit,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["N"]),
        docs: None,
    },
    duplicates: ErrorFollowing,
    gate: Gated {
        feature: sym::large_assignments,
        message: "the `#[move_size_limit]` attribute is an experimental feature",
        check: Features::large_assignments,
        notes: &[],
    },
}gated!(
691        move_size_limit, CrateLevel, template!(NameValueStr: "N"), ErrorFollowing,
692        EncodeCrossCrate::No, large_assignments, experimental!(move_size_limit)
693    ),
694
695    // Entry point:
696    BuiltinAttribute {
    name: sym::no_main,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/crates-and-source-files.html#the-no_main-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
697        no_main, CrateLevel,
698        template!(Word, "https://doc.rust-lang.org/reference/crates-and-source-files.html#the-no_main-attribute"),
699        WarnFollowing, EncodeCrossCrate::No
700    ),
701
702    // Modules, prelude, and resolution:
703    BuiltinAttribute {
    name: sym::path,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["file"]),
        docs: Some("https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute"),
    },
    gate: Ungated,
    duplicates: FutureWarnFollowing,
}ungated!(
704        path, Normal,
705        template!(NameValueStr: "file", "https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute"),
706        FutureWarnFollowing, EncodeCrossCrate::No
707    ),
708    BuiltinAttribute {
    name: sym::no_std,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/names/preludes.html#the-no_std-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
709        no_std, CrateLevel,
710        template!(Word, "https://doc.rust-lang.org/reference/names/preludes.html#the-no_std-attribute"),
711        WarnFollowing, EncodeCrossCrate::No
712    ),
713    BuiltinAttribute {
    name: sym::no_implicit_prelude,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/names/preludes.html#the-no_implicit_prelude-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
714        no_implicit_prelude, Normal,
715        template!(Word, "https://doc.rust-lang.org/reference/names/preludes.html#the-no_implicit_prelude-attribute"),
716        WarnFollowing, EncodeCrossCrate::No
717    ),
718    BuiltinAttribute {
    name: sym::non_exhaustive,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
719        non_exhaustive, Normal,
720        template!(Word, "https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute"),
721        WarnFollowing, EncodeCrossCrate::Yes
722    ),
723
724    // Runtime
725    BuiltinAttribute {
    name: sym::windows_subsystem,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["windows", "console"]),
        docs: Some("https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute"),
    },
    gate: Ungated,
    duplicates: FutureWarnFollowing,
}ungated!(
726        windows_subsystem, CrateLevel,
727        template!(NameValueStr: ["windows", "console"], "https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute"),
728        FutureWarnFollowing, EncodeCrossCrate::No
729    ),
730    BuiltinAttribute {
    name: sym::panic_handler,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/panic.html#the-panic_handler-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!( // RFC 2070
731        panic_handler, Normal,
732        template!(Word, "https://doc.rust-lang.org/reference/panic.html#the-panic_handler-attribute"),
733        WarnFollowing, EncodeCrossCrate::Yes
734    ),
735
736    // Code generation:
737    BuiltinAttribute {
    name: sym::inline,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&["always", "never"]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute"),
    },
    gate: Ungated,
    duplicates: FutureWarnFollowing,
}ungated!(
738        inline, Normal,
739        template!(
740            Word,
741            List: &["always", "never"],
742            "https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute"
743        ),
744        FutureWarnFollowing, EncodeCrossCrate::No
745    ),
746    BuiltinAttribute {
    name: sym::cold,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/codegen.html#the-cold-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
747        cold, Normal,
748        template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-cold-attribute"),
749        WarnFollowing, EncodeCrossCrate::No
750    ),
751    BuiltinAttribute {
    name: sym::no_builtins,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/codegen.html#the-no_builtins-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
752        no_builtins, CrateLevel,
753        template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-no_builtins-attribute"),
754        WarnFollowing, EncodeCrossCrate::Yes
755    ),
756    BuiltinAttribute {
    name: sym::target_feature,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"enable = "name""#]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/codegen.html#the-target_feature-attribute"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
757        target_feature, Normal,
758        template!(List: &[r#"enable = "name""#], "https://doc.rust-lang.org/reference/attributes/codegen.html#the-target_feature-attribute"),
759        DuplicatesOk, EncodeCrossCrate::No,
760    ),
761    BuiltinAttribute {
    name: sym::track_caller,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/codegen.html#the-track_caller-attribute"),
    },
    gate: Ungated,
    duplicates: WarnFollowing,
}ungated!(
762        track_caller, Normal,
763        template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-track_caller-attribute"),
764        WarnFollowing, EncodeCrossCrate::Yes
765    ),
766    BuiltinAttribute {
    name: sym::instruction_set,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["set"]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute"),
    },
    gate: Ungated,
    duplicates: ErrorPreceding,
}ungated!(
767        instruction_set, Normal,
768        template!(List: &["set"], "https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute"),
769        ErrorPreceding, EncodeCrossCrate::No
770    ),
771    BuiltinAttribute {
    name: sym::force_target_feature,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Unsafe { unsafe_since: None },
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"enable = "name""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    gate: Gated {
        feature: sym::effective_target_features,
        message: "the `#[force_target_feature]` attribute is an experimental feature",
        check: Features::effective_target_features,
        notes: &[],
    },
}gated!(
772        unsafe force_target_feature, Normal, template!(List: &[r#"enable = "name""#]),
773        DuplicatesOk, EncodeCrossCrate::No, effective_target_features, experimental!(force_target_feature)
774    ),
775    BuiltinAttribute {
    name: sym::sanitize,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"address = "on|off""#, r#"kernel_address = "on|off""#,
                        r#"cfi = "on|off""#, r#"hwaddress = "on|off""#,
                        r#"kcfi = "on|off""#, r#"memory = "on|off""#,
                        r#"memtag = "on|off""#, r#"shadow_call_stack = "on|off""#,
                        r#"thread = "on|off""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorPreceding,
    gate: Gated {
        feature: sym::sanitize,
        message: "the `#[sanitize]` attribute is an experimental feature",
        check: Features::sanitize,
        notes: &[],
    },
}gated!(
776        sanitize, Normal, template!(List: &[r#"address = "on|off""#, r#"kernel_address = "on|off""#, r#"cfi = "on|off""#, r#"hwaddress = "on|off""#, r#"kcfi = "on|off""#, r#"memory = "on|off""#, r#"memtag = "on|off""#, r#"shadow_call_stack = "on|off""#, r#"thread = "on|off""#]), ErrorPreceding,
777        EncodeCrossCrate::No, sanitize, experimental!(sanitize),
778    ),
779    BuiltinAttribute {
    name: sym::coverage,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[sym::off, sym::on],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorPreceding,
    gate: Gated {
        feature: sym::coverage_attribute,
        message: "the `#[coverage]` attribute is an experimental feature",
        check: Features::coverage_attribute,
        notes: &[],
    },
}gated!(
780        coverage, Normal, template!(OneOf: &[sym::off, sym::on]),
781        ErrorPreceding, EncodeCrossCrate::No,
782        coverage_attribute, experimental!(coverage)
783    ),
784
785    BuiltinAttribute {
    name: sym::doc,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["hidden", "inline"]),
        one_of: &[],
        name_value_str: Some(&["string"]),
        docs: Some("https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
786        doc, Normal,
787        template!(
788            List: &["hidden", "inline"],
789            NameValueStr: "string",
790            "https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html"
791        ),
792        DuplicatesOk, EncodeCrossCrate::Yes
793    ),
794
795    // Debugging
796    BuiltinAttribute {
    name: sym::debugger_visualizer,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"natvis_file = "...", gdb_script_file = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute"),
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
797        debugger_visualizer, Normal,
798        template!(
799            List: &[r#"natvis_file = "...", gdb_script_file = "...""#],
800            "https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute"
801        ),
802        DuplicatesOk, EncodeCrossCrate::No
803    ),
804    BuiltinAttribute {
    name: sym::collapse_debuginfo,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["no", "external", "yes"]),
        one_of: &[],
        name_value_str: None,
        docs: Some("https://doc.rust-lang.org/reference/attributes/debugger.html#the-collapse_debuginfo-attribute"),
    },
    gate: Ungated,
    duplicates: ErrorFollowing,
}ungated!(
805        collapse_debuginfo, Normal,
806        template!(
807            List: &["no", "external", "yes"],
808            "https://doc.rust-lang.org/reference/attributes/debugger.html#the-collapse_debuginfo-attribute"
809        ),
810        ErrorFollowing, EncodeCrossCrate::Yes
811    ),
812
813    // ==========================================================================
814    // Unstable attributes:
815    // ==========================================================================
816
817    // Linking:
818    BuiltinAttribute {
    name: sym::export_stable,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::export_stable,
        message: "the `#[export_stable]` attribute is an experimental feature",
        check: Features::export_stable,
        notes: &[],
    },
}gated!(
819        export_stable, Normal, template!(Word), WarnFollowing,
820        EncodeCrossCrate::No, experimental!(export_stable)
821    ),
822
823    // Testing:
824    BuiltinAttribute {
    name: sym::test_runner,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["path"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    gate: Gated {
        feature: sym::custom_test_frameworks,
        message: "custom test frameworks are an unstable feature",
        check: Features::custom_test_frameworks,
        notes: &[],
    },
}gated!(
825        test_runner, CrateLevel, template!(List: &["path"]), ErrorFollowing,
826        EncodeCrossCrate::Yes, custom_test_frameworks,
827        "custom test frameworks are an unstable feature",
828    ),
829
830    BuiltinAttribute {
    name: sym::reexport_test_harness_main,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["name"]),
        docs: None,
    },
    duplicates: ErrorFollowing,
    gate: Gated {
        feature: sym::custom_test_frameworks,
        message: "custom test frameworks are an unstable feature",
        check: Features::custom_test_frameworks,
        notes: &[],
    },
}gated!(
831        reexport_test_harness_main, CrateLevel, template!(NameValueStr: "name"), ErrorFollowing,
832        EncodeCrossCrate::No, custom_test_frameworks,
833        "custom test frameworks are an unstable feature",
834    ),
835
836    // RFC #1268
837    BuiltinAttribute {
    name: sym::marker,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::marker_trait_attr,
        message: "the `#[marker]` attribute is an experimental feature",
        check: Features::marker_trait_attr,
        notes: &[],
    },
}gated!(
838        marker, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
839        marker_trait_attr, experimental!(marker)
840    ),
841    BuiltinAttribute {
    name: sym::thread_local,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
842        thread_local, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
843        "`#[thread_local]` is an experimental feature, and does not currently handle destructors",
844    ),
845    BuiltinAttribute {
    name: sym::no_core,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::no_core,
        message: "the `#[no_core]` attribute is an experimental feature",
        check: Features::no_core,
        notes: &[],
    },
}gated!(
846        no_core, CrateLevel, template!(Word), WarnFollowing,
847        EncodeCrossCrate::No, experimental!(no_core)
848    ),
849    // RFC 2412
850    BuiltinAttribute {
    name: sym::optimize,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["none", "size", "speed"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorPreceding,
    gate: Gated {
        feature: sym::optimize_attribute,
        message: "the `#[optimize]` attribute is an experimental feature",
        check: Features::optimize_attribute,
        notes: &[],
    },
}gated!(
851        optimize, Normal, template!(List: &["none", "size", "speed"]), ErrorPreceding,
852        EncodeCrossCrate::No, optimize_attribute, experimental!(optimize)
853    ),
854
855    BuiltinAttribute {
    name: sym::ffi_pure,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Unsafe { unsafe_since: None },
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::ffi_pure,
        message: "the `#[ffi_pure]` attribute is an experimental feature",
        check: Features::ffi_pure,
        notes: &[],
    },
}gated!(
856        unsafe ffi_pure, Normal, template!(Word), WarnFollowing,
857        EncodeCrossCrate::No, experimental!(ffi_pure)
858    ),
859    BuiltinAttribute {
    name: sym::ffi_const,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Unsafe { unsafe_since: None },
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::ffi_const,
        message: "the `#[ffi_const]` attribute is an experimental feature",
        check: Features::ffi_const,
        notes: &[],
    },
}gated!(
860        unsafe ffi_const, Normal, template!(Word), WarnFollowing,
861        EncodeCrossCrate::No, experimental!(ffi_const)
862    ),
863    BuiltinAttribute {
    name: sym::register_tool,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["tool1, tool2, ..."]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    gate: Gated {
        feature: sym::register_tool,
        message: "the `#[register_tool]` attribute is an experimental feature",
        check: Features::register_tool,
        notes: &[],
    },
}gated!(
864        register_tool, CrateLevel, template!(List: &["tool1, tool2, ..."]), DuplicatesOk,
865        EncodeCrossCrate::No, experimental!(register_tool),
866    ),
867    // `#[cfi_encoding = ""]`
868    BuiltinAttribute {
    name: sym::cfi_encoding,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["encoding"]),
        docs: None,
    },
    duplicates: ErrorPreceding,
    gate: Gated {
        feature: sym::cfi_encoding,
        message: "the `#[cfi_encoding]` attribute is an experimental feature",
        check: Features::cfi_encoding,
        notes: &[],
    },
}gated!(
869        cfi_encoding, Normal, template!(NameValueStr: "encoding"), ErrorPreceding,
870        EncodeCrossCrate::Yes, experimental!(cfi_encoding)
871    ),
872
873    // `#[coroutine]` attribute to be applied to closures to make them coroutines instead
874    BuiltinAttribute {
    name: sym::coroutine,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    gate: Gated {
        feature: sym::coroutines,
        message: "the `#[coroutine]` attribute is an experimental feature",
        check: Features::coroutines,
        notes: &[],
    },
}gated!(
875        coroutine, Normal, template!(Word), ErrorFollowing,
876        EncodeCrossCrate::No, coroutines, experimental!(coroutine)
877    ),
878
879    // RFC 3543
880    // `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
881    BuiltinAttribute {
    name: sym::patchable_function_entry,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["prefix_nops = m, entry_nops = n"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorPreceding,
    gate: Gated {
        feature: sym::patchable_function_entry,
        message: "the `#[patchable_function_entry]` attribute is an experimental feature",
        check: Features::patchable_function_entry,
        notes: &[],
    },
}gated!(
882        patchable_function_entry, Normal, template!(List: &["prefix_nops = m, entry_nops = n"]), ErrorPreceding,
883        EncodeCrossCrate::Yes, experimental!(patchable_function_entry)
884    ),
885
886    // The `#[loop_match]` and `#[const_continue]` attributes are part of the
887    // lang experiment for RFC 3720 tracked in:
888    //
889    // - https://github.com/rust-lang/rust/issues/132306
890    BuiltinAttribute {
    name: sym::const_continue,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    gate: Gated {
        feature: sym::loop_match,
        message: "the `#[const_continue]` attribute is an experimental feature",
        check: Features::loop_match,
        notes: &[],
    },
}gated!(
891        const_continue, Normal, template!(Word), ErrorFollowing,
892        EncodeCrossCrate::No, loop_match, experimental!(const_continue)
893    ),
894    BuiltinAttribute {
    name: sym::loop_match,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    gate: Gated {
        feature: sym::loop_match,
        message: "the `#[loop_match]` attribute is an experimental feature",
        check: Features::loop_match,
        notes: &[],
    },
}gated!(
895        loop_match, Normal, template!(Word), ErrorFollowing,
896        EncodeCrossCrate::No, loop_match, experimental!(loop_match)
897    ),
898
899    // The `#[pin_v2]` attribute is part of the `pin_ergonomics` experiment
900    // that allows structurally pinning, tracked in:
901    //
902    // - https://github.com/rust-lang/rust/issues/130494
903    BuiltinAttribute {
    name: sym::pin_v2,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    gate: Gated {
        feature: sym::pin_ergonomics,
        message: "the `#[pin_v2]` attribute is an experimental feature",
        check: Features::pin_ergonomics,
        notes: &[],
    },
}gated!(
904        pin_v2, Normal, template!(Word), ErrorFollowing,
905        EncodeCrossCrate::Yes, pin_ergonomics, experimental!(pin_v2),
906    ),
907
908    // ==========================================================================
909    // Internal attributes: Stability, deprecation, and unsafe:
910    // ==========================================================================
911
912    BuiltinAttribute {
    name: sym::feature,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["name1, name2, ..."]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
913        feature, CrateLevel,
914        template!(List: &["name1, name2, ..."]), DuplicatesOk, EncodeCrossCrate::No,
915    ),
916    // DuplicatesOk since it has its own validation
917    BuiltinAttribute {
    name: sym::stable,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"feature = "name", since = "version""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
918        stable, Normal,
919        template!(List: &[r#"feature = "name", since = "version""#]), DuplicatesOk, EncodeCrossCrate::No,
920    ),
921    BuiltinAttribute {
    name: sym::unstable,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"feature = "name", reason = "...", issue = "N""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
922        unstable, Normal,
923        template!(List: &[r#"feature = "name", reason = "...", issue = "N""#]), DuplicatesOk,
924        EncodeCrossCrate::Yes
925    ),
926    BuiltinAttribute {
    name: sym::unstable_feature_bound,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&["feat1, feat2, ..."]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
927        unstable_feature_bound, Normal, template!(Word, List: &["feat1, feat2, ..."]),
928        DuplicatesOk, EncodeCrossCrate::No,
929    ),
930    BuiltinAttribute {
    name: sym::rustc_const_unstable,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"feature = "name""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
931        rustc_const_unstable, Normal, template!(List: &[r#"feature = "name""#]),
932        DuplicatesOk, EncodeCrossCrate::Yes
933    ),
934    BuiltinAttribute {
    name: sym::rustc_const_stable,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"feature = "name""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
935        rustc_const_stable, Normal,
936        template!(List: &[r#"feature = "name""#]), DuplicatesOk, EncodeCrossCrate::No,
937    ),
938    BuiltinAttribute {
    name: sym::rustc_default_body_unstable,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"feature = "name", reason = "...", issue = "N""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
939        rustc_default_body_unstable, Normal,
940        template!(List: &[r#"feature = "name", reason = "...", issue = "N""#]),
941        DuplicatesOk, EncodeCrossCrate::No
942    ),
943    BuiltinAttribute {
    name: sym::allow_internal_unstable,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&["feat1, feat2, ..."]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
944        allow_internal_unstable, Normal, template!(Word, List: &["feat1, feat2, ..."]),
945        DuplicatesOk, EncodeCrossCrate::Yes,
946        "allow_internal_unstable side-steps feature gating and stability checks",
947    ),
948    BuiltinAttribute {
    name: sym::allow_internal_unsafe,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::allow_internal_unsafe,
        message: "allow_internal_unsafe side-steps the unsafe_code lint",
        check: Features::allow_internal_unsafe,
        notes: &[],
    },
}gated!(
949        allow_internal_unsafe, Normal, template!(Word), WarnFollowing,
950        EncodeCrossCrate::No, "allow_internal_unsafe side-steps the unsafe_code lint",
951    ),
952    BuiltinAttribute {
    name: sym::rustc_eii_foreign_item,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
953        rustc_eii_foreign_item, Normal, template!(Word),
954        ErrorFollowing, EncodeCrossCrate::Yes, eii_internals,
955        "used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
956    ),
957    BuiltinAttribute {
    name: sym::rustc_allowed_through_unstable_modules,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["deprecation message"]),
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
958        rustc_allowed_through_unstable_modules, Normal, template!(NameValueStr: "deprecation message"),
959        WarnFollowing, EncodeCrossCrate::No,
960        "rustc_allowed_through_unstable_modules special cases accidental stabilizations of stable items \
961        through unstable paths"
962    ),
963    BuiltinAttribute {
    name: sym::rustc_deprecated_safe_2024,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"audit_that = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
964        rustc_deprecated_safe_2024, Normal, template!(List: &[r#"audit_that = "...""#]),
965        ErrorFollowing, EncodeCrossCrate::Yes,
966        "`#[rustc_deprecated_safe_2024]` is used to declare functions unsafe across the edition 2024 boundary",
967    ),
968    BuiltinAttribute {
    name: sym::rustc_pub_transparent,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
969        rustc_pub_transparent, Normal, template!(Word),
970        ErrorFollowing, EncodeCrossCrate::Yes,
971        "used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
972    ),
973
974
975    // ==========================================================================
976    // Internal attributes: Type system related:
977    // ==========================================================================
978
979    BuiltinAttribute {
    name: sym::fundamental,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::fundamental,
        message: "the `#[fundamental]` attribute is an experimental feature",
        check: Features::fundamental,
        notes: &[],
    },
}gated!(fundamental, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::Yes, experimental!(fundamental)),
980    BuiltinAttribute {
    name: sym::may_dangle,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
981        may_dangle, Normal, template!(Word), WarnFollowing,
982        EncodeCrossCrate::No, dropck_eyepatch,
983        "`may_dangle` has unstable semantics and may be removed in the future",
984    ),
985
986    BuiltinAttribute {
    name: sym::rustc_never_type_options,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["", r#"fallback = "unit""#, r#"fallback = "niko""#,
                        r#"fallback = "never""#, r#"fallback = "no""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
987        rustc_never_type_options,
988        Normal,
989        template!(List: &[
990            "",
991            r#"fallback = "unit""#,
992            r#"fallback = "niko""#,
993            r#"fallback = "never""#,
994            r#"fallback = "no""#,
995        ]),
996        ErrorFollowing,
997        EncodeCrossCrate::No,
998        "`rustc_never_type_options` is used to experiment with never type fallback and work on \
999         never type stabilization"
1000    ),
1001
1002    // ==========================================================================
1003    // Internal attributes: Runtime related:
1004    // ==========================================================================
1005
1006    BuiltinAttribute {
    name: sym::rustc_allocator,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1007        rustc_allocator, Normal, template!(Word), WarnFollowing,
1008        EncodeCrossCrate::No,
1009    ),
1010    BuiltinAttribute {
    name: sym::rustc_nounwind,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1011        rustc_nounwind, Normal, template!(Word), WarnFollowing,
1012        EncodeCrossCrate::No,
1013    ),
1014    BuiltinAttribute {
    name: sym::rustc_reallocator,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1015        rustc_reallocator, Normal, template!(Word), WarnFollowing,
1016        EncodeCrossCrate::No,
1017    ),
1018    BuiltinAttribute {
    name: sym::rustc_deallocator,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1019        rustc_deallocator, Normal, template!(Word), WarnFollowing,
1020        EncodeCrossCrate::No,
1021    ),
1022    BuiltinAttribute {
    name: sym::rustc_allocator_zeroed,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1023        rustc_allocator_zeroed, Normal, template!(Word), WarnFollowing,
1024        EncodeCrossCrate::No,
1025    ),
1026    BuiltinAttribute {
    name: sym::rustc_allocator_zeroed_variant,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["function"]),
        docs: None,
    },
    duplicates: ErrorPreceding,
    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!(
1027        rustc_allocator_zeroed_variant, Normal, template!(NameValueStr: "function"), ErrorPreceding,
1028        EncodeCrossCrate::Yes,
1029    ),
1030    BuiltinAttribute {
    name: sym::default_lib_allocator,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::allocator_internals,
        message: "the `#[default_lib_allocator]` attribute is an experimental feature",
        check: Features::allocator_internals,
        notes: &[],
    },
}gated!(
1031        default_lib_allocator, Normal, template!(Word), WarnFollowing,
1032        EncodeCrossCrate::No, allocator_internals, experimental!(default_lib_allocator),
1033    ),
1034    BuiltinAttribute {
    name: sym::needs_allocator,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::allocator_internals,
        message: "the `#[needs_allocator]` attribute is an experimental feature",
        check: Features::allocator_internals,
        notes: &[],
    },
}gated!(
1035        needs_allocator, Normal, template!(Word), WarnFollowing,
1036        EncodeCrossCrate::No, allocator_internals, experimental!(needs_allocator),
1037    ),
1038    BuiltinAttribute {
    name: sym::panic_runtime,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::panic_runtime,
        message: "the `#[panic_runtime]` attribute is an experimental feature",
        check: Features::panic_runtime,
        notes: &[],
    },
}gated!(
1039        panic_runtime, CrateLevel, template!(Word), WarnFollowing,
1040        EncodeCrossCrate::No, experimental!(panic_runtime)
1041    ),
1042    BuiltinAttribute {
    name: sym::needs_panic_runtime,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::needs_panic_runtime,
        message: "the `#[needs_panic_runtime]` attribute is an experimental feature",
        check: Features::needs_panic_runtime,
        notes: &[],
    },
}gated!(
1043        needs_panic_runtime, CrateLevel, template!(Word), WarnFollowing,
1044        EncodeCrossCrate::No, experimental!(needs_panic_runtime)
1045    ),
1046    BuiltinAttribute {
    name: sym::compiler_builtins,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1047        compiler_builtins, CrateLevel, template!(Word), WarnFollowing,
1048        EncodeCrossCrate::No,
1049        "the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate \
1050        which contains compiler-rt intrinsics and will never be stable",
1051    ),
1052    BuiltinAttribute {
    name: sym::profiler_runtime,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1053        profiler_runtime, CrateLevel, template!(Word), WarnFollowing,
1054        EncodeCrossCrate::No,
1055        "the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \
1056        which contains the profiler runtime and will never be stable",
1057    ),
1058
1059    // ==========================================================================
1060    // Internal attributes, Linkage:
1061    // ==========================================================================
1062
1063    BuiltinAttribute {
    name: sym::linkage,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["available_externally", "common",
                        "extern_weak", "external", "internal", "linkonce",
                        "linkonce_odr", "weak", "weak_odr"]),
        docs: Some("https://doc.rust-lang.org/reference/linkage.html"),
    },
    duplicates: ErrorPreceding,
    gate: Gated {
        feature: sym::linkage,
        message: "the `linkage` attribute is experimental and not portable across platforms",
        check: Features::linkage,
        notes: &[],
    },
}gated!(
1064        linkage, Normal, template!(NameValueStr: [
1065            "available_externally",
1066            "common",
1067            "extern_weak",
1068            "external",
1069            "internal",
1070            "linkonce",
1071            "linkonce_odr",
1072            "weak",
1073            "weak_odr",
1074        ], "https://doc.rust-lang.org/reference/linkage.html"),
1075        ErrorPreceding, EncodeCrossCrate::No,
1076        "the `linkage` attribute is experimental and not portable across platforms",
1077    ),
1078    BuiltinAttribute {
    name: sym::rustc_std_internal_symbol,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1079        rustc_std_internal_symbol, Normal, template!(Word), WarnFollowing,
1080        EncodeCrossCrate::No,
1081    ),
1082    BuiltinAttribute {
    name: sym::rustc_objc_class,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["ClassName"]),
        docs: None,
    },
    duplicates: ErrorPreceding,
    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!(
1083        rustc_objc_class, Normal, template!(NameValueStr: "ClassName"), ErrorPreceding,
1084        EncodeCrossCrate::No,
1085    ),
1086    BuiltinAttribute {
    name: sym::rustc_objc_selector,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["methodName"]),
        docs: None,
    },
    duplicates: ErrorPreceding,
    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!(
1087        rustc_objc_selector, Normal, template!(NameValueStr: "methodName"), ErrorPreceding,
1088        EncodeCrossCrate::No,
1089    ),
1090
1091    // ==========================================================================
1092    // Internal attributes, Macro related:
1093    // ==========================================================================
1094
1095    BuiltinAttribute {
    name: sym::rustc_builtin_macro,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&["name", "name, /*opt*/ attributes(name1, name2, ...)"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1096        rustc_builtin_macro, Normal,
1097        template!(Word, List: &["name", "name, /*opt*/ attributes(name1, name2, ...)"]), ErrorFollowing,
1098        EncodeCrossCrate::Yes,
1099    ),
1100    BuiltinAttribute {
    name: sym::rustc_proc_macro_decls,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1101        rustc_proc_macro_decls, Normal, template!(Word), WarnFollowing,
1102        EncodeCrossCrate::No,
1103    ),
1104    BuiltinAttribute {
    name: sym::rustc_macro_transparency,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["transparent", "semiopaque", "opaque"]),
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1105        rustc_macro_transparency, Normal,
1106        template!(NameValueStr: ["transparent", "semiopaque", "opaque"]), ErrorFollowing,
1107        EncodeCrossCrate::Yes, "used internally for testing macro hygiene",
1108    ),
1109    BuiltinAttribute {
    name: sym::rustc_autodiff,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&[r#""...""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
1110        rustc_autodiff, Normal,
1111        template!(Word, List: &[r#""...""#]), DuplicatesOk,
1112        EncodeCrossCrate::Yes,
1113    ),
1114    BuiltinAttribute {
    name: sym::rustc_offload_kernel,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
1115        rustc_offload_kernel, Normal,
1116        template!(Word), DuplicatesOk,
1117        EncodeCrossCrate::Yes,
1118    ),
1119    // Traces that are left when `cfg` and `cfg_attr` attributes are expanded.
1120    // The attributes are not gated, to avoid stability errors, but they cannot be used in stable
1121    // or unstable code directly because `sym::cfg_(attr_)trace` are not valid identifiers, they
1122    // can only be generated by the compiler.
1123    BuiltinAttribute {
    name: sym::cfg_trace,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
1124        cfg_trace, Normal, template!(Word /* irrelevant */), DuplicatesOk,
1125        EncodeCrossCrate::Yes
1126    ),
1127    BuiltinAttribute {
    name: sym::cfg_attr_trace,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    gate: Ungated,
    duplicates: DuplicatesOk,
}ungated!(
1128        cfg_attr_trace, Normal, template!(Word /* irrelevant */), DuplicatesOk,
1129        EncodeCrossCrate::No
1130    ),
1131
1132    // ==========================================================================
1133    // Internal attributes, Diagnostics related:
1134    // ==========================================================================
1135
1136    BuiltinAttribute {
    name: sym::rustc_on_unimplemented,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...""#]),
        one_of: &[],
        name_value_str: Some(&["message"]),
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1137        rustc_on_unimplemented, Normal,
1138        template!(
1139            List: &[r#"/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...""#],
1140            NameValueStr: "message"
1141        ),
1142        ErrorFollowing, EncodeCrossCrate::Yes,
1143        "see `#[diagnostic::on_unimplemented]` for the stable equivalent of this attribute"
1144    ),
1145    BuiltinAttribute {
    name: sym::rustc_confusables,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#""name1", "name2", ..."#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1146        rustc_confusables, Normal,
1147        template!(List: &[r#""name1", "name2", ..."#]),
1148        ErrorFollowing, EncodeCrossCrate::Yes,
1149    ),
1150    // Enumerates "identity-like" conversion methods to suggest on type mismatch.
1151    BuiltinAttribute {
    name: sym::rustc_conversion_suggestion,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1152        rustc_conversion_suggestion, Normal, template!(Word),
1153        WarnFollowing, EncodeCrossCrate::Yes,
1154    ),
1155    // Prevents field reads in the marked trait or method to be considered
1156    // during dead code analysis.
1157    BuiltinAttribute {
    name: sym::rustc_trivial_field_reads,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1158        rustc_trivial_field_reads, Normal, template!(Word),
1159        WarnFollowing, EncodeCrossCrate::Yes,
1160    ),
1161    // Used by the `rustc::potential_query_instability` lint to warn methods which
1162    // might not be stable during incremental compilation.
1163    BuiltinAttribute {
    name: sym::rustc_lint_query_instability,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1164        rustc_lint_query_instability, Normal, template!(Word),
1165        WarnFollowing, EncodeCrossCrate::Yes,
1166    ),
1167    // Used by the `rustc::untracked_query_information` lint to warn methods which
1168    // might not be stable during incremental compilation.
1169    BuiltinAttribute {
    name: sym::rustc_lint_untracked_query_information,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1170        rustc_lint_untracked_query_information, Normal, template!(Word),
1171        WarnFollowing, EncodeCrossCrate::Yes,
1172    ),
1173    // Used by the `rustc::bad_opt_access` lint to identify `DebuggingOptions` and `CodegenOptions`
1174    // types (as well as any others in future).
1175    BuiltinAttribute {
    name: sym::rustc_lint_opt_ty,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1176        rustc_lint_opt_ty, Normal, template!(Word),
1177        WarnFollowing, EncodeCrossCrate::Yes,
1178    ),
1179    // Used by the `rustc::bad_opt_access` lint on fields
1180    // types (as well as any others in future).
1181    BuiltinAttribute {
    name: sym::rustc_lint_opt_deny_field_access,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["message"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1182        rustc_lint_opt_deny_field_access, Normal, template!(List: &["message"]),
1183        WarnFollowing, EncodeCrossCrate::Yes,
1184    ),
1185
1186    // ==========================================================================
1187    // Internal attributes, Const related:
1188    // ==========================================================================
1189
1190    BuiltinAttribute {
    name: sym::rustc_promotable,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1191        rustc_promotable, Normal, template!(Word), WarnFollowing,
1192        EncodeCrossCrate::No, ),
1193    BuiltinAttribute {
    name: sym::rustc_legacy_const_generics,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["N"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1194        rustc_legacy_const_generics, Normal, template!(List: &["N"]), ErrorFollowing,
1195        EncodeCrossCrate::Yes,
1196    ),
1197    // Do not const-check this function's body. It will always get replaced during CTFE via `hook_special_const_fn`.
1198    BuiltinAttribute {
    name: sym::rustc_do_not_const_check,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1199        rustc_do_not_const_check, Normal, template!(Word), WarnFollowing,
1200        EncodeCrossCrate::Yes, "`#[rustc_do_not_const_check]` skips const-check for this function's body",
1201    ),
1202    BuiltinAttribute {
    name: sym::rustc_const_stable_indirect,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1203        rustc_const_stable_indirect, Normal,
1204        template!(Word),
1205        WarnFollowing,
1206        EncodeCrossCrate::No,
1207        "this is an internal implementation detail",
1208    ),
1209    BuiltinAttribute {
    name: sym::rustc_intrinsic_const_stable_indirect,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1210        rustc_intrinsic_const_stable_indirect, Normal,
1211        template!(Word), WarnFollowing, EncodeCrossCrate::No,  "this is an internal implementation detail",
1212    ),
1213    BuiltinAttribute {
    name: sym::rustc_allow_const_fn_unstable,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&["feat1, feat2, ..."]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
1214        rustc_allow_const_fn_unstable, Normal,
1215        template!(Word, List: &["feat1, feat2, ..."]), DuplicatesOk, EncodeCrossCrate::No,
1216        "rustc_allow_const_fn_unstable side-steps feature gating and stability checks"
1217    ),
1218
1219    // ==========================================================================
1220    // Internal attributes, Layout related:
1221    // ==========================================================================
1222
1223    BuiltinAttribute {
    name: sym::rustc_layout_scalar_valid_range_start,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["value"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_layout_scalar_valid_range_start]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_layout_scalar_valid_range_start]` attribute is just used to enable \
        niche optimizations in the standard library"],
    },
}rustc_attr!(
1224        rustc_layout_scalar_valid_range_start, Normal, template!(List: &["value"]), ErrorFollowing,
1225        EncodeCrossCrate::Yes,
1226        "the `#[rustc_layout_scalar_valid_range_start]` attribute is just used to enable \
1227        niche optimizations in the standard library",
1228    ),
1229    BuiltinAttribute {
    name: sym::rustc_layout_scalar_valid_range_end,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["value"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_layout_scalar_valid_range_end]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_layout_scalar_valid_range_end]` attribute is just used to enable \
        niche optimizations in the standard library"],
    },
}rustc_attr!(
1230        rustc_layout_scalar_valid_range_end, Normal, template!(List: &["value"]), ErrorFollowing,
1231        EncodeCrossCrate::Yes,
1232        "the `#[rustc_layout_scalar_valid_range_end]` attribute is just used to enable \
1233        niche optimizations in the standard library",
1234    ),
1235    BuiltinAttribute {
    name: sym::rustc_simd_monomorphize_lane_limit,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["N"]),
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1236        rustc_simd_monomorphize_lane_limit, Normal, template!(NameValueStr: "N"), ErrorFollowing,
1237        EncodeCrossCrate::Yes,
1238        "the `#[rustc_simd_monomorphize_lane_limit]` attribute is just used by std::simd \
1239        for better error messages",
1240    ),
1241    BuiltinAttribute {
    name: sym::rustc_nonnull_optimization_guaranteed,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1242        rustc_nonnull_optimization_guaranteed, Normal, template!(Word), WarnFollowing,
1243        EncodeCrossCrate::Yes,
1244        "the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to document \
1245        guaranteed niche optimizations in the standard library",
1246        "the compiler does not even check whether the type indeed is being non-null-optimized; \
1247        it is your responsibility to ensure that the attribute is only used on types that are optimized",
1248    ),
1249
1250    // ==========================================================================
1251    // Internal attributes, Misc:
1252    // ==========================================================================
1253    BuiltinAttribute {
    name: sym::lang,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["name"]),
        docs: None,
    },
    duplicates: DuplicatesOk,
    gate: Gated {
        feature: sym::lang_items,
        message: "lang items are subject to change",
        check: Features::lang_items,
        notes: &[],
    },
}gated!(
1254        lang, Normal, template!(NameValueStr: "name"), DuplicatesOk, EncodeCrossCrate::No, lang_items,
1255        "lang items are subject to change",
1256    ),
1257    BuiltinAttribute {
    name: sym::rustc_as_ptr,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1258        rustc_as_ptr, Normal, template!(Word), ErrorFollowing,
1259        EncodeCrossCrate::Yes,
1260        "`#[rustc_as_ptr]` is used to mark functions returning pointers to their inner allocations"
1261    ),
1262    BuiltinAttribute {
    name: sym::rustc_should_not_be_called_on_const_items,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1263        rustc_should_not_be_called_on_const_items, Normal, template!(Word), ErrorFollowing,
1264        EncodeCrossCrate::Yes,
1265        "`#[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"
1266    ),
1267    BuiltinAttribute {
    name: sym::rustc_pass_by_value,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1268        rustc_pass_by_value, Normal, template!(Word), ErrorFollowing,
1269        EncodeCrossCrate::Yes,
1270        "`#[rustc_pass_by_value]` is used to mark types that must be passed by value instead of reference"
1271    ),
1272    BuiltinAttribute {
    name: sym::rustc_never_returns_null_ptr,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1273        rustc_never_returns_null_ptr, Normal, template!(Word), ErrorFollowing,
1274        EncodeCrossCrate::Yes,
1275        "`#[rustc_never_returns_null_ptr]` is used to mark functions returning non-null pointers"
1276    ),
1277    BuiltinAttribute {
    name: sym::rustc_no_implicit_autorefs,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: AttributeType::Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1278        rustc_no_implicit_autorefs, AttributeType::Normal, template!(Word), ErrorFollowing, EncodeCrossCrate::Yes,
1279        "`#[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"
1280    ),
1281    BuiltinAttribute {
    name: sym::rustc_coherence_is_core,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: AttributeType::CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1282        rustc_coherence_is_core, AttributeType::CrateLevel, template!(Word), ErrorFollowing, EncodeCrossCrate::No,
1283        "`#![rustc_coherence_is_core]` allows inherent methods on builtin types, only intended to be used in `core`"
1284    ),
1285    BuiltinAttribute {
    name: sym::rustc_coinductive,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: AttributeType::Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1286        rustc_coinductive, AttributeType::Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
1287        "`#[rustc_coinductive]` changes a trait to be coinductive, allowing cycles in the trait solver"
1288    ),
1289    BuiltinAttribute {
    name: sym::rustc_allow_incoherent_impl,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: AttributeType::Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1290        rustc_allow_incoherent_impl, AttributeType::Normal, template!(Word), ErrorFollowing, EncodeCrossCrate::No,
1291        "`#[rustc_allow_incoherent_impl]` has to be added to all impl items of an incoherent inherent impl"
1292    ),
1293    BuiltinAttribute {
    name: sym::rustc_preserve_ub_checks,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: AttributeType::CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1294        rustc_preserve_ub_checks, AttributeType::CrateLevel, template!(Word), ErrorFollowing, EncodeCrossCrate::No,
1295        "`#![rustc_preserve_ub_checks]` prevents the designated crate from evaluating whether UB checks are enabled when optimizing MIR",
1296    ),
1297    BuiltinAttribute {
    name: sym::rustc_deny_explicit_impl,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: AttributeType::Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1298        rustc_deny_explicit_impl,
1299        AttributeType::Normal,
1300        template!(Word),
1301        ErrorFollowing,
1302        EncodeCrossCrate::No,
1303        "`#[rustc_deny_explicit_impl]` enforces that a trait can have no user-provided impls"
1304    ),
1305    BuiltinAttribute {
    name: sym::rustc_dyn_incompatible_trait,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: AttributeType::Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1306        rustc_dyn_incompatible_trait,
1307        AttributeType::Normal,
1308        template!(Word),
1309        ErrorFollowing,
1310        EncodeCrossCrate::No,
1311        "`#[rustc_dyn_incompatible_trait]` marks a trait as dyn-incompatible, \
1312        even if it otherwise satisfies the requirements to be dyn-compatible."
1313    ),
1314    BuiltinAttribute {
    name: sym::rustc_has_incoherent_inherent_impls,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: AttributeType::Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1315        rustc_has_incoherent_inherent_impls, AttributeType::Normal, template!(Word),
1316        ErrorFollowing, EncodeCrossCrate::Yes,
1317        "`#[rustc_has_incoherent_inherent_impls]` allows the addition of incoherent inherent impls for \
1318         the given type by annotating all impl items with `#[rustc_allow_incoherent_impl]`"
1319    ),
1320    BuiltinAttribute {
    name: sym::rustc_non_const_trait_method,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: AttributeType::Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1321        rustc_non_const_trait_method, AttributeType::Normal, template!(Word),
1322        ErrorFollowing, EncodeCrossCrate::No,
1323        "`#[rustc_non_const_trait_method]` should only used by the standard library to mark trait methods \
1324        as non-const to allow large traits an easier transition to const"
1325    ),
1326
1327    BuiltinAttribute {
1328        name: sym::rustc_diagnostic_item,
1329        // FIXME: This can be `true` once we always use `tcx.is_diagnostic_item`.
1330        encode_cross_crate: EncodeCrossCrate::Yes,
1331        type_: Normal,
1332        safety: AttributeSafety::Normal,
1333        template: crate::AttributeTemplate {
    word: false,
    list: None,
    one_of: &[],
    name_value_str: Some(&["name"]),
    docs: None,
}template!(NameValueStr: "name"),
1334        duplicates: ErrorFollowing,
1335        gate: Gated {
1336            feature: sym::rustc_attrs,
1337            message: "use of an internal attribute",
1338            check: Features::rustc_attrs,
1339            notes: &["the `#[rustc_diagnostic_item]` attribute allows the compiler to reference types \
1340            from the standard library for diagnostic purposes"],
1341        },
1342    },
1343    BuiltinAttribute {
    name: sym::prelude_import,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::prelude_import,
        message: "`#[prelude_import]` is for use by rustc only",
        check: Features::prelude_import,
        notes: &[],
    },
}gated!(
1344        // Used in resolve:
1345        prelude_import, Normal, template!(Word), WarnFollowing,
1346        EncodeCrossCrate::No, "`#[prelude_import]` is for use by rustc only",
1347    ),
1348    BuiltinAttribute {
    name: sym::rustc_paren_sugar,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::unboxed_closures,
        message: "unboxed_closures are still evolving",
        check: Features::unboxed_closures,
        notes: &[],
    },
}gated!(
1349        rustc_paren_sugar, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
1350        unboxed_closures, "unboxed_closures are still evolving",
1351    ),
1352    BuiltinAttribute {
    name: sym::rustc_inherit_overflow_checks,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1353        rustc_inherit_overflow_checks, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
1354        "the `#[rustc_inherit_overflow_checks]` attribute is just used to control \
1355        overflow checking behavior of several functions in the standard library that are inlined \
1356        across crates",
1357    ),
1358    BuiltinAttribute {
    name: sym::rustc_reservation_impl,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["reservation message"]),
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1359        rustc_reservation_impl, Normal,
1360        template!(NameValueStr: "reservation message"), ErrorFollowing, EncodeCrossCrate::Yes,
1361        "the `#[rustc_reservation_impl]` attribute is internally used \
1362        for reserving `impl<T> From<!> for T` as part of the effort to stabilize `!`"
1363    ),
1364    BuiltinAttribute {
    name: sym::rustc_test_marker,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["name"]),
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1365        rustc_test_marker, Normal, template!(NameValueStr: "name"), WarnFollowing,
1366        EncodeCrossCrate::No, "the `#[rustc_test_marker]` attribute is used internally to track tests",
1367    ),
1368    BuiltinAttribute {
    name: sym::rustc_unsafe_specialization_marker,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1369        rustc_unsafe_specialization_marker, Normal, template!(Word),
1370        WarnFollowing, EncodeCrossCrate::No,
1371        "the `#[rustc_unsafe_specialization_marker]` attribute is used to check specializations"
1372    ),
1373    BuiltinAttribute {
    name: sym::rustc_specialization_trait,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1374        rustc_specialization_trait, Normal, template!(Word),
1375        WarnFollowing, EncodeCrossCrate::No,
1376        "the `#[rustc_specialization_trait]` attribute is used to check specializations"
1377    ),
1378    BuiltinAttribute {
    name: sym::rustc_main,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1379        rustc_main, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
1380        "the `#[rustc_main]` attribute is used internally to specify test entry point function",
1381    ),
1382    BuiltinAttribute {
    name: sym::rustc_skip_during_method_dispatch,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["array, boxed_slice"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1383        rustc_skip_during_method_dispatch, Normal, template!(List: &["array, boxed_slice"]), ErrorFollowing,
1384        EncodeCrossCrate::No,
1385        "the `#[rustc_skip_during_method_dispatch]` attribute is used to exclude a trait \
1386        from method dispatch when the receiver is of the following type, for compatibility in \
1387        editions < 2021 (array) or editions < 2024 (boxed_slice)"
1388    ),
1389    BuiltinAttribute {
    name: sym::rustc_must_implement_one_of,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["function1, function2, ..."]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1390        rustc_must_implement_one_of, Normal, template!(List: &["function1, function2, ..."]),
1391        ErrorFollowing, EncodeCrossCrate::No,
1392        "the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete \
1393        definition of a trait. Its syntax and semantics are highly experimental and will be \
1394        subject to change before stabilization",
1395    ),
1396    BuiltinAttribute {
    name: sym::rustc_doc_primitive,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["primitive name"]),
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1397        rustc_doc_primitive, Normal, template!(NameValueStr: "primitive name"), ErrorFollowing,
1398        EncodeCrossCrate::Yes, "the `#[rustc_doc_primitive]` attribute is used by the standard library \
1399        to provide a way to generate documentation for primitive types",
1400    ),
1401    BuiltinAttribute {
    name: sym::rustc_intrinsic,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    gate: Gated {
        feature: sym::intrinsics,
        message: "the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items",
        check: Features::intrinsics,
        notes: &[],
    },
}gated!(
1402        rustc_intrinsic, Normal, template!(Word), ErrorFollowing, EncodeCrossCrate::Yes, intrinsics,
1403        "the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items",
1404    ),
1405    BuiltinAttribute {
    name: sym::rustc_no_mir_inline,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1406        rustc_no_mir_inline, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::Yes,
1407        "`#[rustc_no_mir_inline]` prevents the MIR inliner from inlining a function while not affecting codegen"
1408    ),
1409    BuiltinAttribute {
    name: sym::rustc_force_inline,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: Some(&["reason"]),
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1410        rustc_force_inline, Normal, template!(Word, NameValueStr: "reason"), WarnFollowing, EncodeCrossCrate::Yes,
1411        "`#[rustc_force_inline]` forces a free function to be inlined"
1412    ),
1413    BuiltinAttribute {
    name: sym::rustc_scalable_vector,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["count"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1414        rustc_scalable_vector, Normal, template!(List: &["count"]), WarnFollowing, EncodeCrossCrate::Yes,
1415        "`#[rustc_scalable_vector]` defines a scalable vector type"
1416    ),
1417
1418    // ==========================================================================
1419    // Internal attributes, Testing:
1420    // ==========================================================================
1421
1422    BuiltinAttribute {
    name: sym::rustc_effective_visibility,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::Yes),
1423    BuiltinAttribute {
    name: sym::rustc_dump_inferred_outlives,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1424        TEST, rustc_dump_inferred_outlives, Normal, template!(Word),
1425        WarnFollowing, EncodeCrossCrate::No
1426    ),
1427    BuiltinAttribute {
    name: sym::rustc_capture_analysis,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1428        TEST, rustc_capture_analysis, Normal, template!(Word),
1429        WarnFollowing, EncodeCrossCrate::No
1430    ),
1431    BuiltinAttribute {
    name: sym::rustc_insignificant_dtor,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1432        TEST, rustc_insignificant_dtor, Normal, template!(Word),
1433        WarnFollowing, EncodeCrossCrate::Yes
1434    ),
1435    BuiltinAttribute {
    name: sym::rustc_no_implicit_bounds,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1436        TEST, rustc_no_implicit_bounds, CrateLevel, template!(Word),
1437        WarnFollowing, EncodeCrossCrate::No
1438    ),
1439    BuiltinAttribute {
    name: sym::rustc_strict_coherence,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1440        TEST, rustc_strict_coherence, Normal, template!(Word),
1441        WarnFollowing, EncodeCrossCrate::Yes
1442    ),
1443    BuiltinAttribute {
    name: sym::rustc_dump_variances,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1444        TEST, rustc_dump_variances, Normal, template!(Word),
1445        WarnFollowing, EncodeCrossCrate::No
1446    ),
1447    BuiltinAttribute {
    name: sym::rustc_dump_variances_of_opaques,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1448        TEST, rustc_dump_variances_of_opaques, Normal, template!(Word),
1449        WarnFollowing, EncodeCrossCrate::No
1450    ),
1451    BuiltinAttribute {
    name: sym::rustc_hidden_type_of_opaques,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_hidden_type_of_opaques]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_hidden_type_of_opaques]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(
1452        TEST, rustc_hidden_type_of_opaques, Normal, template!(Word),
1453        WarnFollowing, EncodeCrossCrate::No
1454    ),
1455    BuiltinAttribute {
    name: sym::rustc_layout,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["field1, field2, ..."]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_layout]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_layout]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(
1456        TEST, rustc_layout, Normal, template!(List: &["field1, field2, ..."]),
1457        WarnFollowing, EncodeCrossCrate::Yes
1458    ),
1459    BuiltinAttribute {
    name: sym::rustc_abi,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["field1, field2, ..."]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1460        TEST, rustc_abi, Normal, template!(List: &["field1, field2, ..."]),
1461        WarnFollowing, EncodeCrossCrate::No
1462    ),
1463    BuiltinAttribute {
    name: sym::rustc_regions,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1464        TEST, rustc_regions, Normal, template!(Word),
1465        WarnFollowing, EncodeCrossCrate::No
1466    ),
1467    BuiltinAttribute {
    name: sym::rustc_delayed_bug_from_inside_query,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1468        TEST, rustc_delayed_bug_from_inside_query, Normal,
1469        template!(Word),
1470        WarnFollowing, EncodeCrossCrate::No
1471    ),
1472    BuiltinAttribute {
    name: sym::rustc_dump_user_args,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1473        TEST, rustc_dump_user_args, Normal, template!(Word),
1474        WarnFollowing, EncodeCrossCrate::No
1475    ),
1476    BuiltinAttribute {
    name: sym::rustc_evaluate_where_clauses,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1477        TEST, rustc_evaluate_where_clauses, Normal, template!(Word), WarnFollowing,
1478        EncodeCrossCrate::Yes
1479    ),
1480    BuiltinAttribute {
    name: sym::rustc_if_this_changed,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: Some(&["DepNode"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
1481        TEST, rustc_if_this_changed, Normal, template!(Word, List: &["DepNode"]), DuplicatesOk,
1482        EncodeCrossCrate::No
1483    ),
1484    BuiltinAttribute {
    name: sym::rustc_then_this_would_need,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["DepNode"]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
1485        TEST, rustc_then_this_would_need, Normal, template!(List: &["DepNode"]), DuplicatesOk,
1486        EncodeCrossCrate::No
1487    ),
1488    BuiltinAttribute {
    name: sym::rustc_clean,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"cfg = "...", /*opt*/ label = "...", /*opt*/ except = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
1489        TEST, rustc_clean, Normal,
1490        template!(List: &[r#"cfg = "...", /*opt*/ label = "...", /*opt*/ except = "...""#]),
1491        DuplicatesOk, EncodeCrossCrate::No
1492    ),
1493    BuiltinAttribute {
    name: sym::rustc_partition_reused,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"cfg = "...", module = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
1494        TEST, rustc_partition_reused, Normal,
1495        template!(List: &[r#"cfg = "...", module = "...""#]), DuplicatesOk, EncodeCrossCrate::No
1496    ),
1497    BuiltinAttribute {
    name: sym::rustc_partition_codegened,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"cfg = "...", module = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
1498        TEST, rustc_partition_codegened, Normal,
1499        template!(List: &[r#"cfg = "...", module = "...""#]), DuplicatesOk, EncodeCrossCrate::No
1500    ),
1501    BuiltinAttribute {
    name: sym::rustc_expected_cgu_reuse,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"cfg = "...", module = "...", kind = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
1502        TEST, rustc_expected_cgu_reuse, Normal,
1503        template!(List: &[r#"cfg = "...", module = "...", kind = "...""#]), DuplicatesOk,
1504        EncodeCrossCrate::No
1505    ),
1506    BuiltinAttribute {
    name: sym::rustc_symbol_name,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_symbol_name]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_symbol_name]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(
1507        TEST, rustc_symbol_name, Normal, template!(Word),
1508        WarnFollowing, EncodeCrossCrate::No
1509    ),
1510    BuiltinAttribute {
    name: sym::rustc_def_path,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    gate: Gated {
        feature: sym::rustc_attrs,
        message: "use of an internal attribute",
        check: Features::rustc_attrs,
        notes: &["the `#[rustc_def_path]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_def_path]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(
1511        TEST, rustc_def_path, Normal, template!(Word),
1512        WarnFollowing, EncodeCrossCrate::No
1513    ),
1514    BuiltinAttribute {
    name: sym::rustc_mir,
    encode_cross_crate: EncodeCrossCrate::Yes,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&["arg1, arg2, ..."]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
1515        TEST, rustc_mir, Normal, template!(List: &["arg1, arg2, ..."]),
1516        DuplicatesOk, EncodeCrossCrate::Yes
1517    ),
1518    BuiltinAttribute {
    name: sym::custom_mir,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: Some(&[r#"dialect = "...", phase = "...""#]),
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1519        custom_mir, Normal, template!(List: &[r#"dialect = "...", phase = "...""#]),
1520        ErrorFollowing, EncodeCrossCrate::No,
1521        "the `#[custom_mir]` attribute is just used for the Rust test suite",
1522    ),
1523    BuiltinAttribute {
    name: sym::rustc_dump_item_bounds,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1524        TEST, rustc_dump_item_bounds, Normal, template!(Word),
1525        WarnFollowing, EncodeCrossCrate::No
1526    ),
1527    BuiltinAttribute {
    name: sym::rustc_dump_predicates,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1528        TEST, rustc_dump_predicates, Normal, template!(Word),
1529        WarnFollowing, EncodeCrossCrate::No
1530    ),
1531    BuiltinAttribute {
    name: sym::rustc_dump_def_parents,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1532        TEST, rustc_dump_def_parents, Normal, template!(Word),
1533        WarnFollowing, EncodeCrossCrate::No
1534    ),
1535    BuiltinAttribute {
    name: sym::rustc_dump_object_lifetime_defaults,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1536        TEST, rustc_dump_object_lifetime_defaults, Normal, template!(Word),
1537        WarnFollowing, EncodeCrossCrate::No
1538    ),
1539    BuiltinAttribute {
    name: sym::rustc_dump_vtable,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: WarnFollowing,
    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!(
1540        TEST, rustc_dump_vtable, Normal, template!(Word),
1541        WarnFollowing, EncodeCrossCrate::No
1542    ),
1543    BuiltinAttribute {
    name: sym::rustc_dummy,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: Normal,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: true,
        list: None,
        one_of: &[],
        name_value_str: None,
        docs: None,
    },
    duplicates: DuplicatesOk,
    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!(
1544        TEST, rustc_dummy, Normal, template!(Word /* doesn't matter*/),
1545        DuplicatesOk, EncodeCrossCrate::No
1546    ),
1547    BuiltinAttribute {
    name: sym::pattern_complexity_limit,
    encode_cross_crate: EncodeCrossCrate::No,
    type_: CrateLevel,
    safety: AttributeSafety::Normal,
    template: crate::AttributeTemplate {
        word: false,
        list: None,
        one_of: &[],
        name_value_str: Some(&["N"]),
        docs: None,
    },
    duplicates: ErrorFollowing,
    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!(
1548        TEST, pattern_complexity_limit, CrateLevel, template!(NameValueStr: "N"),
1549        ErrorFollowing, EncodeCrossCrate::No,
1550    ),
1551];
1552
1553pub fn is_builtin_attr_name(name: Symbol) -> bool {
1554    BUILTIN_ATTRIBUTE_MAP.get(&name).is_some()
1555}
1556
1557/// Whether this builtin attribute is encoded cross crate.
1558/// This means it can be used cross crate.
1559pub fn encode_cross_crate(name: Symbol) -> bool {
1560    if let Some(attr) = BUILTIN_ATTRIBUTE_MAP.get(&name) {
1561        attr.encode_cross_crate == EncodeCrossCrate::Yes
1562    } else {
1563        true
1564    }
1565}
1566
1567pub fn is_valid_for_get_attr(name: Symbol) -> bool {
1568    BUILTIN_ATTRIBUTE_MAP.get(&name).is_some_and(|attr| match attr.duplicates {
1569        WarnFollowing | ErrorFollowing | ErrorPreceding | FutureWarnFollowing
1570        | FutureWarnPreceding => true,
1571        DuplicatesOk | WarnFollowingWordOnly => false,
1572    })
1573}
1574
1575pub static BUILTIN_ATTRIBUTE_MAP: LazyLock<FxHashMap<Symbol, &BuiltinAttribute>> =
1576    LazyLock::new(|| {
1577        let mut map = FxHashMap::default();
1578        for attr in BUILTIN_ATTRIBUTES.iter() {
1579            if map.insert(attr.name, attr).is_some() {
1580                {
    ::core::panicking::panic_fmt(format_args!("duplicate builtin attribute `{0}`",
            attr.name));
};panic!("duplicate builtin attribute `{}`", attr.name);
1581            }
1582        }
1583        map
1584    });
1585
1586pub fn is_stable_diagnostic_attribute(sym: Symbol, features: &Features) -> bool {
1587    match sym {
1588        sym::on_unimplemented | sym::do_not_recommend => true,
1589        sym::on_const => features.diagnostic_on_const(),
1590        _ => false,
1591    }
1592}