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            AllowInternalUnstable(..) => Yes,
20            AsPtr(..) => Yes,
21            AutomaticallyDerived(..) => Yes,
22            BodyStability { .. } => No,
23            CoherenceIsCore => No,
24            Coinductive(..) => No,
25            Cold(..) => No,
26            Confusables { .. } => Yes,
27            ConstContinue(..) => No,
28            ConstStability { .. } => Yes,
29            ConstStabilityIndirect => No,
30            ConstTrait(..) => No,
31            Coverage(..) => No,
32            DenyExplicitImpl(..) => No,
33            Deprecation { .. } => Yes,
34            DoNotImplementViaObject(..) => No,
35            DocComment { .. } => Yes,
36            Dummy => No,
37            ExportName { .. } => Yes,
38            ExportStable => No,
39            FfiConst(..) => No,
40            FfiPure(..) => No,
41            Fundamental { .. } => Yes,
42            Ignore { .. } => No,
43            Inline(..) => No,
44            LinkName { .. } => Yes, // Needed for rustdoc
45            LinkOrdinal { .. } => No,
46            LinkSection { .. } => Yes, // Needed for rustdoc
47            LoopMatch(..) => No,
48            MacroEscape(..) => No,
49            MacroTransparency(..) => Yes,
50            MacroUse { .. } => No,
51            Marker(..) => No,
52            MayDangle(..) => No,
53            MustUse { .. } => Yes,
54            Naked(..) => No,
55            NoImplicitPrelude(..) => No,
56            NoMangle(..) => Yes,      // Needed for rustdoc
57            NonExhaustive(..) => Yes, // Needed for rustdoc
58            Optimize(..) => No,
59            ParenSugar(..) => No,
60            PassByValue(..) => Yes,
61            Path(..) => No,
62            Pointee(..) => No,
63            ProcMacro(..) => No,
64            ProcMacroAttribute(..) => No,
65            ProcMacroDerive { .. } => No,
66            PubTransparent(..) => Yes,
67            Repr { .. } => No,
68            RustcBuiltinMacro { .. } => Yes,
69            RustcLayoutScalarValidRangeEnd(..) => Yes,
70            RustcLayoutScalarValidRangeStart(..) => Yes,
71            RustcObjectLifetimeDefault => No,
72            SkipDuringMethodDispatch { .. } => No,
73            SpecializationTrait(..) => No,
74            Stability { .. } => Yes,
75            StdInternalSymbol(..) => No,
76            TargetFeature(..) => No,
77            TrackCaller(..) => Yes,
78            TypeConst(..) => Yes,
79            UnsafeSpecializationMarker(..) => No,
80            UnstableFeatureBound(..) => No,
81            Used { .. } => No,
82            // tidy-alphabetical-end
83        }
84    }
85}