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            CustomMir(_, _, _) => Yes,
35            DenyExplicitImpl(..) => No,
36            Deprecation { .. } => Yes,
37            DoNotImplementViaObject(..) => No,
38            DocComment { .. } => Yes,
39            Dummy => No,
40            ExportName { .. } => Yes,
41            ExportStable => No,
42            FfiConst(..) => No,
43            FfiPure(..) => No,
44            Fundamental { .. } => Yes,
45            Ignore { .. } => No,
46            Inline(..) => No,
47            LinkName { .. } => Yes, // Needed for rustdoc
48            LinkOrdinal { .. } => No,
49            LinkSection { .. } => Yes, // Needed for rustdoc
50            Linkage(..) => No,
51            LoopMatch(..) => No,
52            MacroEscape(..) => No,
53            MacroTransparency(..) => Yes,
54            MacroUse { .. } => No,
55            Marker(..) => No,
56            MayDangle(..) => No,
57            MustUse { .. } => Yes,
58            Naked(..) => No,
59            NoImplicitPrelude(..) => No,
60            NoMangle(..) => Yes,      // Needed for rustdoc
61            NonExhaustive(..) => Yes, // Needed for rustdoc
62            Optimize(..) => No,
63            ParenSugar(..) => No,
64            PassByValue(..) => Yes,
65            Path(..) => No,
66            Pointee(..) => No,
67            ProcMacro(..) => No,
68            ProcMacroAttribute(..) => No,
69            ProcMacroDerive { .. } => No,
70            PubTransparent(..) => Yes,
71            Repr { .. } => No,
72            RustcBuiltinMacro { .. } => Yes,
73            RustcLayoutScalarValidRangeEnd(..) => Yes,
74            RustcLayoutScalarValidRangeStart(..) => Yes,
75            RustcObjectLifetimeDefault => No,
76            ShouldPanic { .. } => No,
77            SkipDuringMethodDispatch { .. } => No,
78            SpecializationTrait(..) => No,
79            Stability { .. } => Yes,
80            StdInternalSymbol(..) => No,
81            TargetFeature(..) => No,
82            TrackCaller(..) => Yes,
83            TypeConst(..) => Yes,
84            UnsafeSpecializationMarker(..) => No,
85            UnstableFeatureBound(..) => No,
86            Used { .. } => No,
87            // tidy-alphabetical-end
88        }
89    }
90}