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    // FIXME(Centril): This can be used on stable but shouldn't.
477    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,
    },
    gate: Ungated,
    duplicates: ErrorFollowing,
}ungated!(
478        reexport_test_harness_main, CrateLevel, template!(NameValueStr: "name"), ErrorFollowing,
479        EncodeCrossCrate::No,
480    ),
481
482    // Macros:
483    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!(
484        automatically_derived, Normal,
485        template!(
486            Word,
487            "https://doc.rust-lang.org/reference/attributes/derive.html#the-automatically_derived-attribute"
488        ),
489        WarnFollowing, EncodeCrossCrate::Yes
490    ),
491    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!(
492        macro_use, Normal,
493        template!(
494            Word,
495            List: &["name1, name2, ..."],
496            "https://doc.rust-lang.org/reference/macros-by-example.html#the-macro_use-attribute"
497        ),
498        WarnFollowingWordOnly, EncodeCrossCrate::No,
499    ),
500    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`.
501    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!(
502        macro_export, Normal,
503        template!(
504            Word,
505            List: &["local_inner_macros"],
506            "https://doc.rust-lang.org/reference/macros-by-example.html#path-based-scope"
507        ),
508        WarnFollowing, EncodeCrossCrate::Yes
509    ),
510    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!(
511        proc_macro, Normal,
512        template!(
513            Word,
514            "https://doc.rust-lang.org/reference/procedural-macros.html#function-like-procedural-macros"),
515        ErrorFollowing, EncodeCrossCrate::No
516    ),
517    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!(
518        proc_macro_derive, Normal,
519        template!(
520            List: &["TraitName", "TraitName, attributes(name1, name2, ...)"],
521            "https://doc.rust-lang.org/reference/procedural-macros.html#derive-macros"
522        ),
523        ErrorFollowing, EncodeCrossCrate::No,
524    ),
525    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!(
526        proc_macro_attribute, Normal,
527        template!(Word, "https://doc.rust-lang.org/reference/procedural-macros.html#attribute-macros"),
528        ErrorFollowing, EncodeCrossCrate::No
529    ),
530
531    // Lints:
532    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!(
533        warn, Normal,
534        template!(
535            List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
536            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
537        ),
538        DuplicatesOk, EncodeCrossCrate::No,
539    ),
540    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!(
541        allow, Normal,
542        template!(
543            List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
544            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
545        ),
546        DuplicatesOk, EncodeCrossCrate::No,
547    ),
548    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!(
549        expect, Normal,
550        template!(
551            List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
552            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
553        ),
554        DuplicatesOk, EncodeCrossCrate::No,
555    ),
556    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!(
557        forbid, Normal,
558        template!(
559            List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
560            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
561        ),
562        DuplicatesOk, EncodeCrossCrate::No
563    ),
564    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!(
565        deny, Normal,
566        template!(
567            List: &["lint1", "lint1, lint2, ...", r#"lint1, lint2, lint3, reason = "...""#],
568            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#lint-check-attributes"
569        ),
570        DuplicatesOk, EncodeCrossCrate::No
571    ),
572    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!(
573        must_use, Normal,
574        template!(
575            Word,
576            NameValueStr: "reason",
577            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute"
578        ),
579        FutureWarnFollowing, EncodeCrossCrate::Yes
580    ),
581    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!(
582        must_not_suspend, Normal, template!(Word, NameValueStr: "reason"), WarnFollowing,
583        EncodeCrossCrate::Yes, experimental!(must_not_suspend)
584    ),
585    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!(
586        deprecated, Normal,
587        template!(
588            Word,
589            List: &[r#"/*opt*/ since = "version", /*opt*/ note = "reason""#],
590            NameValueStr: "reason",
591            "https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute"
592        ),
593        ErrorFollowing, EncodeCrossCrate::Yes
594    ),
595
596    // Crate properties:
597    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!(
598        crate_name, CrateLevel,
599        template!(
600            NameValueStr: "name",
601            "https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute"
602        ),
603        FutureWarnFollowing, EncodeCrossCrate::No,
604    ),
605    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!(
606        crate_type, CrateLevel,
607        template!(
608            NameValueStr: ["bin", "lib", "dylib", "cdylib", "rlib", "staticlib", "sdylib", "proc-macro"],
609            "https://doc.rust-lang.org/reference/linkage.html"
610        ),
611        DuplicatesOk, EncodeCrossCrate::No,
612    ),
613
614    // ABI, linking, symbols, and FFI
615    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!(
616        link, Normal,
617        template!(List: &[
618            r#"name = "...""#,
619            r#"name = "...", kind = "dylib|static|...""#,
620            r#"name = "...", wasm_import_module = "...""#,
621            r#"name = "...", import_name_type = "decorated|noprefix|undecorated""#,
622            r#"name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated""#,
623        ], "https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute"),
624        DuplicatesOk, EncodeCrossCrate::No,
625    ),
626    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!(
627        link_name, Normal,
628        template!(NameValueStr: "name", "https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute"),
629        FutureWarnPreceding, EncodeCrossCrate::Yes
630    ),
631    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!(
632        no_link, Normal,
633        template!(Word, "https://doc.rust-lang.org/reference/items/extern-crates.html#the-no_link-attribute"),
634        WarnFollowing, EncodeCrossCrate::No
635    ),
636    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!(
637        repr, Normal,
638        template!(
639            List: &["C", "Rust", "transparent", "align(...)", "packed(...)", "<integer type>"],
640            "https://doc.rust-lang.org/reference/type-layout.html#representations"
641        ),
642        DuplicatesOk, EncodeCrossCrate::No
643    ),
644    // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
645    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)),
646    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)),
647    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!(
648        unsafe(Edition2024) export_name, Normal,
649        template!(NameValueStr: "name", "https://doc.rust-lang.org/reference/abi.html#the-export_name-attribute"),
650        FutureWarnPreceding, EncodeCrossCrate::No
651    ),
652    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!(
653        unsafe(Edition2024) link_section, Normal,
654        template!(NameValueStr: "name", "https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute"),
655        FutureWarnPreceding, EncodeCrossCrate::No
656    ),
657    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!(
658        unsafe(Edition2024) no_mangle, Normal,
659        template!(Word, "https://doc.rust-lang.org/reference/abi.html#the-no_mangle-attribute"),
660        WarnFollowing, EncodeCrossCrate::No
661    ),
662    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!(
663        used, Normal,
664        template!(Word, List: &["compiler", "linker"], "https://doc.rust-lang.org/reference/abi.html#the-used-attribute"),
665        WarnFollowing, EncodeCrossCrate::No
666    ),
667    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!(
668        link_ordinal, Normal,
669        template!(List: &["ordinal"], "https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute"),
670        ErrorPreceding, EncodeCrossCrate::Yes
671    ),
672    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!(
673        unsafe naked, Normal,
674        template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-naked-attribute"),
675        WarnFollowing, EncodeCrossCrate::No
676    ),
677    // See `TyAndLayout::pass_indirectly_in_non_rustic_abis` for details.
678    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!(
679        rustc_pass_indirectly_in_non_rustic_abis, Normal, template!(Word), ErrorFollowing,
680        EncodeCrossCrate::No,
681        "types marked with `#[rustc_pass_indirectly_in_non_rustic_abis]` are always passed indirectly by non-Rustic ABIs"
682    ),
683
684    // Limits:
685    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!(
686        recursion_limit, CrateLevel,
687        template!(NameValueStr: "N", "https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute"),
688        FutureWarnFollowing, EncodeCrossCrate::No
689    ),
690    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!(
691        type_length_limit, CrateLevel,
692        template!(NameValueStr: "N", "https://doc.rust-lang.org/reference/attributes/limits.html#the-type_length_limit-attribute"),
693        FutureWarnFollowing, EncodeCrossCrate::No
694    ),
695    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!(
696        move_size_limit, CrateLevel, template!(NameValueStr: "N"), ErrorFollowing,
697        EncodeCrossCrate::No, large_assignments, experimental!(move_size_limit)
698    ),
699
700    // Entry point:
701    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!(
702        no_main, CrateLevel,
703        template!(Word, "https://doc.rust-lang.org/reference/crates-and-source-files.html#the-no_main-attribute"),
704        WarnFollowing, EncodeCrossCrate::No
705    ),
706
707    // Modules, prelude, and resolution:
708    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!(
709        path, Normal,
710        template!(NameValueStr: "file", "https://doc.rust-lang.org/reference/items/modules.html#the-path-attribute"),
711        FutureWarnFollowing, EncodeCrossCrate::No
712    ),
713    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!(
714        no_std, CrateLevel,
715        template!(Word, "https://doc.rust-lang.org/reference/names/preludes.html#the-no_std-attribute"),
716        WarnFollowing, EncodeCrossCrate::No
717    ),
718    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!(
719        no_implicit_prelude, Normal,
720        template!(Word, "https://doc.rust-lang.org/reference/names/preludes.html#the-no_implicit_prelude-attribute"),
721        WarnFollowing, EncodeCrossCrate::No
722    ),
723    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!(
724        non_exhaustive, Normal,
725        template!(Word, "https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute"),
726        WarnFollowing, EncodeCrossCrate::Yes
727    ),
728
729    // Runtime
730    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!(
731        windows_subsystem, CrateLevel,
732        template!(NameValueStr: ["windows", "console"], "https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute"),
733        FutureWarnFollowing, EncodeCrossCrate::No
734    ),
735    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
736        panic_handler, Normal,
737        template!(Word, "https://doc.rust-lang.org/reference/panic.html#the-panic_handler-attribute"),
738        WarnFollowing, EncodeCrossCrate::Yes
739    ),
740
741    // Code generation:
742    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!(
743        inline, Normal,
744        template!(
745            Word,
746            List: &["always", "never"],
747            "https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute"
748        ),
749        FutureWarnFollowing, EncodeCrossCrate::No
750    ),
751    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!(
752        cold, Normal,
753        template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-cold-attribute"),
754        WarnFollowing, EncodeCrossCrate::No
755    ),
756    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!(
757        no_builtins, CrateLevel,
758        template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-no_builtins-attribute"),
759        WarnFollowing, EncodeCrossCrate::Yes
760    ),
761    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!(
762        target_feature, Normal,
763        template!(List: &[r#"enable = "name""#], "https://doc.rust-lang.org/reference/attributes/codegen.html#the-target_feature-attribute"),
764        DuplicatesOk, EncodeCrossCrate::No,
765    ),
766    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!(
767        track_caller, Normal,
768        template!(Word, "https://doc.rust-lang.org/reference/attributes/codegen.html#the-track_caller-attribute"),
769        WarnFollowing, EncodeCrossCrate::Yes
770    ),
771    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!(
772        instruction_set, Normal,
773        template!(List: &["set"], "https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute"),
774        ErrorPreceding, EncodeCrossCrate::No
775    ),
776    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!(
777        unsafe force_target_feature, Normal, template!(List: &[r#"enable = "name""#]),
778        DuplicatesOk, EncodeCrossCrate::No, effective_target_features, experimental!(force_target_feature)
779    ),
780    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!(
781        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,
782        EncodeCrossCrate::No, sanitize, experimental!(sanitize),
783    ),
784    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!(
785        coverage, Normal, template!(OneOf: &[sym::off, sym::on]),
786        ErrorPreceding, EncodeCrossCrate::No,
787        coverage_attribute, experimental!(coverage)
788    ),
789
790    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!(
791        doc, Normal,
792        template!(
793            List: &["hidden", "inline"],
794            NameValueStr: "string",
795            "https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html"
796        ),
797        DuplicatesOk, EncodeCrossCrate::Yes
798    ),
799
800    // Debugging
801    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!(
802        debugger_visualizer, Normal,
803        template!(
804            List: &[r#"natvis_file = "...", gdb_script_file = "...""#],
805            "https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute"
806        ),
807        DuplicatesOk, EncodeCrossCrate::No
808    ),
809    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!(
810        collapse_debuginfo, Normal,
811        template!(
812            List: &["no", "external", "yes"],
813            "https://doc.rust-lang.org/reference/attributes/debugger.html#the-collapse_debuginfo-attribute"
814        ),
815        ErrorFollowing, EncodeCrossCrate::Yes
816    ),
817
818    // ==========================================================================
819    // Unstable attributes:
820    // ==========================================================================
821
822    // Linking:
823    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!(
824        export_stable, Normal, template!(Word), WarnFollowing,
825        EncodeCrossCrate::No, experimental!(export_stable)
826    ),
827
828    // Testing:
829    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!(
830        test_runner, CrateLevel, template!(List: &["path"]), ErrorFollowing,
831        EncodeCrossCrate::Yes, custom_test_frameworks,
832        "custom test frameworks are an unstable feature",
833    ),
834    // RFC #1268
835    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!(
836        marker, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
837        marker_trait_attr, experimental!(marker)
838    ),
839    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!(
840        thread_local, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
841        "`#[thread_local]` is an experimental feature, and does not currently handle destructors",
842    ),
843    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!(
844        no_core, CrateLevel, template!(Word), WarnFollowing,
845        EncodeCrossCrate::No, experimental!(no_core)
846    ),
847    // RFC 2412
848    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!(
849        optimize, Normal, template!(List: &["none", "size", "speed"]), ErrorPreceding,
850        EncodeCrossCrate::No, optimize_attribute, experimental!(optimize)
851    ),
852
853    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!(
854        unsafe ffi_pure, Normal, template!(Word), WarnFollowing,
855        EncodeCrossCrate::No, experimental!(ffi_pure)
856    ),
857    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!(
858        unsafe ffi_const, Normal, template!(Word), WarnFollowing,
859        EncodeCrossCrate::No, experimental!(ffi_const)
860    ),
861    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!(
862        register_tool, CrateLevel, template!(List: &["tool1, tool2, ..."]), DuplicatesOk,
863        EncodeCrossCrate::No, experimental!(register_tool),
864    ),
865    // `#[cfi_encoding = ""]`
866    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!(
867        cfi_encoding, Normal, template!(NameValueStr: "encoding"), ErrorPreceding,
868        EncodeCrossCrate::Yes, experimental!(cfi_encoding)
869    ),
870
871    // `#[coroutine]` attribute to be applied to closures to make them coroutines instead
872    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!(
873        coroutine, Normal, template!(Word), ErrorFollowing,
874        EncodeCrossCrate::No, coroutines, experimental!(coroutine)
875    ),
876
877    // RFC 3543
878    // `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
879    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!(
880        patchable_function_entry, Normal, template!(List: &["prefix_nops = m, entry_nops = n"]), ErrorPreceding,
881        EncodeCrossCrate::Yes, experimental!(patchable_function_entry)
882    ),
883
884    // The `#[loop_match]` and `#[const_continue]` attributes are part of the
885    // lang experiment for RFC 3720 tracked in:
886    //
887    // - https://github.com/rust-lang/rust/issues/132306
888    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!(
889        const_continue, Normal, template!(Word), ErrorFollowing,
890        EncodeCrossCrate::No, loop_match, experimental!(const_continue)
891    ),
892    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!(
893        loop_match, Normal, template!(Word), ErrorFollowing,
894        EncodeCrossCrate::No, loop_match, experimental!(loop_match)
895    ),
896
897    // The `#[pin_v2]` attribute is part of the `pin_ergonomics` experiment
898    // that allows structurally pinning, tracked in:
899    //
900    // - https://github.com/rust-lang/rust/issues/130494
901    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!(
902        pin_v2, Normal, template!(Word), ErrorFollowing,
903        EncodeCrossCrate::Yes, pin_ergonomics, experimental!(pin_v2),
904    ),
905
906    // ==========================================================================
907    // Internal attributes: Stability, deprecation, and unsafe:
908    // ==========================================================================
909
910    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!(
911        feature, CrateLevel,
912        template!(List: &["name1, name2, ..."]), DuplicatesOk, EncodeCrossCrate::No,
913    ),
914    // DuplicatesOk since it has its own validation
915    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!(
916        stable, Normal,
917        template!(List: &[r#"feature = "name", since = "version""#]), DuplicatesOk, EncodeCrossCrate::No,
918    ),
919    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!(
920        unstable, Normal,
921        template!(List: &[r#"feature = "name", reason = "...", issue = "N""#]), DuplicatesOk,
922        EncodeCrossCrate::Yes
923    ),
924    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!(
925        unstable_feature_bound, Normal, template!(Word, List: &["feat1, feat2, ..."]),
926        DuplicatesOk, EncodeCrossCrate::No,
927    ),
928    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!(
929        rustc_const_unstable, Normal, template!(List: &[r#"feature = "name""#]),
930        DuplicatesOk, EncodeCrossCrate::Yes
931    ),
932    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!(
933        rustc_const_stable, Normal,
934        template!(List: &[r#"feature = "name""#]), DuplicatesOk, EncodeCrossCrate::No,
935    ),
936    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!(
937        rustc_default_body_unstable, Normal,
938        template!(List: &[r#"feature = "name", reason = "...", issue = "N""#]),
939        DuplicatesOk, EncodeCrossCrate::No
940    ),
941    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!(
942        allow_internal_unstable, Normal, template!(Word, List: &["feat1, feat2, ..."]),
943        DuplicatesOk, EncodeCrossCrate::Yes,
944        "allow_internal_unstable side-steps feature gating and stability checks",
945    ),
946    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!(
947        allow_internal_unsafe, Normal, template!(Word), WarnFollowing,
948        EncodeCrossCrate::No, "allow_internal_unsafe side-steps the unsafe_code lint",
949    ),
950    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!(
951        rustc_eii_foreign_item, Normal, template!(Word),
952        ErrorFollowing, EncodeCrossCrate::Yes, eii_internals,
953        "used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
954    ),
955    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!(
956        rustc_allowed_through_unstable_modules, Normal, template!(NameValueStr: "deprecation message"),
957        WarnFollowing, EncodeCrossCrate::No,
958        "rustc_allowed_through_unstable_modules special cases accidental stabilizations of stable items \
959        through unstable paths"
960    ),
961    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!(
962        rustc_deprecated_safe_2024, Normal, template!(List: &[r#"audit_that = "...""#]),
963        ErrorFollowing, EncodeCrossCrate::Yes,
964        "`#[rustc_deprecated_safe_2024]` is used to declare functions unsafe across the edition 2024 boundary",
965    ),
966    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!(
967        rustc_pub_transparent, Normal, template!(Word),
968        ErrorFollowing, EncodeCrossCrate::Yes,
969        "used internally to mark types with a `transparent` representation when it is guaranteed by the documentation",
970    ),
971
972
973    // ==========================================================================
974    // Internal attributes: Type system related:
975    // ==========================================================================
976
977    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)),
978    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!(
979        may_dangle, Normal, template!(Word), WarnFollowing,
980        EncodeCrossCrate::No, dropck_eyepatch,
981        "`may_dangle` has unstable semantics and may be removed in the future",
982    ),
983
984    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!(
985        rustc_never_type_options,
986        Normal,
987        template!(List: &[
988            "",
989            r#"fallback = "unit""#,
990            r#"fallback = "niko""#,
991            r#"fallback = "never""#,
992            r#"fallback = "no""#,
993        ]),
994        ErrorFollowing,
995        EncodeCrossCrate::No,
996        "`rustc_never_type_options` is used to experiment with never type fallback and work on \
997         never type stabilization"
998    ),
999
1000    // ==========================================================================
1001    // Internal attributes: Runtime related:
1002    // ==========================================================================
1003
1004    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!(
1005        rustc_allocator, Normal, template!(Word), WarnFollowing,
1006        EncodeCrossCrate::No,
1007    ),
1008    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!(
1009        rustc_nounwind, Normal, template!(Word), WarnFollowing,
1010        EncodeCrossCrate::No,
1011    ),
1012    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!(
1013        rustc_reallocator, Normal, template!(Word), WarnFollowing,
1014        EncodeCrossCrate::No,
1015    ),
1016    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!(
1017        rustc_deallocator, Normal, template!(Word), WarnFollowing,
1018        EncodeCrossCrate::No,
1019    ),
1020    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!(
1021        rustc_allocator_zeroed, Normal, template!(Word), WarnFollowing,
1022        EncodeCrossCrate::No,
1023    ),
1024    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!(
1025        rustc_allocator_zeroed_variant, Normal, template!(NameValueStr: "function"), ErrorPreceding,
1026        EncodeCrossCrate::Yes,
1027    ),
1028    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!(
1029        default_lib_allocator, Normal, template!(Word), WarnFollowing,
1030        EncodeCrossCrate::No, allocator_internals, experimental!(default_lib_allocator),
1031    ),
1032    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!(
1033        needs_allocator, Normal, template!(Word), WarnFollowing,
1034        EncodeCrossCrate::No, allocator_internals, experimental!(needs_allocator),
1035    ),
1036    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!(
1037        panic_runtime, CrateLevel, template!(Word), WarnFollowing,
1038        EncodeCrossCrate::No, experimental!(panic_runtime)
1039    ),
1040    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!(
1041        needs_panic_runtime, CrateLevel, template!(Word), WarnFollowing,
1042        EncodeCrossCrate::No, experimental!(needs_panic_runtime)
1043    ),
1044    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!(
1045        compiler_builtins, CrateLevel, template!(Word), WarnFollowing,
1046        EncodeCrossCrate::No,
1047        "the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate \
1048        which contains compiler-rt intrinsics and will never be stable",
1049    ),
1050    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!(
1051        profiler_runtime, CrateLevel, template!(Word), WarnFollowing,
1052        EncodeCrossCrate::No,
1053        "the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \
1054        which contains the profiler runtime and will never be stable",
1055    ),
1056
1057    // ==========================================================================
1058    // Internal attributes, Linkage:
1059    // ==========================================================================
1060
1061    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!(
1062        linkage, Normal, template!(NameValueStr: [
1063            "available_externally",
1064            "common",
1065            "extern_weak",
1066            "external",
1067            "internal",
1068            "linkonce",
1069            "linkonce_odr",
1070            "weak",
1071            "weak_odr",
1072        ], "https://doc.rust-lang.org/reference/linkage.html"),
1073        ErrorPreceding, EncodeCrossCrate::No,
1074        "the `linkage` attribute is experimental and not portable across platforms",
1075    ),
1076    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!(
1077        rustc_std_internal_symbol, Normal, template!(Word), WarnFollowing,
1078        EncodeCrossCrate::No,
1079    ),
1080    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!(
1081        rustc_objc_class, Normal, template!(NameValueStr: "ClassName"), ErrorPreceding,
1082        EncodeCrossCrate::No,
1083    ),
1084    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!(
1085        rustc_objc_selector, Normal, template!(NameValueStr: "methodName"), ErrorPreceding,
1086        EncodeCrossCrate::No,
1087    ),
1088
1089    // ==========================================================================
1090    // Internal attributes, Macro related:
1091    // ==========================================================================
1092
1093    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!(
1094        rustc_builtin_macro, Normal,
1095        template!(Word, List: &["name", "name, /*opt*/ attributes(name1, name2, ...)"]), ErrorFollowing,
1096        EncodeCrossCrate::Yes,
1097    ),
1098    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!(
1099        rustc_proc_macro_decls, Normal, template!(Word), WarnFollowing,
1100        EncodeCrossCrate::No,
1101    ),
1102    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!(
1103        rustc_macro_transparency, Normal,
1104        template!(NameValueStr: ["transparent", "semiopaque", "opaque"]), ErrorFollowing,
1105        EncodeCrossCrate::Yes, "used internally for testing macro hygiene",
1106    ),
1107    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!(
1108        rustc_autodiff, Normal,
1109        template!(Word, List: &[r#""...""#]), DuplicatesOk,
1110        EncodeCrossCrate::Yes,
1111    ),
1112    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!(
1113        rustc_offload_kernel, Normal,
1114        template!(Word), DuplicatesOk,
1115        EncodeCrossCrate::Yes,
1116    ),
1117    // Traces that are left when `cfg` and `cfg_attr` attributes are expanded.
1118    // The attributes are not gated, to avoid stability errors, but they cannot be used in stable
1119    // or unstable code directly because `sym::cfg_(attr_)trace` are not valid identifiers, they
1120    // can only be generated by the compiler.
1121    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!(
1122        cfg_trace, Normal, template!(Word /* irrelevant */), DuplicatesOk,
1123        EncodeCrossCrate::Yes
1124    ),
1125    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!(
1126        cfg_attr_trace, Normal, template!(Word /* irrelevant */), DuplicatesOk,
1127        EncodeCrossCrate::No
1128    ),
1129
1130    // ==========================================================================
1131    // Internal attributes, Diagnostics related:
1132    // ==========================================================================
1133
1134    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!(
1135        rustc_on_unimplemented, Normal,
1136        template!(
1137            List: &[r#"/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...""#],
1138            NameValueStr: "message"
1139        ),
1140        ErrorFollowing, EncodeCrossCrate::Yes,
1141        "see `#[diagnostic::on_unimplemented]` for the stable equivalent of this attribute"
1142    ),
1143    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!(
1144        rustc_confusables, Normal,
1145        template!(List: &[r#""name1", "name2", ..."#]),
1146        ErrorFollowing, EncodeCrossCrate::Yes,
1147    ),
1148    // Enumerates "identity-like" conversion methods to suggest on type mismatch.
1149    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!(
1150        rustc_conversion_suggestion, Normal, template!(Word),
1151        WarnFollowing, EncodeCrossCrate::Yes,
1152    ),
1153    // Prevents field reads in the marked trait or method to be considered
1154    // during dead code analysis.
1155    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!(
1156        rustc_trivial_field_reads, Normal, template!(Word),
1157        WarnFollowing, EncodeCrossCrate::Yes,
1158    ),
1159    // Used by the `rustc::potential_query_instability` lint to warn methods which
1160    // might not be stable during incremental compilation.
1161    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!(
1162        rustc_lint_query_instability, Normal, template!(Word),
1163        WarnFollowing, EncodeCrossCrate::Yes,
1164    ),
1165    // Used by the `rustc::untracked_query_information` lint to warn methods which
1166    // might not be stable during incremental compilation.
1167    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!(
1168        rustc_lint_untracked_query_information, Normal, template!(Word),
1169        WarnFollowing, EncodeCrossCrate::Yes,
1170    ),
1171    // Used by the `rustc::bad_opt_access` lint to identify `DebuggingOptions` and `CodegenOptions`
1172    // types (as well as any others in future).
1173    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!(
1174        rustc_lint_opt_ty, Normal, template!(Word),
1175        WarnFollowing, EncodeCrossCrate::Yes,
1176    ),
1177    // Used by the `rustc::bad_opt_access` lint on fields
1178    // types (as well as any others in future).
1179    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!(
1180        rustc_lint_opt_deny_field_access, Normal, template!(List: &["message"]),
1181        WarnFollowing, EncodeCrossCrate::Yes,
1182    ),
1183
1184    // ==========================================================================
1185    // Internal attributes, Const related:
1186    // ==========================================================================
1187
1188    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!(
1189        rustc_promotable, Normal, template!(Word), WarnFollowing,
1190        EncodeCrossCrate::No, ),
1191    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!(
1192        rustc_legacy_const_generics, Normal, template!(List: &["N"]), ErrorFollowing,
1193        EncodeCrossCrate::Yes,
1194    ),
1195    // Do not const-check this function's body. It will always get replaced during CTFE via `hook_special_const_fn`.
1196    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!(
1197        rustc_do_not_const_check, Normal, template!(Word), WarnFollowing,
1198        EncodeCrossCrate::Yes, "`#[rustc_do_not_const_check]` skips const-check for this function's body",
1199    ),
1200    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!(
1201        rustc_const_stable_indirect, Normal,
1202        template!(Word),
1203        WarnFollowing,
1204        EncodeCrossCrate::No,
1205        "this is an internal implementation detail",
1206    ),
1207    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!(
1208        rustc_intrinsic_const_stable_indirect, Normal,
1209        template!(Word), WarnFollowing, EncodeCrossCrate::No,  "this is an internal implementation detail",
1210    ),
1211    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!(
1212        rustc_allow_const_fn_unstable, Normal,
1213        template!(Word, List: &["feat1, feat2, ..."]), DuplicatesOk, EncodeCrossCrate::No,
1214        "rustc_allow_const_fn_unstable side-steps feature gating and stability checks"
1215    ),
1216
1217    // ==========================================================================
1218    // Internal attributes, Layout related:
1219    // ==========================================================================
1220
1221    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!(
1222        rustc_layout_scalar_valid_range_start, Normal, template!(List: &["value"]), ErrorFollowing,
1223        EncodeCrossCrate::Yes,
1224        "the `#[rustc_layout_scalar_valid_range_start]` attribute is just used to enable \
1225        niche optimizations in the standard library",
1226    ),
1227    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!(
1228        rustc_layout_scalar_valid_range_end, Normal, template!(List: &["value"]), ErrorFollowing,
1229        EncodeCrossCrate::Yes,
1230        "the `#[rustc_layout_scalar_valid_range_end]` attribute is just used to enable \
1231        niche optimizations in the standard library",
1232    ),
1233    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!(
1234        rustc_simd_monomorphize_lane_limit, Normal, template!(NameValueStr: "N"), ErrorFollowing,
1235        EncodeCrossCrate::Yes,
1236        "the `#[rustc_simd_monomorphize_lane_limit]` attribute is just used by std::simd \
1237        for better error messages",
1238    ),
1239    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!(
1240        rustc_nonnull_optimization_guaranteed, Normal, template!(Word), WarnFollowing,
1241        EncodeCrossCrate::Yes,
1242        "the `#[rustc_nonnull_optimization_guaranteed]` attribute is just used to document \
1243        guaranteed niche optimizations in the standard library",
1244        "the compiler does not even check whether the type indeed is being non-null-optimized; \
1245        it is your responsibility to ensure that the attribute is only used on types that are optimized",
1246    ),
1247
1248    // ==========================================================================
1249    // Internal attributes, Misc:
1250    // ==========================================================================
1251    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!(
1252        lang, Normal, template!(NameValueStr: "name"), DuplicatesOk, EncodeCrossCrate::No, lang_items,
1253        "lang items are subject to change",
1254    ),
1255    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!(
1256        rustc_as_ptr, Normal, template!(Word), ErrorFollowing,
1257        EncodeCrossCrate::Yes,
1258        "`#[rustc_as_ptr]` is used to mark functions returning pointers to their inner allocations"
1259    ),
1260    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!(
1261        rustc_should_not_be_called_on_const_items, Normal, template!(Word), ErrorFollowing,
1262        EncodeCrossCrate::Yes,
1263        "`#[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"
1264    ),
1265    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!(
1266        rustc_pass_by_value, Normal, template!(Word), ErrorFollowing,
1267        EncodeCrossCrate::Yes,
1268        "`#[rustc_pass_by_value]` is used to mark types that must be passed by value instead of reference"
1269    ),
1270    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!(
1271        rustc_never_returns_null_ptr, Normal, template!(Word), ErrorFollowing,
1272        EncodeCrossCrate::Yes,
1273        "`#[rustc_never_returns_null_ptr]` is used to mark functions returning non-null pointers"
1274    ),
1275    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!(
1276        rustc_no_implicit_autorefs, AttributeType::Normal, template!(Word), ErrorFollowing, EncodeCrossCrate::Yes,
1277        "`#[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"
1278    ),
1279    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!(
1280        rustc_coherence_is_core, AttributeType::CrateLevel, template!(Word), ErrorFollowing, EncodeCrossCrate::No,
1281        "`#![rustc_coherence_is_core]` allows inherent methods on builtin types, only intended to be used in `core`"
1282    ),
1283    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!(
1284        rustc_coinductive, AttributeType::Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
1285        "`#[rustc_coinductive]` changes a trait to be coinductive, allowing cycles in the trait solver"
1286    ),
1287    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!(
1288        rustc_allow_incoherent_impl, AttributeType::Normal, template!(Word), ErrorFollowing, EncodeCrossCrate::No,
1289        "`#[rustc_allow_incoherent_impl]` has to be added to all impl items of an incoherent inherent impl"
1290    ),
1291    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!(
1292        rustc_preserve_ub_checks, AttributeType::CrateLevel, template!(Word), ErrorFollowing, EncodeCrossCrate::No,
1293        "`#![rustc_preserve_ub_checks]` prevents the designated crate from evaluating whether UB checks are enabled when optimizing MIR",
1294    ),
1295    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!(
1296        rustc_deny_explicit_impl,
1297        AttributeType::Normal,
1298        template!(Word),
1299        ErrorFollowing,
1300        EncodeCrossCrate::No,
1301        "`#[rustc_deny_explicit_impl]` enforces that a trait can have no user-provided impls"
1302    ),
1303    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!(
1304        rustc_dyn_incompatible_trait,
1305        AttributeType::Normal,
1306        template!(Word),
1307        ErrorFollowing,
1308        EncodeCrossCrate::No,
1309        "`#[rustc_dyn_incompatible_trait]` marks a trait as dyn-incompatible, \
1310        even if it otherwise satisfies the requirements to be dyn-compatible."
1311    ),
1312    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!(
1313        rustc_has_incoherent_inherent_impls, AttributeType::Normal, template!(Word),
1314        ErrorFollowing, EncodeCrossCrate::Yes,
1315        "`#[rustc_has_incoherent_inherent_impls]` allows the addition of incoherent inherent impls for \
1316         the given type by annotating all impl items with `#[rustc_allow_incoherent_impl]`"
1317    ),
1318    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!(
1319        rustc_non_const_trait_method, AttributeType::Normal, template!(Word),
1320        ErrorFollowing, EncodeCrossCrate::No,
1321        "`#[rustc_non_const_trait_method]` should only used by the standard library to mark trait methods \
1322        as non-const to allow large traits an easier transition to const"
1323    ),
1324
1325    BuiltinAttribute {
1326        name: sym::rustc_diagnostic_item,
1327        // FIXME: This can be `true` once we always use `tcx.is_diagnostic_item`.
1328        encode_cross_crate: EncodeCrossCrate::Yes,
1329        type_: Normal,
1330        safety: AttributeSafety::Normal,
1331        template: crate::AttributeTemplate {
    word: false,
    list: None,
    one_of: &[],
    name_value_str: Some(&["name"]),
    docs: None,
}template!(NameValueStr: "name"),
1332        duplicates: ErrorFollowing,
1333        gate: Gated{
1334            feature: sym::rustc_attrs,
1335            message: "use of an internal attribute",
1336            check: Features::rustc_attrs,
1337            notes: &["the `#[rustc_diagnostic_item]` attribute allows the compiler to reference types \
1338            from the standard library for diagnostic purposes"],
1339        },
1340    },
1341    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!(
1342        // Used in resolve:
1343        prelude_import, Normal, template!(Word), WarnFollowing,
1344        EncodeCrossCrate::No, "`#[prelude_import]` is for use by rustc only",
1345    ),
1346    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!(
1347        rustc_paren_sugar, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
1348        unboxed_closures, "unboxed_closures are still evolving",
1349    ),
1350    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!(
1351        rustc_inherit_overflow_checks, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
1352        "the `#[rustc_inherit_overflow_checks]` attribute is just used to control \
1353        overflow checking behavior of several functions in the standard library that are inlined \
1354        across crates",
1355    ),
1356    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!(
1357        rustc_reservation_impl, Normal,
1358        template!(NameValueStr: "reservation message"), ErrorFollowing, EncodeCrossCrate::Yes,
1359        "the `#[rustc_reservation_impl]` attribute is internally used \
1360        for reserving `impl<T> From<!> for T` as part of the effort to stabilize `!`"
1361    ),
1362    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!(
1363        rustc_test_marker, Normal, template!(NameValueStr: "name"), WarnFollowing,
1364        EncodeCrossCrate::No, "the `#[rustc_test_marker]` attribute is used internally to track tests",
1365    ),
1366    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!(
1367        rustc_unsafe_specialization_marker, Normal, template!(Word),
1368        WarnFollowing, EncodeCrossCrate::No,
1369        "the `#[rustc_unsafe_specialization_marker]` attribute is used to check specializations"
1370    ),
1371    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!(
1372        rustc_specialization_trait, Normal, template!(Word),
1373        WarnFollowing, EncodeCrossCrate::No,
1374        "the `#[rustc_specialization_trait]` attribute is used to check specializations"
1375    ),
1376    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!(
1377        rustc_main, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
1378        "the `#[rustc_main]` attribute is used internally to specify test entry point function",
1379    ),
1380    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!(
1381        rustc_skip_during_method_dispatch, Normal, template!(List: &["array, boxed_slice"]), ErrorFollowing,
1382        EncodeCrossCrate::No,
1383        "the `#[rustc_skip_during_method_dispatch]` attribute is used to exclude a trait \
1384        from method dispatch when the receiver is of the following type, for compatibility in \
1385        editions < 2021 (array) or editions < 2024 (boxed_slice)"
1386    ),
1387    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!(
1388        rustc_must_implement_one_of, Normal, template!(List: &["function1, function2, ..."]),
1389        ErrorFollowing, EncodeCrossCrate::No,
1390        "the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete \
1391        definition of a trait. Its syntax and semantics are highly experimental and will be \
1392        subject to change before stabilization",
1393    ),
1394    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!(
1395        rustc_doc_primitive, Normal, template!(NameValueStr: "primitive name"), ErrorFollowing,
1396        EncodeCrossCrate::Yes, "the `#[rustc_doc_primitive]` attribute is used by the standard library \
1397        to provide a way to generate documentation for primitive types",
1398    ),
1399    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!(
1400        rustc_intrinsic, Normal, template!(Word), ErrorFollowing, EncodeCrossCrate::Yes, intrinsics,
1401        "the `#[rustc_intrinsic]` attribute is used to declare intrinsics as function items",
1402    ),
1403    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!(
1404        rustc_no_mir_inline, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::Yes,
1405        "`#[rustc_no_mir_inline]` prevents the MIR inliner from inlining a function while not affecting codegen"
1406    ),
1407    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!(
1408        rustc_force_inline, Normal, template!(Word, NameValueStr: "reason"), WarnFollowing, EncodeCrossCrate::Yes,
1409        "`#[rustc_force_inline]` forces a free function to be inlined"
1410    ),
1411    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!(
1412        rustc_scalable_vector, Normal, template!(List: &["count"]), WarnFollowing, EncodeCrossCrate::Yes,
1413        "`#[rustc_scalable_vector]` defines a scalable vector type"
1414    ),
1415
1416    // ==========================================================================
1417    // Internal attributes, Testing:
1418    // ==========================================================================
1419
1420    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),
1421    BuiltinAttribute {
    name: sym::rustc_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_outlives]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_outlives]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(
1422        TEST, rustc_outlives, Normal, template!(Word),
1423        WarnFollowing, EncodeCrossCrate::No
1424    ),
1425    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!(
1426        TEST, rustc_capture_analysis, Normal, template!(Word),
1427        WarnFollowing, EncodeCrossCrate::No
1428    ),
1429    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!(
1430        TEST, rustc_insignificant_dtor, Normal, template!(Word),
1431        WarnFollowing, EncodeCrossCrate::Yes
1432    ),
1433    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!(
1434        TEST, rustc_no_implicit_bounds, CrateLevel, template!(Word),
1435        WarnFollowing, EncodeCrossCrate::No
1436    ),
1437    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!(
1438        TEST, rustc_strict_coherence, Normal, template!(Word),
1439        WarnFollowing, EncodeCrossCrate::Yes
1440    ),
1441    BuiltinAttribute {
    name: sym::rustc_variance,
    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_variance]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_variance]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(
1442        TEST, rustc_variance, Normal, template!(Word),
1443        WarnFollowing, EncodeCrossCrate::No
1444    ),
1445    BuiltinAttribute {
    name: sym::rustc_variance_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_variance_of_opaques]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_variance_of_opaques]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(
1446        TEST, rustc_variance_of_opaques, Normal, template!(Word),
1447        WarnFollowing, EncodeCrossCrate::No
1448    ),
1449    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!(
1450        TEST, rustc_hidden_type_of_opaques, Normal, template!(Word),
1451        WarnFollowing, EncodeCrossCrate::No
1452    ),
1453    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!(
1454        TEST, rustc_layout, Normal, template!(List: &["field1, field2, ..."]),
1455        WarnFollowing, EncodeCrossCrate::Yes
1456    ),
1457    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!(
1458        TEST, rustc_abi, Normal, template!(List: &["field1, field2, ..."]),
1459        WarnFollowing, EncodeCrossCrate::No
1460    ),
1461    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!(
1462        TEST, rustc_regions, Normal, template!(Word),
1463        WarnFollowing, EncodeCrossCrate::No
1464    ),
1465    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!(
1466        TEST, rustc_delayed_bug_from_inside_query, Normal,
1467        template!(Word),
1468        WarnFollowing, EncodeCrossCrate::No
1469    ),
1470    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!(
1471        TEST, rustc_dump_user_args, Normal, template!(Word),
1472        WarnFollowing, EncodeCrossCrate::No
1473    ),
1474    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!(
1475        TEST, rustc_evaluate_where_clauses, Normal, template!(Word), WarnFollowing,
1476        EncodeCrossCrate::Yes
1477    ),
1478    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!(
1479        TEST, rustc_if_this_changed, Normal, template!(Word, List: &["DepNode"]), DuplicatesOk,
1480        EncodeCrossCrate::No
1481    ),
1482    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!(
1483        TEST, rustc_then_this_would_need, Normal, template!(List: &["DepNode"]), DuplicatesOk,
1484        EncodeCrossCrate::No
1485    ),
1486    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!(
1487        TEST, rustc_clean, Normal,
1488        template!(List: &[r#"cfg = "...", /*opt*/ label = "...", /*opt*/ except = "...""#]),
1489        DuplicatesOk, EncodeCrossCrate::No
1490    ),
1491    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!(
1492        TEST, rustc_partition_reused, Normal,
1493        template!(List: &[r#"cfg = "...", module = "...""#]), DuplicatesOk, EncodeCrossCrate::No
1494    ),
1495    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!(
1496        TEST, rustc_partition_codegened, Normal,
1497        template!(List: &[r#"cfg = "...", module = "...""#]), DuplicatesOk, EncodeCrossCrate::No
1498    ),
1499    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!(
1500        TEST, rustc_expected_cgu_reuse, Normal,
1501        template!(List: &[r#"cfg = "...", module = "...", kind = "...""#]), DuplicatesOk,
1502        EncodeCrossCrate::No
1503    ),
1504    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!(
1505        TEST, rustc_symbol_name, Normal, template!(Word),
1506        WarnFollowing, EncodeCrossCrate::No
1507    ),
1508    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!(
1509        TEST, rustc_def_path, Normal, template!(Word),
1510        WarnFollowing, EncodeCrossCrate::No
1511    ),
1512    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!(
1513        TEST, rustc_mir, Normal, template!(List: &["arg1, arg2, ..."]),
1514        DuplicatesOk, EncodeCrossCrate::Yes
1515    ),
1516    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!(
1517        custom_mir, Normal, template!(List: &[r#"dialect = "...", phase = "...""#]),
1518        ErrorFollowing, EncodeCrossCrate::No,
1519        "the `#[custom_mir]` attribute is just used for the Rust test suite",
1520    ),
1521    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!(
1522        TEST, rustc_dump_item_bounds, Normal, template!(Word),
1523        WarnFollowing, EncodeCrossCrate::No
1524    ),
1525    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!(
1526        TEST, rustc_dump_predicates, Normal, template!(Word),
1527        WarnFollowing, EncodeCrossCrate::No
1528    ),
1529    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!(
1530        TEST, rustc_dump_def_parents, Normal, template!(Word),
1531        WarnFollowing, EncodeCrossCrate::No
1532    ),
1533    BuiltinAttribute {
    name: sym::rustc_object_lifetime_default,
    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_object_lifetime_default]` attribute is an internal implementation detail that will never be stable",
                    "the `#[rustc_object_lifetime_default]` attribute is used for rustc unit tests"],
    },
}rustc_attr!(
1534        TEST, rustc_object_lifetime_default, Normal, template!(Word),
1535        WarnFollowing, EncodeCrossCrate::No
1536    ),
1537    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!(
1538        TEST, rustc_dump_vtable, Normal, template!(Word),
1539        WarnFollowing, EncodeCrossCrate::No
1540    ),
1541    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!(
1542        TEST, rustc_dummy, Normal, template!(Word /* doesn't matter*/),
1543        DuplicatesOk, EncodeCrossCrate::No
1544    ),
1545    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!(
1546        TEST, pattern_complexity_limit, CrateLevel, template!(NameValueStr: "N"),
1547        ErrorFollowing, EncodeCrossCrate::No,
1548    ),
1549];
1550
1551pub fn is_builtin_attr_name(name: Symbol) -> bool {
1552    BUILTIN_ATTRIBUTE_MAP.get(&name).is_some()
1553}
1554
1555/// Whether this builtin attribute is encoded cross crate.
1556/// This means it can be used cross crate.
1557pub fn encode_cross_crate(name: Symbol) -> bool {
1558    if let Some(attr) = BUILTIN_ATTRIBUTE_MAP.get(&name) {
1559        attr.encode_cross_crate == EncodeCrossCrate::Yes
1560    } else {
1561        true
1562    }
1563}
1564
1565pub fn is_valid_for_get_attr(name: Symbol) -> bool {
1566    BUILTIN_ATTRIBUTE_MAP.get(&name).is_some_and(|attr| match attr.duplicates {
1567        WarnFollowing | ErrorFollowing | ErrorPreceding | FutureWarnFollowing
1568        | FutureWarnPreceding => true,
1569        DuplicatesOk | WarnFollowingWordOnly => false,
1570    })
1571}
1572
1573pub static BUILTIN_ATTRIBUTE_MAP: LazyLock<FxHashMap<Symbol, &BuiltinAttribute>> =
1574    LazyLock::new(|| {
1575        let mut map = FxHashMap::default();
1576        for attr in BUILTIN_ATTRIBUTES.iter() {
1577            if map.insert(attr.name, attr).is_some() {
1578                {
    ::core::panicking::panic_fmt(format_args!("duplicate builtin attribute `{0}`",
            attr.name));
};panic!("duplicate builtin attribute `{}`", attr.name);
1579            }
1580        }
1581        map
1582    });
1583
1584pub fn is_stable_diagnostic_attribute(sym: Symbol, features: &Features) -> bool {
1585    match sym {
1586        sym::on_unimplemented | sym::do_not_recommend => true,
1587        sym::on_const => features.diagnostic_on_const(),
1588        _ => false,
1589    }
1590}