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