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