rustc_hir/attrs/
encode_cross_crate.rs

1use crate::attrs::AttributeKind;
2
3#[derive(PartialEq)]
4pub enum EncodeCrossCrate {
5    Yes,
6    No,
7}
8
9impl AttributeKind {
10    pub fn encode_cross_crate(&self) -> EncodeCrossCrate {
11        use AttributeKind::*;
12        use EncodeCrossCrate::*;
13
14        match self {
15            // tidy-alphabetical-start
16            Align { .. } => No,
17            AllowConstFnUnstable(..) => No,
18            AllowIncoherentImpl(..) => No,
19            AllowInternalUnsafe(..) => Yes,
20            AllowInternalUnstable(..) => Yes,
21            AsPtr(..) => Yes,
22            AutomaticallyDerived(..) => Yes,
23            BodyStability { .. } => No,
24            CoherenceIsCore => No,
25            Coinductive(..) => No,
26            Cold(..) => No,
27            Confusables { .. } => Yes,
28            ConstContinue(..) => No,
29            ConstStability { .. } => Yes,
30            ConstStabilityIndirect => No,
31            ConstTrait(..) => No,
32            Coroutine(..) => No,
33            Coverage(..) => No,
34            DenyExplicitImpl(..) => No,
35            Deprecation { .. } => Yes,
36            DoNotImplementViaObject(..) => No,
37            DocComment { .. } => Yes,
38            Dummy => No,
39            ExportName { .. } => Yes,
40            ExportStable => No,
41            FfiConst(..) => No,
42            FfiPure(..) => No,
43            Fundamental { .. } => Yes,
44            Ignore { .. } => No,
45            Inline(..) => No,
46            LinkName { .. } => Yes, // Needed for rustdoc
47            LinkOrdinal { .. } => No,
48            LinkSection { .. } => Yes, // Needed for rustdoc
49            Linkage(..) => No,
50            LoopMatch(..) => No,
51            MacroEscape(..) => No,
52            MacroTransparency(..) => Yes,
53            MacroUse { .. } => No,
54            Marker(..) => No,
55            MayDangle(..) => No,
56            MustUse { .. } => Yes,
57            Naked(..) => No,
58            NoImplicitPrelude(..) => No,
59            NoMangle(..) => Yes,      // Needed for rustdoc
60            NonExhaustive(..) => Yes, // Needed for rustdoc
61            Optimize(..) => No,
62            ParenSugar(..) => No,
63            PassByValue(..) => Yes,
64            Path(..) => No,
65            Pointee(..) => No,
66            ProcMacro(..) => No,
67            ProcMacroAttribute(..) => No,
68            ProcMacroDerive { .. } => No,
69            PubTransparent(..) => Yes,
70            Repr { .. } => No,
71            RustcBuiltinMacro { .. } => Yes,
72            RustcLayoutScalarValidRangeEnd(..) => Yes,
73            RustcLayoutScalarValidRangeStart(..) => Yes,
74            RustcObjectLifetimeDefault => No,
75            ShouldPanic { .. } => No,
76            SkipDuringMethodDispatch { .. } => No,
77            SpecializationTrait(..) => No,
78            Stability { .. } => Yes,
79            StdInternalSymbol(..) => No,
80            TargetFeature(..) => No,
81            TrackCaller(..) => Yes,
82            TypeConst(..) => Yes,
83            UnsafeSpecializationMarker(..) => No,
84            UnstableFeatureBound(..) => No,
85            Used { .. } => No,
86            // tidy-alphabetical-end
87        }
88    }
89}