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/// Represents parsed *built-in* inert attributes.
367///
368/// ## Overview
369/// These attributes are markers that guide the compilation process and are never expanded into other code.
370/// They persist throughout the compilation phases, from AST to HIR and beyond.
371///
372/// ## Attribute Processing
373/// While attributes are initially parsed by [`rustc_parse`] into [`ast::Attribute`], they still contain raw token streams
374/// because different attributes have different internal structures. This enum represents the final,
375/// fully parsed form of these attributes, where each variant contains all the information and
376/// structure relevant for the specific attribute.
377///
378/// Some attributes can be applied multiple times to the same item, and they are "collapsed" into a single
379/// semantic attribute. For example:
380/// ```rust
381/// #[repr(C)]
382/// #[repr(packed)]
383/// struct S { }
384/// ```
385/// This is equivalent to `#[repr(C, packed)]` and results in a single [`AttributeKind::Repr`] containing
386/// both `C` and `packed` annotations. This collapsing happens during parsing and is reflected in the
387/// data structures defined in this enum.
388///
389/// ## Usage
390/// These parsed attributes are used throughout the compiler to:
391/// - Control code generation (e.g., `#[repr]`)
392/// - Mark API stability (`#[stable]`, `#[unstable]`)
393/// - Provide documentation (`#[doc]`)
394/// - Guide compiler behavior (e.g., `#[allow_internal_unstable]`)
395///
396/// ## Note on Attribute Organization
397/// Some attributes like `InlineAttr`, `OptimizeAttr`, and `InstructionSetAttr` are defined separately
398/// from this enum because they are used in specific compiler phases (like code generation) and don't
399/// need to persist throughout the entire compilation process. They are typically processed and
400/// converted into their final form earlier in the compilation pipeline.
401///
402/// For example:
403/// - `InlineAttr` is used during code generation to control function inlining
404/// - `OptimizeAttr` is used to control optimization levels
405/// - `InstructionSetAttr` is used for target-specific code generation
406///
407/// These attributes are handled by their respective compiler passes in the [`rustc_codegen_ssa`] crate
408/// and don't need to be preserved in the same way as the attributes in this enum.
409///
410/// For more details on attribute parsing, see the [`rustc_attr_parsing`] crate.
411///
412/// [`rustc_parse`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html
413/// [`rustc_codegen_ssa`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/index.html
414/// [`rustc_attr_parsing`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_attr_parsing/index.html
415#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
416pub enum AttributeKind {
417 // tidy-alphabetical-start
418 /// Represents `#[align(N)]`.
419 // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
420 Align { align: Align, span: Span },
421
422 /// Represents `#[rustc_allow_const_fn_unstable]`.
423 AllowConstFnUnstable(ThinVec<Symbol>, Span),
424
425 /// Represents `#[rustc_allow_incoherent_impl]`.
426 AllowIncoherentImpl(Span),
427
428 /// Represents `#[allow_internal_unsafe]`.
429 AllowInternalUnsafe(Span),
430
431 /// Represents `#[allow_internal_unstable]`.
432 AllowInternalUnstable(ThinVec<(Symbol, Span)>, Span),
433
434 /// Represents `#[rustc_as_ptr]` (used by the `dangling_pointers_from_temporaries` lint).
435 AsPtr(Span),
436
437 /// Represents `#[automatically_derived]`
438 AutomaticallyDerived(Span),
439
440 /// Represents `#[rustc_default_body_unstable]`.
441 BodyStability {
442 stability: DefaultBodyStability,
443 /// Span of the `#[rustc_default_body_unstable(...)]` attribute
444 span: Span,
445 },
446
447 /// Represents `#[rustc_coherence_is_core]`.
448 CoherenceIsCore,
449
450 /// Represents `#[rustc_coinductive]`.
451 Coinductive(Span),
452
453 /// Represents `#[cold]`.
454 Cold(Span),
455
456 /// Represents `#[rustc_confusables]`.
457 Confusables {
458 symbols: ThinVec<Symbol>,
459 // FIXME(jdonszelmann): remove when target validation code is moved
460 first_span: Span,
461 },
462
463 /// Represents `#[const_continue]`.
464 ConstContinue(Span),
465
466 /// Represents `#[rustc_const_stable]` and `#[rustc_const_unstable]`.
467 ConstStability {
468 stability: PartialConstStability,
469 /// Span of the `#[rustc_const_stable(...)]` or `#[rustc_const_unstable(...)]` attribute
470 span: Span,
471 },
472
473 /// Represents `#[rustc_const_stable_indirect]`.
474 ConstStabilityIndirect,
475
476 /// Represents `#[const_trait]`.
477 ConstTrait(Span),
478
479 /// Represents `#[coroutine]`.
480 Coroutine(Span),
481
482 /// Represents `#[coverage(..)]`.
483 Coverage(Span, CoverageAttrKind),
484
485 /// Represents `#[crate_name = ...]`
486 CrateName { name: Symbol, name_span: Span, attr_span: Span, style: AttrStyle },
487
488 /// Represents `#[custom_mir]`.
489 CustomMir(Option<(MirDialect, Span)>, Option<(MirPhase, Span)>, Span),
490
491 ///Represents `#[rustc_deny_explicit_impl]`.
492 DenyExplicitImpl(Span),
493
494 /// Represents [`#[deprecated]`](https://doc.rust-lang.org/stable/reference/attributes/diagnostics.html#the-deprecated-attribute).
495 Deprecation { deprecation: Deprecation, span: Span },
496
497 /// Represents `#[rustc_do_not_implement_via_object]`.
498 DoNotImplementViaObject(Span),
499
500 /// Represents [`#[doc]`](https://doc.rust-lang.org/stable/rustdoc/write-documentation/the-doc-attribute.html).
501 DocComment { style: AttrStyle, kind: CommentKind, span: Span, comment: Symbol },
502
503 /// Represents `#[rustc_dummy]`.
504 Dummy,
505
506 /// Represents [`#[export_name]`](https://doc.rust-lang.org/reference/abi.html#the-export_name-attribute).
507 ExportName {
508 /// The name to export this item with.
509 /// It may not contain \0 bytes as it will be converted to a null-terminated string.
510 name: Symbol,
511 span: Span,
512 },
513
514 /// Represents `#[export_stable]`.
515 ExportStable,
516
517 /// Represents `#[ffi_const]`.
518 FfiConst(Span),
519
520 /// Represents `#[ffi_pure]`.
521 FfiPure(Span),
522
523 /// Represents `#[fundamental]`.
524 Fundamental,
525
526 /// Represents `#[ignore]`
527 Ignore {
528 span: Span,
529 /// ignore can optionally have a reason: `#[ignore = "reason this is ignored"]`
530 reason: Option<Symbol>,
531 },
532
533 /// Represents `#[inline]` and `#[rustc_force_inline]`.
534 Inline(InlineAttr, Span),
535
536 /// Represents `#[link]`.
537 Link(ThinVec<LinkEntry>, Span),
538
539 /// Represents `#[link_name]`.
540 LinkName { name: Symbol, span: Span },
541
542 /// Represents `#[link_ordinal]`.
543 LinkOrdinal { ordinal: u16, span: Span },
544
545 /// Represents [`#[link_section]`](https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute)
546 LinkSection { name: Symbol, span: Span },
547
548 /// Represents `#[linkage]`.
549 Linkage(Linkage, Span),
550
551 /// Represents `#[loop_match]`.
552 LoopMatch(Span),
553
554 /// Represents `#[macro_escape]`.
555 MacroEscape(Span),
556
557 /// Represents `#[rustc_macro_transparency]`.
558 MacroTransparency(Transparency),
559
560 /// Represents `#[macro_use]`.
561 MacroUse { span: Span, arguments: MacroUseArgs },
562
563 /// Represents `#[marker]`.
564 Marker(Span),
565
566 /// Represents [`#[may_dangle]`](https://std-dev-guide.rust-lang.org/tricky/may-dangle.html).
567 MayDangle(Span),
568
569 /// Represents `#[move_size_limit]`
570 MoveSizeLimit { attr_span: Span, limit_span: Span, limit: Limit },
571
572 /// Represents `#[must_use]`.
573 MustUse {
574 span: Span,
575 /// must_use can optionally have a reason: `#[must_use = "reason this must be used"]`
576 reason: Option<Symbol>,
577 },
578
579 /// Represents `#[naked]`
580 Naked(Span),
581
582 /// Represents `#[no_implicit_prelude]`
583 NoImplicitPrelude(Span),
584
585 /// Represents `#[no_mangle]`
586 NoMangle(Span),
587
588 /// Represents `#[non_exhaustive]`
589 NonExhaustive(Span),
590
591 /// Represents `#[optimize(size|speed)]`
592 Optimize(OptimizeAttr, Span),
593
594 /// Represents `#[rustc_paren_sugar]`.
595 ParenSugar(Span),
596
597 /// Represents `#[rustc_pass_by_value]` (used by the `rustc_pass_by_value` lint).
598 PassByValue(Span),
599
600 /// Represents `#[path]`
601 Path(Symbol, Span),
602
603 /// Represents `#[pattern_complexity_limit]`
604 PatternComplexityLimit { attr_span: Span, limit_span: Span, limit: Limit },
605
606 /// Represents `#[pointee]`
607 Pointee(Span),
608
609 /// Represents `#[proc_macro]`
610 ProcMacro(Span),
611
612 /// Represents `#[proc_macro_attribute]`
613 ProcMacroAttribute(Span),
614
615 /// Represents `#[proc_macro_derive]`
616 ProcMacroDerive { trait_name: Symbol, helper_attrs: ThinVec<Symbol>, span: Span },
617
618 /// Represents `#[rustc_pub_transparent]` (used by the `repr_transparent_external_private_fields` lint).
619 PubTransparent(Span),
620
621 /// Represents [`#[recursion_limit]`](https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute)
622 RecursionLimit { attr_span: Span, limit_span: Span, limit: Limit },
623
624 /// Represents [`#[repr]`](https://doc.rust-lang.org/stable/reference/type-layout.html#representations).
625 Repr { reprs: ThinVec<(ReprAttr, Span)>, first_span: Span },
626
627 /// Represents `#[rustc_builtin_macro]`.
628 RustcBuiltinMacro { builtin_name: Option<Symbol>, helper_attrs: ThinVec<Symbol>, span: Span },
629
630 /// Represents `#[rustc_layout_scalar_valid_range_end]`.
631 RustcLayoutScalarValidRangeEnd(Box<u128>, Span),
632
633 /// Represents `#[rustc_layout_scalar_valid_range_start]`.
634 RustcLayoutScalarValidRangeStart(Box<u128>, Span),
635
636 /// Represents `#[rustc_object_lifetime_default]`.
637 RustcObjectLifetimeDefault,
638
639 /// Represents `#[sanitize]`
640 ///
641 /// the on set and off set are distjoint since there's a third option: unset.
642 /// a node may not set the sanitizer setting in which case it inherits from parents.
643 Sanitize { on_set: SanitizerSet, off_set: SanitizerSet, span: Span },
644
645 /// Represents `#[should_panic]`
646 ShouldPanic { reason: Option<Symbol>, span: Span },
647
648 /// Represents `#[rustc_skip_during_method_dispatch]`.
649 SkipDuringMethodDispatch { array: bool, boxed_slice: bool, span: Span },
650
651 /// Represents `#[rustc_specialization_trait]`.
652 SpecializationTrait(Span),
653
654 /// Represents `#[stable]`, `#[unstable]` and `#[rustc_allowed_through_unstable_modules]`.
655 Stability {
656 stability: Stability,
657 /// Span of the attribute.
658 span: Span,
659 },
660
661 /// Represents `#[rustc_std_internal_symbol]`.
662 StdInternalSymbol(Span),
663
664 /// Represents `#[target_feature(enable = "...")]` and
665 /// `#[unsafe(force_target_feature(enable = "...")]`.
666 TargetFeature { features: ThinVec<(Symbol, Span)>, attr_span: Span, was_forced: bool },
667
668 /// Represents `#[track_caller]`
669 TrackCaller(Span),
670
671 /// Represents `#[type_const]`.
672 TypeConst(Span),
673
674 /// Represents `#[type_length_limit]`
675 TypeLengthLimit { attr_span: Span, limit_span: Span, limit: Limit },
676
677 /// Represents `#[rustc_unsafe_specialization_marker]`.
678 UnsafeSpecializationMarker(Span),
679
680 /// Represents `#[unstable_feature_bound]`.
681 UnstableFeatureBound(ThinVec<(Symbol, Span)>),
682
683 /// Represents `#[used]`
684 Used { used_by: UsedBy, span: Span },
685 // tidy-alphabetical-end
686}