Thanks to visit codestin.com
Credit goes to doc.rust-lang.org

rustc_hir/attrs/
data_structures.rs

1use std::borrow::Cow;
2use std::path::PathBuf;
3
4pub use ReprAttr::*;
5use rustc_abi::Align;
6use rustc_ast::token::CommentKind;
7use rustc_ast::{AttrStyle, ast};
8use rustc_error_messages::{DiagArgValue, IntoDiagArg};
9use rustc_macros::{Decodable, Encodable, HashStable_Generic, PrintAttribute};
10use rustc_span::def_id::DefId;
11use rustc_span::hygiene::Transparency;
12use rustc_span::{Ident, Span, Symbol};
13pub use rustc_target::spec::SanitizerSet;
14use thin_vec::ThinVec;
15
16use crate::attrs::pretty_printing::PrintAttribute;
17use crate::limit::Limit;
18use crate::{DefaultBodyStability, PartialConstStability, RustcVersion, Stability};
19
20#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, PrintAttribute)]
21pub enum InlineAttr {
22    None,
23    Hint,
24    Always,
25    Never,
26    /// `#[rustc_force_inline]` forces inlining to happen in the MIR inliner - it reports an error
27    /// if the inlining cannot happen. It is limited to only free functions so that the calls
28    /// can always be resolved.
29    Force {
30        attr_span: Span,
31        reason: Option<Symbol>,
32    },
33}
34
35impl InlineAttr {
36    pub fn always(&self) -> bool {
37        match self {
38            InlineAttr::Always | InlineAttr::Force { .. } => true,
39            InlineAttr::None | InlineAttr::Hint | InlineAttr::Never => false,
40        }
41    }
42}
43
44#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq, HashStable_Generic)]
45pub enum InstructionSetAttr {
46    ArmA32,
47    ArmT32,
48}
49
50#[derive(Copy, Clone, Debug, PartialEq, Eq, Default, PrintAttribute)]
51#[derive(Encodable, Decodable, HashStable_Generic)]
52pub enum OptimizeAttr {
53    /// No `#[optimize(..)]` attribute
54    #[default]
55    Default,
56    /// `#[optimize(none)]`
57    DoNotOptimize,
58    /// `#[optimize(speed)]`
59    Speed,
60    /// `#[optimize(size)]`
61    Size,
62}
63
64impl OptimizeAttr {
65    pub fn do_not_optimize(&self) -> bool {
66        matches!(self, Self::DoNotOptimize)
67    }
68}
69
70#[derive(PartialEq, Debug, Encodable, Decodable, Copy, Clone, HashStable_Generic, PrintAttribute)]
71pub enum ReprAttr {
72    ReprInt(IntType),
73    ReprRust,
74    ReprC,
75    ReprPacked(Align),
76    ReprSimd,
77    ReprTransparent,
78    ReprAlign(Align),
79}
80
81pub enum TransparencyError {
82    UnknownTransparency(Symbol, Span),
83    MultipleTransparencyAttrs(Span, Span),
84}
85
86#[derive(Eq, PartialEq, Debug, Copy, Clone)]
87#[derive(Encodable, Decodable, HashStable_Generic, PrintAttribute)]
88pub enum IntType {
89    SignedInt(ast::IntTy),
90    UnsignedInt(ast::UintTy),
91}
92
93#[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)]
94pub struct Deprecation {
95    pub since: DeprecatedSince,
96    /// The note to issue a reason.
97    pub note: Option<Symbol>,
98    /// A text snippet used to completely replace any use of the deprecated item in an expression.
99    ///
100    /// This is currently unstable.
101    pub suggestion: Option<Symbol>,
102}
103
104/// Release in which an API is deprecated.
105#[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)]
106pub enum DeprecatedSince {
107    RustcVersion(RustcVersion),
108    /// Deprecated in the future ("to be determined").
109    Future,
110    /// `feature(staged_api)` is off. Deprecation versions outside the standard
111    /// library are allowed to be arbitrary strings, for better or worse.
112    NonStandard(Symbol),
113    /// Deprecation version is unspecified but optional.
114    Unspecified,
115    /// Failed to parse a deprecation version, or the deprecation version is
116    /// unspecified and required. An error has already been emitted.
117    Err,
118}
119
120/// Successfully-parsed value of a `#[coverage(..)]` attribute.
121#[derive(Copy, Debug, Eq, PartialEq, Encodable, Decodable, Clone)]
122#[derive(HashStable_Generic, PrintAttribute)]
123pub enum CoverageAttrKind {
124    On,
125    Off,
126}
127
128impl Deprecation {
129    /// Whether an item marked with #[deprecated(since = "X")] is currently
130    /// deprecated (i.e., whether X is not greater than the current rustc
131    /// version).
132    pub fn is_in_effect(&self) -> bool {
133        match self.since {
134            DeprecatedSince::RustcVersion(since) => since <= RustcVersion::CURRENT,
135            DeprecatedSince::Future => false,
136            // The `since` field doesn't have semantic purpose without `#![staged_api]`.
137            DeprecatedSince::NonStandard(_) => true,
138            // Assume deprecation is in effect if "since" field is absent or invalid.
139            DeprecatedSince::Unspecified | DeprecatedSince::Err => true,
140        }
141    }
142
143    pub fn is_since_rustc_version(&self) -> bool {
144        matches!(self.since, DeprecatedSince::RustcVersion(_))
145    }
146}
147
148/// There are three valid forms of the attribute:
149/// `#[used]`, which is semantically equivalent to `#[used(linker)]` except that the latter is currently unstable.
150/// `#[used(compiler)]`
151/// `#[used(linker)]`
152#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
153#[derive(HashStable_Generic, PrintAttribute)]
154pub enum UsedBy {
155    Compiler,
156    Linker,
157}
158
159#[derive(Encodable, Decodable, Clone, Debug, PartialEq, Eq, Hash)]
160#[derive(HashStable_Generic, PrintAttribute)]
161pub enum MacroUseArgs {
162    UseAll,
163    UseSpecific(ThinVec<Ident>),
164}
165
166impl Default for MacroUseArgs {
167    fn default() -> Self {
168        Self::UseSpecific(ThinVec::new())
169    }
170}
171
172#[derive(Debug, Clone, Encodable, Decodable, HashStable_Generic)]
173pub struct StrippedCfgItem<ModId = DefId> {
174    pub parent_module: ModId,
175    pub ident: Ident,
176    pub cfg: (CfgEntry, Span),
177}
178
179impl<ModId> StrippedCfgItem<ModId> {
180    pub fn map_mod_id<New>(self, f: impl FnOnce(ModId) -> New) -> StrippedCfgItem<New> {
181        StrippedCfgItem { parent_module: f(self.parent_module), ident: self.ident, cfg: self.cfg }
182    }
183}
184
185#[derive(Encodable, Decodable, Clone, Debug, PartialEq, Eq, Hash)]
186#[derive(HashStable_Generic, PrintAttribute)]
187pub enum CfgEntry {
188    All(ThinVec<CfgEntry>, Span),
189    Any(ThinVec<CfgEntry>, Span),
190    Not(Box<CfgEntry>, Span),
191    Bool(bool, Span),
192    NameValue { name: Symbol, name_span: Span, value: Option<(Symbol, Span)>, span: Span },
193    Version(Option<RustcVersion>, Span),
194}
195
196/// Possible values for the `#[linkage]` attribute, allowing to specify the
197/// linkage type for a `MonoItem`.
198///
199/// See <https://llvm.org/docs/LangRef.html#linkage-types> for more details about these variants.
200#[derive(Encodable, Decodable, Clone, Copy, Debug, PartialEq, Eq, Hash)]
201#[derive(HashStable_Generic, PrintAttribute)]
202pub enum Linkage {
203    AvailableExternally,
204    Common,
205    ExternalWeak,
206    External,
207    Internal,
208    LinkOnceAny,
209    LinkOnceODR,
210    WeakAny,
211    WeakODR,
212}
213
214#[derive(Clone, Copy, Decodable, Debug, Encodable, PartialEq)]
215#[derive(HashStable_Generic, PrintAttribute)]
216pub enum MirDialect {
217    Analysis,
218    Built,
219    Runtime,
220}
221
222impl IntoDiagArg for MirDialect {
223    fn into_diag_arg(self, _path: &mut Option<PathBuf>) -> DiagArgValue {
224        let arg = match self {
225            MirDialect::Analysis => "analysis",
226            MirDialect::Built => "built",
227            MirDialect::Runtime => "runtime",
228        };
229        DiagArgValue::Str(Cow::Borrowed(arg))
230    }
231}
232
233#[derive(Clone, Copy, Decodable, Debug, Encodable, PartialEq)]
234#[derive(HashStable_Generic, PrintAttribute)]
235pub enum MirPhase {
236    Initial,
237    PostCleanup,
238    Optimized,
239}
240
241impl IntoDiagArg for MirPhase {
242    fn into_diag_arg(self, _path: &mut Option<PathBuf>) -> DiagArgValue {
243        let arg = match self {
244            MirPhase::Initial => "initial",
245            MirPhase::PostCleanup => "post-cleanup",
246            MirPhase::Optimized => "optimized",
247        };
248        DiagArgValue::Str(Cow::Borrowed(arg))
249    }
250}
251
252/// Different ways that the PE Format can decorate a symbol name.
253/// From <https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-name-type>
254#[derive(
255    Copy,
256    Clone,
257    Debug,
258    Encodable,
259    Decodable,
260    HashStable_Generic,
261    PartialEq,
262    Eq,
263    PrintAttribute
264)]
265pub enum PeImportNameType {
266    /// IMPORT_ORDINAL
267    /// Uses the ordinal (i.e., a number) rather than the name.
268    Ordinal(u16),
269    /// Same as IMPORT_NAME
270    /// Name is decorated with all prefixes and suffixes.
271    Decorated,
272    /// Same as IMPORT_NAME_NOPREFIX
273    /// Prefix (e.g., the leading `_` or `@`) is skipped, but suffix is kept.
274    NoPrefix,
275    /// Same as IMPORT_NAME_UNDECORATE
276    /// Prefix (e.g., the leading `_` or `@`) and suffix (the first `@` and all
277    /// trailing characters) are skipped.
278    Undecorated,
279}
280
281#[derive(
282    Copy,
283    Clone,
284    Debug,
285    PartialEq,
286    Eq,
287    PartialOrd,
288    Ord,
289    Hash,
290    Encodable,
291    Decodable,
292    PrintAttribute
293)]
294#[derive(HashStable_Generic)]
295pub enum NativeLibKind {
296    /// Static library (e.g. `libfoo.a` on Linux or `foo.lib` on Windows/MSVC)
297    Static {
298        /// Whether to bundle objects from static library into produced rlib
299        bundle: Option<bool>,
300        /// Whether to link static library without throwing any object files away
301        whole_archive: Option<bool>,
302    },
303    /// Dynamic library (e.g. `libfoo.so` on Linux)
304    /// or an import library corresponding to a dynamic library (e.g. `foo.lib` on Windows/MSVC).
305    Dylib {
306        /// Whether the dynamic library will be linked only if it satisfies some undefined symbols
307        as_needed: Option<bool>,
308    },
309    /// Dynamic library (e.g. `foo.dll` on Windows) without a corresponding import library.
310    /// On Linux, it refers to a generated shared library stub.
311    RawDylib,
312    /// A macOS-specific kind of dynamic libraries.
313    Framework {
314        /// Whether the framework will be linked only if it satisfies some undefined symbols
315        as_needed: Option<bool>,
316    },
317    /// Argument which is passed to linker, relative order with libraries and other arguments
318    /// is preserved
319    LinkArg,
320
321    /// Module imported from WebAssembly
322    WasmImportModule,
323
324    /// The library kind wasn't specified, `Dylib` is currently used as a default.
325    Unspecified,
326}
327
328impl NativeLibKind {
329    pub fn has_modifiers(&self) -> bool {
330        match self {
331            NativeLibKind::Static { bundle, whole_archive } => {
332                bundle.is_some() || whole_archive.is_some()
333            }
334            NativeLibKind::Dylib { as_needed } | NativeLibKind::Framework { as_needed } => {
335                as_needed.is_some()
336            }
337            NativeLibKind::RawDylib
338            | NativeLibKind::Unspecified
339            | NativeLibKind::LinkArg
340            | NativeLibKind::WasmImportModule => false,
341        }
342    }
343
344    pub fn is_statically_included(&self) -> bool {
345        matches!(self, NativeLibKind::Static { .. })
346    }
347
348    pub fn is_dllimport(&self) -> bool {
349        matches!(
350            self,
351            NativeLibKind::Dylib { .. } | NativeLibKind::RawDylib | NativeLibKind::Unspecified
352        )
353    }
354}
355
356#[derive(Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)]
357pub struct LinkEntry {
358    pub span: Span,
359    pub kind: NativeLibKind,
360    pub name: Symbol,
361    pub cfg: Option<CfgEntry>,
362    pub verbatim: Option<bool>,
363    pub import_name_type: Option<(PeImportNameType, Span)>,
364}
365
366#[derive(HashStable_Generic, PrintAttribute)]
367#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug, Encodable, Decodable)]
368pub enum DebuggerVisualizerType {
369    Natvis,
370    GdbPrettyPrinter,
371}
372
373#[derive(Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)]
374pub struct DebugVisualizer {
375    pub span: Span,
376    pub visualizer_type: DebuggerVisualizerType,
377    pub path: Symbol,
378}
379
380/// Represents parsed *built-in* inert attributes.
381///
382/// ## Overview
383/// These attributes are markers that guide the compilation process and are never expanded into other code.
384/// They persist throughout the compilation phases, from AST to HIR and beyond.
385///
386/// ## Attribute Processing
387/// While attributes are initially parsed by [`rustc_parse`] into [`ast::Attribute`], they still contain raw token streams
388/// because different attributes have different internal structures. This enum represents the final,
389/// fully parsed form of these attributes, where each variant contains all the information and
390/// structure relevant for the specific attribute.
391///
392/// Some attributes can be applied multiple times to the same item, and they are "collapsed" into a single
393/// semantic attribute. For example:
394/// ```rust
395/// #[repr(C)]
396/// #[repr(packed)]
397/// struct S { }
398/// ```
399/// This is equivalent to `#[repr(C, packed)]` and results in a single [`AttributeKind::Repr`] containing
400/// both `C` and `packed` annotations. This collapsing happens during parsing and is reflected in the
401/// data structures defined in this enum.
402///
403/// ## Usage
404/// These parsed attributes are used throughout the compiler to:
405/// - Control code generation (e.g., `#[repr]`)
406/// - Mark API stability (`#[stable]`, `#[unstable]`)
407/// - Provide documentation (`#[doc]`)
408/// - Guide compiler behavior (e.g., `#[allow_internal_unstable]`)
409///
410/// ## Note on Attribute Organization
411/// Some attributes like `InlineAttr`, `OptimizeAttr`, and `InstructionSetAttr` are defined separately
412/// from this enum because they are used in specific compiler phases (like code generation) and don't
413/// need to persist throughout the entire compilation process. They are typically processed and
414/// converted into their final form earlier in the compilation pipeline.
415///
416/// For example:
417/// - `InlineAttr` is used during code generation to control function inlining
418/// - `OptimizeAttr` is used to control optimization levels
419/// - `InstructionSetAttr` is used for target-specific code generation
420///
421/// These attributes are handled by their respective compiler passes in the [`rustc_codegen_ssa`] crate
422/// and don't need to be preserved in the same way as the attributes in this enum.
423///
424/// For more details on attribute parsing, see the [`rustc_attr_parsing`] crate.
425///
426/// [`rustc_parse`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html
427/// [`rustc_codegen_ssa`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/index.html
428/// [`rustc_attr_parsing`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_attr_parsing/index.html
429#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
430pub enum AttributeKind {
431    // tidy-alphabetical-start
432    /// Represents `#[align(N)]`.
433    // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
434    Align { align: Align, span: Span },
435
436    /// Represents `#[rustc_allow_const_fn_unstable]`.
437    AllowConstFnUnstable(ThinVec<Symbol>, Span),
438
439    /// Represents `#[rustc_allow_incoherent_impl]`.
440    AllowIncoherentImpl(Span),
441
442    /// Represents `#[allow_internal_unsafe]`.
443    AllowInternalUnsafe(Span),
444
445    /// Represents `#[allow_internal_unstable]`.
446    AllowInternalUnstable(ThinVec<(Symbol, Span)>, Span),
447
448    /// Represents `#[rustc_as_ptr]` (used by the `dangling_pointers_from_temporaries` lint).
449    AsPtr(Span),
450
451    /// Represents `#[automatically_derived]`
452    AutomaticallyDerived(Span),
453
454    /// Represents `#[rustc_default_body_unstable]`.
455    BodyStability {
456        stability: DefaultBodyStability,
457        /// Span of the `#[rustc_default_body_unstable(...)]` attribute
458        span: Span,
459    },
460
461    /// Represents `#[rustc_coinductive]`.
462    Coinductive(Span),
463
464    /// Represents `#[cold]`.
465    Cold(Span),
466
467    /// Represents `#[rustc_confusables]`.
468    Confusables {
469        symbols: ThinVec<Symbol>,
470        // FIXME(jdonszelmann): remove when target validation code is moved
471        first_span: Span,
472    },
473
474    /// Represents `#[const_continue]`.
475    ConstContinue(Span),
476
477    /// Represents `#[rustc_const_stable]` and `#[rustc_const_unstable]`.
478    ConstStability {
479        stability: PartialConstStability,
480        /// Span of the `#[rustc_const_stable(...)]` or `#[rustc_const_unstable(...)]` attribute
481        span: Span,
482    },
483
484    /// Represents `#[rustc_const_stable_indirect]`.
485    ConstStabilityIndirect,
486
487    /// Represents `#[const_trait]`.
488    ConstTrait(Span),
489
490    /// Represents `#[coroutine]`.
491    Coroutine(Span),
492
493    /// Represents `#[coverage(..)]`.
494    Coverage(Span, CoverageAttrKind),
495
496    /// Represents `#[crate_name = ...]`
497    CrateName { name: Symbol, name_span: Span, attr_span: Span, style: AttrStyle },
498
499    /// Represents `#[custom_mir]`.
500    CustomMir(Option<(MirDialect, Span)>, Option<(MirPhase, Span)>, Span),
501
502    /// Represents `#[debugger_visualizer]`.
503    DebuggerVisualizer(ThinVec<DebugVisualizer>),
504
505    /// Represents `#[rustc_deny_explicit_impl]`.
506    DenyExplicitImpl(Span),
507
508    /// Represents [`#[deprecated]`](https://doc.rust-lang.org/stable/reference/attributes/diagnostics.html#the-deprecated-attribute).
509    Deprecation { deprecation: Deprecation, span: Span },
510
511    /// Represents `#[rustc_do_not_implement_via_object]`.
512    DoNotImplementViaObject(Span),
513
514    /// Represents [`#[doc]`](https://doc.rust-lang.org/stable/rustdoc/write-documentation/the-doc-attribute.html).
515    DocComment { style: AttrStyle, kind: CommentKind, span: Span, comment: Symbol },
516
517    /// Represents `#[rustc_dummy]`.
518    Dummy,
519
520    /// Represents [`#[export_name]`](https://doc.rust-lang.org/reference/abi.html#the-export_name-attribute).
521    ExportName {
522        /// The name to export this item with.
523        /// It may not contain \0 bytes as it will be converted to a null-terminated string.
524        name: Symbol,
525        span: Span,
526    },
527
528    /// Represents `#[export_stable]`.
529    ExportStable,
530
531    /// Represents `#[ffi_const]`.
532    FfiConst(Span),
533
534    /// Represents `#[ffi_pure]`.
535    FfiPure(Span),
536
537    /// Represents `#[fundamental]`.
538    Fundamental,
539
540    /// Represents `#[ignore]`
541    Ignore {
542        span: Span,
543        /// ignore can optionally have a reason: `#[ignore = "reason this is ignored"]`
544        reason: Option<Symbol>,
545    },
546
547    /// Represents `#[inline]` and `#[rustc_force_inline]`.
548    Inline(InlineAttr, Span),
549
550    /// Represents `#[link]`.
551    Link(ThinVec<LinkEntry>, Span),
552
553    /// Represents `#[link_name]`.
554    LinkName { name: Symbol, span: Span },
555
556    /// Represents `#[link_ordinal]`.
557    LinkOrdinal { ordinal: u16, span: Span },
558
559    /// Represents [`#[link_section]`](https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute)
560    LinkSection { name: Symbol, span: Span },
561
562    /// Represents `#[linkage]`.
563    Linkage(Linkage, Span),
564
565    /// Represents `#[loop_match]`.
566    LoopMatch(Span),
567
568    /// Represents `#[macro_escape]`.
569    MacroEscape(Span),
570
571    /// Represents [`#[macro_export]`](https://doc.rust-lang.org/reference/macros-by-example.html#r-macro.decl.scope.path).
572    MacroExport { span: Span, local_inner_macros: bool },
573
574    /// Represents `#[rustc_macro_transparency]`.
575    MacroTransparency(Transparency),
576
577    /// Represents `#[macro_use]`.
578    MacroUse { span: Span, arguments: MacroUseArgs },
579
580    /// Represents `#[marker]`.
581    Marker(Span),
582
583    /// Represents [`#[may_dangle]`](https://std-dev-guide.rust-lang.org/tricky/may-dangle.html).
584    MayDangle(Span),
585
586    /// Represents `#[move_size_limit]`
587    MoveSizeLimit { attr_span: Span, limit_span: Span, limit: Limit },
588
589    /// Represents `#[must_use]`.
590    MustUse {
591        span: Span,
592        /// must_use can optionally have a reason: `#[must_use = "reason this must be used"]`
593        reason: Option<Symbol>,
594    },
595
596    /// Represents `#[naked]`
597    Naked(Span),
598
599    /// Represents `#[no_core]`
600    NoCore(Span),
601
602    /// Represents `#[no_implicit_prelude]`
603    NoImplicitPrelude(Span),
604
605    /// Represents `#[no_mangle]`
606    NoMangle(Span),
607
608    /// Represents `#[no_std]`
609    NoStd(Span),
610
611    /// Represents `#[non_exhaustive]`
612    NonExhaustive(Span),
613
614    /// Represents `#[rustc_objc_class]`
615    ObjcClass { classname: Symbol, span: Span },
616
617    /// Represents `#[rustc_objc_selector]`
618    ObjcSelector { methname: Symbol, span: Span },
619
620    /// Represents `#[optimize(size|speed)]`
621    Optimize(OptimizeAttr, Span),
622
623    /// Represents `#[rustc_paren_sugar]`.
624    ParenSugar(Span),
625
626    /// Represents `#[rustc_pass_by_value]` (used by the `rustc_pass_by_value` lint).
627    PassByValue(Span),
628
629    /// Represents `#[path]`
630    Path(Symbol, Span),
631
632    /// Represents `#[pattern_complexity_limit]`
633    PatternComplexityLimit { attr_span: Span, limit_span: Span, limit: Limit },
634
635    /// Represents `#[pointee]`
636    Pointee(Span),
637
638    /// Represents `#[proc_macro]`
639    ProcMacro(Span),
640
641    /// Represents `#[proc_macro_attribute]`
642    ProcMacroAttribute(Span),
643
644    /// Represents `#[proc_macro_derive]`
645    ProcMacroDerive { trait_name: Symbol, helper_attrs: ThinVec<Symbol>, span: Span },
646
647    /// Represents `#[rustc_pub_transparent]` (used by the `repr_transparent_external_private_fields` lint).
648    PubTransparent(Span),
649
650    /// Represents [`#[recursion_limit]`](https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute)
651    RecursionLimit { attr_span: Span, limit_span: Span, limit: Limit },
652
653    /// Represents [`#[repr]`](https://doc.rust-lang.org/stable/reference/type-layout.html#representations).
654    Repr { reprs: ThinVec<(ReprAttr, Span)>, first_span: Span },
655
656    /// Represents `#[rustc_builtin_macro]`.
657    RustcBuiltinMacro { builtin_name: Option<Symbol>, helper_attrs: ThinVec<Symbol>, span: Span },
658
659    /// Represents `#[rustc_coherence_is_core]`
660    RustcCoherenceIsCore(Span),
661
662    /// Represents `#[rustc_layout_scalar_valid_range_end]`.
663    RustcLayoutScalarValidRangeEnd(Box<u128>, Span),
664
665    /// Represents `#[rustc_layout_scalar_valid_range_start]`.
666    RustcLayoutScalarValidRangeStart(Box<u128>, Span),
667
668    /// Represents `#[rustc_object_lifetime_default]`.
669    RustcObjectLifetimeDefault,
670
671    /// Represents `#[rustc_simd_monomorphize_lane_limit = "N"]`.
672    RustcSimdMonomorphizeLaneLimit(Limit),
673
674    /// Represents `#[sanitize]`
675    ///
676    /// the on set and off set are distjoint since there's a third option: unset.
677    /// a node may not set the sanitizer setting in which case it inherits from parents.
678    Sanitize { on_set: SanitizerSet, off_set: SanitizerSet, span: Span },
679
680    /// Represents `#[should_panic]`
681    ShouldPanic { reason: Option<Symbol>, span: Span },
682
683    /// Represents `#[rustc_skip_during_method_dispatch]`.
684    SkipDuringMethodDispatch { array: bool, boxed_slice: bool, span: Span },
685
686    /// Represents `#[rustc_specialization_trait]`.
687    SpecializationTrait(Span),
688
689    /// Represents `#[stable]`, `#[unstable]` and `#[rustc_allowed_through_unstable_modules]`.
690    Stability {
691        stability: Stability,
692        /// Span of the attribute.
693        span: Span,
694    },
695
696    /// Represents `#[rustc_std_internal_symbol]`.
697    StdInternalSymbol(Span),
698
699    /// Represents `#[target_feature(enable = "...")]` and
700    /// `#[unsafe(force_target_feature(enable = "...")]`.
701    TargetFeature { features: ThinVec<(Symbol, Span)>, attr_span: Span, was_forced: bool },
702
703    /// Represents `#[track_caller]`
704    TrackCaller(Span),
705
706    /// Represents `#[type_const]`.
707    TypeConst(Span),
708
709    /// Represents `#[type_length_limit]`
710    TypeLengthLimit { attr_span: Span, limit_span: Span, limit: Limit },
711
712    /// Represents `#[rustc_unsafe_specialization_marker]`.
713    UnsafeSpecializationMarker(Span),
714
715    /// Represents `#[unstable_feature_bound]`.
716    UnstableFeatureBound(ThinVec<(Symbol, Span)>),
717
718    /// Represents `#[used]`
719    Used { used_by: UsedBy, span: Span },
720    // tidy-alphabetical-end
721}