| author | bors <bors@rust-lang.org> 2026-04-30 07:30:46 UTC |
| committer | bors <bors@rust-lang.org> 2026-04-30 07:30:46 UTC |
| log | f53b654a8882fd5fc036c4ca7a4ff41ce32497a6 |
| tree | fb2f8ce531662fba48c10256b90ec7276c6fc4db |
| parent | 57f772f25c5ce2bd870d6f8c3ab318eaee5a3326 |
| parent | 20060c60f320e806fa070a78abe268c15484487d |
Simplify `HashStable`
This PR:
- Simplifies the `HashStable` trait, by moving its generic parameter from the trait to its single method.
- Eliminates the need for the non-obvious `derive(HashStable)`/`derive(HashStable_Generic)` distinction.
- Reduces the need for, and clarifies, the non-obvious `derive(HashStable)`/`derive(HashStable_NoContext)` distinction.
r? @fee1-dead 93 files changed, 1178 insertions(+), 1229 deletions(-)
compiler/rustc_abi/src/callconv/reg.rs+3-3| ... | ... | @@ -1,9 +1,9 @@ |
| 1 | 1 | #[cfg(feature = "nightly")] |
| 2 | use rustc_macros::HashStable_Generic; | |
| 2 | use rustc_macros::HashStable; | |
| 3 | 3 | |
| 4 | 4 | use crate::{Align, HasDataLayout, Integer, Primitive, Size}; |
| 5 | 5 | |
| 6 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 6 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 7 | 7 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] |
| 8 | 8 | pub enum RegKind { |
| 9 | 9 | Integer, |
| ... | ... | @@ -16,7 +16,7 @@ pub enum RegKind { |
| 16 | 16 | }, |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 19 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 20 | 20 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] |
| 21 | 21 | pub struct Reg { |
| 22 | 22 | pub kind: RegKind, |
compiler/rustc_abi/src/canon_abi.rs+5-5| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | use std::fmt; |
| 2 | 2 | |
| 3 | 3 | #[cfg(feature = "nightly")] |
| 4 | use rustc_macros::HashStable_Generic; | |
| 4 | use rustc_macros::HashStable; | |
| 5 | 5 | |
| 6 | 6 | use crate::ExternAbi; |
| 7 | 7 | |
| ... | ... | @@ -18,7 +18,7 @@ use crate::ExternAbi; |
| 18 | 18 | /// rather than picking the "actual" ABI. |
| 19 | 19 | #[derive(Copy, Clone, Debug)] |
| 20 | 20 | #[derive(PartialOrd, Ord, PartialEq, Eq, Hash)] |
| 21 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 21 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 22 | 22 | pub enum CanonAbi { |
| 23 | 23 | // NOTE: the use of nested variants for some ABIs is for many targets they don't matter, |
| 24 | 24 | // and this pushes the complexity of their reasoning to target-specific code, |
| ... | ... | @@ -111,7 +111,7 @@ impl fmt::Display for CanonAbi { |
| 111 | 111 | /// These only affect callee codegen. making their categorization as distinct ABIs a bit peculiar. |
| 112 | 112 | #[derive(Copy, Clone, Debug)] |
| 113 | 113 | #[derive(PartialOrd, Ord, PartialEq, Eq, Hash)] |
| 114 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 114 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 115 | 115 | pub enum InterruptKind { |
| 116 | 116 | Avr, |
| 117 | 117 | AvrNonBlocking, |
| ... | ... | @@ -126,7 +126,7 @@ pub enum InterruptKind { |
| 126 | 126 | /// One of SysV64 or Win64 may alias the C ABI, and arguably Win64 is cross-platform now? |
| 127 | 127 | #[derive(Clone, Copy, Debug)] |
| 128 | 128 | #[derive(PartialOrd, Ord, PartialEq, Eq, Hash)] |
| 129 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 129 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 130 | 130 | pub enum X86Call { |
| 131 | 131 | /// "fastcall" has both GNU and Windows variants |
| 132 | 132 | Fastcall, |
| ... | ... | @@ -141,7 +141,7 @@ pub enum X86Call { |
| 141 | 141 | /// ABIs defined for 32-bit Arm |
| 142 | 142 | #[derive(Copy, Clone, Debug)] |
| 143 | 143 | #[derive(PartialOrd, Ord, PartialEq, Eq, Hash)] |
| 144 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 144 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 145 | 145 | pub enum ArmCall { |
| 146 | 146 | Aapcs, |
| 147 | 147 | CCmseNonSecureCall, |
compiler/rustc_abi/src/extern_abi.rs+5-3| ... | ... | @@ -3,7 +3,9 @@ use std::fmt; |
| 3 | 3 | use std::hash::{Hash, Hasher}; |
| 4 | 4 | |
| 5 | 5 | #[cfg(feature = "nightly")] |
| 6 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd}; | |
| 6 | use rustc_data_structures::stable_hasher::{ | |
| 7 | HashStable, HashStableContext, StableHasher, StableOrd, | |
| 8 | }; | |
| 7 | 9 | #[cfg(feature = "nightly")] |
| 8 | 10 | use rustc_macros::{Decodable, Encodable}; |
| 9 | 11 | #[cfg(feature = "nightly")] |
| ... | ... | @@ -240,9 +242,9 @@ impl Hash for ExternAbi { |
| 240 | 242 | } |
| 241 | 243 | |
| 242 | 244 | #[cfg(feature = "nightly")] |
| 243 | impl<C> HashStable<C> for ExternAbi { | |
| 245 | impl HashStable for ExternAbi { | |
| 244 | 246 | #[inline] |
| 245 | fn hash_stable(&self, _: &mut C, hasher: &mut StableHasher) { | |
| 247 | fn hash_stable<Hcx: HashStableContext>(&self, _: &mut Hcx, hasher: &mut StableHasher) { | |
| 246 | 248 | Hash::hash(self, hasher); |
| 247 | 249 | } |
| 248 | 250 | } |
compiler/rustc_abi/src/layout.rs+2-2| ... | ... | @@ -45,7 +45,7 @@ rustc_index::newtype_index! { |
| 45 | 45 | /// `b` is `FieldIdx(1)` in `VariantIdx(0)`, |
| 46 | 46 | /// `d` is `FieldIdx(1)` in `VariantIdx(1)`, and |
| 47 | 47 | /// `f` is `FieldIdx(1)` in `VariantIdx(0)`. |
| 48 | #[stable_hash_generic] | |
| 48 | #[stable_hash] | |
| 49 | 49 | #[encodable] |
| 50 | 50 | #[orderable] |
| 51 | 51 | #[gate_rustc_only] |
| ... | ... | @@ -70,7 +70,7 @@ rustc_index::newtype_index! { |
| 70 | 70 | /// |
| 71 | 71 | /// `struct`s, `tuples`, and `unions`s are considered to have a single variant |
| 72 | 72 | /// with variant index zero, aka [`FIRST_VARIANT`]. |
| 73 | #[stable_hash_generic] | |
| 73 | #[stable_hash] | |
| 74 | 74 | #[encodable] |
| 75 | 75 | #[orderable] |
| 76 | 76 | #[gate_rustc_only] |
compiler/rustc_abi/src/layout/ty.rs+3-3| ... | ... | @@ -2,7 +2,7 @@ use std::fmt; |
| 2 | 2 | use std::ops::Deref; |
| 3 | 3 | |
| 4 | 4 | use rustc_data_structures::intern::Interned; |
| 5 | use rustc_macros::HashStable_Generic; | |
| 5 | use rustc_macros::HashStable; | |
| 6 | 6 | |
| 7 | 7 | use crate::layout::{FieldIdx, VariantIdx}; |
| 8 | 8 | use crate::{ |
| ... | ... | @@ -12,7 +12,7 @@ use crate::{ |
| 12 | 12 | |
| 13 | 13 | // Explicitly import `Float` to avoid ambiguity with `Primitive::Float`. |
| 14 | 14 | |
| 15 | #[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)] | |
| 15 | #[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)] | |
| 16 | 16 | #[rustc_pass_by_value] |
| 17 | 17 | pub struct Layout<'a>(pub Interned<'a, LayoutData<FieldIdx, VariantIdx>>); |
| 18 | 18 | |
| ... | ... | @@ -71,7 +71,7 @@ impl<'a> Layout<'a> { |
| 71 | 71 | /// to that obtained from `layout_of(ty)`, as we need to produce |
| 72 | 72 | /// layouts for which Rust types do not exist, such as enum variants |
| 73 | 73 | /// or synthetic fields of enums (i.e., discriminants) and wide pointers. |
| 74 | #[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)] | |
| 74 | #[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)] | |
| 75 | 75 | pub struct TyAndLayout<'a, Ty> { |
| 76 | 76 | pub ty: Ty, |
| 77 | 77 | pub layout: Layout<'a>, |
compiler/rustc_abi/src/lib.rs+21-42| ... | ... | @@ -53,7 +53,7 @@ use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, m |
| 53 | 53 | use rustc_hashes::Hash64; |
| 54 | 54 | use rustc_index::{Idx, IndexSlice, IndexVec}; |
| 55 | 55 | #[cfg(feature = "nightly")] |
| 56 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_Generic}; | |
| 56 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable}; | |
| 57 | 57 | #[cfg(feature = "nightly")] |
| 58 | 58 | use rustc_span::{Symbol, sym}; |
| 59 | 59 | |
| ... | ... | @@ -74,10 +74,7 @@ pub use layout::{FIRST_VARIANT, FieldIdx, LayoutCalculator, LayoutCalculatorErro |
| 74 | 74 | pub use layout::{Layout, TyAbiInterface, TyAndLayout}; |
| 75 | 75 | |
| 76 | 76 | #[derive(Clone, Copy, PartialEq, Eq, Default)] |
| 77 | #[cfg_attr( | |
| 78 | feature = "nightly", | |
| 79 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic) | |
| 80 | )] | |
| 77 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 81 | 78 | pub struct ReprFlags(u8); |
| 82 | 79 | |
| 83 | 80 | bitflags! { |
| ... | ... | @@ -114,10 +111,7 @@ impl std::fmt::Debug for ReprFlags { |
| 114 | 111 | } |
| 115 | 112 | |
| 116 | 113 | #[derive(Copy, Clone, Debug, Eq, PartialEq)] |
| 117 | #[cfg_attr( | |
| 118 | feature = "nightly", | |
| 119 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic) | |
| 120 | )] | |
| 114 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 121 | 115 | pub enum IntegerType { |
| 122 | 116 | /// Pointer-sized integer type, i.e. `isize` and `usize`. The field shows signedness, e.g. |
| 123 | 117 | /// `Pointer(true)` means `isize`. |
| ... | ... | @@ -137,10 +131,7 @@ impl IntegerType { |
| 137 | 131 | } |
| 138 | 132 | |
| 139 | 133 | #[derive(Copy, Clone, Debug, Eq, PartialEq)] |
| 140 | #[cfg_attr( | |
| 141 | feature = "nightly", | |
| 142 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic) | |
| 143 | )] | |
| 134 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 144 | 135 | pub enum ScalableElt { |
| 145 | 136 | /// `N` in `rustc_scalable_vector(N)` - the element count of the scalable vector |
| 146 | 137 | ElementCount(u16), |
| ... | ... | @@ -151,10 +142,7 @@ pub enum ScalableElt { |
| 151 | 142 | |
| 152 | 143 | /// Represents the repr options provided by the user. |
| 153 | 144 | #[derive(Copy, Clone, Debug, Eq, PartialEq, Default)] |
| 154 | #[cfg_attr( | |
| 155 | feature = "nightly", | |
| 156 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic) | |
| 157 | )] | |
| 145 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 158 | 146 | pub struct ReprOptions { |
| 159 | 147 | pub int: Option<IntegerType>, |
| 160 | 148 | pub align: Option<Align>, |
| ... | ... | @@ -804,10 +792,7 @@ impl FromStr for Endian { |
| 804 | 792 | |
| 805 | 793 | /// Size of a type in bytes. |
| 806 | 794 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 807 | #[cfg_attr( | |
| 808 | feature = "nightly", | |
| 809 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic) | |
| 810 | )] | |
| 795 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 811 | 796 | pub struct Size { |
| 812 | 797 | raw: u64, |
| 813 | 798 | } |
| ... | ... | @@ -1032,10 +1017,7 @@ impl Step for Size { |
| 1032 | 1017 | |
| 1033 | 1018 | /// Alignment of a type in bytes (always a power of two). |
| 1034 | 1019 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 1035 | #[cfg_attr( | |
| 1036 | feature = "nightly", | |
| 1037 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic) | |
| 1038 | )] | |
| 1020 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 1039 | 1021 | pub struct Align { |
| 1040 | 1022 | pow2: u8, |
| 1041 | 1023 | } |
| ... | ... | @@ -1168,7 +1150,7 @@ impl Align { |
| 1168 | 1150 | /// An example of a rare thing actually affected by preferred alignment is aligning of statics. |
| 1169 | 1151 | /// It is of effectively no consequence for layout in structs and on the stack. |
| 1170 | 1152 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] |
| 1171 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 1153 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 1172 | 1154 | pub struct AbiAlign { |
| 1173 | 1155 | pub abi: Align, |
| 1174 | 1156 | } |
| ... | ... | @@ -1200,10 +1182,7 @@ impl Deref for AbiAlign { |
| 1200 | 1182 | |
| 1201 | 1183 | /// Integers, also used for enum discriminants. |
| 1202 | 1184 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] |
| 1203 | #[cfg_attr( | |
| 1204 | feature = "nightly", | |
| 1205 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic) | |
| 1206 | )] | |
| 1185 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 1207 | 1186 | pub enum Integer { |
| 1208 | 1187 | I8, |
| 1209 | 1188 | I16, |
| ... | ... | @@ -1363,7 +1342,7 @@ impl Integer { |
| 1363 | 1342 | |
| 1364 | 1343 | /// Floating-point types. |
| 1365 | 1344 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] |
| 1366 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 1345 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 1367 | 1346 | pub enum Float { |
| 1368 | 1347 | F16, |
| 1369 | 1348 | F32, |
| ... | ... | @@ -1398,7 +1377,7 @@ impl Float { |
| 1398 | 1377 | |
| 1399 | 1378 | /// Fundamental unit of memory access and layout. |
| 1400 | 1379 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] |
| 1401 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 1380 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 1402 | 1381 | pub enum Primitive { |
| 1403 | 1382 | /// The `bool` is the signedness of the `Integer` type. |
| 1404 | 1383 | /// |
| ... | ... | @@ -1446,7 +1425,7 @@ impl Primitive { |
| 1446 | 1425 | /// |
| 1447 | 1426 | /// This is intended specifically to mirror LLVM’s `!range` metadata semantics. |
| 1448 | 1427 | #[derive(Clone, Copy, PartialEq, Eq, Hash)] |
| 1449 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 1428 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 1450 | 1429 | pub struct WrappingRange { |
| 1451 | 1430 | pub start: u128, |
| 1452 | 1431 | pub end: u128, |
| ... | ... | @@ -1558,7 +1537,7 @@ impl fmt::Debug for WrappingRange { |
| 1558 | 1537 | |
| 1559 | 1538 | /// Information about one scalar component of a Rust type. |
| 1560 | 1539 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] |
| 1561 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 1540 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 1562 | 1541 | pub enum Scalar { |
| 1563 | 1542 | Initialized { |
| 1564 | 1543 | value: Primitive, |
| ... | ... | @@ -1662,7 +1641,7 @@ impl Scalar { |
| 1662 | 1641 | // NOTE: This struct is generic over the FieldIdx for rust-analyzer usage. |
| 1663 | 1642 | /// Describes how the fields of a type are located in memory. |
| 1664 | 1643 | #[derive(PartialEq, Eq, Hash, Clone, Debug)] |
| 1665 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 1644 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 1666 | 1645 | pub enum FieldsShape<FieldIdx: Idx> { |
| 1667 | 1646 | /// Scalar primitives and `!`, which never have fields. |
| 1668 | 1647 | Primitive, |
| ... | ... | @@ -1747,7 +1726,7 @@ impl<FieldIdx: Idx> FieldsShape<FieldIdx> { |
| 1747 | 1726 | /// should operate on. Special address spaces have an effect on code generation, |
| 1748 | 1727 | /// depending on the target and the address spaces it implements. |
| 1749 | 1728 | #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 1750 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 1729 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 1751 | 1730 | pub struct AddressSpace(pub u32); |
| 1752 | 1731 | |
| 1753 | 1732 | impl AddressSpace { |
| ... | ... | @@ -1760,7 +1739,7 @@ impl AddressSpace { |
| 1760 | 1739 | |
| 1761 | 1740 | /// How many scalable vectors are in a `BackendRepr::ScalableVector`? |
| 1762 | 1741 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] |
| 1763 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 1742 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 1764 | 1743 | pub struct NumScalableVectors(pub u8); |
| 1765 | 1744 | |
| 1766 | 1745 | impl NumScalableVectors { |
| ... | ... | @@ -1809,7 +1788,7 @@ impl IntoDiagArg for NumScalableVectors { |
| 1809 | 1788 | /// Generally, a codegen backend will prefer to handle smaller values as a scalar or short vector, |
| 1810 | 1789 | /// and larger values will usually prefer to be represented as memory. |
| 1811 | 1790 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] |
| 1812 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 1791 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 1813 | 1792 | pub enum BackendRepr { |
| 1814 | 1793 | Scalar(Scalar), |
| 1815 | 1794 | ScalarPair(Scalar, Scalar), |
| ... | ... | @@ -1953,7 +1932,7 @@ impl BackendRepr { |
| 1953 | 1932 | |
| 1954 | 1933 | // NOTE: This struct is generic over the FieldIdx and VariantIdx for rust-analyzer usage. |
| 1955 | 1934 | #[derive(PartialEq, Eq, Hash, Clone, Debug)] |
| 1956 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 1935 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 1957 | 1936 | pub enum Variants<FieldIdx: Idx, VariantIdx: Idx> { |
| 1958 | 1937 | /// A type with no valid variants. Must be uninhabited. |
| 1959 | 1938 | Empty, |
| ... | ... | @@ -1980,7 +1959,7 @@ pub enum Variants<FieldIdx: Idx, VariantIdx: Idx> { |
| 1980 | 1959 | |
| 1981 | 1960 | // NOTE: This struct is generic over the VariantIdx for rust-analyzer usage. |
| 1982 | 1961 | #[derive(PartialEq, Eq, Hash, Clone, Debug)] |
| 1983 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 1962 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 1984 | 1963 | pub enum TagEncoding<VariantIdx: Idx> { |
| 1985 | 1964 | /// The tag directly stores the discriminant, but possibly with a smaller layout |
| 1986 | 1965 | /// (so converting the tag to the discriminant can require sign extension). |
| ... | ... | @@ -2021,7 +2000,7 @@ pub enum TagEncoding<VariantIdx: Idx> { |
| 2021 | 2000 | } |
| 2022 | 2001 | |
| 2023 | 2002 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] |
| 2024 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 2003 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 2025 | 2004 | pub struct Niche { |
| 2026 | 2005 | pub offset: Size, |
| 2027 | 2006 | pub value: Primitive, |
| ... | ... | @@ -2118,7 +2097,7 @@ impl Niche { |
| 2118 | 2097 | |
| 2119 | 2098 | // NOTE: This struct is generic over the FieldIdx and VariantIdx for rust-analyzer usage. |
| 2120 | 2099 | #[derive(PartialEq, Eq, Hash, Clone)] |
| 2121 | #[cfg_attr(feature = "nightly", derive(HashStable_Generic))] | |
| 2100 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 2122 | 2101 | pub struct LayoutData<FieldIdx: Idx, VariantIdx: Idx> { |
| 2123 | 2102 | /// Says where the fields are located within the layout. |
| 2124 | 2103 | pub fields: FieldsShape<FieldIdx>, |
compiler/rustc_ast/src/ast.rs+40-41| ... | ... | @@ -25,14 +25,13 @@ pub use GenericArgs::*; |
| 25 | 25 | pub use UnsafeSource::*; |
| 26 | 26 | pub use rustc_ast_ir::{FloatTy, IntTy, Movability, Mutability, Pinnedness, UintTy}; |
| 27 | 27 | use rustc_data_structures::packed::Pu128; |
| 28 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 28 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 29 | 29 | use rustc_data_structures::stack::ensure_sufficient_stack; |
| 30 | 30 | use rustc_data_structures::tagged_ptr::Tag; |
| 31 | use rustc_macros::{Decodable, Encodable, HashStable_Generic, Walkable}; | |
| 31 | use rustc_macros::{Decodable, Encodable, HashStable, Walkable}; | |
| 32 | 32 | pub use rustc_span::AttrId; |
| 33 | 33 | use rustc_span::{ |
| 34 | ByteSymbol, DUMMY_SP, ErrorGuaranteed, HashStableContext, Ident, Span, Spanned, Symbol, kw, | |
| 35 | respan, sym, | |
| 34 | ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, respan, sym, | |
| 36 | 35 | }; |
| 37 | 36 | use thin_vec::{ThinVec, thin_vec}; |
| 38 | 37 | |
| ... | ... | @@ -53,7 +52,7 @@ use crate::visit::{AssocCtxt, BoundKind, LifetimeCtxt}; |
| 53 | 52 | /// ``` |
| 54 | 53 | /// |
| 55 | 54 | /// `'outer` is a label. |
| 56 | #[derive(Clone, Encodable, Decodable, Copy, HashStable_Generic, Eq, PartialEq, Walkable)] | |
| 55 | #[derive(Clone, Encodable, Decodable, Copy, HashStable, Eq, PartialEq, Walkable)] | |
| 57 | 56 | pub struct Label { |
| 58 | 57 | pub ident: Ident, |
| 59 | 58 | } |
| ... | ... | @@ -121,8 +120,8 @@ impl PartialEq<&[Symbol]> for Path { |
| 121 | 120 | } |
| 122 | 121 | } |
| 123 | 122 | |
| 124 | impl<Hcx: HashStableContext> HashStable<Hcx> for Path { | |
| 125 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 123 | impl HashStable for Path { | |
| 124 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 126 | 125 | self.segments.len().hash_stable(hcx, hasher); |
| 127 | 126 | for segment in &self.segments { |
| 128 | 127 | segment.ident.hash_stable(hcx, hasher); |
| ... | ... | @@ -565,7 +564,7 @@ pub struct Crate { |
| 565 | 564 | /// for most built-in attributes. |
| 566 | 565 | /// |
| 567 | 566 | /// E.g., `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`. |
| 568 | #[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 567 | #[derive(Clone, Encodable, Decodable, Debug, HashStable)] | |
| 569 | 568 | pub struct MetaItem { |
| 570 | 569 | pub unsafety: Safety, |
| 571 | 570 | pub path: Path, |
| ... | ... | @@ -574,7 +573,7 @@ pub struct MetaItem { |
| 574 | 573 | } |
| 575 | 574 | |
| 576 | 575 | /// The meta item kind, containing the data after the initial path. |
| 577 | #[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 576 | #[derive(Clone, Encodable, Decodable, Debug, HashStable)] | |
| 578 | 577 | pub enum MetaItemKind { |
| 579 | 578 | /// Word meta item. |
| 580 | 579 | /// |
| ... | ... | @@ -595,7 +594,7 @@ pub enum MetaItemKind { |
| 595 | 594 | /// Values inside meta item lists. |
| 596 | 595 | /// |
| 597 | 596 | /// E.g., each of `Clone`, `Copy` in `#[derive(Clone, Copy)]`. |
| 598 | #[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 597 | #[derive(Clone, Encodable, Decodable, Debug, HashStable)] | |
| 599 | 598 | pub enum MetaItemInner { |
| 600 | 599 | /// A full MetaItem, for recursive meta items. |
| 601 | 600 | MetaItem(MetaItem), |
| ... | ... | @@ -793,7 +792,7 @@ pub struct PatField { |
| 793 | 792 | } |
| 794 | 793 | |
| 795 | 794 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 796 | #[derive(Encodable, Decodable, HashStable_Generic, Walkable)] | |
| 795 | #[derive(Encodable, Decodable, HashStable, Walkable)] | |
| 797 | 796 | pub enum ByRef { |
| 798 | 797 | Yes(Pinnedness, Mutability), |
| 799 | 798 | No, |
| ... | ... | @@ -815,7 +814,7 @@ impl ByRef { |
| 815 | 814 | /// `.0` is the by-reference mode (`ref`, `ref mut`, or by value), |
| 816 | 815 | /// `.1` is the mutability of the binding. |
| 817 | 816 | #[derive(Clone, Copy, Debug, Eq, PartialEq)] |
| 818 | #[derive(Encodable, Decodable, HashStable_Generic, Walkable)] | |
| 817 | #[derive(Encodable, Decodable, HashStable, Walkable)] | |
| 819 | 818 | pub struct BindingMode(pub ByRef, pub Mutability); |
| 820 | 819 | |
| 821 | 820 | impl BindingMode { |
| ... | ... | @@ -965,7 +964,7 @@ pub enum PatFieldsRest { |
| 965 | 964 | /// The kind of borrow in an `AddrOf` expression, |
| 966 | 965 | /// e.g., `&place` or `&raw const place`. |
| 967 | 966 | #[derive(Clone, Copy, PartialEq, Eq, Debug)] |
| 968 | #[derive(Encodable, Decodable, HashStable_Generic, Walkable)] | |
| 967 | #[derive(Encodable, Decodable, HashStable, Walkable)] | |
| 969 | 968 | pub enum BorrowKind { |
| 970 | 969 | /// A normal borrow, `&$expr` or `&mut $expr`. |
| 971 | 970 | /// The resulting type is either `&'a T` or `&'a mut T` |
| ... | ... | @@ -981,7 +980,7 @@ pub enum BorrowKind { |
| 981 | 980 | Pin, |
| 982 | 981 | } |
| 983 | 982 | |
| 984 | #[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)] | |
| 983 | #[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable, Walkable)] | |
| 985 | 984 | pub enum BinOpKind { |
| 986 | 985 | /// The `+` operator (addition) |
| 987 | 986 | Add, |
| ... | ... | @@ -1111,7 +1110,7 @@ impl From<AssignOpKind> for BinOpKind { |
| 1111 | 1110 | } |
| 1112 | 1111 | } |
| 1113 | 1112 | |
| 1114 | #[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)] | |
| 1113 | #[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable, Walkable)] | |
| 1115 | 1114 | pub enum AssignOpKind { |
| 1116 | 1115 | /// The `+=` operator (addition) |
| 1117 | 1116 | AddAssign, |
| ... | ... | @@ -1163,7 +1162,7 @@ pub type AssignOp = Spanned<AssignOpKind>; |
| 1163 | 1162 | /// Unary operator. |
| 1164 | 1163 | /// |
| 1165 | 1164 | /// Note that `&data` is not an operator, it's an `AddrOf` expression. |
| 1166 | #[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)] | |
| 1165 | #[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable, Walkable)] | |
| 1167 | 1166 | pub enum UnOp { |
| 1168 | 1167 | /// The `*` operator for dereferencing |
| 1169 | 1168 | Deref, |
| ... | ... | @@ -1962,7 +1961,7 @@ impl GenBlockKind { |
| 1962 | 1961 | |
| 1963 | 1962 | /// Whether we're unwrapping or wrapping an unsafe binder |
| 1964 | 1963 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] |
| 1965 | #[derive(Encodable, Decodable, HashStable_Generic, Walkable)] | |
| 1964 | #[derive(Encodable, Decodable, HashStable, Walkable)] | |
| 1966 | 1965 | pub enum UnsafeBinderCastKind { |
| 1967 | 1966 | // e.g. `&i32` -> `unsafe<'a> &'a i32` |
| 1968 | 1967 | Wrap, |
| ... | ... | @@ -1996,7 +1995,7 @@ pub struct QSelf { |
| 1996 | 1995 | } |
| 1997 | 1996 | |
| 1998 | 1997 | /// A capture clause used in closures and `async` blocks. |
| 1999 | #[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] | |
| 1998 | #[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable, Walkable)] | |
| 2000 | 1999 | pub enum CaptureBy { |
| 2001 | 2000 | /// `move |x| y + x`. |
| 2002 | 2001 | Value { |
| ... | ... | @@ -2091,7 +2090,7 @@ impl AttrArgs { |
| 2091 | 2090 | } |
| 2092 | 2091 | |
| 2093 | 2092 | /// Delimited arguments, as used in `#[attr()/[]/{}]` or `mac!()/[]/{}`. |
| 2094 | #[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] | |
| 2093 | #[derive(Clone, Encodable, Decodable, Debug, HashStable, Walkable)] | |
| 2095 | 2094 | pub struct DelimArgs { |
| 2096 | 2095 | pub dspan: DelimSpan, |
| 2097 | 2096 | pub delim: Delimiter, // Note: `Delimiter::Invisible` never occurs |
| ... | ... | @@ -2107,7 +2106,7 @@ impl DelimArgs { |
| 2107 | 2106 | } |
| 2108 | 2107 | |
| 2109 | 2108 | /// Represents a macro definition. |
| 2110 | #[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] | |
| 2109 | #[derive(Clone, Encodable, Decodable, Debug, HashStable, Walkable)] | |
| 2111 | 2110 | pub struct MacroDef { |
| 2112 | 2111 | pub body: Box<DelimArgs>, |
| 2113 | 2112 | /// `true` if macro was defined with `macro_rules`. |
| ... | ... | @@ -2121,7 +2120,7 @@ pub struct MacroDef { |
| 2121 | 2120 | pub eii_declaration: Option<EiiDecl>, |
| 2122 | 2121 | } |
| 2123 | 2122 | |
| 2124 | #[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] | |
| 2123 | #[derive(Clone, Encodable, Decodable, Debug, HashStable, Walkable)] | |
| 2125 | 2124 | pub struct EiiDecl { |
| 2126 | 2125 | /// path to the extern item we're targeting |
| 2127 | 2126 | pub foreign_item: Path, |
| ... | ... | @@ -2129,7 +2128,7 @@ pub struct EiiDecl { |
| 2129 | 2128 | } |
| 2130 | 2129 | |
| 2131 | 2130 | #[derive(Clone, Encodable, Decodable, Debug, Copy, Hash, Eq, PartialEq)] |
| 2132 | #[derive(HashStable_Generic, Walkable)] | |
| 2131 | #[derive(HashStable, Walkable)] | |
| 2133 | 2132 | pub enum StrStyle { |
| 2134 | 2133 | /// A regular string, like `"foo"`. |
| 2135 | 2134 | Cooked, |
| ... | ... | @@ -2187,7 +2186,7 @@ impl YieldKind { |
| 2187 | 2186 | } |
| 2188 | 2187 | |
| 2189 | 2188 | /// A literal in a meta item. |
| 2190 | #[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 2189 | #[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable)] | |
| 2191 | 2190 | pub struct MetaItemLit { |
| 2192 | 2191 | /// The original literal as written in the source code. |
| 2193 | 2192 | pub symbol: Symbol, |
| ... | ... | @@ -2224,7 +2223,7 @@ impl StrLit { |
| 2224 | 2223 | |
| 2225 | 2224 | /// Type of the integer literal based on provided suffix. |
| 2226 | 2225 | #[derive(Clone, Copy, Encodable, Decodable, Debug, Hash, Eq, PartialEq)] |
| 2227 | #[derive(HashStable_Generic)] | |
| 2226 | #[derive(HashStable)] | |
| 2228 | 2227 | pub enum LitIntType { |
| 2229 | 2228 | /// e.g. `42_i32`. |
| 2230 | 2229 | Signed(IntTy), |
| ... | ... | @@ -2236,7 +2235,7 @@ pub enum LitIntType { |
| 2236 | 2235 | |
| 2237 | 2236 | /// Type of the float literal based on provided suffix. |
| 2238 | 2237 | #[derive(Clone, Copy, Encodable, Decodable, Debug, Hash, Eq, PartialEq)] |
| 2239 | #[derive(HashStable_Generic)] | |
| 2238 | #[derive(HashStable)] | |
| 2240 | 2239 | pub enum LitFloatType { |
| 2241 | 2240 | /// A float literal with a suffix (`1f32` or `1E10f32`). |
| 2242 | 2241 | Suffixed(FloatTy), |
| ... | ... | @@ -2250,7 +2249,7 @@ pub enum LitFloatType { |
| 2250 | 2249 | /// deciding the `LitKind`. This means that float literals like `1f32` are |
| 2251 | 2250 | /// classified by this type as `Float`. This is different to `token::LitKind` |
| 2252 | 2251 | /// which does *not* consider the suffix. |
| 2253 | #[derive(Clone, Copy, Encodable, Decodable, Debug, Hash, Eq, PartialEq, HashStable_Generic)] | |
| 2252 | #[derive(Clone, Copy, Encodable, Decodable, Debug, Hash, Eq, PartialEq, HashStable)] | |
| 2254 | 2253 | pub enum LitKind { |
| 2255 | 2254 | /// A string literal (`"foo"`). The symbol is unescaped, and so may differ |
| 2256 | 2255 | /// from the original token's symbol. |
| ... | ... | @@ -2653,7 +2652,7 @@ pub enum TyPatKind { |
| 2653 | 2652 | } |
| 2654 | 2653 | |
| 2655 | 2654 | /// Syntax used to declare a trait object. |
| 2656 | #[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] | |
| 2655 | #[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable, Walkable)] | |
| 2657 | 2656 | #[repr(u8)] |
| 2658 | 2657 | pub enum TraitObjectSyntax { |
| 2659 | 2658 | // SAFETY: When adding new variants make sure to update the `Tag` impl. |
| ... | ... | @@ -2697,7 +2696,7 @@ pub enum InlineAsmRegOrRegClass { |
| 2697 | 2696 | RegClass(Symbol), |
| 2698 | 2697 | } |
| 2699 | 2698 | |
| 2700 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)] | |
| 2699 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)] | |
| 2701 | 2700 | pub struct InlineAsmOptions(u16); |
| 2702 | 2701 | bitflags::bitflags! { |
| 2703 | 2702 | impl InlineAsmOptions: u16 { |
| ... | ... | @@ -2760,7 +2759,7 @@ impl std::fmt::Debug for InlineAsmOptions { |
| 2760 | 2759 | } |
| 2761 | 2760 | } |
| 2762 | 2761 | |
| 2763 | #[derive(Clone, PartialEq, Encodable, Decodable, Debug, Hash, HashStable_Generic, Walkable)] | |
| 2762 | #[derive(Clone, PartialEq, Encodable, Decodable, Debug, Hash, HashStable, Walkable)] | |
| 2764 | 2763 | pub enum InlineAsmTemplatePiece { |
| 2765 | 2764 | String(Cow<'static, str>), |
| 2766 | 2765 | Placeholder { operand_idx: usize, modifier: Option<char>, span: Span }, |
| ... | ... | @@ -2863,7 +2862,7 @@ impl InlineAsmOperand { |
| 2863 | 2862 | } |
| 2864 | 2863 | } |
| 2865 | 2864 | |
| 2866 | #[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable_Generic, Walkable, PartialEq, Eq)] | |
| 2865 | #[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable, Walkable, PartialEq, Eq)] | |
| 2867 | 2866 | pub enum AsmMacro { |
| 2868 | 2867 | /// The `asm!` macro |
| 2869 | 2868 | Asm, |
| ... | ... | @@ -3061,7 +3060,7 @@ impl FnDecl { |
| 3061 | 3060 | } |
| 3062 | 3061 | |
| 3063 | 3062 | /// Is the trait definition an auto trait? |
| 3064 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] | |
| 3063 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable, Walkable)] | |
| 3065 | 3064 | pub enum IsAuto { |
| 3066 | 3065 | Yes, |
| 3067 | 3066 | No, |
| ... | ... | @@ -3069,7 +3068,7 @@ pub enum IsAuto { |
| 3069 | 3068 | |
| 3070 | 3069 | /// Safety of items. |
| 3071 | 3070 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable, Debug)] |
| 3072 | #[derive(HashStable_Generic, Walkable)] | |
| 3071 | #[derive(HashStable, Walkable)] | |
| 3073 | 3072 | pub enum Safety { |
| 3074 | 3073 | /// `unsafe` an item is explicitly marked as `unsafe`. |
| 3075 | 3074 | Unsafe(Span), |
| ... | ... | @@ -3134,7 +3133,7 @@ impl CoroutineKind { |
| 3134 | 3133 | } |
| 3135 | 3134 | |
| 3136 | 3135 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable, Debug)] |
| 3137 | #[derive(HashStable_Generic, Walkable)] | |
| 3136 | #[derive(HashStable, Walkable)] | |
| 3138 | 3137 | pub enum Const { |
| 3139 | 3138 | Yes(Span), |
| 3140 | 3139 | No, |
| ... | ... | @@ -3142,7 +3141,7 @@ pub enum Const { |
| 3142 | 3141 | |
| 3143 | 3142 | /// Item defaultness. |
| 3144 | 3143 | /// For details see the [RFC #2532](https://github.com/rust-lang/rfcs/pull/2532). |
| 3145 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)] | |
| 3144 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable, Walkable)] | |
| 3146 | 3145 | pub enum Defaultness { |
| 3147 | 3146 | /// Item is unmarked. Implicitly determined based off of position. |
| 3148 | 3147 | /// For impls, this is `final`; for traits, this is `default`. |
| ... | ... | @@ -3156,7 +3155,7 @@ pub enum Defaultness { |
| 3156 | 3155 | Final(Span), |
| 3157 | 3156 | } |
| 3158 | 3157 | |
| 3159 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)] | |
| 3158 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, HashStable, Walkable)] | |
| 3160 | 3159 | pub enum ImplPolarity { |
| 3161 | 3160 | /// `impl Trait for Type` |
| 3162 | 3161 | Positive, |
| ... | ... | @@ -3175,7 +3174,7 @@ impl fmt::Debug for ImplPolarity { |
| 3175 | 3174 | |
| 3176 | 3175 | /// The polarity of a trait bound. |
| 3177 | 3176 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash)] |
| 3178 | #[derive(HashStable_Generic, Walkable)] | |
| 3177 | #[derive(HashStable, Walkable)] | |
| 3179 | 3178 | pub enum BoundPolarity { |
| 3180 | 3179 | /// `Type: Trait` |
| 3181 | 3180 | Positive, |
| ... | ... | @@ -3197,7 +3196,7 @@ impl BoundPolarity { |
| 3197 | 3196 | |
| 3198 | 3197 | /// The constness of a trait bound. |
| 3199 | 3198 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash)] |
| 3200 | #[derive(HashStable_Generic, Walkable)] | |
| 3199 | #[derive(HashStable, Walkable)] | |
| 3201 | 3200 | pub enum BoundConstness { |
| 3202 | 3201 | /// `Type: Trait` |
| 3203 | 3202 | Never, |
| ... | ... | @@ -3219,7 +3218,7 @@ impl BoundConstness { |
| 3219 | 3218 | |
| 3220 | 3219 | /// The asyncness of a trait bound. |
| 3221 | 3220 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug)] |
| 3222 | #[derive(HashStable_Generic, Walkable)] | |
| 3221 | #[derive(HashStable, Walkable)] | |
| 3223 | 3222 | pub enum BoundAsyncness { |
| 3224 | 3223 | /// `Type: Trait` |
| 3225 | 3224 | Normal, |
| ... | ... | @@ -3388,7 +3387,7 @@ impl UseTree { |
| 3388 | 3387 | /// are contained as statements within items. These two cases need to be |
| 3389 | 3388 | /// distinguished for pretty-printing. |
| 3390 | 3389 | #[derive(Clone, PartialEq, Eq, Hash, Debug, Copy)] |
| 3391 | #[derive(Encodable, Decodable, HashStable_Generic, Walkable)] | |
| 3390 | #[derive(Encodable, Decodable, HashStable, Walkable)] | |
| 3392 | 3391 | pub enum AttrStyle { |
| 3393 | 3392 | Outer, |
| 3394 | 3393 | Inner, |
| ... | ... | @@ -3485,7 +3484,7 @@ impl AttrItemKind { |
| 3485 | 3484 | /// |
| 3486 | 3485 | /// Currently all early parsed attributes are excluded from pretty printing at rustc_ast_pretty::pprust::state::print_attribute_inline. |
| 3487 | 3486 | /// When adding new early parsed attributes, consider whether they should be pretty printed. |
| 3488 | #[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 3487 | #[derive(Clone, Encodable, Decodable, Debug, HashStable)] | |
| 3489 | 3488 | pub enum EarlyParsedAttribute { |
| 3490 | 3489 | CfgTrace(CfgEntry), |
| 3491 | 3490 | CfgAttrTrace, |
| ... | ... | @@ -3608,7 +3607,7 @@ pub struct FieldDef { |
| 3608 | 3607 | } |
| 3609 | 3608 | |
| 3610 | 3609 | /// Was parsing recovery performed? |
| 3611 | #[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable_Generic, Walkable)] | |
| 3610 | #[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable, Walkable)] | |
| 3612 | 3611 | pub enum Recovered { |
| 3613 | 3612 | No, |
| 3614 | 3613 | Yes(ErrorGuaranteed), |
compiler/rustc_ast/src/attr/data_structures.rs+2-2| ... | ... | @@ -1,12 +1,12 @@ |
| 1 | 1 | use std::fmt; |
| 2 | 2 | |
| 3 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 3 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 4 | 4 | use rustc_span::{Span, Symbol}; |
| 5 | 5 | use thin_vec::ThinVec; |
| 6 | 6 | |
| 7 | 7 | use crate::attr::version::RustcVersion; |
| 8 | 8 | |
| 9 | #[derive(Encodable, Decodable, Clone, Debug, PartialEq, Eq, Hash, HashStable_Generic)] | |
| 9 | #[derive(Encodable, Decodable, Clone, Debug, PartialEq, Eq, Hash, HashStable)] | |
| 10 | 10 | pub enum CfgEntry { |
| 11 | 11 | All(ThinVec<CfgEntry>, Span), |
| 12 | 12 | Any(ThinVec<CfgEntry>, Span), |
compiler/rustc_ast/src/attr/version.rs+2-2| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | 1 | use std::fmt::{self, Display}; |
| 2 | 2 | use std::sync::OnceLock; |
| 3 | 3 | |
| 4 | use rustc_macros::{BlobDecodable, Encodable, HashStable_Generic, current_rustc_version}; | |
| 4 | use rustc_macros::{BlobDecodable, Encodable, HashStable, current_rustc_version}; | |
| 5 | 5 | |
| 6 | 6 | #[derive(Encodable, BlobDecodable, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 7 | #[derive(HashStable_Generic)] | |
| 7 | #[derive(HashStable)] | |
| 8 | 8 | pub struct RustcVersion { |
| 9 | 9 | pub major: u16, |
| 10 | 10 | pub minor: u16, |
compiler/rustc_ast/src/expand/allocator.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | use rustc_macros::HashStable_Generic; | |
| 1 | use rustc_macros::HashStable; | |
| 2 | 2 | use rustc_span::{Symbol, sym}; |
| 3 | 3 | |
| 4 | #[derive(Clone, Debug, Copy, Eq, PartialEq, HashStable_Generic)] | |
| 4 | #[derive(Clone, Debug, Copy, Eq, PartialEq, HashStable)] | |
| 5 | 5 | pub enum AllocatorKind { |
| 6 | 6 | /// Use `#[global_allocator]` as global allocator. |
| 7 | 7 | Global, |
compiler/rustc_ast/src/expand/autodiff_attrs.rs+3-3| ... | ... | @@ -8,7 +8,7 @@ use std::str::FromStr; |
| 8 | 8 | |
| 9 | 9 | use rustc_span::{Symbol, sym}; |
| 10 | 10 | |
| 11 | use crate::expand::{Decodable, Encodable, HashStable_Generic}; | |
| 11 | use crate::expand::{Decodable, Encodable, HashStable}; | |
| 12 | 12 | use crate::{Ty, TyKind}; |
| 13 | 13 | |
| 14 | 14 | /// Forward and Reverse Mode are well known names for automatic differentiation implementations. |
| ... | ... | @@ -20,7 +20,7 @@ use crate::{Ty, TyKind}; |
| 20 | 20 | /// |
| 21 | 21 | /// Documentation for using [reverse](https://enzyme.mit.edu/rust/rev.html) and |
| 22 | 22 | /// [forward](https://enzyme.mit.edu/rust/fwd.html) mode is available online. |
| 23 | #[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 23 | #[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)] | |
| 24 | 24 | pub enum DiffMode { |
| 25 | 25 | /// No autodiff is applied (used during error handling). |
| 26 | 26 | Error, |
| ... | ... | @@ -42,7 +42,7 @@ impl DiffMode { |
| 42 | 42 | /// However, under forward mode we overwrite the previous shadow value, while for reverse mode |
| 43 | 43 | /// we add to the previous shadow value. To not surprise users, we picked different names. |
| 44 | 44 | /// Dual numbers is also a quite well known name for forward mode AD types. |
| 45 | #[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 45 | #[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)] | |
| 46 | 46 | pub enum DiffActivity { |
| 47 | 47 | /// Implicit or Explicit () return type, so a special case of Const. |
| 48 | 48 | None, |
compiler/rustc_ast/src/expand/mod.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //! Definitions shared by macros / syntax extensions and e.g. `rustc_middle`. |
| 2 | 2 | |
| 3 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 3 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 4 | 4 | |
| 5 | 5 | pub mod allocator; |
| 6 | 6 | pub mod autodiff_attrs; |
compiler/rustc_ast/src/expand/typetree.rs+5-5| ... | ... | @@ -21,9 +21,9 @@ |
| 21 | 21 | |
| 22 | 22 | use std::fmt; |
| 23 | 23 | |
| 24 | use crate::expand::{Decodable, Encodable, HashStable_Generic}; | |
| 24 | use crate::expand::{Decodable, Encodable, HashStable}; | |
| 25 | 25 | |
| 26 | #[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 26 | #[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)] | |
| 27 | 27 | pub enum Kind { |
| 28 | 28 | Anything, |
| 29 | 29 | Integer, |
| ... | ... | @@ -35,7 +35,7 @@ pub enum Kind { |
| 35 | 35 | Unknown, |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | #[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 38 | #[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)] | |
| 39 | 39 | pub struct TypeTree(pub Vec<Type>); |
| 40 | 40 | |
| 41 | 41 | impl TypeTree { |
| ... | ... | @@ -59,13 +59,13 @@ impl TypeTree { |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | #[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 62 | #[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)] | |
| 63 | 63 | pub struct FncTree { |
| 64 | 64 | pub args: Vec<TypeTree>, |
| 65 | 65 | pub ret: TypeTree, |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | #[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 68 | #[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)] | |
| 69 | 69 | pub struct Type { |
| 70 | 70 | pub offset: isize, |
| 71 | 71 | pub size: usize, |
compiler/rustc_ast/src/node_id.rs+10| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | use std::fmt; |
| 2 | 2 | |
| 3 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 3 | 4 | use rustc_span::LocalExpnId; |
| 4 | 5 | |
| 5 | 6 | rustc_index::newtype_index! { |
| ... | ... | @@ -18,6 +19,15 @@ rustc_index::newtype_index! { |
| 18 | 19 | } |
| 19 | 20 | } |
| 20 | 21 | |
| 22 | impl HashStable for NodeId { | |
| 23 | #[inline] | |
| 24 | fn hash_stable<Hcx: HashStableContext>(&self, _: &mut Hcx, _: &mut StableHasher) { | |
| 25 | // This impl is never called but is necessary for types implementing `HashStable` such as | |
| 26 | // `MainDefinition` and `DocLinkResMap` (both of which occur in `ResolverGlobalCtxt`). | |
| 27 | panic!("Node IDs should not appear in incremental state"); | |
| 28 | } | |
| 29 | } | |
| 30 | ||
| 21 | 31 | rustc_data_structures::define_id_collections!(NodeMap, NodeSet, NodeMapEntry, NodeId); |
| 22 | 32 | |
| 23 | 33 | /// When parsing and at the beginning of doing expansions, we initially give all AST nodes |
compiler/rustc_ast/src/token.rs+14-14| ... | ... | @@ -5,7 +5,7 @@ pub use LitKind::*; |
| 5 | 5 | pub use NtExprKind::*; |
| 6 | 6 | pub use NtPatKind::*; |
| 7 | 7 | pub use TokenKind::*; |
| 8 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 8 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 9 | 9 | use rustc_span::edition::Edition; |
| 10 | 10 | use rustc_span::symbol::IdentPrintMode; |
| 11 | 11 | use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, kw, sym}; |
| ... | ... | @@ -17,7 +17,7 @@ use crate::ast; |
| 17 | 17 | use crate::util::case::Case; |
| 18 | 18 | |
| 19 | 19 | /// Represents the kind of doc comment it is, ie `///` or `#[doc = ""]`. |
| 20 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 20 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)] | |
| 21 | 21 | pub enum DocFragmentKind { |
| 22 | 22 | /// A sugared doc comment: `///` or `//!` or `/**` or `/*!`. |
| 23 | 23 | Sugared(CommentKind), |
| ... | ... | @@ -40,13 +40,13 @@ impl DocFragmentKind { |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 43 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable)] | |
| 44 | 44 | pub enum CommentKind { |
| 45 | 45 | Line, |
| 46 | 46 | Block, |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, Encodable, Decodable, HashStable_Generic)] | |
| 49 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, Encodable, Decodable, HashStable)] | |
| 50 | 50 | pub enum InvisibleOrigin { |
| 51 | 51 | // From the expansion of a metavariable in a declarative macro. |
| 52 | 52 | MetaVar(MetaVarKind), |
| ... | ... | @@ -69,7 +69,7 @@ impl InvisibleOrigin { |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /// Annoyingly similar to `NonterminalKind`, but the slight differences are important. |
| 72 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)] | |
| 72 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable)] | |
| 73 | 73 | pub enum MetaVarKind { |
| 74 | 74 | Item, |
| 75 | 75 | Block, |
| ... | ... | @@ -125,7 +125,7 @@ impl fmt::Display for MetaVarKind { |
| 125 | 125 | /// Describes how a sequence of token trees is delimited. |
| 126 | 126 | /// Cannot use `proc_macro::Delimiter` directly because this |
| 127 | 127 | /// structure should implement some additional traits. |
| 128 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)] | |
| 128 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)] | |
| 129 | 129 | pub enum Delimiter { |
| 130 | 130 | /// `( ... )` |
| 131 | 131 | Parenthesis, |
| ... | ... | @@ -188,7 +188,7 @@ impl Delimiter { |
| 188 | 188 | // type. This means that float literals like `1f32` are classified by this type |
| 189 | 189 | // as `Int`. Only upon conversion to `ast::LitKind` will such a literal be |
| 190 | 190 | // given the `Float` kind. |
| 191 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 191 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable)] | |
| 192 | 192 | pub enum LitKind { |
| 193 | 193 | Bool, // AST only, must never appear in a `Token` |
| 194 | 194 | Byte, |
| ... | ... | @@ -205,7 +205,7 @@ pub enum LitKind { |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /// A literal token. |
| 208 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 208 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable)] | |
| 209 | 209 | pub struct Lit { |
| 210 | 210 | pub kind: LitKind, |
| 211 | 211 | pub symbol: Symbol, |
| ... | ... | @@ -351,7 +351,7 @@ fn ident_can_begin_type(name: Symbol, span: Span, is_raw: IdentIsRaw) -> bool { |
| 351 | 351 | .contains(&name) |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | #[derive(PartialEq, Eq, Encodable, Decodable, Hash, Debug, Copy, Clone, HashStable_Generic)] | |
| 354 | #[derive(PartialEq, Eq, Encodable, Decodable, Hash, Debug, Copy, Clone, HashStable)] | |
| 355 | 355 | pub enum IdentIsRaw { |
| 356 | 356 | No, |
| 357 | 357 | Yes, |
| ... | ... | @@ -378,7 +378,7 @@ impl From<bool> for IdentIsRaw { |
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 381 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable)] | |
| 382 | 382 | pub enum TokenKind { |
| 383 | 383 | /* Expression-operator symbols. */ |
| 384 | 384 | /// `=` |
| ... | ... | @@ -528,7 +528,7 @@ pub enum TokenKind { |
| 528 | 528 | Eof, |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 531 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable)] | |
| 532 | 532 | pub struct Token { |
| 533 | 533 | pub kind: TokenKind, |
| 534 | 534 | pub span: Span, |
| ... | ... | @@ -1090,7 +1090,7 @@ impl PartialEq<TokenKind> for Token { |
| 1090 | 1090 | } |
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)] | |
| 1093 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable)] | |
| 1094 | 1094 | pub enum NtPatKind { |
| 1095 | 1095 | // Matches or-patterns. Was written using `pat` in edition 2021 or later. |
| 1096 | 1096 | PatWithOr, |
| ... | ... | @@ -1100,7 +1100,7 @@ pub enum NtPatKind { |
| 1100 | 1100 | PatParam { inferred: bool }, |
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)] | |
| 1103 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable)] | |
| 1104 | 1104 | pub enum NtExprKind { |
| 1105 | 1105 | // Matches expressions using the post-edition 2024. Was written using |
| 1106 | 1106 | // `expr` in edition 2024 or later. |
| ... | ... | @@ -1112,7 +1112,7 @@ pub enum NtExprKind { |
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | /// A macro nonterminal, known in documentation as a fragment specifier. |
| 1115 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)] | |
| 1115 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable)] | |
| 1116 | 1116 | pub enum NonterminalKind { |
| 1117 | 1117 | Item, |
| 1118 | 1118 | Block, |
compiler/rustc_ast/src/tokenstream.rs+11-14| ... | ... | @@ -10,11 +10,11 @@ use std::ops::Range; |
| 10 | 10 | use std::sync::Arc; |
| 11 | 11 | use std::{cmp, fmt, iter, mem}; |
| 12 | 12 | |
| 13 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 13 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 14 | 14 | use rustc_data_structures::sync; |
| 15 | use rustc_macros::{Decodable, Encodable, HashStable_Generic, Walkable}; | |
| 15 | use rustc_macros::{Decodable, Encodable, HashStable, Walkable}; | |
| 16 | 16 | use rustc_serialize::{Decodable, Encodable}; |
| 17 | use rustc_span::{DUMMY_SP, HashStableContext, Span, SpanDecoder, SpanEncoder, Symbol, sym}; | |
| 17 | use rustc_span::{DUMMY_SP, Span, SpanDecoder, SpanEncoder, Symbol, sym}; | |
| 18 | 18 | use thin_vec::ThinVec; |
| 19 | 19 | |
| 20 | 20 | use crate::ast::AttrStyle; |
| ... | ... | @@ -23,7 +23,7 @@ use crate::token::{self, Delimiter, Token, TokenKind}; |
| 23 | 23 | use crate::{AttrVec, Attribute}; |
| 24 | 24 | |
| 25 | 25 | /// Part of a `TokenStream`. |
| 26 | #[derive(Debug, Clone, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)] | |
| 26 | #[derive(Debug, Clone, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)] | |
| 27 | 27 | pub enum TokenTree { |
| 28 | 28 | /// A single token. Should never be `OpenDelim` or `CloseDelim`, because |
| 29 | 29 | /// delimiters are implicitly represented by `Delimited`. |
| ... | ... | @@ -138,8 +138,8 @@ impl<D: SpanDecoder> Decodable<D> for LazyAttrTokenStream { |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | impl<Hcx> HashStable<Hcx> for LazyAttrTokenStream { | |
| 142 | fn hash_stable(&self, _hcx: &mut Hcx, _hasher: &mut StableHasher) { | |
| 141 | impl HashStable for LazyAttrTokenStream { | |
| 142 | fn hash_stable<Hcx: HashStableContext>(&self, _hcx: &mut Hcx, _hasher: &mut StableHasher) { | |
| 143 | 143 | panic!("Attempted to compute stable hash for LazyAttrTokenStream"); |
| 144 | 144 | } |
| 145 | 145 | } |
| ... | ... | @@ -545,7 +545,7 @@ pub struct AttrsTarget { |
| 545 | 545 | /// compound token. Used for conversions to `proc_macro::Spacing`. Also used to |
| 546 | 546 | /// guide pretty-printing, which is where the `JointHidden` value (which isn't |
| 547 | 547 | /// part of `proc_macro::Spacing`) comes in useful. |
| 548 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)] | |
| 548 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)] | |
| 549 | 549 | pub enum Spacing { |
| 550 | 550 | /// The token cannot join with the following token to form a compound |
| 551 | 551 | /// token. |
| ... | ... | @@ -824,11 +824,8 @@ impl FromIterator<TokenTree> for TokenStream { |
| 824 | 824 | } |
| 825 | 825 | } |
| 826 | 826 | |
| 827 | impl<Hcx> HashStable<Hcx> for TokenStream | |
| 828 | where | |
| 829 | Hcx: HashStableContext, | |
| 830 | { | |
| 831 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 827 | impl HashStable for TokenStream { | |
| 828 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 832 | 829 | for sub_tt in self.iter() { |
| 833 | 830 | sub_tt.hash_stable(hcx, hasher); |
| 834 | 831 | } |
| ... | ... | @@ -970,7 +967,7 @@ impl TokenCursor { |
| 970 | 967 | } |
| 971 | 968 | |
| 972 | 969 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] |
| 973 | #[derive(Encodable, Decodable, HashStable_Generic, Walkable)] | |
| 970 | #[derive(Encodable, Decodable, HashStable, Walkable)] | |
| 974 | 971 | pub struct DelimSpan { |
| 975 | 972 | pub open: Span, |
| 976 | 973 | pub close: Span, |
| ... | ... | @@ -994,7 +991,7 @@ impl DelimSpan { |
| 994 | 991 | } |
| 995 | 992 | } |
| 996 | 993 | |
| 997 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)] | |
| 994 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)] | |
| 998 | 995 | pub struct DelimSpacing { |
| 999 | 996 | pub open: Spacing, |
| 1000 | 997 | pub close: Spacing, |
compiler/rustc_ast_ir/src/lib.rs+7-25| ... | ... | @@ -14,17 +14,14 @@ |
| 14 | 14 | use std::fmt; |
| 15 | 15 | |
| 16 | 16 | #[cfg(feature = "nightly")] |
| 17 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; | |
| 17 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable}; | |
| 18 | 18 | #[cfg(feature = "nightly")] |
| 19 | 19 | use rustc_span::{Symbol, sym}; |
| 20 | 20 | |
| 21 | 21 | pub mod visit; |
| 22 | 22 | |
| 23 | 23 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 24 | #[cfg_attr( | |
| 25 | feature = "nightly", | |
| 26 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) | |
| 27 | )] | |
| 24 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 28 | 25 | pub enum IntTy { |
| 29 | 26 | Isize, |
| 30 | 27 | I8, |
| ... | ... | @@ -100,10 +97,7 @@ impl fmt::Debug for IntTy { |
| 100 | 97 | } |
| 101 | 98 | |
| 102 | 99 | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)] |
| 103 | #[cfg_attr( | |
| 104 | feature = "nightly", | |
| 105 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) | |
| 106 | )] | |
| 100 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 107 | 101 | pub enum UintTy { |
| 108 | 102 | Usize, |
| 109 | 103 | U8, |
| ... | ... | @@ -179,10 +173,7 @@ impl fmt::Debug for UintTy { |
| 179 | 173 | } |
| 180 | 174 | |
| 181 | 175 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 182 | #[cfg_attr( | |
| 183 | feature = "nightly", | |
| 184 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) | |
| 185 | )] | |
| 176 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 186 | 177 | pub enum FloatTy { |
| 187 | 178 | F16, |
| 188 | 179 | F32, |
| ... | ... | @@ -229,10 +220,7 @@ impl fmt::Debug for FloatTy { |
| 229 | 220 | /// The movability of a coroutine / closure literal: |
| 230 | 221 | /// whether a coroutine contains self-references, causing it to be `!Unpin`. |
| 231 | 222 | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Copy)] |
| 232 | #[cfg_attr( | |
| 233 | feature = "nightly", | |
| 234 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) | |
| 235 | )] | |
| 223 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 236 | 224 | pub enum Movability { |
| 237 | 225 | /// May contain self-references, `!Unpin`. |
| 238 | 226 | Static, |
| ... | ... | @@ -241,10 +229,7 @@ pub enum Movability { |
| 241 | 229 | } |
| 242 | 230 | |
| 243 | 231 | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Copy)] |
| 244 | #[cfg_attr( | |
| 245 | feature = "nightly", | |
| 246 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) | |
| 247 | )] | |
| 232 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 248 | 233 | pub enum Mutability { |
| 249 | 234 | // N.B. Order is deliberate, so that Not < Mut |
| 250 | 235 | Not, |
| ... | ... | @@ -303,10 +288,7 @@ impl Mutability { |
| 303 | 288 | } |
| 304 | 289 | |
| 305 | 290 | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Copy)] |
| 306 | #[cfg_attr( | |
| 307 | feature = "nightly", | |
| 308 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) | |
| 309 | )] | |
| 291 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 310 | 292 | pub enum Pinnedness { |
| 311 | 293 | Not, |
| 312 | 294 | Pinned, |
compiler/rustc_codegen_cranelift/src/driver/aot.rs+3-3| ... | ... | @@ -14,7 +14,7 @@ use rustc_codegen_ssa::back::write::produce_final_output_artifacts; |
| 14 | 14 | use rustc_codegen_ssa::base::determine_cgu_reuse; |
| 15 | 15 | use rustc_codegen_ssa::{CompiledModule, CompiledModules, ModuleKind}; |
| 16 | 16 | use rustc_data_structures::profiling::SelfProfilerRef; |
| 17 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 17 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 18 | 18 | use rustc_data_structures::sync::{IntoDynSyncSend, par_map}; |
| 19 | 19 | use rustc_hir::attrs::Linkage as RLinkage; |
| 20 | 20 | use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; |
| ... | ... | @@ -45,8 +45,8 @@ enum OngoingModuleCodegen { |
| 45 | 45 | Async(JoinHandle<Result<ModuleCodegenResult, String>>), |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | impl<Hcx> HashStable<Hcx> for OngoingModuleCodegen { | |
| 49 | fn hash_stable(&self, _: &mut Hcx, _: &mut StableHasher) { | |
| 48 | impl HashStable for OngoingModuleCodegen { | |
| 49 | fn hash_stable<Hcx: HashStableContext>(&self, _: &mut Hcx, _: &mut StableHasher) { | |
| 50 | 50 | // do nothing |
| 51 | 51 | } |
| 52 | 52 | } |
compiler/rustc_codegen_ssa/src/common.rs+3-3| ... | ... | @@ -98,12 +98,12 @@ pub enum TypeKind { |
| 98 | 98 | // for now we content ourselves with providing a no-op HashStable |
| 99 | 99 | // implementation for CGUs. |
| 100 | 100 | mod temp_stable_hash_impls { |
| 101 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 101 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 102 | 102 | |
| 103 | 103 | use crate::ModuleCodegen; |
| 104 | 104 | |
| 105 | impl<Hcx, M> HashStable<Hcx> for ModuleCodegen<M> { | |
| 106 | fn hash_stable(&self, _: &mut Hcx, _: &mut StableHasher) { | |
| 105 | impl<M> HashStable for ModuleCodegen<M> { | |
| 106 | fn hash_stable<Hcx: HashStableContext>(&self, _: &mut Hcx, _: &mut StableHasher) { | |
| 107 | 107 | // do nothing |
| 108 | 108 | } |
| 109 | 109 | } |
compiler/rustc_data_structures/src/intern.rs+4-4| ... | ... | @@ -4,7 +4,7 @@ use std::hash::{Hash, Hasher}; |
| 4 | 4 | use std::ops::Deref; |
| 5 | 5 | use std::ptr; |
| 6 | 6 | |
| 7 | use crate::stable_hasher::{HashStable, StableHasher}; | |
| 7 | use crate::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 8 | 8 | |
| 9 | 9 | mod private { |
| 10 | 10 | #[derive(Clone, Copy, Debug)] |
| ... | ... | @@ -103,11 +103,11 @@ where |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | impl<T, Hcx> HashStable<Hcx> for Interned<'_, T> | |
| 106 | impl<T> HashStable for Interned<'_, T> | |
| 107 | 107 | where |
| 108 | T: HashStable<Hcx>, | |
| 108 | T: HashStable, | |
| 109 | 109 | { |
| 110 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 110 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 111 | 111 | self.0.hash_stable(hcx, hasher); |
| 112 | 112 | } |
| 113 | 113 | } |
compiler/rustc_data_structures/src/packed.rs+3-3| ... | ... | @@ -3,7 +3,7 @@ use std::fmt; |
| 3 | 3 | |
| 4 | 4 | use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; |
| 5 | 5 | |
| 6 | use crate::stable_hasher::{HashStable, StableHasher}; | |
| 6 | use crate::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 7 | 7 | |
| 8 | 8 | /// A packed 128-bit integer. Useful for reducing the size of structures in |
| 9 | 9 | /// some cases. |
| ... | ... | @@ -60,9 +60,9 @@ impl fmt::UpperHex for Pu128 { |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | impl<Hcx> HashStable<Hcx> for Pu128 { | |
| 63 | impl HashStable for Pu128 { | |
| 64 | 64 | #[inline] |
| 65 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 65 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 66 | 66 | { self.0 }.hash_stable(hcx, hasher) |
| 67 | 67 | } |
| 68 | 68 | } |
compiler/rustc_data_structures/src/sorted_map.rs+3-3| ... | ... | @@ -7,7 +7,7 @@ use std::ops::{Bound, Index, IndexMut, RangeBounds}; |
| 7 | 7 | |
| 8 | 8 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext}; |
| 9 | 9 | |
| 10 | use crate::stable_hasher::{HashStable, StableHasher, StableOrd}; | |
| 10 | use crate::stable_hasher::{HashStable, HashStableContext, StableHasher, StableOrd}; | |
| 11 | 11 | |
| 12 | 12 | mod index_map; |
| 13 | 13 | |
| ... | ... | @@ -347,9 +347,9 @@ impl<K: Ord, V> FromIterator<(K, V)> for SortedMap<K, V> { |
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | impl<K: HashStable<Hcx> + StableOrd, V: HashStable<Hcx>, Hcx> HashStable<Hcx> for SortedMap<K, V> { | |
| 350 | impl<K: HashStable + StableOrd, V: HashStable> HashStable for SortedMap<K, V> { | |
| 351 | 351 | #[inline] |
| 352 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 352 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 353 | 353 | self.data.hash_stable(hcx, hasher); |
| 354 | 354 | } |
| 355 | 355 | } |
compiler/rustc_data_structures/src/sorted_map/index_map.rs+2-2| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | use std::hash::{Hash, Hasher}; |
| 4 | 4 | |
| 5 | 5 | use rustc_index::{Idx, IndexVec}; |
| 6 | use rustc_macros::HashStable_NoContext; | |
| 6 | use rustc_macros::HashStable; | |
| 7 | 7 | |
| 8 | 8 | /// An indexed multi-map that preserves insertion order while permitting both *O*(log *n*) lookup of |
| 9 | 9 | /// an item by key and *O*(1) lookup by index. |
| ... | ... | @@ -23,7 +23,7 @@ use rustc_macros::HashStable_NoContext; |
| 23 | 23 | /// in-place. |
| 24 | 24 | /// |
| 25 | 25 | /// [`SortedMap`]: super::SortedMap |
| 26 | #[derive(Clone, Debug, HashStable_NoContext)] | |
| 26 | #[derive(Clone, Debug, HashStable)] | |
| 27 | 27 | pub struct SortedIndexMultiMap<I: Idx, K, V> { |
| 28 | 28 | /// The elements of the map in insertion order. |
| 29 | 29 | items: IndexVec<I, (K, V)>, |
compiler/rustc_data_structures/src/stable_hasher.rs+145-106| ... | ... | @@ -15,7 +15,38 @@ pub use rustc_stable_hash::{ |
| 15 | 15 | FromStableHash, SipHasher128Hash as StableHasherHash, StableSipHasher128 as StableHasher, |
| 16 | 16 | }; |
| 17 | 17 | |
| 18 | /// Something that implements `HashStable<Hcx>` can be hashed in a way that is | |
| 18 | /// This trait lets `HashStable` and `derive(HashStable)` be used in | |
| 19 | /// this crate (and other crates upstream of `rustc_middle`), while leaving | |
| 20 | /// certain operations to be defined in `rustc_middle` where more things are | |
| 21 | /// visible. | |
| 22 | pub trait HashStableContext { | |
| 23 | /// The main event: stable hashing of a span. | |
| 24 | fn span_hash_stable(&mut self, span: RawSpan, hasher: &mut StableHasher); | |
| 25 | ||
| 26 | /// Compute a `DefPathHash`. | |
| 27 | fn def_path_hash(&self, def_id: RawDefId) -> RawDefPathHash; | |
| 28 | ||
| 29 | /// Get the hashing controls. | |
| 30 | fn hashing_controls(&self) -> HashingControls; | |
| 31 | ||
| 32 | /// Assert that the provided `HashStableContext` is configured with the default | |
| 33 | /// `HashingControls`. We should always have bailed out before getting to here with a | |
| 34 | fn assert_default_hashing_controls(&self, msg: &str); | |
| 35 | } | |
| 36 | ||
| 37 | // A type used to work around `Span` not being visible in this crate. It is the same layout as | |
| 38 | // `Span`. | |
| 39 | pub struct RawSpan(pub u32, pub u16, pub u16); | |
| 40 | ||
| 41 | // A type used to work around `DefId` not being visible in this crate. It is the same size as | |
| 42 | // `DefId`. | |
| 43 | pub struct RawDefId(pub u32, pub u32); | |
| 44 | ||
| 45 | // A type used to work around `DefPathHash` not being visible in this crate. It is the same size as | |
| 46 | // `DefPathHash`. | |
| 47 | pub struct RawDefPathHash(pub [u8; 16]); | |
| 48 | ||
| 49 | /// Something that implements `HashStable` can be hashed in a way that is | |
| 19 | 50 | /// stable across multiple compilation sessions. |
| 20 | 51 | /// |
| 21 | 52 | /// Note that `HashStable` imposes rather more strict requirements than usual |
| ... | ... | @@ -41,16 +72,16 @@ pub use rustc_stable_hash::{ |
| 41 | 72 | /// - `hash_stable()` must be independent of the host architecture. The |
| 42 | 73 | /// `StableHasher` takes care of endianness and `isize`/`usize` platform |
| 43 | 74 | /// differences. |
| 44 | pub trait HashStable<Hcx> { | |
| 45 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher); | |
| 75 | pub trait HashStable { | |
| 76 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher); | |
| 46 | 77 | } |
| 47 | 78 | |
| 48 | 79 | /// Implement this for types that can be turned into stable keys like, for |
| 49 | 80 | /// example, for DefId that can be converted to a DefPathHash. This is used for |
| 50 | 81 | /// bringing maps into a predictable order before hashing them. |
| 51 | pub trait ToStableHashKey<Hcx> { | |
| 52 | type KeyType: Ord + Sized + HashStable<Hcx>; | |
| 53 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> Self::KeyType; | |
| 82 | pub trait ToStableHashKey { | |
| 83 | type KeyType: Ord + Sized + HashStable; | |
| 84 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> Self::KeyType; | |
| 54 | 85 | } |
| 55 | 86 | |
| 56 | 87 | /// Trait for marking a type as having a sort order that is |
| ... | ... | @@ -133,12 +164,16 @@ impl<T: StableOrd> StableCompare for T { |
| 133 | 164 | /// for examples). Therefore this macro is not exported and should only be used in the limited cases |
| 134 | 165 | /// here in this module. |
| 135 | 166 | /// |
| 136 | /// Use `#[derive(HashStable_Generic)]` instead. | |
| 167 | /// Use `#[derive(HashStable)]` instead. | |
| 137 | 168 | macro_rules! impl_stable_traits_for_trivial_type { |
| 138 | 169 | ($t:ty) => { |
| 139 | impl<Hcx> $crate::stable_hasher::HashStable<Hcx> for $t { | |
| 170 | impl $crate::stable_hasher::HashStable for $t { | |
| 140 | 171 | #[inline] |
| 141 | fn hash_stable(&self, _: &mut Hcx, hasher: &mut $crate::stable_hasher::StableHasher) { | |
| 172 | fn hash_stable<Hcx>( | |
| 173 | &self, | |
| 174 | _: &mut Hcx, | |
| 175 | hasher: &mut $crate::stable_hasher::StableHasher, | |
| 176 | ) { | |
| 142 | 177 | ::std::hash::Hash::hash(self, hasher); |
| 143 | 178 | } |
| 144 | 179 | } |
| ... | ... | @@ -177,9 +212,9 @@ impl_stable_traits_for_trivial_type!(Hash64); |
| 177 | 212 | |
| 178 | 213 | // We need a custom impl as the default hash function will only hash half the bits. For stable |
| 179 | 214 | // hashing we want to hash the full 128-bit hash. |
| 180 | impl<Hcx> HashStable<Hcx> for Hash128 { | |
| 215 | impl HashStable for Hash128 { | |
| 181 | 216 | #[inline] |
| 182 | fn hash_stable(&self, _: &mut Hcx, hasher: &mut StableHasher) { | |
| 217 | fn hash_stable<Hcx>(&self, _: &mut Hcx, hasher: &mut StableHasher) { | |
| 183 | 218 | self.as_u128().hash(hasher); |
| 184 | 219 | } |
| 185 | 220 | } |
| ... | ... | @@ -192,61 +227,61 @@ impl StableOrd for Hash128 { |
| 192 | 227 | const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); |
| 193 | 228 | } |
| 194 | 229 | |
| 195 | impl<Hcx> HashStable<Hcx> for ! { | |
| 196 | fn hash_stable(&self, _hcx: &mut Hcx, _hasher: &mut StableHasher) { | |
| 230 | impl HashStable for ! { | |
| 231 | fn hash_stable<Hcx>(&self, _hcx: &mut Hcx, _hasher: &mut StableHasher) { | |
| 197 | 232 | unreachable!() |
| 198 | 233 | } |
| 199 | 234 | } |
| 200 | 235 | |
| 201 | impl<Hcx, T> HashStable<Hcx> for PhantomData<T> { | |
| 202 | fn hash_stable(&self, _hcx: &mut Hcx, _hasher: &mut StableHasher) {} | |
| 236 | impl<T> HashStable for PhantomData<T> { | |
| 237 | fn hash_stable<Hcx>(&self, _hcx: &mut Hcx, _hasher: &mut StableHasher) {} | |
| 203 | 238 | } |
| 204 | 239 | |
| 205 | impl<Hcx> HashStable<Hcx> for NonZero<u32> { | |
| 240 | impl HashStable for NonZero<u32> { | |
| 206 | 241 | #[inline] |
| 207 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 242 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 208 | 243 | self.get().hash_stable(hcx, hasher) |
| 209 | 244 | } |
| 210 | 245 | } |
| 211 | 246 | |
| 212 | impl<Hcx> HashStable<Hcx> for NonZero<usize> { | |
| 247 | impl HashStable for NonZero<usize> { | |
| 213 | 248 | #[inline] |
| 214 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 249 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 215 | 250 | self.get().hash_stable(hcx, hasher) |
| 216 | 251 | } |
| 217 | 252 | } |
| 218 | 253 | |
| 219 | impl<Hcx> HashStable<Hcx> for f32 { | |
| 220 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 254 | impl HashStable for f32 { | |
| 255 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 221 | 256 | let val: u32 = self.to_bits(); |
| 222 | 257 | val.hash_stable(hcx, hasher); |
| 223 | 258 | } |
| 224 | 259 | } |
| 225 | 260 | |
| 226 | impl<Hcx> HashStable<Hcx> for f64 { | |
| 227 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 261 | impl HashStable for f64 { | |
| 262 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 228 | 263 | let val: u64 = self.to_bits(); |
| 229 | 264 | val.hash_stable(hcx, hasher); |
| 230 | 265 | } |
| 231 | 266 | } |
| 232 | 267 | |
| 233 | impl<Hcx> HashStable<Hcx> for ::std::cmp::Ordering { | |
| 268 | impl HashStable for ::std::cmp::Ordering { | |
| 234 | 269 | #[inline] |
| 235 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 270 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 236 | 271 | (*self as i8).hash_stable(hcx, hasher); |
| 237 | 272 | } |
| 238 | 273 | } |
| 239 | 274 | |
| 240 | impl<T1: HashStable<Hcx>, Hcx> HashStable<Hcx> for (T1,) { | |
| 275 | impl<T1: HashStable> HashStable for (T1,) { | |
| 241 | 276 | #[inline] |
| 242 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 277 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 243 | 278 | let (ref _0,) = *self; |
| 244 | 279 | _0.hash_stable(hcx, hasher); |
| 245 | 280 | } |
| 246 | 281 | } |
| 247 | 282 | |
| 248 | impl<T1: HashStable<Hcx>, T2: HashStable<Hcx>, Hcx> HashStable<Hcx> for (T1, T2) { | |
| 249 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 283 | impl<T1: HashStable, T2: HashStable> HashStable for (T1, T2) { | |
| 284 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 250 | 285 | let (ref _0, ref _1) = *self; |
| 251 | 286 | _0.hash_stable(hcx, hasher); |
| 252 | 287 | _1.hash_stable(hcx, hasher); |
| ... | ... | @@ -261,13 +296,13 @@ impl<T1: StableOrd, T2: StableOrd> StableOrd for (T1, T2) { |
| 261 | 296 | const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); |
| 262 | 297 | } |
| 263 | 298 | |
| 264 | impl<T1, T2, T3, Hcx> HashStable<Hcx> for (T1, T2, T3) | |
| 299 | impl<T1, T2, T3> HashStable for (T1, T2, T3) | |
| 265 | 300 | where |
| 266 | T1: HashStable<Hcx>, | |
| 267 | T2: HashStable<Hcx>, | |
| 268 | T3: HashStable<Hcx>, | |
| 301 | T1: HashStable, | |
| 302 | T2: HashStable, | |
| 303 | T3: HashStable, | |
| 269 | 304 | { |
| 270 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 305 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 271 | 306 | let (ref _0, ref _1, ref _2) = *self; |
| 272 | 307 | _0.hash_stable(hcx, hasher); |
| 273 | 308 | _1.hash_stable(hcx, hasher); |
| ... | ... | @@ -284,14 +319,14 @@ impl<T1: StableOrd, T2: StableOrd, T3: StableOrd> StableOrd for (T1, T2, T3) { |
| 284 | 319 | const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); |
| 285 | 320 | } |
| 286 | 321 | |
| 287 | impl<T1, T2, T3, T4, Hcx> HashStable<Hcx> for (T1, T2, T3, T4) | |
| 322 | impl<T1, T2, T3, T4> HashStable for (T1, T2, T3, T4) | |
| 288 | 323 | where |
| 289 | T1: HashStable<Hcx>, | |
| 290 | T2: HashStable<Hcx>, | |
| 291 | T3: HashStable<Hcx>, | |
| 292 | T4: HashStable<Hcx>, | |
| 324 | T1: HashStable, | |
| 325 | T2: HashStable, | |
| 326 | T3: HashStable, | |
| 327 | T4: HashStable, | |
| 293 | 328 | { |
| 294 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 329 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 295 | 330 | let (ref _0, ref _1, ref _2, ref _3) = *self; |
| 296 | 331 | _0.hash_stable(hcx, hasher); |
| 297 | 332 | _1.hash_stable(hcx, hasher); |
| ... | ... | @@ -311,8 +346,12 @@ impl<T1: StableOrd, T2: StableOrd, T3: StableOrd, T4: StableOrd> StableOrd for ( |
| 311 | 346 | const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); |
| 312 | 347 | } |
| 313 | 348 | |
| 314 | impl<T: HashStable<Hcx>, Hcx> HashStable<Hcx> for [T] { | |
| 315 | default fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 349 | impl<T: HashStable> HashStable for [T] { | |
| 350 | default fn hash_stable<Hcx: HashStableContext>( | |
| 351 | &self, | |
| 352 | hcx: &mut Hcx, | |
| 353 | hasher: &mut StableHasher, | |
| 354 | ) { | |
| 316 | 355 | self.len().hash_stable(hcx, hasher); |
| 317 | 356 | for item in self { |
| 318 | 357 | item.hash_stable(hcx, hasher); |
| ... | ... | @@ -320,28 +359,28 @@ impl<T: HashStable<Hcx>, Hcx> HashStable<Hcx> for [T] { |
| 320 | 359 | } |
| 321 | 360 | } |
| 322 | 361 | |
| 323 | impl<Hcx> HashStable<Hcx> for [u8] { | |
| 324 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 362 | impl HashStable for [u8] { | |
| 363 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 325 | 364 | self.len().hash_stable(hcx, hasher); |
| 326 | 365 | hasher.write(self); |
| 327 | 366 | } |
| 328 | 367 | } |
| 329 | 368 | |
| 330 | impl<T: HashStable<Hcx>, Hcx> HashStable<Hcx> for Vec<T> { | |
| 369 | impl<T: HashStable> HashStable for Vec<T> { | |
| 331 | 370 | #[inline] |
| 332 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 371 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 333 | 372 | self[..].hash_stable(hcx, hasher); |
| 334 | 373 | } |
| 335 | 374 | } |
| 336 | 375 | |
| 337 | impl<K, V, R, Hcx> HashStable<Hcx> for indexmap::IndexMap<K, V, R> | |
| 376 | impl<K, V, R> HashStable for indexmap::IndexMap<K, V, R> | |
| 338 | 377 | where |
| 339 | K: HashStable<Hcx> + Eq + Hash, | |
| 340 | V: HashStable<Hcx>, | |
| 378 | K: HashStable + Eq + Hash, | |
| 379 | V: HashStable, | |
| 341 | 380 | R: BuildHasher, |
| 342 | 381 | { |
| 343 | 382 | #[inline] |
| 344 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 383 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 345 | 384 | self.len().hash_stable(hcx, hasher); |
| 346 | 385 | for kv in self { |
| 347 | 386 | kv.hash_stable(hcx, hasher); |
| ... | ... | @@ -349,13 +388,13 @@ where |
| 349 | 388 | } |
| 350 | 389 | } |
| 351 | 390 | |
| 352 | impl<K, R, Hcx> HashStable<Hcx> for indexmap::IndexSet<K, R> | |
| 391 | impl<K, R> HashStable for indexmap::IndexSet<K, R> | |
| 353 | 392 | where |
| 354 | K: HashStable<Hcx> + Eq + Hash, | |
| 393 | K: HashStable + Eq + Hash, | |
| 355 | 394 | R: BuildHasher, |
| 356 | 395 | { |
| 357 | 396 | #[inline] |
| 358 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 397 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 359 | 398 | self.len().hash_stable(hcx, hasher); |
| 360 | 399 | for key in self { |
| 361 | 400 | key.hash_stable(hcx, hasher); |
| ... | ... | @@ -363,40 +402,40 @@ where |
| 363 | 402 | } |
| 364 | 403 | } |
| 365 | 404 | |
| 366 | impl<A, const N: usize, Hcx> HashStable<Hcx> for SmallVec<[A; N]> | |
| 405 | impl<A, const N: usize> HashStable for SmallVec<[A; N]> | |
| 367 | 406 | where |
| 368 | A: HashStable<Hcx>, | |
| 407 | A: HashStable, | |
| 369 | 408 | { |
| 370 | 409 | #[inline] |
| 371 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 410 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 372 | 411 | self[..].hash_stable(hcx, hasher); |
| 373 | 412 | } |
| 374 | 413 | } |
| 375 | 414 | |
| 376 | impl<T: ?Sized + HashStable<Hcx>, Hcx> HashStable<Hcx> for Box<T> { | |
| 415 | impl<T: ?Sized + HashStable> HashStable for Box<T> { | |
| 377 | 416 | #[inline] |
| 378 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 417 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 379 | 418 | (**self).hash_stable(hcx, hasher); |
| 380 | 419 | } |
| 381 | 420 | } |
| 382 | 421 | |
| 383 | impl<T: ?Sized + HashStable<Hcx>, Hcx> HashStable<Hcx> for ::std::rc::Rc<T> { | |
| 422 | impl<T: ?Sized + HashStable> HashStable for ::std::rc::Rc<T> { | |
| 384 | 423 | #[inline] |
| 385 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 424 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 386 | 425 | (**self).hash_stable(hcx, hasher); |
| 387 | 426 | } |
| 388 | 427 | } |
| 389 | 428 | |
| 390 | impl<T: ?Sized + HashStable<Hcx>, Hcx> HashStable<Hcx> for ::std::sync::Arc<T> { | |
| 429 | impl<T: ?Sized + HashStable> HashStable for ::std::sync::Arc<T> { | |
| 391 | 430 | #[inline] |
| 392 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 431 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 393 | 432 | (**self).hash_stable(hcx, hasher); |
| 394 | 433 | } |
| 395 | 434 | } |
| 396 | 435 | |
| 397 | impl<Hcx> HashStable<Hcx> for str { | |
| 436 | impl HashStable for str { | |
| 398 | 437 | #[inline] |
| 399 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 438 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 400 | 439 | self.as_bytes().hash_stable(hcx, hasher); |
| 401 | 440 | } |
| 402 | 441 | } |
| ... | ... | @@ -409,9 +448,9 @@ impl StableOrd for &str { |
| 409 | 448 | const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); |
| 410 | 449 | } |
| 411 | 450 | |
| 412 | impl<Hcx> HashStable<Hcx> for String { | |
| 451 | impl HashStable for String { | |
| 413 | 452 | #[inline] |
| 414 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 453 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 415 | 454 | self[..].hash_stable(hcx, hasher); |
| 416 | 455 | } |
| 417 | 456 | } |
| ... | ... | @@ -424,25 +463,25 @@ impl StableOrd for String { |
| 424 | 463 | const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); |
| 425 | 464 | } |
| 426 | 465 | |
| 427 | impl<Hcx> ToStableHashKey<Hcx> for String { | |
| 466 | impl ToStableHashKey for String { | |
| 428 | 467 | type KeyType = String; |
| 429 | 468 | #[inline] |
| 430 | fn to_stable_hash_key(&self, _: &mut Hcx) -> Self::KeyType { | |
| 469 | fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> Self::KeyType { | |
| 431 | 470 | self.clone() |
| 432 | 471 | } |
| 433 | 472 | } |
| 434 | 473 | |
| 435 | impl<Hcx, T1: ToStableHashKey<Hcx>, T2: ToStableHashKey<Hcx>> ToStableHashKey<Hcx> for (T1, T2) { | |
| 474 | impl<T1: ToStableHashKey, T2: ToStableHashKey> ToStableHashKey for (T1, T2) { | |
| 436 | 475 | type KeyType = (T1::KeyType, T2::KeyType); |
| 437 | 476 | #[inline] |
| 438 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> Self::KeyType { | |
| 477 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> Self::KeyType { | |
| 439 | 478 | (self.0.to_stable_hash_key(hcx), self.1.to_stable_hash_key(hcx)) |
| 440 | 479 | } |
| 441 | 480 | } |
| 442 | 481 | |
| 443 | impl<Hcx> HashStable<Hcx> for bool { | |
| 482 | impl HashStable for bool { | |
| 444 | 483 | #[inline] |
| 445 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 484 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 446 | 485 | (if *self { 1u8 } else { 0u8 }).hash_stable(hcx, hasher); |
| 447 | 486 | } |
| 448 | 487 | } |
| ... | ... | @@ -454,12 +493,12 @@ impl StableOrd for bool { |
| 454 | 493 | const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); |
| 455 | 494 | } |
| 456 | 495 | |
| 457 | impl<T, Hcx> HashStable<Hcx> for Option<T> | |
| 496 | impl<T> HashStable for Option<T> | |
| 458 | 497 | where |
| 459 | T: HashStable<Hcx>, | |
| 498 | T: HashStable, | |
| 460 | 499 | { |
| 461 | 500 | #[inline] |
| 462 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 501 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 463 | 502 | if let Some(ref value) = *self { |
| 464 | 503 | 1u8.hash_stable(hcx, hasher); |
| 465 | 504 | value.hash_stable(hcx, hasher); |
| ... | ... | @@ -476,13 +515,13 @@ impl<T: StableOrd> StableOrd for Option<T> { |
| 476 | 515 | const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); |
| 477 | 516 | } |
| 478 | 517 | |
| 479 | impl<T1, T2, Hcx> HashStable<Hcx> for Result<T1, T2> | |
| 518 | impl<T1, T2> HashStable for Result<T1, T2> | |
| 480 | 519 | where |
| 481 | T1: HashStable<Hcx>, | |
| 482 | T2: HashStable<Hcx>, | |
| 520 | T1: HashStable, | |
| 521 | T2: HashStable, | |
| 483 | 522 | { |
| 484 | 523 | #[inline] |
| 485 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 524 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 486 | 525 | mem::discriminant(self).hash_stable(hcx, hasher); |
| 487 | 526 | match *self { |
| 488 | 527 | Ok(ref x) => x.hash_stable(hcx, hasher), |
| ... | ... | @@ -491,39 +530,39 @@ where |
| 491 | 530 | } |
| 492 | 531 | } |
| 493 | 532 | |
| 494 | impl<'a, T, Hcx> HashStable<Hcx> for &'a T | |
| 533 | impl<'a, T> HashStable for &'a T | |
| 495 | 534 | where |
| 496 | T: HashStable<Hcx> + ?Sized, | |
| 535 | T: HashStable + ?Sized, | |
| 497 | 536 | { |
| 498 | 537 | #[inline] |
| 499 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 538 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 500 | 539 | (**self).hash_stable(hcx, hasher); |
| 501 | 540 | } |
| 502 | 541 | } |
| 503 | 542 | |
| 504 | impl<T, Hcx> HashStable<Hcx> for ::std::mem::Discriminant<T> { | |
| 543 | impl<T> HashStable for ::std::mem::Discriminant<T> { | |
| 505 | 544 | #[inline] |
| 506 | fn hash_stable(&self, _: &mut Hcx, hasher: &mut StableHasher) { | |
| 545 | fn hash_stable<Hcx: HashStableContext>(&self, _: &mut Hcx, hasher: &mut StableHasher) { | |
| 507 | 546 | ::std::hash::Hash::hash(self, hasher); |
| 508 | 547 | } |
| 509 | 548 | } |
| 510 | 549 | |
| 511 | impl<T, Hcx> HashStable<Hcx> for ::std::ops::RangeInclusive<T> | |
| 550 | impl<T> HashStable for ::std::ops::RangeInclusive<T> | |
| 512 | 551 | where |
| 513 | T: HashStable<Hcx>, | |
| 552 | T: HashStable, | |
| 514 | 553 | { |
| 515 | 554 | #[inline] |
| 516 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 555 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 517 | 556 | self.start().hash_stable(hcx, hasher); |
| 518 | 557 | self.end().hash_stable(hcx, hasher); |
| 519 | 558 | } |
| 520 | 559 | } |
| 521 | 560 | |
| 522 | impl<I: Idx, T, Hcx> HashStable<Hcx> for IndexSlice<I, T> | |
| 561 | impl<I: Idx, T> HashStable for IndexSlice<I, T> | |
| 523 | 562 | where |
| 524 | T: HashStable<Hcx>, | |
| 563 | T: HashStable, | |
| 525 | 564 | { |
| 526 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 565 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 527 | 566 | self.len().hash_stable(hcx, hasher); |
| 528 | 567 | for v in &self.raw { |
| 529 | 568 | v.hash_stable(hcx, hasher); |
| ... | ... | @@ -531,11 +570,11 @@ where |
| 531 | 570 | } |
| 532 | 571 | } |
| 533 | 572 | |
| 534 | impl<I: Idx, T, Hcx> HashStable<Hcx> for IndexVec<I, T> | |
| 573 | impl<I: Idx, T> HashStable for IndexVec<I, T> | |
| 535 | 574 | where |
| 536 | T: HashStable<Hcx>, | |
| 575 | T: HashStable, | |
| 537 | 576 | { |
| 538 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 577 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 539 | 578 | self.len().hash_stable(hcx, hasher); |
| 540 | 579 | for v in &self.raw { |
| 541 | 580 | v.hash_stable(hcx, hasher); |
| ... | ... | @@ -543,14 +582,14 @@ where |
| 543 | 582 | } |
| 544 | 583 | } |
| 545 | 584 | |
| 546 | impl<I: Idx, Hcx> HashStable<Hcx> for DenseBitSet<I> { | |
| 547 | fn hash_stable(&self, _hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 585 | impl<I: Idx> HashStable for DenseBitSet<I> { | |
| 586 | fn hash_stable<Hcx: HashStableContext>(&self, _hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 548 | 587 | ::std::hash::Hash::hash(self, hasher); |
| 549 | 588 | } |
| 550 | 589 | } |
| 551 | 590 | |
| 552 | impl<R: Idx, C: Idx, Hcx> HashStable<Hcx> for bit_set::BitMatrix<R, C> { | |
| 553 | fn hash_stable(&self, _hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 591 | impl<R: Idx, C: Idx> HashStable for bit_set::BitMatrix<R, C> { | |
| 592 | fn hash_stable<Hcx: HashStableContext>(&self, _hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 554 | 593 | ::std::hash::Hash::hash(self, hasher); |
| 555 | 594 | } |
| 556 | 595 | } |
| ... | ... | @@ -563,15 +602,15 @@ impl_stable_traits_for_trivial_type!(::std::path::PathBuf); |
| 563 | 602 | // It is not safe to implement HashStable for HashSet, HashMap or any other collection type |
| 564 | 603 | // with unstable but observable iteration order. |
| 565 | 604 | // See https://github.com/rust-lang/compiler-team/issues/533 for further information. |
| 566 | impl<V, Hcx> !HashStable<Hcx> for std::collections::HashSet<V> {} | |
| 567 | impl<K, V, Hcx> !HashStable<Hcx> for std::collections::HashMap<K, V> {} | |
| 605 | impl<V> !HashStable for std::collections::HashSet<V> {} | |
| 606 | impl<K, V> !HashStable for std::collections::HashMap<K, V> {} | |
| 568 | 607 | |
| 569 | impl<K, V, Hcx> HashStable<Hcx> for ::std::collections::BTreeMap<K, V> | |
| 608 | impl<K, V> HashStable for ::std::collections::BTreeMap<K, V> | |
| 570 | 609 | where |
| 571 | K: HashStable<Hcx> + StableOrd, | |
| 572 | V: HashStable<Hcx>, | |
| 610 | K: HashStable + StableOrd, | |
| 611 | V: HashStable, | |
| 573 | 612 | { |
| 574 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 613 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 575 | 614 | self.len().hash_stable(hcx, hasher); |
| 576 | 615 | for entry in self.iter() { |
| 577 | 616 | entry.hash_stable(hcx, hasher); |
| ... | ... | @@ -579,11 +618,11 @@ where |
| 579 | 618 | } |
| 580 | 619 | } |
| 581 | 620 | |
| 582 | impl<K, Hcx> HashStable<Hcx> for ::std::collections::BTreeSet<K> | |
| 621 | impl<K> HashStable for ::std::collections::BTreeSet<K> | |
| 583 | 622 | where |
| 584 | K: HashStable<Hcx> + StableOrd, | |
| 623 | K: HashStable + StableOrd, | |
| 585 | 624 | { |
| 586 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 625 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 587 | 626 | self.len().hash_stable(hcx, hasher); |
| 588 | 627 | for entry in self.iter() { |
| 589 | 628 | entry.hash_stable(hcx, hasher); |
compiler/rustc_data_structures/src/stable_hasher/tests.rs+24-5| ... | ... | @@ -7,10 +7,25 @@ use super::*; |
| 7 | 7 | // ways). The expected values depend on the hashing algorithm used, so they |
| 8 | 8 | // need to be updated whenever StableHasher changes its hashing algorithm. |
| 9 | 9 | |
| 10 | fn hash<T: HashStable<()>>(t: &T) -> Hash128 { | |
| 10 | impl HashStableContext for () { | |
| 11 | fn span_hash_stable(&mut self, _: RawSpan, _: &mut StableHasher) { | |
| 12 | panic!(); | |
| 13 | } | |
| 14 | fn def_path_hash(&self, _: RawDefId) -> RawDefPathHash { | |
| 15 | panic!(); | |
| 16 | } | |
| 17 | fn hashing_controls(&self) -> HashingControls { | |
| 18 | panic!(); | |
| 19 | } | |
| 20 | fn assert_default_hashing_controls(&self, _: &str) { | |
| 21 | panic!(); | |
| 22 | } | |
| 23 | } | |
| 24 | ||
| 25 | fn hash<T: HashStable>(t: &T) -> Hash128 { | |
| 11 | 26 | let mut h = StableHasher::new(); |
| 12 | let ctx = &mut (); | |
| 13 | t.hash_stable(ctx, &mut h); | |
| 27 | let hcx = &mut (); | |
| 28 | t.hash_stable(hcx, &mut h); | |
| 14 | 29 | h.finish() |
| 15 | 30 | } |
| 16 | 31 | |
| ... | ... | @@ -44,8 +59,12 @@ fn test_attribute_permutation() { |
| 44 | 59 | b: $ty, |
| 45 | 60 | } |
| 46 | 61 | |
| 47 | impl<Hcx> HashStable<Hcx> for Foo { | |
| 48 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 62 | impl HashStable for Foo { | |
| 63 | fn hash_stable<Hcx: HashStableContext>( | |
| 64 | &self, | |
| 65 | hcx: &mut Hcx, | |
| 66 | hasher: &mut StableHasher, | |
| 67 | ) { | |
| 49 | 68 | self.a.hash_stable(hcx, hasher); |
| 50 | 69 | self.b.hash_stable(hcx, hasher); |
| 51 | 70 | } |
compiler/rustc_data_structures/src/steal.rs+3-3| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use crate::stable_hasher::{HashStable, StableHasher}; | |
| 1 | use crate::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 2 | 2 | use crate::sync::{MappedReadGuard, MappedWriteGuard, ReadGuard, RwLock, WriteGuard}; |
| 3 | 3 | |
| 4 | 4 | /// The `Steal` struct is intended to used as the value for a query. |
| ... | ... | @@ -71,8 +71,8 @@ impl<T> Steal<T> { |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | impl<Hcx, T: HashStable<Hcx>> HashStable<Hcx> for Steal<T> { | |
| 75 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 74 | impl<T: HashStable> HashStable for Steal<T> { | |
| 75 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 76 | 76 | self.borrow().hash_stable(hcx, hasher); |
| 77 | 77 | } |
| 78 | 78 | } |
compiler/rustc_data_structures/src/svh.rs+2-2| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | use std::fmt; |
| 9 | 9 | |
| 10 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; | |
| 10 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable}; | |
| 11 | 11 | |
| 12 | 12 | use crate::fingerprint::Fingerprint; |
| 13 | 13 | |
| ... | ... | @@ -20,7 +20,7 @@ use crate::fingerprint::Fingerprint; |
| 20 | 20 | Encodable_NoContext, |
| 21 | 21 | Decodable_NoContext, |
| 22 | 22 | Hash, |
| 23 | HashStable_NoContext | |
| 23 | HashStable | |
| 24 | 24 | )] |
| 25 | 25 | pub struct Svh { |
| 26 | 26 | hash: Fingerprint, |
compiler/rustc_data_structures/src/tagged_ptr.rs+5-5| ... | ... | @@ -12,7 +12,7 @@ use std::ops::Deref; |
| 12 | 12 | use std::ptr::NonNull; |
| 13 | 13 | |
| 14 | 14 | use crate::aligned::Aligned; |
| 15 | use crate::stable_hasher::{HashStable, StableHasher}; | |
| 15 | use crate::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 16 | 16 | |
| 17 | 17 | /// This describes tags that the [`TaggedRef`] struct can hold. |
| 18 | 18 | /// |
| ... | ... | @@ -259,12 +259,12 @@ impl<P, T: Tag> Hash for TaggedRef<'_, P, T> { |
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | impl<'a, P, T, Hcx> HashStable<Hcx> for TaggedRef<'a, P, T> | |
| 262 | impl<'a, P, T> HashStable for TaggedRef<'a, P, T> | |
| 263 | 263 | where |
| 264 | P: HashStable<Hcx> + Aligned + ?Sized, | |
| 265 | T: Tag + HashStable<Hcx>, | |
| 264 | P: HashStable + Aligned + ?Sized, | |
| 265 | T: Tag + HashStable, | |
| 266 | 266 | { |
| 267 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 267 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 268 | 268 | self.pointer().hash_stable(hcx, hasher); |
| 269 | 269 | self.tag().hash_stable(hcx, hasher); |
| 270 | 270 | } |
compiler/rustc_data_structures/src/tagged_ptr/tests.rs+6-2| ... | ... | @@ -32,8 +32,12 @@ unsafe impl Tag for Tag2 { |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | impl<Hcx> crate::stable_hasher::HashStable<Hcx> for Tag2 { | |
| 36 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut crate::stable_hasher::StableHasher) { | |
| 35 | impl HashStable for Tag2 { | |
| 36 | fn hash_stable<Hcx: HashStableContext>( | |
| 37 | &self, | |
| 38 | hcx: &mut Hcx, | |
| 39 | hasher: &mut crate::stable_hasher::StableHasher, | |
| 40 | ) { | |
| 37 | 41 | (*self as u8).hash_stable(hcx, hasher); |
| 38 | 42 | } |
| 39 | 43 | } |
compiler/rustc_data_structures/src/unord.rs+27-18| ... | ... | @@ -12,7 +12,9 @@ use rustc_macros::{Decodable_NoContext, Encodable_NoContext}; |
| 12 | 12 | |
| 13 | 13 | use crate::fingerprint::Fingerprint; |
| 14 | 14 | use crate::fx::{FxBuildHasher, FxHashMap, FxHashSet}; |
| 15 | use crate::stable_hasher::{HashStable, StableCompare, StableHasher, ToStableHashKey}; | |
| 15 | use crate::stable_hasher::{ | |
| 16 | HashStable, HashStableContext, StableCompare, StableHasher, ToStableHashKey, | |
| 17 | }; | |
| 16 | 18 | |
| 17 | 19 | /// `UnordItems` is the order-less version of `Iterator`. It only contains methods |
| 18 | 20 | /// that don't (easily) expose an ordering of the underlying items. |
| ... | ... | @@ -143,9 +145,9 @@ impl<'a, T: Copy + 'a, I: Iterator<Item = &'a T>> UnordItems<&'a T, I> { |
| 143 | 145 | |
| 144 | 146 | impl<T, I: Iterator<Item = T>> UnordItems<T, I> { |
| 145 | 147 | #[inline] |
| 146 | pub fn into_sorted<Hcx>(self, hcx: &mut Hcx) -> Vec<T> | |
| 148 | pub fn into_sorted<Hcx: HashStableContext>(self, hcx: &mut Hcx) -> Vec<T> | |
| 147 | 149 | where |
| 148 | T: ToStableHashKey<Hcx>, | |
| 150 | T: ToStableHashKey, | |
| 149 | 151 | { |
| 150 | 152 | self.collect_sorted(hcx, true) |
| 151 | 153 | } |
| ... | ... | @@ -170,7 +172,8 @@ impl<T, I: Iterator<Item = T>> UnordItems<T, I> { |
| 170 | 172 | #[inline] |
| 171 | 173 | pub fn collect_sorted<Hcx, C>(self, hcx: &mut Hcx, cache_sort_key: bool) -> C |
| 172 | 174 | where |
| 173 | T: ToStableHashKey<Hcx>, | |
| 175 | Hcx: HashStableContext, | |
| 176 | T: ToStableHashKey, | |
| 174 | 177 | C: FromIterator<T> + BorrowMut<[T]>, |
| 175 | 178 | { |
| 176 | 179 | let mut items: C = self.0.collect(); |
| ... | ... | @@ -317,7 +320,8 @@ impl<V: Eq + Hash> UnordSet<V> { |
| 317 | 320 | #[inline] |
| 318 | 321 | pub fn to_sorted<Hcx>(&self, hcx: &mut Hcx, cache_sort_key: bool) -> Vec<&V> |
| 319 | 322 | where |
| 320 | V: ToStableHashKey<Hcx>, | |
| 323 | Hcx: HashStableContext, | |
| 324 | V: ToStableHashKey, | |
| 321 | 325 | { |
| 322 | 326 | to_sorted_vec(hcx, self.inner.iter(), cache_sort_key, |&x| x) |
| 323 | 327 | } |
| ... | ... | @@ -359,7 +363,8 @@ impl<V: Eq + Hash> UnordSet<V> { |
| 359 | 363 | #[inline] |
| 360 | 364 | pub fn into_sorted<Hcx>(self, hcx: &mut Hcx, cache_sort_key: bool) -> Vec<V> |
| 361 | 365 | where |
| 362 | V: ToStableHashKey<Hcx>, | |
| 366 | Hcx: HashStableContext, | |
| 367 | V: ToStableHashKey, | |
| 363 | 368 | { |
| 364 | 369 | to_sorted_vec(hcx, self.inner.into_iter(), cache_sort_key, |x| x) |
| 365 | 370 | } |
| ... | ... | @@ -415,9 +420,9 @@ impl<V: Hash + Eq, I: Iterator<Item = V>> From<UnordItems<V, I>> for UnordSet<V> |
| 415 | 420 | } |
| 416 | 421 | } |
| 417 | 422 | |
| 418 | impl<Hcx, V: Hash + Eq + HashStable<Hcx>> HashStable<Hcx> for UnordSet<V> { | |
| 423 | impl<V: Hash + Eq + HashStable> HashStable for UnordSet<V> { | |
| 419 | 424 | #[inline] |
| 420 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 425 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 421 | 426 | hash_iter_order_independent(self.inner.iter(), hcx, hasher); |
| 422 | 427 | } |
| 423 | 428 | } |
| ... | ... | @@ -557,7 +562,8 @@ impl<K: Eq + Hash, V> UnordMap<K, V> { |
| 557 | 562 | #[inline] |
| 558 | 563 | pub fn to_sorted<Hcx>(&self, hcx: &mut Hcx, cache_sort_key: bool) -> Vec<(&K, &V)> |
| 559 | 564 | where |
| 560 | K: ToStableHashKey<Hcx>, | |
| 565 | Hcx: HashStableContext, | |
| 566 | K: ToStableHashKey, | |
| 561 | 567 | { |
| 562 | 568 | to_sorted_vec(hcx, self.inner.iter(), cache_sort_key, |&(k, _)| k) |
| 563 | 569 | } |
| ... | ... | @@ -584,7 +590,8 @@ impl<K: Eq + Hash, V> UnordMap<K, V> { |
| 584 | 590 | #[inline] |
| 585 | 591 | pub fn into_sorted<Hcx>(self, hcx: &mut Hcx, cache_sort_key: bool) -> Vec<(K, V)> |
| 586 | 592 | where |
| 587 | K: ToStableHashKey<Hcx>, | |
| 593 | Hcx: HashStableContext, | |
| 594 | K: ToStableHashKey, | |
| 588 | 595 | { |
| 589 | 596 | to_sorted_vec(hcx, self.inner.into_iter(), cache_sort_key, |(k, _)| k) |
| 590 | 597 | } |
| ... | ... | @@ -616,7 +623,8 @@ impl<K: Eq + Hash, V> UnordMap<K, V> { |
| 616 | 623 | cache_sort_key: bool, |
| 617 | 624 | ) -> impl Iterator<Item = &V> |
| 618 | 625 | where |
| 619 | K: ToStableHashKey<Hcx>, | |
| 626 | Hcx: HashStableContext, | |
| 627 | K: ToStableHashKey, | |
| 620 | 628 | { |
| 621 | 629 | to_sorted_vec(hcx, self.inner.iter(), cache_sort_key, |&(k, _)| k) |
| 622 | 630 | .into_iter() |
| ... | ... | @@ -642,9 +650,9 @@ where |
| 642 | 650 | } |
| 643 | 651 | } |
| 644 | 652 | |
| 645 | impl<Hcx, K: Hash + Eq + HashStable<Hcx>, V: HashStable<Hcx>> HashStable<Hcx> for UnordMap<K, V> { | |
| 653 | impl<K: Hash + Eq + HashStable, V: HashStable> HashStable for UnordMap<K, V> { | |
| 646 | 654 | #[inline] |
| 647 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 655 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 648 | 656 | hash_iter_order_independent(self.inner.iter(), hcx, hasher); |
| 649 | 657 | } |
| 650 | 658 | } |
| ... | ... | @@ -705,9 +713,9 @@ impl<T, I: Iterator<Item = T>> From<UnordItems<T, I>> for UnordBag<T> { |
| 705 | 713 | } |
| 706 | 714 | } |
| 707 | 715 | |
| 708 | impl<Hcx, V: Hash + Eq + HashStable<Hcx>> HashStable<Hcx> for UnordBag<V> { | |
| 716 | impl<V: Hash + Eq + HashStable> HashStable for UnordBag<V> { | |
| 709 | 717 | #[inline] |
| 710 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 718 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 711 | 719 | hash_iter_order_independent(self.inner.iter(), hcx, hasher); |
| 712 | 720 | } |
| 713 | 721 | } |
| ... | ... | @@ -720,8 +728,9 @@ fn to_sorted_vec<Hcx, T, K, I>( |
| 720 | 728 | extract_key: fn(&T) -> &K, |
| 721 | 729 | ) -> Vec<T> |
| 722 | 730 | where |
| 731 | Hcx: HashStableContext, | |
| 723 | 732 | I: Iterator<Item = T>, |
| 724 | K: ToStableHashKey<Hcx>, | |
| 733 | K: ToStableHashKey, | |
| 725 | 734 | { |
| 726 | 735 | let mut items: Vec<T> = iter.collect(); |
| 727 | 736 | if cache_sort_key { |
| ... | ... | @@ -734,8 +743,8 @@ where |
| 734 | 743 | } |
| 735 | 744 | |
| 736 | 745 | fn hash_iter_order_independent< |
| 737 | Hcx, | |
| 738 | T: HashStable<Hcx>, | |
| 746 | Hcx: HashStableContext, | |
| 747 | T: HashStable, | |
| 739 | 748 | I: Iterator<Item = T> + ExactSizeIterator, |
| 740 | 749 | >( |
| 741 | 750 | mut it: I, |
compiler/rustc_error_messages/src/lib.rs+3-3| ... | ... | @@ -7,7 +7,7 @@ use std::borrow::Cow; |
| 7 | 7 | |
| 8 | 8 | pub use fluent_bundle::types::FluentType; |
| 9 | 9 | pub use fluent_bundle::{self, FluentArgs, FluentError, FluentValue}; |
| 10 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 10 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 11 | 11 | use rustc_span::Span; |
| 12 | 12 | pub use unic_langid::{LanguageIdentifier, langid}; |
| 13 | 13 | |
| ... | ... | @@ -28,7 +28,7 @@ pub fn register_functions<R, M>(bundle: &mut fluent_bundle::bundle::FluentBundle |
| 28 | 28 | /// diagnostic messages. |
| 29 | 29 | /// |
| 30 | 30 | /// Intended to be removed once diagnostics are entirely translatable. |
| 31 | #[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)] | |
| 31 | #[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)] | |
| 32 | 32 | #[rustc_diagnostic_item = "DiagMessage"] |
| 33 | 33 | pub enum DiagMessage { |
| 34 | 34 | /// Non-translatable diagnostic message or a message that has been translated eagerly. |
| ... | ... | @@ -89,7 +89,7 @@ pub struct SpanLabel { |
| 89 | 89 | /// the error, and would be rendered with `^^^`. |
| 90 | 90 | /// - They can have a *label*. In this case, the label is written next |
| 91 | 91 | /// to the mark in the snippet when we render. |
| 92 | #[derive(Clone, Debug, Hash, PartialEq, Eq, Encodable, Decodable, HashStable_Generic)] | |
| 92 | #[derive(Clone, Debug, Hash, PartialEq, Eq, Encodable, Decodable, HashStable)] | |
| 93 | 93 | pub struct MultiSpan { |
| 94 | 94 | primary_spans: Vec<Span>, |
| 95 | 95 | span_labels: Vec<(Span, DiagMessage)>, |
compiler/rustc_feature/src/unstable.rs+27| ... | ... | @@ -5,6 +5,7 @@ use std::time::{SystemTime, UNIX_EPOCH}; |
| 5 | 5 | |
| 6 | 6 | use rustc_data_structures::AtomicRef; |
| 7 | 7 | use rustc_data_structures::fx::FxHashSet; |
| 8 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 8 | 9 | use rustc_span::{Span, Symbol, sym}; |
| 9 | 10 | |
| 10 | 11 | use super::{Feature, to_nonzero}; |
| ... | ... | @@ -119,6 +120,32 @@ impl Features { |
| 119 | 120 | } |
| 120 | 121 | } |
| 121 | 122 | |
| 123 | impl HashStable for Features { | |
| 124 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 125 | // `enabled_features` is skipped because it's the sum of the lang and lib features. | |
| 126 | let Features { enabled_lang_features, enabled_lib_features, enabled_features: _ } = self; | |
| 127 | enabled_lang_features.hash_stable(hcx, hasher); | |
| 128 | enabled_lib_features.hash_stable(hcx, hasher); | |
| 129 | } | |
| 130 | } | |
| 131 | ||
| 132 | impl HashStable for EnabledLangFeature { | |
| 133 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 134 | let EnabledLangFeature { gate_name, attr_sp, stable_since } = self; | |
| 135 | gate_name.hash_stable(hcx, hasher); | |
| 136 | attr_sp.hash_stable(hcx, hasher); | |
| 137 | stable_since.hash_stable(hcx, hasher); | |
| 138 | } | |
| 139 | } | |
| 140 | ||
| 141 | impl HashStable for EnabledLibFeature { | |
| 142 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 143 | let EnabledLibFeature { gate_name, attr_sp } = self; | |
| 144 | gate_name.hash_stable(hcx, hasher); | |
| 145 | attr_sp.hash_stable(hcx, hasher); | |
| 146 | } | |
| 147 | } | |
| 148 | ||
| 122 | 149 | macro_rules! declare_features { |
| 123 | 150 | ($( |
| 124 | 151 | $(#[doc = $doc:tt])* ($status:ident, $feature:ident, $ver:expr, $issue:expr), |
compiler/rustc_hir/src/attrs/data_structures.rs+46-66| ... | ... | @@ -12,7 +12,7 @@ use rustc_ast::{AttrStyle, Path, ast}; |
| 12 | 12 | use rustc_data_structures::fx::FxIndexMap; |
| 13 | 13 | use rustc_error_messages::{DiagArgValue, IntoDiagArg}; |
| 14 | 14 | use rustc_hir::LangItem; |
| 15 | use rustc_macros::{Decodable, Encodable, HashStable_Generic, PrintAttribute}; | |
| 15 | use rustc_macros::{Decodable, Encodable, HashStable, PrintAttribute}; | |
| 16 | 16 | use rustc_span::def_id::DefId; |
| 17 | 17 | use rustc_span::hygiene::Transparency; |
| 18 | 18 | use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol}; |
| ... | ... | @@ -24,7 +24,7 @@ use crate::attrs::pretty_printing::PrintAttribute; |
| 24 | 24 | use crate::limit::Limit; |
| 25 | 25 | use crate::{DefaultBodyStability, PartialConstStability, RustcVersion, Stability}; |
| 26 | 26 | |
| 27 | #[derive(Copy, Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 27 | #[derive(Copy, Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 28 | 28 | pub enum EiiImplResolution { |
| 29 | 29 | /// Usually, finding the extern item that an EII implementation implements means finding |
| 30 | 30 | /// the defid of the associated attribute macro, and looking at *its* attributes to find |
| ... | ... | @@ -37,7 +37,7 @@ pub enum EiiImplResolution { |
| 37 | 37 | Error(ErrorGuaranteed), |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | #[derive(Copy, Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 40 | #[derive(Copy, Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 41 | 41 | pub struct EiiImpl { |
| 42 | 42 | pub resolution: EiiImplResolution, |
| 43 | 43 | pub impl_marked_unsafe: bool, |
| ... | ... | @@ -46,7 +46,7 @@ pub struct EiiImpl { |
| 46 | 46 | pub is_default: bool, |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | #[derive(Copy, Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 49 | #[derive(Copy, Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 50 | 50 | pub struct EiiDecl { |
| 51 | 51 | pub foreign_item: DefId, |
| 52 | 52 | /// whether or not it is unsafe to implement this EII |
| ... | ... | @@ -54,7 +54,7 @@ pub struct EiiDecl { |
| 54 | 54 | pub name: Ident, |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, PrintAttribute)] | |
| 57 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable, PrintAttribute)] | |
| 58 | 58 | pub enum CguKind { |
| 59 | 59 | No, |
| 60 | 60 | PreDashLto, |
| ... | ... | @@ -62,7 +62,7 @@ pub enum CguKind { |
| 62 | 62 | Any, |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, PrintAttribute)] | |
| 65 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable, PrintAttribute)] | |
| 66 | 66 | pub enum CguFields { |
| 67 | 67 | PartitionReused { cfg: Symbol, module: Symbol }, |
| 68 | 68 | PartitionCodegened { cfg: Symbol, module: Symbol }, |
| ... | ... | @@ -70,7 +70,7 @@ pub enum CguFields { |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | #[derive(Copy, Clone, PartialEq, Debug, PrintAttribute)] |
| 73 | #[derive(HashStable_Generic, Encodable, Decodable)] | |
| 73 | #[derive(HashStable, Encodable, Decodable)] | |
| 74 | 74 | pub enum DivergingFallbackBehavior { |
| 75 | 75 | /// Always fallback to `()` (aka "always spontaneous decay") |
| 76 | 76 | ToUnit, |
| ... | ... | @@ -82,7 +82,7 @@ pub enum DivergingFallbackBehavior { |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | #[derive(Copy, Clone, PartialEq, Debug, PrintAttribute, Default)] |
| 85 | #[derive(HashStable_Generic, Encodable, Decodable)] | |
| 85 | #[derive(HashStable, Encodable, Decodable)] | |
| 86 | 86 | pub enum DivergingBlockBehavior { |
| 87 | 87 | /// This is the current stable behavior: |
| 88 | 88 | /// |
| ... | ... | @@ -105,7 +105,7 @@ pub enum DivergingBlockBehavior { |
| 105 | 105 | Unit, |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, PrintAttribute)] | |
| 108 | #[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable, PrintAttribute)] | |
| 109 | 109 | pub enum InlineAttr { |
| 110 | 110 | None, |
| 111 | 111 | Hint, |
| ... | ... | @@ -129,24 +129,14 @@ impl InlineAttr { |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | #[derive( | |
| 133 | Copy, | |
| 134 | Clone, | |
| 135 | Encodable, | |
| 136 | Decodable, | |
| 137 | Debug, | |
| 138 | PartialEq, | |
| 139 | Eq, | |
| 140 | HashStable_Generic, | |
| 141 | PrintAttribute | |
| 142 | )] | |
| 132 | #[derive(Copy, Clone, Encodable, Decodable, Debug, PartialEq, Eq, HashStable, PrintAttribute)] | |
| 143 | 133 | pub enum InstructionSetAttr { |
| 144 | 134 | ArmA32, |
| 145 | 135 | ArmT32, |
| 146 | 136 | } |
| 147 | 137 | |
| 148 | 138 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Default, PrintAttribute)] |
| 149 | #[derive(Encodable, Decodable, HashStable_Generic)] | |
| 139 | #[derive(Encodable, Decodable, HashStable)] | |
| 150 | 140 | pub enum OptimizeAttr { |
| 151 | 141 | /// No `#[optimize(..)]` attribute |
| 152 | 142 | #[default] |
| ... | ... | @@ -165,7 +155,7 @@ impl OptimizeAttr { |
| 165 | 155 | } |
| 166 | 156 | } |
| 167 | 157 | |
| 168 | #[derive(PartialEq, Debug, Encodable, Decodable, Copy, Clone, HashStable_Generic, PrintAttribute)] | |
| 158 | #[derive(PartialEq, Debug, Encodable, Decodable, Copy, Clone, HashStable, PrintAttribute)] | |
| 169 | 159 | pub enum ReprAttr { |
| 170 | 160 | ReprInt(IntType), |
| 171 | 161 | ReprRust, |
| ... | ... | @@ -182,13 +172,13 @@ pub enum TransparencyError { |
| 182 | 172 | } |
| 183 | 173 | |
| 184 | 174 | #[derive(Eq, PartialEq, Debug, Copy, Clone)] |
| 185 | #[derive(Encodable, Decodable, HashStable_Generic, PrintAttribute)] | |
| 175 | #[derive(Encodable, Decodable, HashStable, PrintAttribute)] | |
| 186 | 176 | pub enum IntType { |
| 187 | 177 | SignedInt(ast::IntTy), |
| 188 | 178 | UnsignedInt(ast::UintTy), |
| 189 | 179 | } |
| 190 | 180 | |
| 191 | #[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)] | |
| 181 | #[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable, PrintAttribute)] | |
| 192 | 182 | pub struct Deprecation { |
| 193 | 183 | pub since: DeprecatedSince, |
| 194 | 184 | /// The note to issue a reason. |
| ... | ... | @@ -200,7 +190,7 @@ pub struct Deprecation { |
| 200 | 190 | } |
| 201 | 191 | |
| 202 | 192 | /// Release in which an API is deprecated. |
| 203 | #[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)] | |
| 193 | #[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable, PrintAttribute)] | |
| 204 | 194 | pub enum DeprecatedSince { |
| 205 | 195 | RustcVersion(RustcVersion), |
| 206 | 196 | /// Deprecated in the future ("to be determined"). |
| ... | ... | @@ -217,7 +207,7 @@ pub enum DeprecatedSince { |
| 217 | 207 | |
| 218 | 208 | /// Successfully-parsed value of a `#[coverage(..)]` attribute. |
| 219 | 209 | #[derive(Copy, Debug, Eq, PartialEq, Encodable, Decodable, Clone)] |
| 220 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 210 | #[derive(HashStable, PrintAttribute)] | |
| 221 | 211 | pub enum CoverageAttrKind { |
| 222 | 212 | On, |
| 223 | 213 | Off, |
| ... | ... | @@ -225,7 +215,7 @@ pub enum CoverageAttrKind { |
| 225 | 215 | |
| 226 | 216 | /// Successfully-parsed value of a `#[rustc_abi(..)]` attribute. |
| 227 | 217 | #[derive(Copy, Debug, Eq, PartialEq, Encodable, Decodable, Clone)] |
| 228 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 218 | #[derive(HashStable, PrintAttribute)] | |
| 229 | 219 | pub enum RustcAbiAttrKind { |
| 230 | 220 | Debug, |
| 231 | 221 | AssertEq, |
| ... | ... | @@ -256,7 +246,7 @@ impl Deprecation { |
| 256 | 246 | /// `#[used(compiler)]` |
| 257 | 247 | /// `#[used(linker)]` |
| 258 | 248 | #[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, Hash)] |
| 259 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 249 | #[derive(HashStable, PrintAttribute)] | |
| 260 | 250 | pub enum UsedBy { |
| 261 | 251 | Default, |
| 262 | 252 | Compiler, |
| ... | ... | @@ -264,7 +254,7 @@ pub enum UsedBy { |
| 264 | 254 | } |
| 265 | 255 | |
| 266 | 256 | #[derive(Encodable, Decodable, Clone, Debug, PartialEq, Eq, Hash)] |
| 267 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 257 | #[derive(HashStable, PrintAttribute)] | |
| 268 | 258 | pub enum MacroUseArgs { |
| 269 | 259 | UseAll, |
| 270 | 260 | UseSpecific(ThinVec<Ident>), |
| ... | ... | @@ -276,7 +266,7 @@ impl Default for MacroUseArgs { |
| 276 | 266 | } |
| 277 | 267 | } |
| 278 | 268 | |
| 279 | #[derive(Debug, Clone, Encodable, Decodable, HashStable_Generic)] | |
| 269 | #[derive(Debug, Clone, Encodable, Decodable, HashStable)] | |
| 280 | 270 | pub struct StrippedCfgItem<ScopeId = DefId> { |
| 281 | 271 | pub parent_scope: ScopeId, |
| 282 | 272 | pub ident: Ident, |
| ... | ... | @@ -294,7 +284,7 @@ impl<ScopeId> StrippedCfgItem<ScopeId> { |
| 294 | 284 | /// |
| 295 | 285 | /// See <https://llvm.org/docs/LangRef.html#linkage-types> for more details about these variants. |
| 296 | 286 | #[derive(Encodable, Decodable, Clone, Copy, Debug, PartialEq, Eq, Hash)] |
| 297 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 287 | #[derive(HashStable, PrintAttribute)] | |
| 298 | 288 | pub enum Linkage { |
| 299 | 289 | AvailableExternally, |
| 300 | 290 | Common, |
| ... | ... | @@ -308,7 +298,7 @@ pub enum Linkage { |
| 308 | 298 | } |
| 309 | 299 | |
| 310 | 300 | #[derive(Clone, Copy, Decodable, Debug, Encodable, PartialEq)] |
| 311 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 301 | #[derive(HashStable, PrintAttribute)] | |
| 312 | 302 | pub enum MirDialect { |
| 313 | 303 | Analysis, |
| 314 | 304 | Built, |
| ... | ... | @@ -327,7 +317,7 @@ impl IntoDiagArg for MirDialect { |
| 327 | 317 | } |
| 328 | 318 | |
| 329 | 319 | #[derive(Clone, Copy, Decodable, Debug, Encodable, PartialEq)] |
| 330 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 320 | #[derive(HashStable, PrintAttribute)] | |
| 331 | 321 | pub enum MirPhase { |
| 332 | 322 | Initial, |
| 333 | 323 | PostCleanup, |
| ... | ... | @@ -347,17 +337,7 @@ impl IntoDiagArg for MirPhase { |
| 347 | 337 | |
| 348 | 338 | /// Different ways that the PE Format can decorate a symbol name. |
| 349 | 339 | /// From <https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-name-type> |
| 350 | #[derive( | |
| 351 | Copy, | |
| 352 | Clone, | |
| 353 | Debug, | |
| 354 | Encodable, | |
| 355 | Decodable, | |
| 356 | HashStable_Generic, | |
| 357 | PartialEq, | |
| 358 | Eq, | |
| 359 | PrintAttribute | |
| 360 | )] | |
| 340 | #[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable, PartialEq, Eq, PrintAttribute)] | |
| 361 | 341 | pub enum PeImportNameType { |
| 362 | 342 | /// IMPORT_ORDINAL |
| 363 | 343 | /// Uses the ordinal (i.e., a number) rather than the name. |
| ... | ... | @@ -387,7 +367,7 @@ pub enum PeImportNameType { |
| 387 | 367 | Decodable, |
| 388 | 368 | PrintAttribute |
| 389 | 369 | )] |
| 390 | #[derive(HashStable_Generic)] | |
| 370 | #[derive(HashStable)] | |
| 391 | 371 | pub enum NativeLibKind { |
| 392 | 372 | /// Static library (e.g. `libfoo.a` on Linux or `foo.lib` on Windows/MSVC) |
| 393 | 373 | Static { |
| ... | ... | @@ -455,7 +435,7 @@ impl NativeLibKind { |
| 455 | 435 | } |
| 456 | 436 | } |
| 457 | 437 | |
| 458 | #[derive(Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)] | |
| 438 | #[derive(Debug, Encodable, Decodable, Clone, HashStable, PrintAttribute)] | |
| 459 | 439 | pub struct LinkEntry { |
| 460 | 440 | pub span: Span, |
| 461 | 441 | pub kind: NativeLibKind, |
| ... | ... | @@ -465,14 +445,14 @@ pub struct LinkEntry { |
| 465 | 445 | pub import_name_type: Option<(PeImportNameType, Span)>, |
| 466 | 446 | } |
| 467 | 447 | |
| 468 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 448 | #[derive(HashStable, PrintAttribute)] | |
| 469 | 449 | #[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug, Encodable, Decodable)] |
| 470 | 450 | pub enum DebuggerVisualizerType { |
| 471 | 451 | Natvis, |
| 472 | 452 | GdbPrettyPrinter, |
| 473 | 453 | } |
| 474 | 454 | |
| 475 | #[derive(Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)] | |
| 455 | #[derive(Debug, Encodable, Decodable, Clone, HashStable, PrintAttribute)] | |
| 476 | 456 | pub struct DebugVisualizer { |
| 477 | 457 | pub span: Span, |
| 478 | 458 | pub visualizer_type: DebuggerVisualizerType, |
| ... | ... | @@ -480,7 +460,7 @@ pub struct DebugVisualizer { |
| 480 | 460 | } |
| 481 | 461 | |
| 482 | 462 | #[derive(Clone, Copy, Debug, Decodable, Encodable, Eq, PartialEq)] |
| 483 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 463 | #[derive(HashStable, PrintAttribute)] | |
| 484 | 464 | #[derive_const(Default)] |
| 485 | 465 | pub enum RtsanSetting { |
| 486 | 466 | Nonblocking, |
| ... | ... | @@ -490,7 +470,7 @@ pub enum RtsanSetting { |
| 490 | 470 | } |
| 491 | 471 | |
| 492 | 472 | #[derive(Eq, PartialEq, Debug, Copy, Clone)] |
| 493 | #[derive(Encodable, Decodable, HashStable_Generic, PrintAttribute)] | |
| 473 | #[derive(Encodable, Decodable, HashStable, PrintAttribute)] | |
| 494 | 474 | pub enum WindowsSubsystemKind { |
| 495 | 475 | Console, |
| 496 | 476 | Windows, |
| ... | ... | @@ -506,20 +486,20 @@ impl WindowsSubsystemKind { |
| 506 | 486 | } |
| 507 | 487 | |
| 508 | 488 | #[derive(Copy, Clone, Debug, PartialEq)] |
| 509 | #[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 489 | #[derive(HashStable, Encodable, Decodable, PrintAttribute)] | |
| 510 | 490 | pub enum DocInline { |
| 511 | 491 | Inline, |
| 512 | 492 | NoInline, |
| 513 | 493 | } |
| 514 | 494 | |
| 515 | 495 | #[derive(Copy, Clone, Debug, PartialEq)] |
| 516 | #[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 496 | #[derive(HashStable, Encodable, Decodable, PrintAttribute)] | |
| 517 | 497 | pub enum HideOrShow { |
| 518 | 498 | Hide, |
| 519 | 499 | Show, |
| 520 | 500 | } |
| 521 | 501 | |
| 522 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 502 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 523 | 503 | pub struct CfgInfo { |
| 524 | 504 | pub name: Symbol, |
| 525 | 505 | pub name_span: Span, |
| ... | ... | @@ -536,13 +516,13 @@ impl CfgInfo { |
| 536 | 516 | } |
| 537 | 517 | } |
| 538 | 518 | |
| 539 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 519 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 540 | 520 | pub struct CfgHideShow { |
| 541 | 521 | pub kind: HideOrShow, |
| 542 | 522 | pub values: ThinVec<CfgInfo>, |
| 543 | 523 | } |
| 544 | 524 | |
| 545 | #[derive(Clone, Debug, Default, HashStable_Generic, Decodable, PrintAttribute)] | |
| 525 | #[derive(Clone, Debug, Default, HashStable, Decodable, PrintAttribute)] | |
| 546 | 526 | pub struct DocAttribute { |
| 547 | 527 | pub first_span: Span, |
| 548 | 528 | |
| ... | ... | @@ -646,7 +626,7 @@ impl<E: rustc_span::SpanEncoder> rustc_serialize::Encodable<E> for DocAttribute |
| 646 | 626 | /// | external | no | if-ext | if-ext | yes | |
| 647 | 627 | /// | yes | yes | yes | yes | yes | |
| 648 | 628 | #[derive(Copy, Clone, Debug, Hash, PartialEq)] |
| 649 | #[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 629 | #[derive(HashStable, Encodable, Decodable, PrintAttribute)] | |
| 650 | 630 | pub enum CollapseMacroDebuginfo { |
| 651 | 631 | /// Don't collapse debuginfo for the macro |
| 652 | 632 | No = 0, |
| ... | ... | @@ -660,7 +640,7 @@ pub enum CollapseMacroDebuginfo { |
| 660 | 640 | |
| 661 | 641 | /// Crate type, as specified by `#![crate_type]` |
| 662 | 642 | #[derive(Copy, Clone, Debug, Hash, PartialEq, Default, PartialOrd, Eq, Ord)] |
| 663 | #[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 643 | #[derive(HashStable, Encodable, Decodable, PrintAttribute)] | |
| 664 | 644 | pub enum CrateType { |
| 665 | 645 | /// `#![crate_type = "bin"]` |
| 666 | 646 | Executable, |
| ... | ... | @@ -760,7 +740,7 @@ impl IntoDiagArg for CrateType { |
| 760 | 740 | } |
| 761 | 741 | } |
| 762 | 742 | |
| 763 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 743 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 764 | 744 | pub enum RustcDumpLayoutKind { |
| 765 | 745 | Align, |
| 766 | 746 | BackendRepr, |
| ... | ... | @@ -769,7 +749,7 @@ pub enum RustcDumpLayoutKind { |
| 769 | 749 | Size, |
| 770 | 750 | } |
| 771 | 751 | |
| 772 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute, PartialEq, Eq)] | |
| 752 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute, PartialEq, Eq)] | |
| 773 | 753 | pub enum RustcMirKind { |
| 774 | 754 | PeekMaybeInit, |
| 775 | 755 | PeekMaybeUninit, |
| ... | ... | @@ -779,13 +759,13 @@ pub enum RustcMirKind { |
| 779 | 759 | BorrowckGraphvizFormat { format: BorrowckGraphvizFormatKind }, |
| 780 | 760 | } |
| 781 | 761 | |
| 782 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute, PartialEq, Eq)] | |
| 762 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute, PartialEq, Eq)] | |
| 783 | 763 | pub enum BorrowckGraphvizFormatKind { |
| 784 | 764 | TwoPhase, |
| 785 | 765 | } |
| 786 | 766 | |
| 787 | 767 | #[derive(Clone, Debug, PartialEq, Eq)] |
| 788 | #[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 768 | #[derive(HashStable, Encodable, Decodable, PrintAttribute)] | |
| 789 | 769 | pub struct RustcCleanAttribute { |
| 790 | 770 | pub span: Span, |
| 791 | 771 | pub cfg: Symbol, |
| ... | ... | @@ -795,14 +775,14 @@ pub struct RustcCleanAttribute { |
| 795 | 775 | |
| 796 | 776 | /// Represents the `except=` or `loaded_from_disk=` argument of `#[rustc_clean]` |
| 797 | 777 | #[derive(Clone, Debug, PartialEq, Eq)] |
| 798 | #[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 778 | #[derive(HashStable, Encodable, Decodable, PrintAttribute)] | |
| 799 | 779 | pub struct RustcCleanQueries { |
| 800 | 780 | pub entries: ThinVec<Symbol>, |
| 801 | 781 | pub span: Span, |
| 802 | 782 | } |
| 803 | 783 | |
| 804 | 784 | #[derive(Clone, Debug, PartialEq, Eq)] |
| 805 | #[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 785 | #[derive(HashStable, Encodable, Decodable, PrintAttribute)] | |
| 806 | 786 | pub struct RustcAutodiff { |
| 807 | 787 | /// Conceptually either forward or reverse mode AD, as described in various autodiff papers and |
| 808 | 788 | /// e.g. in the [JAX |
| ... | ... | @@ -878,7 +858,7 @@ impl RustcAutodiff { |
| 878 | 858 | } |
| 879 | 859 | |
| 880 | 860 | /// We generate one of these structs for each `#[autodiff(...)]` attribute. |
| 881 | #[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 861 | #[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)] | |
| 882 | 862 | pub struct AutoDiffItem { |
| 883 | 863 | /// The name of the function getting differentiated |
| 884 | 864 | pub source: String, |
| ... | ... | @@ -898,7 +878,7 @@ impl fmt::Display for AutoDiffItem { |
| 898 | 878 | } |
| 899 | 879 | } |
| 900 | 880 | |
| 901 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 881 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 902 | 882 | pub struct UnstableRemovedFeature { |
| 903 | 883 | pub feature: Symbol, |
| 904 | 884 | pub reason: Symbol, |
| ... | ... | @@ -955,7 +935,7 @@ pub struct UnstableRemovedFeature { |
| 955 | 935 | /// [`rustc_parse`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html |
| 956 | 936 | /// [`rustc_codegen_ssa`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/index.html |
| 957 | 937 | /// [`rustc_attr_parsing`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_attr_parsing/index.html |
| 958 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 938 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 959 | 939 | pub enum AttributeKind { |
| 960 | 940 | // tidy-alphabetical-start |
| 961 | 941 | /// Represents `#[allow_internal_unsafe]`. |
compiler/rustc_hir/src/attrs/diagnostic.rs+12-12| ... | ... | @@ -3,14 +3,14 @@ use std::fmt; |
| 3 | 3 | use std::fmt::Debug; |
| 4 | 4 | |
| 5 | 5 | pub use rustc_ast::attr::data_structures::*; |
| 6 | use rustc_macros::{Decodable, Encodable, HashStable_Generic, PrintAttribute}; | |
| 6 | use rustc_macros::{Decodable, Encodable, HashStable, PrintAttribute}; | |
| 7 | 7 | use rustc_span::{DesugaringKind, Span, Symbol, kw}; |
| 8 | 8 | use thin_vec::ThinVec; |
| 9 | 9 | use tracing::debug; |
| 10 | 10 | |
| 11 | 11 | use crate::attrs::PrintAttribute; |
| 12 | 12 | |
| 13 | #[derive(Clone, Default, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 13 | #[derive(Clone, Default, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 14 | 14 | pub struct Directive { |
| 15 | 15 | pub is_rustc_attr: bool, |
| 16 | 16 | pub condition: Option<OnUnimplementedCondition>, |
| ... | ... | @@ -123,7 +123,7 @@ pub struct CustomDiagnostic { |
| 123 | 123 | |
| 124 | 124 | /// Like [std::fmt::Arguments] this is a string that has been parsed into "pieces", |
| 125 | 125 | /// either as string pieces or dynamic arguments. |
| 126 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 126 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 127 | 127 | pub struct FormatString { |
| 128 | 128 | pub input: Symbol, |
| 129 | 129 | pub span: Span, |
| ... | ... | @@ -225,13 +225,13 @@ pub struct FormatArgs { |
| 225 | 225 | pub generic_args: Vec<(Symbol, String)> = Vec::new(), |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 228 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 229 | 229 | pub enum Piece { |
| 230 | 230 | Lit(Symbol), |
| 231 | 231 | Arg(FormatArg), |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 234 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 235 | 235 | pub enum FormatArg { |
| 236 | 236 | // A generic parameter, like `{T}` if we're on the `From<T>` trait. |
| 237 | 237 | GenericParam { |
| ... | ... | @@ -251,7 +251,7 @@ pub enum FormatArg { |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /// Represents the `on` filter in `#[rustc_on_unimplemented]`. |
| 254 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 254 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 255 | 255 | pub struct OnUnimplementedCondition { |
| 256 | 256 | pub span: Span, |
| 257 | 257 | pub pred: Predicate, |
| ... | ... | @@ -276,7 +276,7 @@ impl OnUnimplementedCondition { |
| 276 | 276 | /// |
| 277 | 277 | /// It is similar to the predicate in the `cfg` attribute, |
| 278 | 278 | /// and may contain nested predicates. |
| 279 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 279 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 280 | 280 | pub enum Predicate { |
| 281 | 281 | /// A condition like `on(crate_local)`. |
| 282 | 282 | Flag(Flag), |
| ... | ... | @@ -314,7 +314,7 @@ impl Predicate { |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /// Represents a `MetaWord` in an `on`-filter. |
| 317 | #[derive(Clone, Copy, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 317 | #[derive(Clone, Copy, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 318 | 318 | pub enum Flag { |
| 319 | 319 | /// Whether the code causing the trait bound to not be fulfilled |
| 320 | 320 | /// is part of the user's crate. |
| ... | ... | @@ -329,7 +329,7 @@ pub enum Flag { |
| 329 | 329 | /// A `MetaNameValueStr` in an `on`-filter. |
| 330 | 330 | /// |
| 331 | 331 | /// For example, `#[rustc_on_unimplemented(on(name = "value", message = "hello"))]`. |
| 332 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 332 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 333 | 333 | pub struct NameValue { |
| 334 | 334 | pub name: Name, |
| 335 | 335 | /// Something like `"&str"` or `"alloc::string::String"`, |
| ... | ... | @@ -348,7 +348,7 @@ impl NameValue { |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /// The valid names of the `on` filter. |
| 351 | #[derive(Clone, Copy, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 351 | #[derive(Clone, Copy, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 352 | 352 | pub enum Name { |
| 353 | 353 | Cause, |
| 354 | 354 | FromDesugaring, |
| ... | ... | @@ -368,7 +368,7 @@ pub enum FlagOrNv<'p> { |
| 368 | 368 | /// If it is a simple literal like this then `pieces` will be `[LitOrArg::Lit("value")]`. |
| 369 | 369 | /// The `Arg` variant is used when it contains formatting like |
| 370 | 370 | /// `#[rustc_on_unimplemented(on(Self = "&[{A}]", message = "hello"))]`. |
| 371 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 371 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 372 | 372 | pub struct FilterFormatString { |
| 373 | 373 | pub pieces: ThinVec<LitOrArg>, |
| 374 | 374 | } |
| ... | ... | @@ -400,7 +400,7 @@ impl FilterFormatString { |
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)] | |
| 403 | #[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)] | |
| 404 | 404 | pub enum LitOrArg { |
| 405 | 405 | Lit(Symbol), |
| 406 | 406 | Arg(Symbol), |
compiler/rustc_hir/src/def.rs+12-12| ... | ... | @@ -7,16 +7,16 @@ use rustc_ast::NodeId; |
| 7 | 7 | use rustc_data_structures::stable_hasher::ToStableHashKey; |
| 8 | 8 | use rustc_data_structures::unord::UnordMap; |
| 9 | 9 | use rustc_error_messages::{DiagArgValue, IntoDiagArg}; |
| 10 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 10 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 11 | use rustc_span::Symbol; | |
| 11 | 12 | use rustc_span::def_id::{DefId, LocalDefId}; |
| 12 | 13 | use rustc_span::hygiene::MacroKind; |
| 13 | use rustc_span::{HashStableContext, Symbol}; | |
| 14 | 14 | |
| 15 | 15 | use crate::definitions::DefPathData; |
| 16 | 16 | use crate::hir; |
| 17 | 17 | |
| 18 | 18 | /// Encodes if a `DefKind::Ctor` is the constructor of an enum variant or a struct. |
| 19 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)] | |
| 19 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)] | |
| 20 | 20 | pub enum CtorOf { |
| 21 | 21 | /// This `DefKind::Ctor` is a synthesized constructor of a tuple or unit struct. |
| 22 | 22 | Struct, |
| ... | ... | @@ -25,7 +25,7 @@ pub enum CtorOf { |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /// What kind of constructor something is. |
| 28 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)] | |
| 28 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)] | |
| 29 | 29 | pub enum CtorKind { |
| 30 | 30 | /// Constructor function automatically created by a tuple struct/variant. |
| 31 | 31 | Fn, |
| ... | ... | @@ -35,7 +35,7 @@ pub enum CtorKind { |
| 35 | 35 | |
| 36 | 36 | /// A set of macro kinds, for macros that can have more than one kind |
| 37 | 37 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Hash, Debug)] |
| 38 | #[derive(HashStable_Generic)] | |
| 38 | #[derive(HashStable)] | |
| 39 | 39 | pub struct MacroKinds(u8); |
| 40 | 40 | bitflags::bitflags! { |
| 41 | 41 | impl MacroKinds: u8 { |
| ... | ... | @@ -81,7 +81,7 @@ impl MacroKinds { |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /// An attribute that is not a macro; e.g., `#[inline]` or `#[rustfmt::skip]`. |
| 84 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)] | |
| 84 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)] | |
| 85 | 85 | pub enum NonMacroAttrKind { |
| 86 | 86 | /// Single-segment attribute defined by the language (`#[inline]`) |
| 87 | 87 | Builtin(Symbol), |
| ... | ... | @@ -96,7 +96,7 @@ pub enum NonMacroAttrKind { |
| 96 | 96 | |
| 97 | 97 | /// What kind of definition something is; e.g., `mod` vs `struct`. |
| 98 | 98 | /// `enum DefPathData` may need to be updated if a new variant is added here. |
| 99 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)] | |
| 99 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)] | |
| 100 | 100 | pub enum DefKind { |
| 101 | 101 | // Type namespace |
| 102 | 102 | Mod, |
| ... | ... | @@ -511,7 +511,7 @@ impl DefKind { |
| 511 | 511 | /// - the call to `str_to_string` will resolve to [`Res::Def`], with the [`DefId`] |
| 512 | 512 | /// pointing to the definition of `str_to_string` in the current crate. |
| 513 | 513 | // |
| 514 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)] | |
| 514 | #[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)] | |
| 515 | 515 | pub enum Res<Id = hir::HirId> { |
| 516 | 516 | /// Definition having a unique ID (`DefId`), corresponds to something defined in user code. |
| 517 | 517 | /// |
| ... | ... | @@ -679,7 +679,7 @@ impl PartialRes { |
| 679 | 679 | /// Different kinds of symbols can coexist even if they share the same textual name. |
| 680 | 680 | /// Therefore, they each have a separate universe (known as a "namespace"). |
| 681 | 681 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Encodable, Decodable)] |
| 682 | #[derive(HashStable_Generic)] | |
| 682 | #[derive(HashStable)] | |
| 683 | 683 | pub enum Namespace { |
| 684 | 684 | /// The type namespace includes `struct`s, `enum`s, `union`s, `trait`s, and `mod`s |
| 685 | 685 | /// (and, by extension, crates). |
| ... | ... | @@ -712,17 +712,17 @@ impl IntoDiagArg for Namespace { |
| 712 | 712 | } |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for Namespace { | |
| 715 | impl ToStableHashKey for Namespace { | |
| 716 | 716 | type KeyType = Namespace; |
| 717 | 717 | |
| 718 | 718 | #[inline] |
| 719 | fn to_stable_hash_key(&self, _: &mut Hcx) -> Namespace { | |
| 719 | fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> Namespace { | |
| 720 | 720 | *self |
| 721 | 721 | } |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | /// Just a helper ‒ separate structure for each namespace. |
| 725 | #[derive(Copy, Clone, Default, Debug, HashStable_Generic)] | |
| 725 | #[derive(Copy, Clone, Default, Debug, HashStable)] | |
| 726 | 726 | pub struct PerNS<T> { |
| 727 | 727 | pub value_ns: T, |
| 728 | 728 | pub type_ns: T, |
compiler/rustc_hir/src/diagnostic_items.rs+2-2| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | use rustc_data_structures::fx::FxIndexMap; |
| 2 | use rustc_macros::HashStable_Generic; | |
| 2 | use rustc_macros::HashStable; | |
| 3 | 3 | use rustc_span::Symbol; |
| 4 | 4 | use rustc_span::def_id::DefIdMap; |
| 5 | 5 | |
| 6 | 6 | use crate::def_id::DefId; |
| 7 | 7 | |
| 8 | #[derive(Debug, Default, HashStable_Generic)] | |
| 8 | #[derive(Debug, Default, HashStable)] | |
| 9 | 9 | pub struct DiagnosticItems { |
| 10 | 10 | #[stable_hasher(ignore)] |
| 11 | 11 | pub id_to_name: DefIdMap<Symbol>, |
compiler/rustc_hir/src/hir.rs+142-142| ... | ... | @@ -22,7 +22,7 @@ use rustc_data_structures::steal::Steal; |
| 22 | 22 | use rustc_data_structures::tagged_ptr::TaggedRef; |
| 23 | 23 | use rustc_error_messages::{DiagArgValue, IntoDiagArg}; |
| 24 | 24 | use rustc_index::IndexVec; |
| 25 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 25 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 26 | 26 | use rustc_span::def_id::LocalDefId; |
| 27 | 27 | use rustc_span::{ |
| 28 | 28 | BytePos, DUMMY_SP, DesugaringKind, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, sym, |
| ... | ... | @@ -39,7 +39,7 @@ pub(crate) use crate::hir_id::{HirId, ItemLocalId, ItemLocalMap, OwnerId}; |
| 39 | 39 | use crate::intravisit::{FnKind, VisitorExt}; |
| 40 | 40 | use crate::lints::DelayedLints; |
| 41 | 41 | |
| 42 | #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable_Generic)] | |
| 42 | #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable)] | |
| 43 | 43 | pub enum AngleBrackets { |
| 44 | 44 | /// E.g. `Path`. |
| 45 | 45 | Missing, |
| ... | ... | @@ -49,7 +49,7 @@ pub enum AngleBrackets { |
| 49 | 49 | Full, |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable_Generic)] | |
| 52 | #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable)] | |
| 53 | 53 | pub enum LifetimeSource { |
| 54 | 54 | /// E.g. `&Type`, `&'_ Type`, `&'a Type`, `&mut Type`, `&'_ mut Type`, `&'a mut Type` |
| 55 | 55 | Reference, |
| ... | ... | @@ -73,7 +73,7 @@ pub enum LifetimeSource { |
| 73 | 73 | Other, |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable_Generic)] | |
| 76 | #[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable)] | |
| 77 | 77 | pub enum LifetimeSyntax { |
| 78 | 78 | /// E.g. `&Type`, `ContainsLifetime` |
| 79 | 79 | Implicit, |
| ... | ... | @@ -150,7 +150,7 @@ impl From<Ident> for LifetimeSyntax { |
| 150 | 150 | /// Some combinations that cannot occur are `LifetimeSyntax::Implicit` with |
| 151 | 151 | /// `LifetimeSource::OutlivesBound` or `LifetimeSource::PreciseCapturing` |
| 152 | 152 | /// — there's no way to "elide" these lifetimes. |
| 153 | #[derive(Debug, Copy, Clone, HashStable_Generic)] | |
| 153 | #[derive(Debug, Copy, Clone, HashStable)] | |
| 154 | 154 | // Raise the alignment to at least 4 bytes. |
| 155 | 155 | // This is relied on in other parts of the compiler (for pointer tagging): |
| 156 | 156 | // <https://github.com/rust-lang/rust/blob/ce5fdd7d42aba9a2925692e11af2bd39cf37798a/compiler/rustc_data_structures/src/tagged_ptr.rs#L163> |
| ... | ... | @@ -180,7 +180,7 @@ pub struct Lifetime { |
| 180 | 180 | pub syntax: LifetimeSyntax, |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | #[derive(Debug, Copy, Clone, HashStable_Generic)] | |
| 183 | #[derive(Debug, Copy, Clone, HashStable)] | |
| 184 | 184 | pub enum ParamName { |
| 185 | 185 | /// Some user-given name like `T` or `'x`. |
| 186 | 186 | Plain(Ident), |
| ... | ... | @@ -218,7 +218,7 @@ impl ParamName { |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)] | |
| 221 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, HashStable)] | |
| 222 | 222 | pub enum LifetimeKind { |
| 223 | 223 | /// User-given names or fresh (synthetic) names. |
| 224 | 224 | Param(LocalDefId), |
| ... | ... | @@ -345,7 +345,7 @@ impl Lifetime { |
| 345 | 345 | /// A `Path` is essentially Rust's notion of a name; for instance, |
| 346 | 346 | /// `std::cmp::PartialEq`. It's represented as a sequence of identifiers, |
| 347 | 347 | /// along with a bunch of supporting information. |
| 348 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 348 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 349 | 349 | pub struct Path<'hir, R = Res> { |
| 350 | 350 | pub span: Span, |
| 351 | 351 | /// The resolution for the path. |
| ... | ... | @@ -365,7 +365,7 @@ impl Path<'_> { |
| 365 | 365 | |
| 366 | 366 | /// A segment of a path: an identifier, an optional lifetime, and a set of |
| 367 | 367 | /// types. |
| 368 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 368 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 369 | 369 | pub struct PathSegment<'hir> { |
| 370 | 370 | /// The identifier portion of this path segment. |
| 371 | 371 | pub ident: Ident, |
| ... | ... | @@ -402,7 +402,7 @@ impl<'hir> PathSegment<'hir> { |
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | #[derive(Clone, Copy, Debug, HashStable_Generic)] | |
| 405 | #[derive(Clone, Copy, Debug, HashStable)] | |
| 406 | 406 | pub enum ConstItemRhs<'hir> { |
| 407 | 407 | Body(BodyId), |
| 408 | 408 | TypeConst(&'hir ConstArg<'hir>), |
| ... | ... | @@ -437,7 +437,7 @@ impl<'hir> ConstItemRhs<'hir> { |
| 437 | 437 | /// |
| 438 | 438 | /// For an explanation of the `Unambig` generic parameter see the dev-guide: |
| 439 | 439 | /// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html> |
| 440 | #[derive(Clone, Copy, Debug, HashStable_Generic)] | |
| 440 | #[derive(Clone, Copy, Debug, HashStable)] | |
| 441 | 441 | #[repr(C)] |
| 442 | 442 | pub struct ConstArg<'hir, Unambig = ()> { |
| 443 | 443 | #[stable_hasher(ignore)] |
| ... | ... | @@ -494,7 +494,7 @@ impl<'hir, Unambig> ConstArg<'hir, Unambig> { |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | /// See [`ConstArg`]. |
| 497 | #[derive(Clone, Copy, Debug, HashStable_Generic)] | |
| 497 | #[derive(Clone, Copy, Debug, HashStable)] | |
| 498 | 498 | #[repr(u8, C)] |
| 499 | 499 | pub enum ConstArgKind<'hir, Unambig = ()> { |
| 500 | 500 | Tup(&'hir [&'hir ConstArg<'hir, Unambig>]), |
| ... | ... | @@ -522,7 +522,7 @@ pub enum ConstArgKind<'hir, Unambig = ()> { |
| 522 | 522 | }, |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | #[derive(Clone, Copy, Debug, HashStable_Generic)] | |
| 525 | #[derive(Clone, Copy, Debug, HashStable)] | |
| 526 | 526 | pub struct ConstArgExprField<'hir> { |
| 527 | 527 | pub hir_id: HirId, |
| 528 | 528 | pub span: Span, |
| ... | ... | @@ -530,13 +530,13 @@ pub struct ConstArgExprField<'hir> { |
| 530 | 530 | pub expr: &'hir ConstArg<'hir>, |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | #[derive(Clone, Copy, Debug, HashStable_Generic)] | |
| 533 | #[derive(Clone, Copy, Debug, HashStable)] | |
| 534 | 534 | pub struct ConstArgArrayExpr<'hir> { |
| 535 | 535 | pub span: Span, |
| 536 | 536 | pub elems: &'hir [&'hir ConstArg<'hir>], |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | #[derive(Clone, Copy, Debug, HashStable_Generic)] | |
| 539 | #[derive(Clone, Copy, Debug, HashStable)] | |
| 540 | 540 | pub struct InferArg { |
| 541 | 541 | #[stable_hasher(ignore)] |
| 542 | 542 | pub hir_id: HirId, |
| ... | ... | @@ -549,7 +549,7 @@ impl InferArg { |
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 552 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 553 | 553 | pub enum GenericArg<'hir> { |
| 554 | 554 | Lifetime(&'hir Lifetime), |
| 555 | 555 | Type(&'hir Ty<'hir, AmbigArg>), |
| ... | ... | @@ -612,7 +612,7 @@ impl GenericArg<'_> { |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | /// The generic arguments and associated item constraints of a path segment. |
| 615 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 615 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 616 | 616 | pub struct GenericArgs<'hir> { |
| 617 | 617 | /// The generic arguments for this path segment. |
| 618 | 618 | pub args: &'hir [GenericArg<'hir>], |
| ... | ... | @@ -736,7 +736,7 @@ impl<'hir> GenericArgs<'hir> { |
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | |
| 739 | #[derive(Copy, Clone, PartialEq, Eq, Debug, HashStable_Generic)] | |
| 739 | #[derive(Copy, Clone, PartialEq, Eq, Debug, HashStable)] | |
| 740 | 740 | pub enum GenericArgsParentheses { |
| 741 | 741 | No, |
| 742 | 742 | /// Bounds for `feature(return_type_notation)`, like `T: Trait<method(..): Send>`, |
| ... | ... | @@ -747,7 +747,7 @@ pub enum GenericArgsParentheses { |
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | /// The modifiers on a trait bound. |
| 750 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)] | |
| 750 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable)] | |
| 751 | 751 | pub struct TraitBoundModifiers { |
| 752 | 752 | pub constness: BoundConstness, |
| 753 | 753 | pub polarity: BoundPolarity, |
| ... | ... | @@ -758,7 +758,7 @@ impl TraitBoundModifiers { |
| 758 | 758 | TraitBoundModifiers { constness: BoundConstness::Never, polarity: BoundPolarity::Positive }; |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | #[derive(Clone, Copy, Debug, HashStable_Generic)] | |
| 761 | #[derive(Clone, Copy, Debug, HashStable)] | |
| 762 | 762 | pub enum GenericBound<'hir> { |
| 763 | 763 | Trait(PolyTraitRef<'hir>), |
| 764 | 764 | Outlives(&'hir Lifetime), |
| ... | ... | @@ -784,7 +784,7 @@ impl GenericBound<'_> { |
| 784 | 784 | |
| 785 | 785 | pub type GenericBounds<'hir> = &'hir [GenericBound<'hir>]; |
| 786 | 786 | |
| 787 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable_Generic, Debug)] | |
| 787 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable, Debug)] | |
| 788 | 788 | pub enum MissingLifetimeKind { |
| 789 | 789 | /// An explicit `'_`. |
| 790 | 790 | Underscore, |
| ... | ... | @@ -796,7 +796,7 @@ pub enum MissingLifetimeKind { |
| 796 | 796 | Brackets, |
| 797 | 797 | } |
| 798 | 798 | |
| 799 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 799 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 800 | 800 | pub enum LifetimeParamKind { |
| 801 | 801 | // Indicates that the lifetime definition was explicitly declared (e.g., in |
| 802 | 802 | // `fn foo<'a>(x: &'a u8) -> &'a u8 { x }`). |
| ... | ... | @@ -810,7 +810,7 @@ pub enum LifetimeParamKind { |
| 810 | 810 | Error, |
| 811 | 811 | } |
| 812 | 812 | |
| 813 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 813 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 814 | 814 | pub enum GenericParamKind<'hir> { |
| 815 | 815 | /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`). |
| 816 | 816 | Lifetime { |
| ... | ... | @@ -827,7 +827,7 @@ pub enum GenericParamKind<'hir> { |
| 827 | 827 | }, |
| 828 | 828 | } |
| 829 | 829 | |
| 830 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 830 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 831 | 831 | pub struct GenericParam<'hir> { |
| 832 | 832 | #[stable_hasher(ignore)] |
| 833 | 833 | pub hir_id: HirId, |
| ... | ... | @@ -866,7 +866,7 @@ impl<'hir> GenericParam<'hir> { |
| 866 | 866 | /// early-bound (but can be a late-bound lifetime in functions, for example), |
| 867 | 867 | /// or from a `for<...>` binder, in which case it's late-bound (and notably, |
| 868 | 868 | /// does not show up in the parent item's generics). |
| 869 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 869 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 870 | 870 | pub enum GenericParamSource { |
| 871 | 871 | // Early or late-bound parameters defined on an item |
| 872 | 872 | Generics, |
| ... | ... | @@ -884,7 +884,7 @@ pub struct GenericParamCount { |
| 884 | 884 | |
| 885 | 885 | /// Represents lifetimes and type parameters attached to a declaration |
| 886 | 886 | /// of a function, enum, trait, etc. |
| 887 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 887 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 888 | 888 | pub struct Generics<'hir> { |
| 889 | 889 | pub params: &'hir [GenericParam<'hir>], |
| 890 | 890 | pub predicates: &'hir [WherePredicate<'hir>], |
| ... | ... | @@ -1091,7 +1091,7 @@ impl<'hir> Generics<'hir> { |
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | /// A single predicate in a where-clause. |
| 1094 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1094 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1095 | 1095 | pub struct WherePredicate<'hir> { |
| 1096 | 1096 | #[stable_hasher(ignore)] |
| 1097 | 1097 | pub hir_id: HirId, |
| ... | ... | @@ -1100,7 +1100,7 @@ pub struct WherePredicate<'hir> { |
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | /// The kind of a single predicate in a where-clause. |
| 1103 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1103 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1104 | 1104 | pub enum WherePredicateKind<'hir> { |
| 1105 | 1105 | /// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`). |
| 1106 | 1106 | BoundPredicate(WhereBoundPredicate<'hir>), |
| ... | ... | @@ -1128,7 +1128,7 @@ impl<'hir> WherePredicateKind<'hir> { |
| 1128 | 1128 | } |
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | #[derive(Copy, Clone, Debug, HashStable_Generic, PartialEq, Eq)] | |
| 1131 | #[derive(Copy, Clone, Debug, HashStable, PartialEq, Eq)] | |
| 1132 | 1132 | pub enum PredicateOrigin { |
| 1133 | 1133 | WhereClause, |
| 1134 | 1134 | GenericParam, |
| ... | ... | @@ -1136,7 +1136,7 @@ pub enum PredicateOrigin { |
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | /// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`). |
| 1139 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1139 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1140 | 1140 | pub struct WhereBoundPredicate<'hir> { |
| 1141 | 1141 | /// Origin of the predicate. |
| 1142 | 1142 | pub origin: PredicateOrigin, |
| ... | ... | @@ -1156,7 +1156,7 @@ impl<'hir> WhereBoundPredicate<'hir> { |
| 1156 | 1156 | } |
| 1157 | 1157 | |
| 1158 | 1158 | /// A lifetime predicate (e.g., `'a: 'b + 'c`). |
| 1159 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1159 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1160 | 1160 | pub struct WhereRegionPredicate<'hir> { |
| 1161 | 1161 | pub in_where_clause: bool, |
| 1162 | 1162 | pub lifetime: &'hir Lifetime, |
| ... | ... | @@ -1171,7 +1171,7 @@ impl<'hir> WhereRegionPredicate<'hir> { |
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | 1173 | /// An equality predicate (e.g., `T = int`); currently unsupported. |
| 1174 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1174 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1175 | 1175 | pub struct WhereEqPredicate<'hir> { |
| 1176 | 1176 | pub lhs_ty: &'hir Ty<'hir>, |
| 1177 | 1177 | pub rhs_ty: &'hir Ty<'hir>, |
| ... | ... | @@ -1187,7 +1187,7 @@ pub struct ParentedNode<'tcx> { |
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | 1189 | /// Arguments passed to an attribute macro. |
| 1190 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable)] | |
| 1190 | #[derive(Clone, Debug, HashStable, Encodable, Decodable)] | |
| 1191 | 1191 | pub enum AttrArgs { |
| 1192 | 1192 | /// No arguments: `#[attr]`. |
| 1193 | 1193 | Empty, |
| ... | ... | @@ -1202,7 +1202,7 @@ pub enum AttrArgs { |
| 1202 | 1202 | }, |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable)] | |
| 1205 | #[derive(Clone, Debug, HashStable, Encodable, Decodable)] | |
| 1206 | 1206 | pub struct AttrPath { |
| 1207 | 1207 | pub segments: Box<[Symbol]>, |
| 1208 | 1208 | pub span: Span, |
| ... | ... | @@ -1238,7 +1238,7 @@ impl fmt::Display for AttrPath { |
| 1238 | 1238 | } |
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | #[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable)] | |
| 1241 | #[derive(Clone, Debug, HashStable, Encodable, Decodable)] | |
| 1242 | 1242 | pub struct AttrItem { |
| 1243 | 1243 | // Not lowered to hir::Path because we have no NodeId to resolve to. |
| 1244 | 1244 | pub path: AttrPath, |
| ... | ... | @@ -1251,7 +1251,7 @@ pub struct AttrItem { |
| 1251 | 1251 | pub span: Span, |
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | /// The derived implementation of [`HashStable_Generic`] on [`Attribute`]s shouldn't hash | |
| 1254 | /// The derived implementation of [`HashStable`] on [`Attribute`]s shouldn't hash | |
| 1255 | 1255 | /// [`AttrId`]s. By wrapping them in this, we make sure we never do. |
| 1256 | 1256 | #[derive(Copy, Debug, Encodable, Decodable, Clone)] |
| 1257 | 1257 | pub struct HashIgnoredAttrId { |
| ... | ... | @@ -1260,7 +1260,7 @@ pub struct HashIgnoredAttrId { |
| 1260 | 1260 | |
| 1261 | 1261 | /// Many functions on this type have their documentation in the [`AttributeExt`] trait, |
| 1262 | 1262 | /// since they defer their implementation directly to that trait. |
| 1263 | #[derive(Clone, Debug, Encodable, Decodable, HashStable_Generic)] | |
| 1263 | #[derive(Clone, Debug, Encodable, Decodable, HashStable)] | |
| 1264 | 1264 | pub enum Attribute { |
| 1265 | 1265 | /// A parsed built-in attribute. |
| 1266 | 1266 | /// |
| ... | ... | @@ -1619,7 +1619,7 @@ impl fmt::Debug for OwnerNodes<'_> { |
| 1619 | 1619 | } |
| 1620 | 1620 | |
| 1621 | 1621 | /// Full information resulting from lowering an AST node. |
| 1622 | #[derive(Debug, HashStable_Generic)] | |
| 1622 | #[derive(Debug, HashStable)] | |
| 1623 | 1623 | pub struct OwnerInfo<'hir> { |
| 1624 | 1624 | /// Contents of the HIR. |
| 1625 | 1625 | pub nodes: OwnerNodes<'hir>, |
| ... | ... | @@ -1647,7 +1647,7 @@ impl<'tcx> OwnerInfo<'tcx> { |
| 1647 | 1647 | } |
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 1650 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 1651 | 1651 | pub enum MaybeOwner<'tcx> { |
| 1652 | 1652 | Owner(&'tcx OwnerInfo<'tcx>), |
| 1653 | 1653 | NonOwner(HirId), |
| ... | ... | @@ -1668,7 +1668,7 @@ impl<'tcx> MaybeOwner<'tcx> { |
| 1668 | 1668 | } |
| 1669 | 1669 | } |
| 1670 | 1670 | |
| 1671 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1671 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1672 | 1672 | pub struct Closure<'hir> { |
| 1673 | 1673 | pub def_id: LocalDefId, |
| 1674 | 1674 | pub binder: ClosureBinder, |
| ... | ... | @@ -1684,7 +1684,7 @@ pub struct Closure<'hir> { |
| 1684 | 1684 | pub kind: ClosureKind, |
| 1685 | 1685 | } |
| 1686 | 1686 | |
| 1687 | #[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable_Generic, Encodable, Decodable)] | |
| 1687 | #[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable, Encodable, Decodable)] | |
| 1688 | 1688 | pub enum ClosureKind { |
| 1689 | 1689 | /// This is a plain closure expression. |
| 1690 | 1690 | Closure, |
| ... | ... | @@ -1703,7 +1703,7 @@ pub enum ClosureKind { |
| 1703 | 1703 | /// A block of statements `{ .. }`, which may have a label (in this case the |
| 1704 | 1704 | /// `targeted_by_break` field will be `true`) and may be `unsafe` by means of |
| 1705 | 1705 | /// the `rules` being anything but `DefaultBlock`. |
| 1706 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1706 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1707 | 1707 | pub struct Block<'hir> { |
| 1708 | 1708 | /// Statements in a block. |
| 1709 | 1709 | pub stmts: &'hir [Stmt<'hir>], |
| ... | ... | @@ -1732,13 +1732,13 @@ impl<'hir> Block<'hir> { |
| 1732 | 1732 | } |
| 1733 | 1733 | } |
| 1734 | 1734 | |
| 1735 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1735 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1736 | 1736 | pub struct TyFieldPath { |
| 1737 | 1737 | pub variant: Option<Ident>, |
| 1738 | 1738 | pub field: Ident, |
| 1739 | 1739 | } |
| 1740 | 1740 | |
| 1741 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1741 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1742 | 1742 | pub struct TyPat<'hir> { |
| 1743 | 1743 | #[stable_hasher(ignore)] |
| 1744 | 1744 | pub hir_id: HirId, |
| ... | ... | @@ -1746,7 +1746,7 @@ pub struct TyPat<'hir> { |
| 1746 | 1746 | pub span: Span, |
| 1747 | 1747 | } |
| 1748 | 1748 | |
| 1749 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1749 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1750 | 1750 | pub struct Pat<'hir> { |
| 1751 | 1751 | #[stable_hasher(ignore)] |
| 1752 | 1752 | pub hir_id: HirId, |
| ... | ... | @@ -1894,7 +1894,7 @@ impl<'hir> Pat<'hir> { |
| 1894 | 1894 | /// Patterns like the fields of Foo `{ x, ref y, ref mut z }` |
| 1895 | 1895 | /// are treated the same as` x: x, y: ref y, z: ref mut z`, |
| 1896 | 1896 | /// except `is_shorthand` is true. |
| 1897 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1897 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1898 | 1898 | pub struct PatField<'hir> { |
| 1899 | 1899 | #[stable_hasher(ignore)] |
| 1900 | 1900 | pub hir_id: HirId, |
| ... | ... | @@ -1906,7 +1906,7 @@ pub struct PatField<'hir> { |
| 1906 | 1906 | pub span: Span, |
| 1907 | 1907 | } |
| 1908 | 1908 | |
| 1909 | #[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic, Hash, Eq, Encodable, Decodable)] | |
| 1909 | #[derive(Copy, Clone, PartialEq, Debug, HashStable, Hash, Eq, Encodable, Decodable)] | |
| 1910 | 1910 | pub enum RangeEnd { |
| 1911 | 1911 | Included, |
| 1912 | 1912 | Excluded, |
| ... | ... | @@ -1924,7 +1924,7 @@ impl fmt::Display for RangeEnd { |
| 1924 | 1924 | // Equivalent to `Option<usize>`. That type takes up 16 bytes on 64-bit, but |
| 1925 | 1925 | // this type only takes up 4 bytes, at the cost of being restricted to a |
| 1926 | 1926 | // maximum value of `u32::MAX - 1`. In practice, this is more than enough. |
| 1927 | #[derive(Clone, Copy, PartialEq, Eq, Hash, HashStable_Generic)] | |
| 1927 | #[derive(Clone, Copy, PartialEq, Eq, Hash, HashStable)] | |
| 1928 | 1928 | pub struct DotDotPos(u32); |
| 1929 | 1929 | |
| 1930 | 1930 | impl DotDotPos { |
| ... | ... | @@ -1950,7 +1950,7 @@ impl fmt::Debug for DotDotPos { |
| 1950 | 1950 | } |
| 1951 | 1951 | } |
| 1952 | 1952 | |
| 1953 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1953 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1954 | 1954 | pub struct PatExpr<'hir> { |
| 1955 | 1955 | #[stable_hasher(ignore)] |
| 1956 | 1956 | pub hir_id: HirId, |
| ... | ... | @@ -1958,7 +1958,7 @@ pub struct PatExpr<'hir> { |
| 1958 | 1958 | pub kind: PatExprKind<'hir>, |
| 1959 | 1959 | } |
| 1960 | 1960 | |
| 1961 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1961 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1962 | 1962 | pub enum PatExprKind<'hir> { |
| 1963 | 1963 | Lit { |
| 1964 | 1964 | lit: Lit, |
| ... | ... | @@ -1968,7 +1968,7 @@ pub enum PatExprKind<'hir> { |
| 1968 | 1968 | Path(QPath<'hir>), |
| 1969 | 1969 | } |
| 1970 | 1970 | |
| 1971 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1971 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1972 | 1972 | pub enum TyPatKind<'hir> { |
| 1973 | 1973 | /// A range pattern (e.g., `1..=2` or `1..2`). |
| 1974 | 1974 | Range(&'hir ConstArg<'hir>, &'hir ConstArg<'hir>), |
| ... | ... | @@ -1983,7 +1983,7 @@ pub enum TyPatKind<'hir> { |
| 1983 | 1983 | Err(ErrorGuaranteed), |
| 1984 | 1984 | } |
| 1985 | 1985 | |
| 1986 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 1986 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 1987 | 1987 | pub enum PatKind<'hir> { |
| 1988 | 1988 | /// A missing pattern, e.g. for an anonymous param in a bare fn like `fn f(u32)`. |
| 1989 | 1989 | Missing, |
| ... | ... | @@ -2058,7 +2058,7 @@ pub enum PatKind<'hir> { |
| 2058 | 2058 | } |
| 2059 | 2059 | |
| 2060 | 2060 | /// A statement. |
| 2061 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 2061 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 2062 | 2062 | pub struct Stmt<'hir> { |
| 2063 | 2063 | #[stable_hasher(ignore)] |
| 2064 | 2064 | pub hir_id: HirId, |
| ... | ... | @@ -2067,7 +2067,7 @@ pub struct Stmt<'hir> { |
| 2067 | 2067 | } |
| 2068 | 2068 | |
| 2069 | 2069 | /// The contents of a statement. |
| 2070 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 2070 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 2071 | 2071 | pub enum StmtKind<'hir> { |
| 2072 | 2072 | /// A local (`let`) binding. |
| 2073 | 2073 | Let(&'hir LetStmt<'hir>), |
| ... | ... | @@ -2083,7 +2083,7 @@ pub enum StmtKind<'hir> { |
| 2083 | 2083 | } |
| 2084 | 2084 | |
| 2085 | 2085 | /// Represents a `let` statement (i.e., `let <pat>:<ty> = <init>;`). |
| 2086 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 2086 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 2087 | 2087 | pub struct LetStmt<'hir> { |
| 2088 | 2088 | /// Span of `super` in `super let`. |
| 2089 | 2089 | pub super_: Option<Span>, |
| ... | ... | @@ -2105,7 +2105,7 @@ pub struct LetStmt<'hir> { |
| 2105 | 2105 | |
| 2106 | 2106 | /// Represents a single arm of a `match` expression, e.g. |
| 2107 | 2107 | /// `<pat> (if <guard>) => <body>`. |
| 2108 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 2108 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 2109 | 2109 | pub struct Arm<'hir> { |
| 2110 | 2110 | #[stable_hasher(ignore)] |
| 2111 | 2111 | pub hir_id: HirId, |
| ... | ... | @@ -2123,7 +2123,7 @@ pub struct Arm<'hir> { |
| 2123 | 2123 | /// |
| 2124 | 2124 | /// In an `if let`, imagine it as `if (let <pat> = <expr>) { ... }`; in a let-else, it is part of |
| 2125 | 2125 | /// the desugaring to if-let. Only let-else supports the type annotation at present. |
| 2126 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 2126 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 2127 | 2127 | pub struct LetExpr<'hir> { |
| 2128 | 2128 | pub span: Span, |
| 2129 | 2129 | pub pat: &'hir Pat<'hir>, |
| ... | ... | @@ -2134,7 +2134,7 @@ pub struct LetExpr<'hir> { |
| 2134 | 2134 | pub recovered: ast::Recovered, |
| 2135 | 2135 | } |
| 2136 | 2136 | |
| 2137 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 2137 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 2138 | 2138 | pub struct ExprField<'hir> { |
| 2139 | 2139 | #[stable_hasher(ignore)] |
| 2140 | 2140 | pub hir_id: HirId, |
| ... | ... | @@ -2144,19 +2144,19 @@ pub struct ExprField<'hir> { |
| 2144 | 2144 | pub is_shorthand: bool, |
| 2145 | 2145 | } |
| 2146 | 2146 | |
| 2147 | #[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic)] | |
| 2147 | #[derive(Copy, Clone, PartialEq, Debug, HashStable)] | |
| 2148 | 2148 | pub enum BlockCheckMode { |
| 2149 | 2149 | DefaultBlock, |
| 2150 | 2150 | UnsafeBlock(UnsafeSource), |
| 2151 | 2151 | } |
| 2152 | 2152 | |
| 2153 | #[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic)] | |
| 2153 | #[derive(Copy, Clone, PartialEq, Debug, HashStable)] | |
| 2154 | 2154 | pub enum UnsafeSource { |
| 2155 | 2155 | CompilerGenerated, |
| 2156 | 2156 | UserProvided, |
| 2157 | 2157 | } |
| 2158 | 2158 | |
| 2159 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)] | |
| 2159 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable)] | |
| 2160 | 2160 | pub struct BodyId { |
| 2161 | 2161 | pub hir_id: HirId, |
| 2162 | 2162 | } |
| ... | ... | @@ -2182,7 +2182,7 @@ pub struct BodyId { |
| 2182 | 2182 | /// |
| 2183 | 2183 | /// All bodies have an **owner**, which can be accessed via the HIR |
| 2184 | 2184 | /// map using `body_owner_def_id()`. |
| 2185 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 2185 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 2186 | 2186 | pub struct Body<'hir> { |
| 2187 | 2187 | pub params: &'hir [Param<'hir>], |
| 2188 | 2188 | pub value: &'hir Expr<'hir>, |
| ... | ... | @@ -2195,7 +2195,7 @@ impl<'hir> Body<'hir> { |
| 2195 | 2195 | } |
| 2196 | 2196 | |
| 2197 | 2197 | /// The type of source expression that caused this coroutine to be created. |
| 2198 | #[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable_Generic, Encodable, Decodable)] | |
| 2198 | #[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable, Encodable, Decodable)] | |
| 2199 | 2199 | pub enum CoroutineKind { |
| 2200 | 2200 | /// A coroutine that comes from a desugaring. |
| 2201 | 2201 | Desugared(CoroutineDesugaring, CoroutineSource), |
| ... | ... | @@ -2245,7 +2245,7 @@ impl fmt::Display for CoroutineKind { |
| 2245 | 2245 | /// |
| 2246 | 2246 | /// This helps error messages but is also used to drive coercions in |
| 2247 | 2247 | /// type-checking (see #60424). |
| 2248 | #[derive(Clone, PartialEq, Eq, Hash, Debug, Copy, HashStable_Generic, Encodable, Decodable)] | |
| 2248 | #[derive(Clone, PartialEq, Eq, Hash, Debug, Copy, HashStable, Encodable, Decodable)] | |
| 2249 | 2249 | pub enum CoroutineSource { |
| 2250 | 2250 | /// An explicit `async`/`gen` block written by the user. |
| 2251 | 2251 | Block, |
| ... | ... | @@ -2268,7 +2268,7 @@ impl fmt::Display for CoroutineSource { |
| 2268 | 2268 | } |
| 2269 | 2269 | } |
| 2270 | 2270 | |
| 2271 | #[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable_Generic, Encodable, Decodable)] | |
| 2271 | #[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable, Encodable, Decodable)] | |
| 2272 | 2272 | pub enum CoroutineDesugaring { |
| 2273 | 2273 | /// An explicit `async` block or the body of an `async` function. |
| 2274 | 2274 | Async, |
| ... | ... | @@ -2408,7 +2408,7 @@ pub type Lit = Spanned<LitKind>; |
| 2408 | 2408 | /// |
| 2409 | 2409 | /// You can check if this anon const is a default in a const param |
| 2410 | 2410 | /// `const N: usize = { ... }` with `tcx.hir_opt_const_param_default_param_def_id(..)` |
| 2411 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 2411 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 2412 | 2412 | pub struct AnonConst { |
| 2413 | 2413 | #[stable_hasher(ignore)] |
| 2414 | 2414 | pub hir_id: HirId, |
| ... | ... | @@ -2418,7 +2418,7 @@ pub struct AnonConst { |
| 2418 | 2418 | } |
| 2419 | 2419 | |
| 2420 | 2420 | /// An inline constant expression `const { something }`. |
| 2421 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 2421 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 2422 | 2422 | pub struct ConstBlock { |
| 2423 | 2423 | #[stable_hasher(ignore)] |
| 2424 | 2424 | pub hir_id: HirId, |
| ... | ... | @@ -2434,7 +2434,7 @@ pub struct ConstBlock { |
| 2434 | 2434 | /// the compiler and the reference. |
| 2435 | 2435 | /// |
| 2436 | 2436 | /// [rust lang reference]: https://doc.rust-lang.org/reference/expressions.html |
| 2437 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 2437 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 2438 | 2438 | pub struct Expr<'hir> { |
| 2439 | 2439 | #[stable_hasher(ignore)] |
| 2440 | 2440 | pub hir_id: HirId, |
| ... | ... | @@ -2793,7 +2793,7 @@ pub fn expr_needs_parens(expr: &Expr<'_>) -> bool { |
| 2793 | 2793 | } |
| 2794 | 2794 | } |
| 2795 | 2795 | |
| 2796 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 2796 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 2797 | 2797 | pub enum ExprKind<'hir> { |
| 2798 | 2798 | /// Allow anonymous constants from an inline `const` block |
| 2799 | 2799 | ConstBlock(ConstBlock), |
| ... | ... | @@ -2932,7 +2932,7 @@ pub enum ExprKind<'hir> { |
| 2932 | 2932 | Err(rustc_span::ErrorGuaranteed), |
| 2933 | 2933 | } |
| 2934 | 2934 | |
| 2935 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 2935 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 2936 | 2936 | pub enum StructTailExpr<'hir> { |
| 2937 | 2937 | /// A struct expression where all the fields are explicitly enumerated: `Foo { a, b }`. |
| 2938 | 2938 | None, |
| ... | ... | @@ -2956,7 +2956,7 @@ pub enum StructTailExpr<'hir> { |
| 2956 | 2956 | /// To resolve the path to a `DefId`, call [`qpath_res`]. |
| 2957 | 2957 | /// |
| 2958 | 2958 | /// [`qpath_res`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.qpath_res |
| 2959 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 2959 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 2960 | 2960 | pub enum QPath<'hir> { |
| 2961 | 2961 | /// Path to a definition, optionally "fully-qualified" with a `Self` |
| 2962 | 2962 | /// type, if the path points to an associated item in a trait. |
| ... | ... | @@ -2995,7 +2995,7 @@ impl<'hir> QPath<'hir> { |
| 2995 | 2995 | } |
| 2996 | 2996 | |
| 2997 | 2997 | /// Hints at the original code for a let statement. |
| 2998 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 2998 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 2999 | 2999 | pub enum LocalSource { |
| 3000 | 3000 | /// A `match _ { .. }`. |
| 3001 | 3001 | Normal, |
| ... | ... | @@ -3019,7 +3019,7 @@ pub enum LocalSource { |
| 3019 | 3019 | } |
| 3020 | 3020 | |
| 3021 | 3021 | /// Hints at the original code for a `match _ { .. }`. |
| 3022 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic, Encodable, Decodable)] | |
| 3022 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable, Encodable, Decodable)] | |
| 3023 | 3023 | pub enum MatchSource { |
| 3024 | 3024 | /// A `match _ { .. }`. |
| 3025 | 3025 | Normal, |
| ... | ... | @@ -3051,7 +3051,7 @@ impl MatchSource { |
| 3051 | 3051 | } |
| 3052 | 3052 | |
| 3053 | 3053 | /// The loop type that yielded an `ExprKind::Loop`. |
| 3054 | #[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic)] | |
| 3054 | #[derive(Copy, Clone, PartialEq, Debug, HashStable)] | |
| 3055 | 3055 | pub enum LoopSource { |
| 3056 | 3056 | /// A `loop { .. }` loop. |
| 3057 | 3057 | Loop, |
| ... | ... | @@ -3071,7 +3071,7 @@ impl LoopSource { |
| 3071 | 3071 | } |
| 3072 | 3072 | } |
| 3073 | 3073 | |
| 3074 | #[derive(Copy, Clone, Debug, PartialEq, HashStable_Generic)] | |
| 3074 | #[derive(Copy, Clone, Debug, PartialEq, HashStable)] | |
| 3075 | 3075 | pub enum LoopIdError { |
| 3076 | 3076 | OutsideLoopScope, |
| 3077 | 3077 | UnlabeledCfInWhileCondition, |
| ... | ... | @@ -3090,7 +3090,7 @@ impl fmt::Display for LoopIdError { |
| 3090 | 3090 | } |
| 3091 | 3091 | } |
| 3092 | 3092 | |
| 3093 | #[derive(Copy, Clone, Debug, PartialEq, HashStable_Generic)] | |
| 3093 | #[derive(Copy, Clone, Debug, PartialEq, HashStable)] | |
| 3094 | 3094 | pub struct Destination { |
| 3095 | 3095 | /// This is `Some(_)` iff there is an explicit user-specified 'label |
| 3096 | 3096 | pub label: Option<Label>, |
| ... | ... | @@ -3101,7 +3101,7 @@ pub struct Destination { |
| 3101 | 3101 | } |
| 3102 | 3102 | |
| 3103 | 3103 | /// The yield kind that caused an `ExprKind::Yield`. |
| 3104 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 3104 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 3105 | 3105 | pub enum YieldSource { |
| 3106 | 3106 | /// An `<expr>.await`. |
| 3107 | 3107 | Await { expr: Option<HirId> }, |
| ... | ... | @@ -3120,7 +3120,7 @@ impl fmt::Display for YieldSource { |
| 3120 | 3120 | |
| 3121 | 3121 | // N.B., if you change this, you'll probably want to change the corresponding |
| 3122 | 3122 | // type structure in middle/ty.rs as well. |
| 3123 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3123 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3124 | 3124 | pub struct MutTy<'hir> { |
| 3125 | 3125 | pub ty: &'hir Ty<'hir>, |
| 3126 | 3126 | pub mutbl: Mutability, |
| ... | ... | @@ -3128,7 +3128,7 @@ pub struct MutTy<'hir> { |
| 3128 | 3128 | |
| 3129 | 3129 | /// Represents a function's signature in a trait declaration, |
| 3130 | 3130 | /// trait implementation, or a free function. |
| 3131 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3131 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3132 | 3132 | pub struct FnSig<'hir> { |
| 3133 | 3133 | pub header: FnHeader, |
| 3134 | 3134 | pub decl: &'hir FnDecl<'hir>, |
| ... | ... | @@ -3138,7 +3138,7 @@ pub struct FnSig<'hir> { |
| 3138 | 3138 | // The bodies for items are stored "out of line", in a separate |
| 3139 | 3139 | // hashmap in the `Crate`. Here we just record the hir-id of the item |
| 3140 | 3140 | // so it can fetched later. |
| 3141 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 3141 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)] | |
| 3142 | 3142 | pub struct TraitItemId { |
| 3143 | 3143 | pub owner_id: OwnerId, |
| 3144 | 3144 | } |
| ... | ... | @@ -3155,7 +3155,7 @@ impl TraitItemId { |
| 3155 | 3155 | /// possibly including a default implementation. A trait item is |
| 3156 | 3156 | /// either required (meaning it doesn't have an implementation, just a |
| 3157 | 3157 | /// signature) or provided (meaning it has a default implementation). |
| 3158 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3158 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3159 | 3159 | pub struct TraitItem<'hir> { |
| 3160 | 3160 | pub ident: Ident, |
| 3161 | 3161 | pub owner_id: OwnerId, |
| ... | ... | @@ -3219,7 +3219,7 @@ impl<'hir> TraitItem<'hir> { |
| 3219 | 3219 | } |
| 3220 | 3220 | |
| 3221 | 3221 | /// Represents a trait method's body (or just argument names). |
| 3222 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3222 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3223 | 3223 | pub enum TraitFn<'hir> { |
| 3224 | 3224 | /// No default body in the trait, just a signature. |
| 3225 | 3225 | Required(&'hir [Option<Ident>]), |
| ... | ... | @@ -3228,7 +3228,7 @@ pub enum TraitFn<'hir> { |
| 3228 | 3228 | Provided(BodyId), |
| 3229 | 3229 | } |
| 3230 | 3230 | |
| 3231 | #[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)] | |
| 3231 | #[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable)] | |
| 3232 | 3232 | pub enum IsTypeConst { |
| 3233 | 3233 | No, |
| 3234 | 3234 | Yes, |
| ... | ... | @@ -3247,7 +3247,7 @@ impl From<IsTypeConst> for bool { |
| 3247 | 3247 | } |
| 3248 | 3248 | |
| 3249 | 3249 | /// Represents a trait method or associated constant or type |
| 3250 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3250 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3251 | 3251 | pub enum TraitItemKind<'hir> { |
| 3252 | 3252 | // FIXME(mgca) eventually want to move the option that is around `ConstItemRhs<'hir>` |
| 3253 | 3253 | // into `ConstItemRhs`, much like `ast::ConstItemRhsKind`, but for now mark whether |
| ... | ... | @@ -3264,7 +3264,7 @@ pub enum TraitItemKind<'hir> { |
| 3264 | 3264 | // The bodies for items are stored "out of line", in a separate |
| 3265 | 3265 | // hashmap in the `Crate`. Here we just record the hir-id of the item |
| 3266 | 3266 | // so it can fetched later. |
| 3267 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 3267 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)] | |
| 3268 | 3268 | pub struct ImplItemId { |
| 3269 | 3269 | pub owner_id: OwnerId, |
| 3270 | 3270 | } |
| ... | ... | @@ -3280,7 +3280,7 @@ impl ImplItemId { |
| 3280 | 3280 | /// Represents an associated item within an impl block. |
| 3281 | 3281 | /// |
| 3282 | 3282 | /// Refer to [`Impl`] for an impl block declaration. |
| 3283 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3283 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3284 | 3284 | pub struct ImplItem<'hir> { |
| 3285 | 3285 | pub ident: Ident, |
| 3286 | 3286 | pub owner_id: OwnerId, |
| ... | ... | @@ -3291,7 +3291,7 @@ pub struct ImplItem<'hir> { |
| 3291 | 3291 | pub has_delayed_lints: bool, |
| 3292 | 3292 | } |
| 3293 | 3293 | |
| 3294 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3294 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3295 | 3295 | pub enum ImplItemImplKind { |
| 3296 | 3296 | Inherent { |
| 3297 | 3297 | vis_span: Span, |
| ... | ... | @@ -3329,7 +3329,7 @@ impl<'hir> ImplItem<'hir> { |
| 3329 | 3329 | } |
| 3330 | 3330 | |
| 3331 | 3331 | /// Represents various kinds of content within an `impl`. |
| 3332 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3332 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3333 | 3333 | pub enum ImplItemKind<'hir> { |
| 3334 | 3334 | /// An associated constant of the given type, set to the constant result |
| 3335 | 3335 | /// of the expression. |
| ... | ... | @@ -3350,7 +3350,7 @@ pub enum ImplItemKind<'hir> { |
| 3350 | 3350 | /// * the `RetTy` in `Trait(ArgTy, ArgTy) -> RetTy` |
| 3351 | 3351 | /// * the `C = { Ct }` in `Trait<C = { Ct }>` (feature `min_generic_const_args`) |
| 3352 | 3352 | /// * the `f(..): Bound` in `Trait<f(..): Bound>` (feature `return_type_notation`) |
| 3353 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3353 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3354 | 3354 | pub struct AssocItemConstraint<'hir> { |
| 3355 | 3355 | #[stable_hasher(ignore)] |
| 3356 | 3356 | pub hir_id: HirId, |
| ... | ... | @@ -3378,7 +3378,7 @@ impl<'hir> AssocItemConstraint<'hir> { |
| 3378 | 3378 | } |
| 3379 | 3379 | } |
| 3380 | 3380 | |
| 3381 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3381 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3382 | 3382 | pub enum Term<'hir> { |
| 3383 | 3383 | Ty(&'hir Ty<'hir>), |
| 3384 | 3384 | Const(&'hir ConstArg<'hir>), |
| ... | ... | @@ -3397,7 +3397,7 @@ impl<'hir> From<&'hir ConstArg<'hir>> for Term<'hir> { |
| 3397 | 3397 | } |
| 3398 | 3398 | |
| 3399 | 3399 | /// The kind of [associated item constraint][AssocItemConstraint]. |
| 3400 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3400 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3401 | 3401 | pub enum AssocItemConstraintKind<'hir> { |
| 3402 | 3402 | /// An equality constraint for an associated item (e.g., `AssocTy = Ty` in `Trait<AssocTy = Ty>`). |
| 3403 | 3403 | /// |
| ... | ... | @@ -3422,14 +3422,14 @@ impl<'hir> AssocItemConstraintKind<'hir> { |
| 3422 | 3422 | /// An uninhabited enum used to make `Infer` variants on [`Ty`] and [`ConstArg`] be |
| 3423 | 3423 | /// unreachable. Zero-Variant enums are guaranteed to have the same layout as the never |
| 3424 | 3424 | /// type. |
| 3425 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3425 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3426 | 3426 | pub enum AmbigArg {} |
| 3427 | 3427 | |
| 3428 | 3428 | /// Represents a type in the `HIR`. |
| 3429 | 3429 | /// |
| 3430 | 3430 | /// For an explanation of the `Unambig` generic parameter see the dev-guide: |
| 3431 | 3431 | /// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html> |
| 3432 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3432 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3433 | 3433 | #[repr(C)] |
| 3434 | 3434 | pub struct Ty<'hir, Unambig = ()> { |
| 3435 | 3435 | #[stable_hasher(ignore)] |
| ... | ... | @@ -3569,7 +3569,7 @@ impl<'hir> Ty<'hir> { |
| 3569 | 3569 | } |
| 3570 | 3570 | |
| 3571 | 3571 | /// Not represented directly in the AST; referred to by name through a `ty_path`. |
| 3572 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)] | |
| 3572 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)] | |
| 3573 | 3573 | pub enum PrimTy { |
| 3574 | 3574 | Int(IntTy), |
| 3575 | 3575 | Uint(UintTy), |
| ... | ... | @@ -3659,7 +3659,7 @@ impl PrimTy { |
| 3659 | 3659 | } |
| 3660 | 3660 | } |
| 3661 | 3661 | |
| 3662 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3662 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3663 | 3663 | pub struct FnPtrTy<'hir> { |
| 3664 | 3664 | pub safety: Safety, |
| 3665 | 3665 | pub abi: ExternAbi, |
| ... | ... | @@ -3670,13 +3670,13 @@ pub struct FnPtrTy<'hir> { |
| 3670 | 3670 | pub param_idents: &'hir [Option<Ident>], |
| 3671 | 3671 | } |
| 3672 | 3672 | |
| 3673 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3673 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3674 | 3674 | pub struct UnsafeBinderTy<'hir> { |
| 3675 | 3675 | pub generic_params: &'hir [GenericParam<'hir>], |
| 3676 | 3676 | pub inner_ty: &'hir Ty<'hir>, |
| 3677 | 3677 | } |
| 3678 | 3678 | |
| 3679 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3679 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3680 | 3680 | pub struct OpaqueTy<'hir> { |
| 3681 | 3681 | #[stable_hasher(ignore)] |
| 3682 | 3682 | pub hir_id: HirId, |
| ... | ... | @@ -3686,7 +3686,7 @@ pub struct OpaqueTy<'hir> { |
| 3686 | 3686 | pub span: Span, |
| 3687 | 3687 | } |
| 3688 | 3688 | |
| 3689 | #[derive(Debug, Clone, Copy, HashStable_Generic, Encodable, Decodable)] | |
| 3689 | #[derive(Debug, Clone, Copy, HashStable, Encodable, Decodable)] | |
| 3690 | 3690 | pub enum PreciseCapturingArgKind<T, U> { |
| 3691 | 3691 | Lifetime(T), |
| 3692 | 3692 | /// Non-lifetime argument (type or const) |
| ... | ... | @@ -3716,7 +3716,7 @@ impl PreciseCapturingArg<'_> { |
| 3716 | 3716 | /// resolution to. Lifetimes don't have this problem, and for them, it's actually |
| 3717 | 3717 | /// kind of detrimental to use a custom node type versus just using [`Lifetime`], |
| 3718 | 3718 | /// since resolve_bound_vars operates on `Lifetime`s. |
| 3719 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3719 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3720 | 3720 | pub struct PreciseCapturingNonLifetimeArg { |
| 3721 | 3721 | #[stable_hasher(ignore)] |
| 3722 | 3722 | pub hir_id: HirId, |
| ... | ... | @@ -3725,7 +3725,7 @@ pub struct PreciseCapturingNonLifetimeArg { |
| 3725 | 3725 | } |
| 3726 | 3726 | |
| 3727 | 3727 | #[derive(Copy, Clone, PartialEq, Eq, Debug)] |
| 3728 | #[derive(HashStable_Generic, Encodable, Decodable)] | |
| 3728 | #[derive(HashStable, Encodable, Decodable)] | |
| 3729 | 3729 | pub enum RpitContext { |
| 3730 | 3730 | Trait, |
| 3731 | 3731 | TraitImpl, |
| ... | ... | @@ -3733,7 +3733,7 @@ pub enum RpitContext { |
| 3733 | 3733 | |
| 3734 | 3734 | /// From whence the opaque type came. |
| 3735 | 3735 | #[derive(Copy, Clone, PartialEq, Eq, Debug)] |
| 3736 | #[derive(HashStable_Generic, Encodable, Decodable)] | |
| 3736 | #[derive(HashStable, Encodable, Decodable)] | |
| 3737 | 3737 | pub enum OpaqueTyOrigin<D> { |
| 3738 | 3738 | /// `-> impl Trait` |
| 3739 | 3739 | FnReturn { |
| ... | ... | @@ -3759,7 +3759,7 @@ pub enum OpaqueTyOrigin<D> { |
| 3759 | 3759 | } |
| 3760 | 3760 | |
| 3761 | 3761 | // Ids of parent (or child) path segment that contains user-specified args |
| 3762 | #[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)] | |
| 3762 | #[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable)] | |
| 3763 | 3763 | pub struct DelegationGenerics { |
| 3764 | 3764 | pub parent_args_segment_id: Option<HirId>, |
| 3765 | 3765 | pub child_args_segment_id: Option<HirId>, |
| ... | ... | @@ -3767,14 +3767,14 @@ pub struct DelegationGenerics { |
| 3767 | 3767 | pub propagate_self_ty: bool, |
| 3768 | 3768 | } |
| 3769 | 3769 | |
| 3770 | #[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)] | |
| 3770 | #[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable)] | |
| 3771 | 3771 | pub enum InferDelegationSig<'hir> { |
| 3772 | 3772 | Input(usize), |
| 3773 | 3773 | // Place generics info here, as we always specify output type for delegations. |
| 3774 | 3774 | Output(&'hir DelegationGenerics), |
| 3775 | 3775 | } |
| 3776 | 3776 | |
| 3777 | #[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)] | |
| 3777 | #[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable)] | |
| 3778 | 3778 | pub enum InferDelegation<'hir> { |
| 3779 | 3779 | /// Infer the type of this `DefId` through `tcx.type_of(def_id).instantiate_identity()`, |
| 3780 | 3780 | /// used for const types propagation. |
| ... | ... | @@ -3789,7 +3789,7 @@ pub enum InferDelegation<'hir> { |
| 3789 | 3789 | /// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html> |
| 3790 | 3790 | // SAFETY: `repr(u8)` is required so that `TyKind<()>` and `TyKind<!>` are layout compatible |
| 3791 | 3791 | #[repr(u8, C)] |
| 3792 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3792 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3793 | 3793 | pub enum TyKind<'hir, Unambig = ()> { |
| 3794 | 3794 | /// Actual type should be inherited from `DefId` signature |
| 3795 | 3795 | InferDelegation(InferDelegation<'hir>), |
| ... | ... | @@ -3840,7 +3840,7 @@ pub enum TyKind<'hir, Unambig = ()> { |
| 3840 | 3840 | Infer(Unambig), |
| 3841 | 3841 | } |
| 3842 | 3842 | |
| 3843 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3843 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3844 | 3844 | pub enum InlineAsmOperand<'hir> { |
| 3845 | 3845 | In { |
| 3846 | 3846 | reg: InlineAsmRegOrRegClass, |
| ... | ... | @@ -3899,7 +3899,7 @@ impl<'hir> InlineAsmOperand<'hir> { |
| 3899 | 3899 | } |
| 3900 | 3900 | } |
| 3901 | 3901 | |
| 3902 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3902 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3903 | 3903 | pub struct InlineAsm<'hir> { |
| 3904 | 3904 | pub asm_macro: ast::AsmMacro, |
| 3905 | 3905 | pub template: &'hir [InlineAsmTemplatePiece], |
| ... | ... | @@ -3916,7 +3916,7 @@ impl InlineAsm<'_> { |
| 3916 | 3916 | } |
| 3917 | 3917 | |
| 3918 | 3918 | /// Represents a parameter in a function header. |
| 3919 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 3919 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 3920 | 3920 | pub struct Param<'hir> { |
| 3921 | 3921 | #[stable_hasher(ignore)] |
| 3922 | 3922 | pub hir_id: HirId, |
| ... | ... | @@ -3928,7 +3928,7 @@ pub struct Param<'hir> { |
| 3928 | 3928 | /// Contains the packed non-type fields of a function declaration. |
| 3929 | 3929 | // FIXME(splat): add the splatted argument index as a u16 |
| 3930 | 3930 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 3931 | #[derive(Encodable, Decodable, HashStable_Generic)] | |
| 3931 | #[derive(Encodable, Decodable, HashStable)] | |
| 3932 | 3932 | pub struct FnDeclFlags { |
| 3933 | 3933 | /// Holds the c_variadic and lifetime_elision_allowed bitflags, and 3 bits for the `ImplicitSelfKind`. |
| 3934 | 3934 | flags: u8, |
| ... | ... | @@ -4037,7 +4037,7 @@ impl FnDeclFlags { |
| 4037 | 4037 | } |
| 4038 | 4038 | |
| 4039 | 4039 | /// Represents the header (not the body) of a function declaration. |
| 4040 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4040 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4041 | 4041 | pub struct FnDecl<'hir> { |
| 4042 | 4042 | /// The types of the function's parameters. |
| 4043 | 4043 | /// |
| ... | ... | @@ -4091,7 +4091,7 @@ impl<'hir> FnDecl<'hir> { |
| 4091 | 4091 | } |
| 4092 | 4092 | |
| 4093 | 4093 | /// Represents what type of implicit self a function has, if any. |
| 4094 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 4094 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)] | |
| 4095 | 4095 | pub enum ImplicitSelfKind { |
| 4096 | 4096 | /// Represents a `fn x(self);`. |
| 4097 | 4097 | Imm, |
| ... | ... | @@ -4113,7 +4113,7 @@ impl ImplicitSelfKind { |
| 4113 | 4113 | } |
| 4114 | 4114 | } |
| 4115 | 4115 | |
| 4116 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 4116 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)] | |
| 4117 | 4117 | pub enum IsAsync { |
| 4118 | 4118 | Async(Span), |
| 4119 | 4119 | NotAsync, |
| ... | ... | @@ -4125,7 +4125,7 @@ impl IsAsync { |
| 4125 | 4125 | } |
| 4126 | 4126 | } |
| 4127 | 4127 | |
| 4128 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, HashStable_Generic)] | |
| 4128 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, HashStable)] | |
| 4129 | 4129 | #[derive(Default)] |
| 4130 | 4130 | pub enum Defaultness { |
| 4131 | 4131 | Default { |
| ... | ... | @@ -4152,7 +4152,7 @@ impl Defaultness { |
| 4152 | 4152 | } |
| 4153 | 4153 | } |
| 4154 | 4154 | |
| 4155 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4155 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4156 | 4156 | pub enum FnRetTy<'hir> { |
| 4157 | 4157 | /// Return type is not specified. |
| 4158 | 4158 | /// |
| ... | ... | @@ -4184,7 +4184,7 @@ impl<'hir> FnRetTy<'hir> { |
| 4184 | 4184 | } |
| 4185 | 4185 | |
| 4186 | 4186 | /// Represents `for<...>` binder before a closure |
| 4187 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 4187 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 4188 | 4188 | pub enum ClosureBinder { |
| 4189 | 4189 | /// Binder is not specified. |
| 4190 | 4190 | Default, |
| ... | ... | @@ -4194,13 +4194,13 @@ pub enum ClosureBinder { |
| 4194 | 4194 | For { span: Span }, |
| 4195 | 4195 | } |
| 4196 | 4196 | |
| 4197 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4197 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4198 | 4198 | pub struct Mod<'hir> { |
| 4199 | 4199 | pub spans: ModSpans, |
| 4200 | 4200 | pub item_ids: &'hir [ItemId], |
| 4201 | 4201 | } |
| 4202 | 4202 | |
| 4203 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 4203 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 4204 | 4204 | pub struct ModSpans { |
| 4205 | 4205 | /// A span from the first token past `{` to the last token until `}`. |
| 4206 | 4206 | /// For `mod foo;`, the inner span ranges from the first token |
| ... | ... | @@ -4209,12 +4209,12 @@ pub struct ModSpans { |
| 4209 | 4209 | pub inject_use_span: Span, |
| 4210 | 4210 | } |
| 4211 | 4211 | |
| 4212 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4212 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4213 | 4213 | pub struct EnumDef<'hir> { |
| 4214 | 4214 | pub variants: &'hir [Variant<'hir>], |
| 4215 | 4215 | } |
| 4216 | 4216 | |
| 4217 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4217 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4218 | 4218 | pub struct Variant<'hir> { |
| 4219 | 4219 | /// Name of the variant. |
| 4220 | 4220 | pub ident: Ident, |
| ... | ... | @@ -4230,7 +4230,7 @@ pub struct Variant<'hir> { |
| 4230 | 4230 | pub span: Span, |
| 4231 | 4231 | } |
| 4232 | 4232 | |
| 4233 | #[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic)] | |
| 4233 | #[derive(Copy, Clone, PartialEq, Debug, HashStable)] | |
| 4234 | 4234 | pub enum UseKind { |
| 4235 | 4235 | /// One import, e.g., `use foo::bar` or `use foo::bar as baz`. |
| 4236 | 4236 | /// Also produced for each element of a list `use`, e.g. |
| ... | ... | @@ -4255,7 +4255,7 @@ pub enum UseKind { |
| 4255 | 4255 | /// that the `ref_id` is for. Note that `ref_id`'s value is not the `HirId` of the |
| 4256 | 4256 | /// trait being referred to but just a unique `HirId` that serves as a key |
| 4257 | 4257 | /// within the resolution map. |
| 4258 | #[derive(Clone, Debug, Copy, HashStable_Generic)] | |
| 4258 | #[derive(Clone, Debug, Copy, HashStable)] | |
| 4259 | 4259 | pub struct TraitRef<'hir> { |
| 4260 | 4260 | pub path: &'hir Path<'hir>, |
| 4261 | 4261 | // Don't hash the `ref_id`. It is tracked via the thing it is used to access. |
| ... | ... | @@ -4274,7 +4274,7 @@ impl TraitRef<'_> { |
| 4274 | 4274 | } |
| 4275 | 4275 | } |
| 4276 | 4276 | |
| 4277 | #[derive(Clone, Debug, Copy, HashStable_Generic)] | |
| 4277 | #[derive(Clone, Debug, Copy, HashStable)] | |
| 4278 | 4278 | pub struct PolyTraitRef<'hir> { |
| 4279 | 4279 | /// The `'a` in `for<'a> Foo<&'a T>`. |
| 4280 | 4280 | pub bound_generic_params: &'hir [GenericParam<'hir>], |
| ... | ... | @@ -4290,7 +4290,7 @@ pub struct PolyTraitRef<'hir> { |
| 4290 | 4290 | pub span: Span, |
| 4291 | 4291 | } |
| 4292 | 4292 | |
| 4293 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4293 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4294 | 4294 | pub struct FieldDef<'hir> { |
| 4295 | 4295 | pub span: Span, |
| 4296 | 4296 | pub vis_span: Span, |
| ... | ... | @@ -4311,7 +4311,7 @@ impl FieldDef<'_> { |
| 4311 | 4311 | } |
| 4312 | 4312 | |
| 4313 | 4313 | /// Fields and constructor IDs of enum variants and structs. |
| 4314 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4314 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4315 | 4315 | pub enum VariantData<'hir> { |
| 4316 | 4316 | /// A struct variant. |
| 4317 | 4317 | /// |
| ... | ... | @@ -4365,7 +4365,7 @@ impl<'hir> VariantData<'hir> { |
| 4365 | 4365 | // The bodies for items are stored "out of line", in a separate |
| 4366 | 4366 | // hashmap in the `Crate`. Here we just record the hir-id of the item |
| 4367 | 4367 | // so it can fetched later. |
| 4368 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash, HashStable_Generic)] | |
| 4368 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash, HashStable)] | |
| 4369 | 4369 | pub struct ItemId { |
| 4370 | 4370 | pub owner_id: OwnerId, |
| 4371 | 4371 | } |
| ... | ... | @@ -4386,7 +4386,7 @@ impl ItemId { |
| 4386 | 4386 | /// the compiler and the reference. |
| 4387 | 4387 | /// |
| 4388 | 4388 | /// [rust lang reference]: https://doc.rust-lang.org/reference/items.html |
| 4389 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4389 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4390 | 4390 | pub struct Item<'hir> { |
| 4391 | 4391 | pub owner_id: OwnerId, |
| 4392 | 4392 | pub kind: ItemKind<'hir>, |
| ... | ... | @@ -4479,7 +4479,7 @@ impl<'hir> Item<'hir> { |
| 4479 | 4479 | } |
| 4480 | 4480 | |
| 4481 | 4481 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] |
| 4482 | #[derive(Encodable, Decodable, HashStable_Generic, Default)] | |
| 4482 | #[derive(Encodable, Decodable, HashStable, Default)] | |
| 4483 | 4483 | pub enum Safety { |
| 4484 | 4484 | /// This is the default variant, because the compiler messing up |
| 4485 | 4485 | /// metadata encoding and failing to encode a `Safe` flag, means |
| ... | ... | @@ -4521,7 +4521,7 @@ impl fmt::Display for Safety { |
| 4521 | 4521 | } |
| 4522 | 4522 | } |
| 4523 | 4523 | |
| 4524 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, HashStable_Generic)] | |
| 4524 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, HashStable)] | |
| 4525 | 4525 | #[derive(Default)] |
| 4526 | 4526 | pub enum Constness { |
| 4527 | 4527 | #[default] |
| ... | ... | @@ -4538,13 +4538,13 @@ impl fmt::Display for Constness { |
| 4538 | 4538 | } |
| 4539 | 4539 | } |
| 4540 | 4540 | |
| 4541 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4541 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4542 | 4542 | pub struct ImplRestriction<'hir> { |
| 4543 | 4543 | pub kind: RestrictionKind<'hir>, |
| 4544 | 4544 | pub span: Span, |
| 4545 | 4545 | } |
| 4546 | 4546 | |
| 4547 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4547 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4548 | 4548 | pub enum RestrictionKind<'hir> { |
| 4549 | 4549 | /// The restriction does not affect the item. |
| 4550 | 4550 | Unrestricted, |
| ... | ... | @@ -4556,7 +4556,7 @@ pub enum RestrictionKind<'hir> { |
| 4556 | 4556 | /// its safety different within the type system to create a |
| 4557 | 4557 | /// "sound by default" system that needs checking this enum |
| 4558 | 4558 | /// explicitly to allow unsafe operations. |
| 4559 | #[derive(Copy, Clone, Debug, HashStable_Generic, PartialEq, Eq)] | |
| 4559 | #[derive(Copy, Clone, Debug, HashStable, PartialEq, Eq)] | |
| 4560 | 4560 | pub enum HeaderSafety { |
| 4561 | 4561 | /// A safe function annotated with `#[target_features]`. |
| 4562 | 4562 | /// The type system treats this function as an unsafe function, |
| ... | ... | @@ -4573,7 +4573,7 @@ impl From<Safety> for HeaderSafety { |
| 4573 | 4573 | } |
| 4574 | 4574 | } |
| 4575 | 4575 | |
| 4576 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 4576 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 4577 | 4577 | pub struct FnHeader { |
| 4578 | 4578 | pub safety: HeaderSafety, |
| 4579 | 4579 | pub constness: Constness, |
| ... | ... | @@ -4606,7 +4606,7 @@ impl FnHeader { |
| 4606 | 4606 | } |
| 4607 | 4607 | } |
| 4608 | 4608 | |
| 4609 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4609 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4610 | 4610 | pub enum ItemKind<'hir> { |
| 4611 | 4611 | /// An `extern crate` item, with optional *original* crate name if the crate was renamed. |
| 4612 | 4612 | /// |
| ... | ... | @@ -4681,7 +4681,7 @@ pub enum ItemKind<'hir> { |
| 4681 | 4681 | /// |
| 4682 | 4682 | /// E.g., `impl $Type { .. }` or `impl $Trait for $Type { .. }` |
| 4683 | 4683 | /// Refer to [`ImplItem`] for an associated item within an impl block. |
| 4684 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4684 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4685 | 4685 | pub struct Impl<'hir> { |
| 4686 | 4686 | pub generics: &'hir Generics<'hir>, |
| 4687 | 4687 | pub of_trait: Option<&'hir TraitImplHeader<'hir>>, |
| ... | ... | @@ -4690,7 +4690,7 @@ pub struct Impl<'hir> { |
| 4690 | 4690 | pub constness: Constness, |
| 4691 | 4691 | } |
| 4692 | 4692 | |
| 4693 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4693 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4694 | 4694 | pub struct TraitImplHeader<'hir> { |
| 4695 | 4695 | pub safety: Safety, |
| 4696 | 4696 | pub polarity: ImplPolarity, |
| ... | ... | @@ -4764,7 +4764,7 @@ impl ItemKind<'_> { |
| 4764 | 4764 | // The bodies for items are stored "out of line", in a separate |
| 4765 | 4765 | // hashmap in the `Crate`. Here we just record the hir-id of the item |
| 4766 | 4766 | // so it can fetched later. |
| 4767 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)] | |
| 4767 | #[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)] | |
| 4768 | 4768 | pub struct ForeignItemId { |
| 4769 | 4769 | pub owner_id: OwnerId, |
| 4770 | 4770 | } |
| ... | ... | @@ -4777,7 +4777,7 @@ impl ForeignItemId { |
| 4777 | 4777 | } |
| 4778 | 4778 | } |
| 4779 | 4779 | |
| 4780 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4780 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4781 | 4781 | pub struct ForeignItem<'hir> { |
| 4782 | 4782 | pub ident: Ident, |
| 4783 | 4783 | pub kind: ForeignItemKind<'hir>, |
| ... | ... | @@ -4800,7 +4800,7 @@ impl ForeignItem<'_> { |
| 4800 | 4800 | } |
| 4801 | 4801 | |
| 4802 | 4802 | /// An item within an `extern` block. |
| 4803 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4803 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4804 | 4804 | pub enum ForeignItemKind<'hir> { |
| 4805 | 4805 | /// A foreign function. |
| 4806 | 4806 | /// |
| ... | ... | @@ -4816,7 +4816,7 @@ pub enum ForeignItemKind<'hir> { |
| 4816 | 4816 | } |
| 4817 | 4817 | |
| 4818 | 4818 | /// A variable captured by a closure. |
| 4819 | #[derive(Debug, Copy, Clone, HashStable_Generic)] | |
| 4819 | #[derive(Debug, Copy, Clone, HashStable)] | |
| 4820 | 4820 | pub struct Upvar { |
| 4821 | 4821 | /// First span where it is accessed (there can be multiple). |
| 4822 | 4822 | pub span: Span, |
| ... | ... | @@ -4825,7 +4825,7 @@ pub struct Upvar { |
| 4825 | 4825 | // The TraitCandidate's import_ids is empty if the trait is defined in the same module, and |
| 4826 | 4826 | // has length > 0 if the trait is found through an chain of imports, starting with the |
| 4827 | 4827 | // import/use statement in the scope where the trait is used. |
| 4828 | #[derive(Debug, Clone, Copy, HashStable_Generic)] | |
| 4828 | #[derive(Debug, Clone, Copy, HashStable)] | |
| 4829 | 4829 | pub struct TraitCandidate<'hir> { |
| 4830 | 4830 | pub def_id: DefId, |
| 4831 | 4831 | pub import_ids: &'hir [LocalDefId], |
| ... | ... | @@ -4836,7 +4836,7 @@ pub struct TraitCandidate<'hir> { |
| 4836 | 4836 | pub lint_ambiguous: bool, |
| 4837 | 4837 | } |
| 4838 | 4838 | |
| 4839 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 4839 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 4840 | 4840 | pub enum OwnerNode<'hir> { |
| 4841 | 4841 | Item(&'hir Item<'hir>), |
| 4842 | 4842 | ForeignItem(&'hir ForeignItem<'hir>), |
| ... | ... | @@ -4970,7 +4970,7 @@ impl<'hir> From<OwnerNode<'hir>> for Node<'hir> { |
| 4970 | 4970 | } |
| 4971 | 4971 | } |
| 4972 | 4972 | |
| 4973 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 4973 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 4974 | 4974 | pub enum Node<'hir> { |
| 4975 | 4975 | Param(&'hir Param<'hir>), |
| 4976 | 4976 | Item(&'hir Item<'hir>), |
compiler/rustc_hir/src/lang_items.rs+5-5| ... | ... | @@ -8,8 +8,8 @@ |
| 8 | 8 | //! * Functions called by the compiler itself. |
| 9 | 9 | |
| 10 | 10 | use rustc_data_structures::fx::FxIndexMap; |
| 11 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 12 | use rustc_macros::{BlobDecodable, Encodable, HashStable_Generic, PrintAttribute}; | |
| 11 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 12 | use rustc_macros::{BlobDecodable, Encodable, HashStable, PrintAttribute}; | |
| 13 | 13 | use rustc_span::{Symbol, kw, sym}; |
| 14 | 14 | |
| 15 | 15 | use crate::attrs::PrintAttribute; |
| ... | ... | @@ -18,7 +18,7 @@ use crate::{MethodKind, Target}; |
| 18 | 18 | |
| 19 | 19 | /// All of the lang items, defined or not. |
| 20 | 20 | /// Defined lang items can come from the current crate or its dependencies. |
| 21 | #[derive(HashStable_Generic, Debug)] | |
| 21 | #[derive(HashStable, Debug)] | |
| 22 | 22 | pub struct LanguageItems { |
| 23 | 23 | /// Mappings from lang items to their possibly found [`DefId`]s. |
| 24 | 24 | /// The index corresponds to the order in [`LangItem`]. |
| ... | ... | @@ -144,8 +144,8 @@ macro_rules! language_item_table { |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | impl<Hcx> HashStable<Hcx> for LangItem { | |
| 148 | fn hash_stable(&self, _: &mut Hcx, hasher: &mut StableHasher) { | |
| 147 | impl HashStable for LangItem { | |
| 148 | fn hash_stable<Hcx: HashStableContext>(&self, _: &mut Hcx, hasher: &mut StableHasher) { | |
| 149 | 149 | ::std::hash::Hash::hash(self, hasher); |
| 150 | 150 | } |
| 151 | 151 | } |
compiler/rustc_hir/src/limit.rs+2-2| ... | ... | @@ -2,11 +2,11 @@ use std::fmt; |
| 2 | 2 | use std::ops::{Div, Mul}; |
| 3 | 3 | |
| 4 | 4 | use rustc_error_messages::{DiagArgValue, IntoDiagArg}; |
| 5 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 5 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 6 | 6 | |
| 7 | 7 | /// New-type wrapper around `usize` for representing limits. Ensures that comparisons against |
| 8 | 8 | /// limits are consistent throughout the compiler. |
| 9 | #[derive(Clone, Copy, Debug, HashStable_Generic, Encodable, Decodable)] | |
| 9 | #[derive(Clone, Copy, Debug, HashStable, Encodable, Decodable)] | |
| 10 | 10 | pub struct Limit(pub usize); |
| 11 | 11 | |
| 12 | 12 | impl Limit { |
compiler/rustc_hir/src/stability.rs+8-8| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use std::num::NonZero; |
| 2 | 2 | |
| 3 | use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable_Generic, PrintAttribute}; | |
| 3 | use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable, PrintAttribute}; | |
| 4 | 4 | use rustc_span::{ErrorGuaranteed, Symbol, sym}; |
| 5 | 5 | |
| 6 | 6 | use crate::RustcVersion; |
| ... | ... | @@ -22,7 +22,7 @@ pub const VERSION_PLACEHOLDER: &str = concat!("CURRENT_RUSTC_VERSIO", "N"); |
| 22 | 22 | /// - `#[stable]` |
| 23 | 23 | /// - `#[unstable]` |
| 24 | 24 | #[derive(Encodable, BlobDecodable, Copy, Clone, Debug, PartialEq, Eq, Hash)] |
| 25 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 25 | #[derive(HashStable, PrintAttribute)] | |
| 26 | 26 | pub struct Stability { |
| 27 | 27 | pub level: StabilityLevel, |
| 28 | 28 | pub feature: Symbol, |
| ... | ... | @@ -44,7 +44,7 @@ impl Stability { |
| 44 | 44 | |
| 45 | 45 | /// Represents the `#[rustc_const_unstable]` and `#[rustc_const_stable]` attributes. |
| 46 | 46 | #[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, Hash)] |
| 47 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 47 | #[derive(HashStable, PrintAttribute)] | |
| 48 | 48 | pub struct ConstStability { |
| 49 | 49 | pub level: StabilityLevel, |
| 50 | 50 | pub feature: Symbol, |
| ... | ... | @@ -84,7 +84,7 @@ impl ConstStability { |
| 84 | 84 | /// Excludes `const_stable_indirect`. This is necessary because when `-Zforce-unstable-if-unmarked` |
| 85 | 85 | /// is set, we need to encode standalone `#[rustc_const_stable_indirect]` attributes |
| 86 | 86 | #[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, Hash)] |
| 87 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 87 | #[derive(HashStable, PrintAttribute)] | |
| 88 | 88 | pub struct PartialConstStability { |
| 89 | 89 | pub level: StabilityLevel, |
| 90 | 90 | pub feature: Symbol, |
| ... | ... | @@ -104,7 +104,7 @@ impl PartialConstStability { |
| 104 | 104 | |
| 105 | 105 | /// The available stability levels. |
| 106 | 106 | #[derive(Encodable, BlobDecodable, PartialEq, Copy, Clone, Debug, Eq, Hash)] |
| 107 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 107 | #[derive(HashStable, PrintAttribute)] | |
| 108 | 108 | pub enum StabilityLevel { |
| 109 | 109 | /// `#[unstable]` |
| 110 | 110 | Unstable { |
| ... | ... | @@ -146,7 +146,7 @@ pub enum StabilityLevel { |
| 146 | 146 | |
| 147 | 147 | /// Rust release in which a feature is stabilized. |
| 148 | 148 | #[derive(Encodable, BlobDecodable, PartialEq, Copy, Clone, Debug, Eq, PartialOrd, Ord, Hash)] |
| 149 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 149 | #[derive(HashStable, PrintAttribute)] | |
| 150 | 150 | pub enum StableSince { |
| 151 | 151 | /// also stores the original symbol for printing |
| 152 | 152 | Version(RustcVersion), |
| ... | ... | @@ -172,7 +172,7 @@ impl StabilityLevel { |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | #[derive(Encodable, BlobDecodable, PartialEq, Copy, Clone, Debug, Eq, Hash)] |
| 175 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 175 | #[derive(HashStable, PrintAttribute)] | |
| 176 | 176 | pub enum UnstableReason { |
| 177 | 177 | None, |
| 178 | 178 | Default, |
| ... | ... | @@ -181,7 +181,7 @@ pub enum UnstableReason { |
| 181 | 181 | |
| 182 | 182 | /// Represents the `#[rustc_default_body_unstable]` attribute. |
| 183 | 183 | #[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, Hash)] |
| 184 | #[derive(HashStable_Generic, PrintAttribute)] | |
| 184 | #[derive(HashStable, PrintAttribute)] | |
| 185 | 185 | pub struct DefaultBodyStability { |
| 186 | 186 | pub level: StabilityLevel, |
| 187 | 187 | pub feature: Symbol, |
compiler/rustc_hir/src/stable_hash_impls.rs+22-18| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; | |
| 2 | use rustc_span::HashStableContext; | |
| 1 | use rustc_data_structures::stable_hasher::{ | |
| 2 | HashStable, HashStableContext, StableHasher, ToStableHashKey, | |
| 3 | }; | |
| 3 | 4 | use rustc_span::def_id::DefPathHash; |
| 4 | 5 | |
| 5 | 6 | use crate::HashIgnoredAttrId; |
| ... | ... | @@ -8,48 +9,51 @@ use crate::hir::{ |
| 8 | 9 | }; |
| 9 | 10 | use crate::hir_id::ItemLocalId; |
| 10 | 11 | |
| 11 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for BodyId { | |
| 12 | impl ToStableHashKey for BodyId { | |
| 12 | 13 | type KeyType = (DefPathHash, ItemLocalId); |
| 13 | 14 | |
| 14 | 15 | #[inline] |
| 15 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> (DefPathHash, ItemLocalId) { | |
| 16 | fn to_stable_hash_key<Hcx: HashStableContext>( | |
| 17 | &self, | |
| 18 | hcx: &mut Hcx, | |
| 19 | ) -> (DefPathHash, ItemLocalId) { | |
| 16 | 20 | let BodyId { hir_id } = *self; |
| 17 | 21 | hir_id.to_stable_hash_key(hcx) |
| 18 | 22 | } |
| 19 | 23 | } |
| 20 | 24 | |
| 21 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for ItemId { | |
| 25 | impl ToStableHashKey for ItemId { | |
| 22 | 26 | type KeyType = DefPathHash; |
| 23 | 27 | |
| 24 | 28 | #[inline] |
| 25 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 29 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 26 | 30 | self.owner_id.def_id.to_stable_hash_key(hcx) |
| 27 | 31 | } |
| 28 | 32 | } |
| 29 | 33 | |
| 30 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for TraitItemId { | |
| 34 | impl ToStableHashKey for TraitItemId { | |
| 31 | 35 | type KeyType = DefPathHash; |
| 32 | 36 | |
| 33 | 37 | #[inline] |
| 34 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 38 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 35 | 39 | self.owner_id.def_id.to_stable_hash_key(hcx) |
| 36 | 40 | } |
| 37 | 41 | } |
| 38 | 42 | |
| 39 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for ImplItemId { | |
| 43 | impl ToStableHashKey for ImplItemId { | |
| 40 | 44 | type KeyType = DefPathHash; |
| 41 | 45 | |
| 42 | 46 | #[inline] |
| 43 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 47 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 44 | 48 | self.owner_id.def_id.to_stable_hash_key(hcx) |
| 45 | 49 | } |
| 46 | 50 | } |
| 47 | 51 | |
| 48 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for ForeignItemId { | |
| 52 | impl ToStableHashKey for ForeignItemId { | |
| 49 | 53 | type KeyType = DefPathHash; |
| 50 | 54 | |
| 51 | 55 | #[inline] |
| 52 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 56 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 53 | 57 | self.owner_id.def_id.to_stable_hash_key(hcx) |
| 54 | 58 | } |
| 55 | 59 | } |
| ... | ... | @@ -61,8 +65,8 @@ impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for ForeignItemId { |
| 61 | 65 | // want to pick up on a reference changing its target, so we hash the NodeIds |
| 62 | 66 | // in "DefPath Mode". |
| 63 | 67 | |
| 64 | impl<'tcx, Hcx: HashStableContext> HashStable<Hcx> for OwnerNodes<'tcx> { | |
| 65 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 68 | impl<'tcx> HashStable for OwnerNodes<'tcx> { | |
| 69 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 66 | 70 | // We ignore the `nodes` and `bodies` fields since these refer to information included in |
| 67 | 71 | // `hash` which is hashed in the collector and used for the crate hash. |
| 68 | 72 | // `local_id_to_def_id` is also ignored because is dependent on the body, then just hashing |
| ... | ... | @@ -73,8 +77,8 @@ impl<'tcx, Hcx: HashStableContext> HashStable<Hcx> for OwnerNodes<'tcx> { |
| 73 | 77 | } |
| 74 | 78 | } |
| 75 | 79 | |
| 76 | impl<'tcx, Hcx: HashStableContext> HashStable<Hcx> for AttributeMap<'tcx> { | |
| 77 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 80 | impl<'tcx> HashStable for AttributeMap<'tcx> { | |
| 81 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 78 | 82 | // We ignore the `map` since it refers to information included in `opt_hash` which is |
| 79 | 83 | // hashed in the collector and used for the crate hash. |
| 80 | 84 | let AttributeMap { opt_hash, define_opaque: _, map: _ } = *self; |
| ... | ... | @@ -82,8 +86,8 @@ impl<'tcx, Hcx: HashStableContext> HashStable<Hcx> for AttributeMap<'tcx> { |
| 82 | 86 | } |
| 83 | 87 | } |
| 84 | 88 | |
| 85 | impl<Hcx: HashStableContext> HashStable<Hcx> for HashIgnoredAttrId { | |
| 86 | fn hash_stable(&self, _hcx: &mut Hcx, _hasher: &mut StableHasher) { | |
| 89 | impl HashStable for HashIgnoredAttrId { | |
| 90 | fn hash_stable<Hcx: HashStableContext>(&self, _hcx: &mut Hcx, _hasher: &mut StableHasher) { | |
| 87 | 91 | /* we don't hash HashIgnoredAttrId, we ignore them */ |
| 88 | 92 | } |
| 89 | 93 | } |
compiler/rustc_hir/src/target.rs+4-4| ... | ... | @@ -4,19 +4,19 @@ use std::fmt::{self, Display}; |
| 4 | 4 | |
| 5 | 5 | use rustc_ast::visit::AssocCtxt; |
| 6 | 6 | use rustc_ast::{AssocItemKind, ForeignItemKind, ast}; |
| 7 | use rustc_macros::HashStable_Generic; | |
| 7 | use rustc_macros::HashStable; | |
| 8 | 8 | |
| 9 | 9 | use crate::def::DefKind; |
| 10 | 10 | use crate::{Item, ItemKind, TraitItem, TraitItemKind, hir}; |
| 11 | 11 | |
| 12 | #[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable_Generic)] | |
| 12 | #[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable)] | |
| 13 | 13 | pub enum GenericParamKind { |
| 14 | 14 | Type, |
| 15 | 15 | Lifetime, |
| 16 | 16 | Const, |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | #[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable_Generic)] | |
| 19 | #[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable)] | |
| 20 | 20 | pub enum MethodKind { |
| 21 | 21 | /// Method in a `trait Trait` block |
| 22 | 22 | Trait { |
| ... | ... | @@ -29,7 +29,7 @@ pub enum MethodKind { |
| 29 | 29 | Inherent, |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | #[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable_Generic)] | |
| 32 | #[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable)] | |
| 33 | 33 | pub enum Target { |
| 34 | 34 | ExternCrate, |
| 35 | 35 | Use, |
compiler/rustc_hir_id/src/lib.rs+18-14| ... | ... | @@ -6,9 +6,10 @@ |
| 6 | 6 | |
| 7 | 7 | use std::fmt::{self, Debug}; |
| 8 | 8 | |
| 9 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd, ToStableHashKey}; | |
| 10 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 11 | use rustc_span::HashStableContext; | |
| 9 | use rustc_data_structures::stable_hasher::{ | |
| 10 | HashStable, HashStableContext, StableHasher, StableOrd, ToStableHashKey, | |
| 11 | }; | |
| 12 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 12 | 13 | use rustc_span::def_id::{CRATE_DEF_ID, DefId, DefIndex, DefPathHash, LocalDefId}; |
| 13 | 14 | |
| 14 | 15 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)] |
| ... | ... | @@ -54,19 +55,19 @@ impl rustc_index::Idx for OwnerId { |
| 54 | 55 | } |
| 55 | 56 | } |
| 56 | 57 | |
| 57 | impl<Hcx: HashStableContext> HashStable<Hcx> for OwnerId { | |
| 58 | impl HashStable for OwnerId { | |
| 58 | 59 | #[inline] |
| 59 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 60 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 60 | 61 | self.to_stable_hash_key(hcx).hash_stable(hcx, hasher); |
| 61 | 62 | } |
| 62 | 63 | } |
| 63 | 64 | |
| 64 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for OwnerId { | |
| 65 | impl ToStableHashKey for OwnerId { | |
| 65 | 66 | type KeyType = DefPathHash; |
| 66 | 67 | |
| 67 | 68 | #[inline] |
| 68 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 69 | hcx.def_path_hash(self.to_def_id()) | |
| 69 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 70 | self.to_def_id().to_stable_hash_key(hcx) | |
| 70 | 71 | } |
| 71 | 72 | } |
| 72 | 73 | |
| ... | ... | @@ -80,7 +81,7 @@ impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for OwnerId { |
| 80 | 81 | /// the `local_id` part of the `HirId` changing, which is a very useful property in |
| 81 | 82 | /// incremental compilation where we have to persist things through changes to |
| 82 | 83 | /// the code base. |
| 83 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)] | |
| 84 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)] | |
| 84 | 85 | #[rustc_pass_by_value] |
| 85 | 86 | pub struct HirId { |
| 86 | 87 | pub owner: OwnerId, |
| ... | ... | @@ -151,7 +152,7 @@ rustc_index::newtype_index! { |
| 151 | 152 | /// integers starting at zero, so a mapping that maps all or most nodes within |
| 152 | 153 | /// an "item-like" to something else can be implemented by a `Vec` instead of a |
| 153 | 154 | /// tree or hash map. |
| 154 | #[stable_hash_generic] | |
| 155 | #[stable_hash] | |
| 155 | 156 | #[encodable] |
| 156 | 157 | #[orderable] |
| 157 | 158 | pub struct ItemLocalId {} |
| ... | ... | @@ -176,21 +177,24 @@ pub const CRATE_HIR_ID: HirId = |
| 176 | 177 | |
| 177 | 178 | pub const CRATE_OWNER_ID: OwnerId = OwnerId { def_id: CRATE_DEF_ID }; |
| 178 | 179 | |
| 179 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for HirId { | |
| 180 | impl ToStableHashKey for HirId { | |
| 180 | 181 | type KeyType = (DefPathHash, ItemLocalId); |
| 181 | 182 | |
| 182 | 183 | #[inline] |
| 183 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> (DefPathHash, ItemLocalId) { | |
| 184 | fn to_stable_hash_key<Hcx: HashStableContext>( | |
| 185 | &self, | |
| 186 | hcx: &mut Hcx, | |
| 187 | ) -> (DefPathHash, ItemLocalId) { | |
| 184 | 188 | let def_path_hash = self.owner.def_id.to_stable_hash_key(hcx); |
| 185 | 189 | (def_path_hash, self.local_id) |
| 186 | 190 | } |
| 187 | 191 | } |
| 188 | 192 | |
| 189 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for ItemLocalId { | |
| 193 | impl ToStableHashKey for ItemLocalId { | |
| 190 | 194 | type KeyType = ItemLocalId; |
| 191 | 195 | |
| 192 | 196 | #[inline] |
| 193 | fn to_stable_hash_key(&self, _: &mut Hcx) -> ItemLocalId { | |
| 197 | fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> ItemLocalId { | |
| 194 | 198 | *self |
| 195 | 199 | } |
| 196 | 200 | } |
compiler/rustc_index_macros/src/lib.rs+1-2| ... | ... | @@ -25,8 +25,7 @@ mod newtype; |
| 25 | 25 | /// The impls provided by default are Clone, Copy, PartialEq, Eq, and Hash. |
| 26 | 26 | /// |
| 27 | 27 | /// Accepted attributes for customization: |
| 28 | /// - `#[derive(HashStable_Generic)]`/`#[derive(HashStable)]`: derives | |
| 29 | /// `HashStable`, as normal. | |
| 28 | /// - `#[derive(HashStable)]`: derives `HashStable`, as normal. | |
| 30 | 29 | /// - `#[encodable]`: derives `Encodable`/`Decodable`. |
| 31 | 30 | /// - `#[orderable]`: derives `PartialOrd`/`Ord`, plus step-related methods. |
| 32 | 31 | /// - `#[debug_format = "Foo({})"]`: derives `Debug` with particular output. |
compiler/rustc_index_macros/src/newtype.rs+8-21| ... | ... | @@ -24,8 +24,6 @@ impl Parse for Newtype { |
| 24 | 24 | let mut encodable = false; |
| 25 | 25 | let mut ord = false; |
| 26 | 26 | let mut stable_hash = false; |
| 27 | let mut stable_hash_generic = false; | |
| 28 | let mut stable_hash_no_context = false; | |
| 29 | 27 | let mut gate_rustc_only = quote! {}; |
| 30 | 28 | let mut gate_rustc_only_cfg = quote! { all() }; |
| 31 | 29 | |
| ... | ... | @@ -48,14 +46,6 @@ impl Parse for Newtype { |
| 48 | 46 | stable_hash = true; |
| 49 | 47 | false |
| 50 | 48 | } |
| 51 | "stable_hash_generic" => { | |
| 52 | stable_hash_generic = true; | |
| 53 | false | |
| 54 | } | |
| 55 | "stable_hash_no_context" => { | |
| 56 | stable_hash_no_context = true; | |
| 57 | false | |
| 58 | } | |
| 59 | 49 | "max" => { |
| 60 | 50 | let Meta::NameValue(MetaNameValue { value: Expr::Lit(lit), .. }) = &attr.meta |
| 61 | 51 | else { |
| ... | ... | @@ -165,17 +155,14 @@ impl Parse for Newtype { |
| 165 | 155 | let hash_stable = if stable_hash { |
| 166 | 156 | quote! { |
| 167 | 157 | #gate_rustc_only |
| 168 | impl<'__ctx> ::rustc_data_structures::stable_hasher::HashStable<::rustc_middle::ich::StableHashingContext<'__ctx>> for #name { | |
| 169 | fn hash_stable(&self, hcx: &mut ::rustc_middle::ich::StableHashingContext<'__ctx>, hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { | |
| 170 | self.as_u32().hash_stable(hcx, hasher) | |
| 171 | } | |
| 172 | } | |
| 173 | } | |
| 174 | } else if stable_hash_generic || stable_hash_no_context { | |
| 175 | quote! { | |
| 176 | #gate_rustc_only | |
| 177 | impl<Hcx> ::rustc_data_structures::stable_hasher::HashStable<Hcx> for #name { | |
| 178 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { | |
| 158 | impl ::rustc_data_structures::stable_hasher::HashStable for #name { | |
| 159 | fn hash_stable< | |
| 160 | __Hcx: ::rustc_data_structures::stable_hasher::HashStableContext | |
| 161 | >( | |
| 162 | &self, | |
| 163 | hcx: &mut __Hcx, | |
| 164 | hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher | |
| 165 | ) { | |
| 179 | 166 | self.as_u32().hash_stable(hcx, hasher) |
| 180 | 167 | } |
| 181 | 168 | } |
compiler/rustc_lint_defs/src/lib.rs+12-22| ... | ... | @@ -5,14 +5,14 @@ use rustc_ast::AttrId; |
| 5 | 5 | use rustc_ast::attr::AttributeExt; |
| 6 | 6 | use rustc_data_structures::fx::FxIndexSet; |
| 7 | 7 | use rustc_data_structures::stable_hasher::{ |
| 8 | HashStable, StableCompare, StableHasher, ToStableHashKey, | |
| 8 | HashStable, HashStableContext, StableCompare, StableHasher, ToStableHashKey, | |
| 9 | 9 | }; |
| 10 | 10 | use rustc_error_messages::{DiagArgValue, IntoDiagArg}; |
| 11 | 11 | use rustc_hir_id::{HirId, ItemLocalId}; |
| 12 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 12 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 13 | 13 | use rustc_span::def_id::DefPathHash; |
| 14 | 14 | pub use rustc_span::edition::Edition; |
| 15 | use rustc_span::{HashStableContext, Ident, Symbol, sym}; | |
| 15 | use rustc_span::{Ident, Symbol, sym}; | |
| 16 | 16 | use serde::{Deserialize, Serialize}; |
| 17 | 17 | |
| 18 | 18 | pub use self::Level::*; |
| ... | ... | @@ -138,9 +138,9 @@ impl LintExpectationId { |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | impl<Hcx: HashStableContext> HashStable<Hcx> for LintExpectationId { | |
| 141 | impl HashStable for LintExpectationId { | |
| 142 | 142 | #[inline] |
| 143 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 143 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 144 | 144 | match self { |
| 145 | 145 | LintExpectationId::Stable { hir_id, attr_index, lint_index: Some(lint_index) } => { |
| 146 | 146 | hir_id.hash_stable(hcx, hasher); |
| ... | ... | @@ -156,11 +156,11 @@ impl<Hcx: HashStableContext> HashStable<Hcx> for LintExpectationId { |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for LintExpectationId { | |
| 159 | impl ToStableHashKey for LintExpectationId { | |
| 160 | 160 | type KeyType = (DefPathHash, ItemLocalId, u16, u16); |
| 161 | 161 | |
| 162 | 162 | #[inline] |
| 163 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> Self::KeyType { | |
| 163 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> Self::KeyType { | |
| 164 | 164 | match self { |
| 165 | 165 | LintExpectationId::Stable { hir_id, attr_index, lint_index: Some(lint_index) } => { |
| 166 | 166 | let (def_path_hash, lint_idx) = hir_id.to_stable_hash_key(hcx); |
| ... | ... | @@ -177,17 +177,7 @@ impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for LintExpectationId { |
| 177 | 177 | /// |
| 178 | 178 | /// See: <https://doc.rust-lang.org/rustc/lints/levels.html> |
| 179 | 179 | #[derive( |
| 180 | Clone, | |
| 181 | Copy, | |
| 182 | PartialEq, | |
| 183 | PartialOrd, | |
| 184 | Eq, | |
| 185 | Ord, | |
| 186 | Debug, | |
| 187 | Hash, | |
| 188 | Encodable, | |
| 189 | Decodable, | |
| 190 | HashStable_Generic | |
| 180 | Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash, Encodable, Decodable, HashStable | |
| 191 | 181 | )] |
| 192 | 182 | pub enum Level { |
| 193 | 183 | /// The `allow` level will not issue any message. |
| ... | ... | @@ -621,18 +611,18 @@ impl LintId { |
| 621 | 611 | } |
| 622 | 612 | } |
| 623 | 613 | |
| 624 | impl<Hcx> HashStable<Hcx> for LintId { | |
| 614 | impl HashStable for LintId { | |
| 625 | 615 | #[inline] |
| 626 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 616 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 627 | 617 | self.lint_name_raw().hash_stable(hcx, hasher); |
| 628 | 618 | } |
| 629 | 619 | } |
| 630 | 620 | |
| 631 | impl<Hcx> ToStableHashKey<Hcx> for LintId { | |
| 621 | impl ToStableHashKey for LintId { | |
| 632 | 622 | type KeyType = &'static str; |
| 633 | 623 | |
| 634 | 624 | #[inline] |
| 635 | fn to_stable_hash_key(&self, _: &mut Hcx) -> &'static str { | |
| 625 | fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> &'static str { | |
| 636 | 626 | self.lint_name_raw() |
| 637 | 627 | } |
| 638 | 628 | } |
compiler/rustc_macros/src/hash_stable.rs+21-47| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | use proc_macro2::Ident; |
| 2 | 2 | use quote::quote; |
| 3 | use syn::parse_quote; | |
| 4 | 3 | |
| 5 | 4 | struct Attributes { |
| 6 | 5 | ignore: bool, |
| ... | ... | @@ -42,12 +41,6 @@ pub(crate) fn hash_stable_derive(s: synstructure::Structure<'_>) -> proc_macro2: |
| 42 | 41 | hash_stable_derive_with_mode(s, HashStableMode::Normal) |
| 43 | 42 | } |
| 44 | 43 | |
| 45 | pub(crate) fn hash_stable_generic_derive( | |
| 46 | s: synstructure::Structure<'_>, | |
| 47 | ) -> proc_macro2::TokenStream { | |
| 48 | hash_stable_derive_with_mode(s, HashStableMode::Generic) | |
| 49 | } | |
| 50 | ||
| 51 | 44 | pub(crate) fn hash_stable_no_context_derive( |
| 52 | 45 | s: synstructure::Structure<'_>, |
| 53 | 46 | ) -> proc_macro2::TokenStream { |
| ... | ... | @@ -55,13 +48,19 @@ pub(crate) fn hash_stable_no_context_derive( |
| 55 | 48 | } |
| 56 | 49 | |
| 57 | 50 | enum HashStableMode { |
| 58 | // Use the query-system aware stable hashing context. | |
| 51 | // Do a normal derive, where any generic type parameter gets a `HashStable` bound. | |
| 52 | // For example, in `struct Abc<T, U>(T, U)` the added bounds are `T: HashStable` and | |
| 53 | // `U: HashStable`. | |
| 59 | 54 | Normal, |
| 60 | // Emit a generic implementation that uses a crate-local `StableHashingContext` | |
| 61 | // trait, when the crate is upstream of `rustc_middle`. | |
| 62 | Generic, | |
| 63 | // Emit a hash-stable implementation that takes no context, | |
| 64 | // and emits per-field where clauses for (almost-)perfect derives. | |
| 55 | ||
| 56 | // Do an (almost-)perfect derive, where any field with a generic type parameter gets a | |
| 57 | // `HashStable` bound. For example, in `struct Def<T, U>(T, U::Assoc)` the added bounds are | |
| 58 | // `T::HashStable` and `U::Assoc: HashStable` (not `U: HashStable`). | |
| 59 | // | |
| 60 | // This is used most commonly in `rustc_type_ir` for types like `TyKind<I: Interner>`. | |
| 61 | // `Interner` does not impl `HashStable`, but the fields of `TyKind` do not use `I` itself, | |
| 62 | // instead only using associated types from `I` such as `I::Region`. On types like `TyKind` we | |
| 63 | // typically also see the use of `derive_where` for built-in traits such as `Debug`. | |
| 65 | 64 | NoContext, |
| 66 | 65 | } |
| 67 | 66 | |
| ... | ... | @@ -69,50 +68,25 @@ fn hash_stable_derive_with_mode( |
| 69 | 68 | mut s: synstructure::Structure<'_>, |
| 70 | 69 | mode: HashStableMode, |
| 71 | 70 | ) -> proc_macro2::TokenStream { |
| 72 | let generic: syn::GenericParam = match mode { | |
| 73 | HashStableMode::Normal => parse_quote!('__ctx), | |
| 74 | HashStableMode::Generic | HashStableMode::NoContext => parse_quote!(__CTX), | |
| 75 | }; | |
| 76 | ||
| 77 | // no_context impl is able to derive by-field, which is closer to a perfect derive. | |
| 78 | s.add_bounds(match mode { | |
| 79 | HashStableMode::Normal | HashStableMode::Generic => synstructure::AddBounds::Generics, | |
| 71 | let add_bounds = match mode { | |
| 72 | HashStableMode::Normal => synstructure::AddBounds::Generics, | |
| 80 | 73 | HashStableMode::NoContext => synstructure::AddBounds::Fields, |
| 81 | }); | |
| 82 | ||
| 83 | // For generic impl, add `where __CTX: HashStableContext`. | |
| 84 | match mode { | |
| 85 | HashStableMode::Normal => {} | |
| 86 | HashStableMode::Generic => { | |
| 87 | s.add_where_predicate(parse_quote! { __CTX: ::rustc_span::HashStableContext }); | |
| 88 | } | |
| 89 | HashStableMode::NoContext => {} | |
| 90 | } | |
| 74 | }; | |
| 91 | 75 | |
| 92 | s.add_impl_generic(generic); | |
| 76 | s.add_bounds(add_bounds); | |
| 93 | 77 | |
| 94 | 78 | let discriminant = hash_stable_discriminant(&mut s); |
| 95 | 79 | let body = hash_stable_body(&mut s); |
| 96 | 80 | |
| 97 | let context: syn::Type = match mode { | |
| 98 | HashStableMode::Normal => { | |
| 99 | parse_quote!(::rustc_middle::ich::StableHashingContext<'__ctx>) | |
| 100 | } | |
| 101 | HashStableMode::Generic | HashStableMode::NoContext => parse_quote!(__CTX), | |
| 102 | }; | |
| 103 | ||
| 104 | 81 | s.bound_impl( |
| 105 | quote!( | |
| 106 | ::rustc_data_structures::stable_hasher::HashStable< | |
| 107 | #context | |
| 108 | > | |
| 109 | ), | |
| 82 | quote!(::rustc_data_structures::stable_hasher::HashStable), | |
| 110 | 83 | quote! { |
| 111 | 84 | #[inline] |
| 112 | fn hash_stable( | |
| 85 | fn hash_stable<__Hcx: ::rustc_data_structures::stable_hasher::HashStableContext>( | |
| 113 | 86 | &self, |
| 114 | __hcx: &mut #context, | |
| 115 | __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) { | |
| 87 | __hcx: &mut __Hcx, | |
| 88 | __hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher | |
| 89 | ) { | |
| 116 | 90 | #discriminant |
| 117 | 91 | match *self { #body } |
| 118 | 92 | } |
compiler/rustc_macros/src/lib.rs+2-8| ... | ... | @@ -58,17 +58,11 @@ pub fn extension(attr: TokenStream, input: TokenStream) -> TokenStream { |
| 58 | 58 | extension::extension(attr, input) |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | decl_derive!([HashStable, attributes(stable_hasher)] => hash_stable::hash_stable_derive); | |
| 62 | 61 | decl_derive!( |
| 63 | [HashStable_Generic, attributes(stable_hasher)] => | |
| 64 | hash_stable::hash_stable_generic_derive | |
| 62 | [HashStable, attributes(stable_hasher)] => hash_stable::hash_stable_derive | |
| 65 | 63 | ); |
| 66 | 64 | decl_derive!( |
| 67 | [HashStable_NoContext, attributes(stable_hasher)] => | |
| 68 | /// `HashStable` implementation that has no `HashStableContext` bound and | |
| 69 | /// which adds `where` bounds for `HashStable` based off of fields and not | |
| 70 | /// generics. This is suitable for use in crates like `rustc_type_ir`. | |
| 71 | hash_stable::hash_stable_no_context_derive | |
| 65 | [HashStable_NoContext, attributes(stable_hasher)] => hash_stable::hash_stable_no_context_derive | |
| 72 | 66 | ); |
| 73 | 67 | |
| 74 | 68 | // Encoding and Decoding derives |
compiler/rustc_middle/src/dep_graph/dep_node.rs+2-2| ... | ... | @@ -231,10 +231,10 @@ impl WorkProductId { |
| 231 | 231 | WorkProductId { hash: hasher.finish() } |
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | impl<Hcx> ToStableHashKey<Hcx> for WorkProductId { | |
| 234 | impl ToStableHashKey for WorkProductId { | |
| 235 | 235 | type KeyType = Fingerprint; |
| 236 | 236 | #[inline] |
| 237 | fn to_stable_hash_key(&self, _: &mut Hcx) -> Self::KeyType { | |
| 237 | fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> Self::KeyType { | |
| 238 | 238 | self.hash |
| 239 | 239 | } |
| 240 | 240 | } |
compiler/rustc_middle/src/dep_graph/dep_node_key.rs+1-2| ... | ... | @@ -7,7 +7,6 @@ use rustc_hir::definitions::DefPathHash; |
| 7 | 7 | use rustc_hir::{HirId, ItemLocalId, OwnerId}; |
| 8 | 8 | |
| 9 | 9 | use crate::dep_graph::{DepNode, KeyFingerprintStyle}; |
| 10 | use crate::ich::StableHashingContext; | |
| 11 | 10 | use crate::ty::TyCtxt; |
| 12 | 11 | |
| 13 | 12 | /// Trait for query keys as seen by dependency-node tracking. |
| ... | ... | @@ -30,7 +29,7 @@ pub trait DepNodeKey<'tcx>: Debug + Sized { |
| 30 | 29 | // Blanket impl of `DepNodeKey`, which is specialized by other impls elsewhere. |
| 31 | 30 | impl<'tcx, T> DepNodeKey<'tcx> for T |
| 32 | 31 | where |
| 33 | T: for<'a> HashStable<StableHashingContext<'a>> + Debug, | |
| 32 | T: HashStable + Debug, | |
| 34 | 33 | { |
| 35 | 34 | #[inline(always)] |
| 36 | 35 | default fn key_fingerprint_style() -> KeyFingerprintStyle { |
compiler/rustc_middle/src/dep_graph/graph.rs+1-1| ... | ... | @@ -123,7 +123,7 @@ pub struct DepGraphData { |
| 123 | 123 | |
| 124 | 124 | pub fn hash_result<R>(hcx: &mut StableHashingContext<'_>, result: &R) -> Fingerprint |
| 125 | 125 | where |
| 126 | R: for<'a> HashStable<StableHashingContext<'a>>, | |
| 126 | R: HashStable, | |
| 127 | 127 | { |
| 128 | 128 | let mut stable_hasher = StableHasher::new(); |
| 129 | 129 | result.hash_stable(hcx, &mut stable_hasher); |
compiler/rustc_middle/src/hir/mod.rs+4-4| ... | ... | @@ -12,7 +12,7 @@ use rustc_ast::{self as ast}; |
| 12 | 12 | use rustc_data_structures::fingerprint::Fingerprint; |
| 13 | 13 | use rustc_data_structures::fx::FxIndexSet; |
| 14 | 14 | use rustc_data_structures::sorted_map::SortedMap; |
| 15 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 15 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 16 | 16 | use rustc_data_structures::steal::Steal; |
| 17 | 17 | use rustc_data_structures::sync::{DynSend, DynSync, try_par_for_each_in}; |
| 18 | 18 | use rustc_hir::def::{DefKind, Res}; |
| ... | ... | @@ -20,7 +20,7 @@ use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId}; |
| 20 | 20 | use rustc_hir::*; |
| 21 | 21 | use rustc_index::IndexVec; |
| 22 | 22 | use rustc_macros::{Decodable, Encodable, HashStable}; |
| 23 | use rustc_span::{ErrorGuaranteed, ExpnId, HashStableContext, Span}; | |
| 23 | use rustc_span::{ErrorGuaranteed, ExpnId, Span}; | |
| 24 | 24 | |
| 25 | 25 | use crate::query::Providers; |
| 26 | 26 | use crate::ty::{ResolverAstLowering, TyCtxt}; |
| ... | ... | @@ -76,8 +76,8 @@ impl<'hir> Crate<'hir> { |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | impl<Hcx: HashStableContext> HashStable<Hcx> for Crate<'_> { | |
| 80 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 79 | impl HashStable for Crate<'_> { | |
| 80 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 81 | 81 | let Crate { opt_hir_hash, .. } = self; |
| 82 | 82 | opt_hir_hash.unwrap().hash_stable(hcx, hasher) |
| 83 | 83 | } |
compiler/rustc_middle/src/ich.rs created+198| ... | ... | @@ -0,0 +1,198 @@ |
| 1 | use std::hash::Hash; | |
| 2 | ||
| 3 | use rustc_data_structures::stable_hasher::{ | |
| 4 | HashStable, HashStableContext, HashingControls, RawDefId, RawDefPathHash, RawSpan, StableHasher, | |
| 5 | }; | |
| 6 | use rustc_hir::def_id::{DefId, LocalDefId}; | |
| 7 | use rustc_session::Session; | |
| 8 | use rustc_session::cstore::Untracked; | |
| 9 | use rustc_span::source_map::SourceMap; | |
| 10 | use rustc_span::{CachingSourceMapView, DUMMY_SP, Pos, Span}; | |
| 11 | ||
| 12 | // Very often, we are hashing something that does not need the `CachingSourceMapView`, so we | |
| 13 | // initialize it lazily. | |
| 14 | enum CachingSourceMap<'a> { | |
| 15 | Unused(&'a SourceMap), | |
| 16 | InUse(CachingSourceMapView<'a>), | |
| 17 | } | |
| 18 | ||
| 19 | /// This is the context state available during incr. comp. hashing. It contains | |
| 20 | /// enough information to transform `DefId`s and `HirId`s into stable `DefPath`s (i.e., | |
| 21 | /// a reference to the `TyCtxt`) and it holds a few caches for speeding up various | |
| 22 | /// things (e.g., each `DefId`/`DefPath` is only hashed once). | |
| 23 | pub struct StableHashingContext<'a> { | |
| 24 | untracked: &'a Untracked, | |
| 25 | // The value of `-Z incremental-ignore-spans`. | |
| 26 | // This field should only be used by `unstable_opts_incremental_ignore_span` | |
| 27 | incremental_ignore_spans: bool, | |
| 28 | caching_source_map: CachingSourceMap<'a>, | |
| 29 | hashing_controls: HashingControls, | |
| 30 | } | |
| 31 | ||
| 32 | impl<'a> StableHashingContext<'a> { | |
| 33 | #[inline] | |
| 34 | pub fn new(sess: &'a Session, untracked: &'a Untracked) -> Self { | |
| 35 | let hash_spans_initial = !sess.opts.unstable_opts.incremental_ignore_spans; | |
| 36 | ||
| 37 | StableHashingContext { | |
| 38 | untracked, | |
| 39 | incremental_ignore_spans: sess.opts.unstable_opts.incremental_ignore_spans, | |
| 40 | caching_source_map: CachingSourceMap::Unused(sess.source_map()), | |
| 41 | hashing_controls: HashingControls { hash_spans: hash_spans_initial }, | |
| 42 | } | |
| 43 | } | |
| 44 | ||
| 45 | #[inline] | |
| 46 | pub fn while_hashing_spans<F: FnOnce(&mut Self)>(&mut self, hash_spans: bool, f: F) { | |
| 47 | let prev_hash_spans = self.hashing_controls.hash_spans; | |
| 48 | self.hashing_controls.hash_spans = hash_spans; | |
| 49 | f(self); | |
| 50 | self.hashing_controls.hash_spans = prev_hash_spans; | |
| 51 | } | |
| 52 | ||
| 53 | #[inline] | |
| 54 | fn source_map(&mut self) -> &mut CachingSourceMapView<'a> { | |
| 55 | match self.caching_source_map { | |
| 56 | CachingSourceMap::InUse(ref mut sm) => sm, | |
| 57 | CachingSourceMap::Unused(sm) => { | |
| 58 | self.caching_source_map = CachingSourceMap::InUse(CachingSourceMapView::new(sm)); | |
| 59 | self.source_map() // this recursive call will hit the `InUse` case | |
| 60 | } | |
| 61 | } | |
| 62 | } | |
| 63 | ||
| 64 | #[inline] | |
| 65 | fn def_span(&self, def_id: LocalDefId) -> Span { | |
| 66 | self.untracked.source_span.get(def_id).unwrap_or(DUMMY_SP) | |
| 67 | } | |
| 68 | ||
| 69 | #[inline] | |
| 70 | pub fn hashing_controls(&self) -> HashingControls { | |
| 71 | self.hashing_controls | |
| 72 | } | |
| 73 | } | |
| 74 | ||
| 75 | impl<'a> HashStableContext for StableHashingContext<'a> { | |
| 76 | /// Hashes a span in a stable way. We can't directly hash the span's `BytePos` fields (that | |
| 77 | /// would be similar to hashing pointers, since those are just offsets into the `SourceMap`). | |
| 78 | /// Instead, we hash the (file name, line, column) triple, which stays the same even if the | |
| 79 | /// containing `SourceFile` has moved within the `SourceMap`. | |
| 80 | /// | |
| 81 | /// Also note that we are hashing byte offsets for the column, not unicode codepoint offsets. | |
| 82 | /// For the purpose of the hash that's sufficient. Also, hashing filenames is expensive so we | |
| 83 | /// avoid doing it twice when the span starts and ends in the same file, which is almost always | |
| 84 | /// the case. | |
| 85 | /// | |
| 86 | /// IMPORTANT: changes to this method should be reflected in implementations of `SpanEncoder`. | |
| 87 | #[inline] | |
| 88 | fn span_hash_stable(&mut self, raw_span: RawSpan, hasher: &mut StableHasher) { | |
| 89 | const TAG_VALID_SPAN: u8 = 0; | |
| 90 | const TAG_INVALID_SPAN: u8 = 1; | |
| 91 | const TAG_RELATIVE_SPAN: u8 = 2; | |
| 92 | ||
| 93 | if !self.hashing_controls().hash_spans { | |
| 94 | return; | |
| 95 | } | |
| 96 | ||
| 97 | let span = Span::from_raw_span(raw_span); | |
| 98 | let span = span.data_untracked(); | |
| 99 | span.ctxt.hash_stable(self, hasher); | |
| 100 | span.parent.hash_stable(self, hasher); | |
| 101 | ||
| 102 | if span.is_dummy() { | |
| 103 | Hash::hash(&TAG_INVALID_SPAN, hasher); | |
| 104 | return; | |
| 105 | } | |
| 106 | ||
| 107 | let parent = span.parent.map(|parent| self.def_span(parent).data_untracked()); | |
| 108 | if let Some(parent) = parent | |
| 109 | && parent.contains(span) | |
| 110 | { | |
| 111 | // This span is enclosed in a definition: only hash the relative position. This catches | |
| 112 | // a subset of the cases from the `file.contains(parent.lo)`. But we can do this check | |
| 113 | // cheaply without the expensive `span_data_to_lines_and_cols` query. | |
| 114 | Hash::hash(&TAG_RELATIVE_SPAN, hasher); | |
| 115 | (span.lo - parent.lo).to_u32().hash_stable(self, hasher); | |
| 116 | (span.hi - parent.lo).to_u32().hash_stable(self, hasher); | |
| 117 | return; | |
| 118 | } | |
| 119 | ||
| 120 | // If this is not an empty or invalid span, we want to hash the last position that belongs | |
| 121 | // to it, as opposed to hashing the first position past it. | |
| 122 | let Some((file, line_lo, col_lo, line_hi, col_hi)) = | |
| 123 | self.source_map().span_data_to_lines_and_cols(&span) | |
| 124 | else { | |
| 125 | Hash::hash(&TAG_INVALID_SPAN, hasher); | |
| 126 | return; | |
| 127 | }; | |
| 128 | ||
| 129 | if let Some(parent) = parent | |
| 130 | && file.contains(parent.lo) | |
| 131 | { | |
| 132 | // This span is relative to another span in the same file, | |
| 133 | // only hash the relative position. | |
| 134 | Hash::hash(&TAG_RELATIVE_SPAN, hasher); | |
| 135 | Hash::hash(&(span.lo.0.wrapping_sub(parent.lo.0)), hasher); | |
| 136 | Hash::hash(&(span.hi.0.wrapping_sub(parent.lo.0)), hasher); | |
| 137 | return; | |
| 138 | } | |
| 139 | ||
| 140 | Hash::hash(&TAG_VALID_SPAN, hasher); | |
| 141 | Hash::hash(&file.stable_id, hasher); | |
| 142 | ||
| 143 | // Hash both the length and the end location (line/column) of a span. If we hash only the | |
| 144 | // length, for example, then two otherwise equal spans with different end locations will | |
| 145 | // have the same hash. This can cause a problem during incremental compilation wherein a | |
| 146 | // previous result for a query that depends on the end location of a span will be | |
| 147 | // incorrectly reused when the end location of the span it depends on has changed (see | |
| 148 | // issue #74890). A similar analysis applies if some query depends specifically on the | |
| 149 | // length of the span, but we only hash the end location. So hash both. | |
| 150 | ||
| 151 | let col_lo_trunc = (col_lo.0 as u64) & 0xFF; | |
| 152 | let line_lo_trunc = ((line_lo as u64) & 0xFF_FF_FF) << 8; | |
| 153 | let col_hi_trunc = (col_hi.0 as u64) & 0xFF << 32; | |
| 154 | let line_hi_trunc = ((line_hi as u64) & 0xFF_FF_FF) << 40; | |
| 155 | let col_line = col_lo_trunc | line_lo_trunc | col_hi_trunc | line_hi_trunc; | |
| 156 | let len = (span.hi - span.lo).0; | |
| 157 | Hash::hash(&col_line, hasher); | |
| 158 | Hash::hash(&len, hasher); | |
| 159 | } | |
| 160 | ||
| 161 | #[inline] | |
| 162 | fn def_path_hash(&self, raw_def_id: RawDefId) -> RawDefPathHash { | |
| 163 | let def_id = DefId::from_raw_def_id(raw_def_id); | |
| 164 | if let Some(def_id) = def_id.as_local() { | |
| 165 | self.untracked.definitions.read().def_path_hash(def_id) | |
| 166 | } else { | |
| 167 | self.untracked.cstore.read().def_path_hash(def_id) | |
| 168 | } | |
| 169 | .to_raw_def_path_hash() | |
| 170 | } | |
| 171 | ||
| 172 | /// Assert that the provided `HashStableContext` is configured with the default | |
| 173 | /// `HashingControls`. We should always have bailed out before getting to here with a | |
| 174 | /// non-default mode. With this check in place, we can avoid the need to maintain separate | |
| 175 | /// versions of `ExpnData` hashes for each permutation of `HashingControls` settings. | |
| 176 | #[inline] | |
| 177 | fn assert_default_hashing_controls(&self, msg: &str) { | |
| 178 | let hashing_controls = self.hashing_controls; | |
| 179 | let HashingControls { hash_spans } = hashing_controls; | |
| 180 | ||
| 181 | // Note that we require that `hash_spans` be the inverse of the global `-Z | |
| 182 | // incremental-ignore-spans` option. Normally, this option is disabled, in which case | |
| 183 | // `hash_spans` must be true. | |
| 184 | // | |
| 185 | // Span hashing can also be disabled without `-Z incremental-ignore-spans`. This is the | |
| 186 | // case for instance when building a hash for name mangling. Such configuration must not be | |
| 187 | // used for metadata. | |
| 188 | assert_eq!( | |
| 189 | hash_spans, !self.incremental_ignore_spans, | |
| 190 | "Attempted hashing of {msg} with non-default HashingControls: {hashing_controls:?}" | |
| 191 | ); | |
| 192 | } | |
| 193 | ||
| 194 | #[inline] | |
| 195 | fn hashing_controls(&self) -> HashingControls { | |
| 196 | self.hashing_controls | |
| 197 | } | |
| 198 | } |
compiler/rustc_middle/src/ich/hcx.rs deleted-189| ... | ... | @@ -1,189 +0,0 @@ |
| 1 | use std::hash::Hash; | |
| 2 | ||
| 3 | use rustc_data_structures::stable_hasher::{HashStable, HashingControls, StableHasher}; | |
| 4 | use rustc_hir::def_id::{DefId, LocalDefId}; | |
| 5 | use rustc_hir::definitions::DefPathHash; | |
| 6 | use rustc_session::Session; | |
| 7 | use rustc_session::cstore::Untracked; | |
| 8 | use rustc_span::source_map::SourceMap; | |
| 9 | use rustc_span::{CachingSourceMapView, DUMMY_SP, HashStableContext, Pos, Span}; | |
| 10 | ||
| 11 | // Very often, we are hashing something that does not need the `CachingSourceMapView`, so we | |
| 12 | // initialize it lazily. | |
| 13 | enum CachingSourceMap<'a> { | |
| 14 | Unused(&'a SourceMap), | |
| 15 | InUse(CachingSourceMapView<'a>), | |
| 16 | } | |
| 17 | ||
| 18 | /// This is the context state available during incr. comp. hashing. It contains | |
| 19 | /// enough information to transform `DefId`s and `HirId`s into stable `DefPath`s (i.e., | |
| 20 | /// a reference to the `TyCtxt`) and it holds a few caches for speeding up various | |
| 21 | /// things (e.g., each `DefId`/`DefPath` is only hashed once). | |
| 22 | pub struct StableHashingContext<'a> { | |
| 23 | untracked: &'a Untracked, | |
| 24 | // The value of `-Z incremental-ignore-spans`. | |
| 25 | // This field should only be used by `unstable_opts_incremental_ignore_span` | |
| 26 | incremental_ignore_spans: bool, | |
| 27 | caching_source_map: CachingSourceMap<'a>, | |
| 28 | hashing_controls: HashingControls, | |
| 29 | } | |
| 30 | ||
| 31 | impl<'a> StableHashingContext<'a> { | |
| 32 | #[inline] | |
| 33 | pub fn new(sess: &'a Session, untracked: &'a Untracked) -> Self { | |
| 34 | let hash_spans_initial = !sess.opts.unstable_opts.incremental_ignore_spans; | |
| 35 | ||
| 36 | StableHashingContext { | |
| 37 | untracked, | |
| 38 | incremental_ignore_spans: sess.opts.unstable_opts.incremental_ignore_spans, | |
| 39 | caching_source_map: CachingSourceMap::Unused(sess.source_map()), | |
| 40 | hashing_controls: HashingControls { hash_spans: hash_spans_initial }, | |
| 41 | } | |
| 42 | } | |
| 43 | ||
| 44 | #[inline] | |
| 45 | pub fn while_hashing_spans<F: FnOnce(&mut Self)>(&mut self, hash_spans: bool, f: F) { | |
| 46 | let prev_hash_spans = self.hashing_controls.hash_spans; | |
| 47 | self.hashing_controls.hash_spans = hash_spans; | |
| 48 | f(self); | |
| 49 | self.hashing_controls.hash_spans = prev_hash_spans; | |
| 50 | } | |
| 51 | ||
| 52 | #[inline] | |
| 53 | fn source_map(&mut self) -> &mut CachingSourceMapView<'a> { | |
| 54 | match self.caching_source_map { | |
| 55 | CachingSourceMap::InUse(ref mut sm) => sm, | |
| 56 | CachingSourceMap::Unused(sm) => { | |
| 57 | self.caching_source_map = CachingSourceMap::InUse(CachingSourceMapView::new(sm)); | |
| 58 | self.source_map() // this recursive call will hit the `InUse` case | |
| 59 | } | |
| 60 | } | |
| 61 | } | |
| 62 | ||
| 63 | #[inline] | |
| 64 | fn def_span(&self, def_id: LocalDefId) -> Span { | |
| 65 | self.untracked.source_span.get(def_id).unwrap_or(DUMMY_SP) | |
| 66 | } | |
| 67 | ||
| 68 | #[inline] | |
| 69 | pub fn hashing_controls(&self) -> HashingControls { | |
| 70 | self.hashing_controls | |
| 71 | } | |
| 72 | } | |
| 73 | ||
| 74 | impl<'a> HashStableContext for StableHashingContext<'a> { | |
| 75 | /// Hashes a span in a stable way. We can't directly hash the span's `BytePos` fields (that | |
| 76 | /// would be similar to hashing pointers, since those are just offsets into the `SourceMap`). | |
| 77 | /// Instead, we hash the (file name, line, column) triple, which stays the same even if the | |
| 78 | /// containing `SourceFile` has moved within the `SourceMap`. | |
| 79 | /// | |
| 80 | /// Also note that we are hashing byte offsets for the column, not unicode codepoint offsets. | |
| 81 | /// For the purpose of the hash that's sufficient. Also, hashing filenames is expensive so we | |
| 82 | /// avoid doing it twice when the span starts and ends in the same file, which is almost always | |
| 83 | /// the case. | |
| 84 | /// | |
| 85 | /// IMPORTANT: changes to this method should be reflected in implementations of `SpanEncoder`. | |
| 86 | #[inline] | |
| 87 | fn span_hash_stable(&mut self, span: Span, hasher: &mut StableHasher) { | |
| 88 | const TAG_VALID_SPAN: u8 = 0; | |
| 89 | const TAG_INVALID_SPAN: u8 = 1; | |
| 90 | const TAG_RELATIVE_SPAN: u8 = 2; | |
| 91 | ||
| 92 | if !self.hashing_controls().hash_spans { | |
| 93 | return; | |
| 94 | } | |
| 95 | ||
| 96 | let span = span.data_untracked(); | |
| 97 | span.ctxt.hash_stable(self, hasher); | |
| 98 | span.parent.hash_stable(self, hasher); | |
| 99 | ||
| 100 | if span.is_dummy() { | |
| 101 | Hash::hash(&TAG_INVALID_SPAN, hasher); | |
| 102 | return; | |
| 103 | } | |
| 104 | ||
| 105 | let parent = span.parent.map(|parent| self.def_span(parent).data_untracked()); | |
| 106 | if let Some(parent) = parent | |
| 107 | && parent.contains(span) | |
| 108 | { | |
| 109 | // This span is enclosed in a definition: only hash the relative position. This catches | |
| 110 | // a subset of the cases from the `file.contains(parent.lo)`. But we can do this check | |
| 111 | // cheaply without the expensive `span_data_to_lines_and_cols` query. | |
| 112 | Hash::hash(&TAG_RELATIVE_SPAN, hasher); | |
| 113 | (span.lo - parent.lo).to_u32().hash_stable(self, hasher); | |
| 114 | (span.hi - parent.lo).to_u32().hash_stable(self, hasher); | |
| 115 | return; | |
| 116 | } | |
| 117 | ||
| 118 | // If this is not an empty or invalid span, we want to hash the last position that belongs | |
| 119 | // to it, as opposed to hashing the first position past it. | |
| 120 | let Some((file, line_lo, col_lo, line_hi, col_hi)) = | |
| 121 | self.source_map().span_data_to_lines_and_cols(&span) | |
| 122 | else { | |
| 123 | Hash::hash(&TAG_INVALID_SPAN, hasher); | |
| 124 | return; | |
| 125 | }; | |
| 126 | ||
| 127 | if let Some(parent) = parent | |
| 128 | && file.contains(parent.lo) | |
| 129 | { | |
| 130 | // This span is relative to another span in the same file, | |
| 131 | // only hash the relative position. | |
| 132 | Hash::hash(&TAG_RELATIVE_SPAN, hasher); | |
| 133 | Hash::hash(&(span.lo.0.wrapping_sub(parent.lo.0)), hasher); | |
| 134 | Hash::hash(&(span.hi.0.wrapping_sub(parent.lo.0)), hasher); | |
| 135 | return; | |
| 136 | } | |
| 137 | ||
| 138 | Hash::hash(&TAG_VALID_SPAN, hasher); | |
| 139 | Hash::hash(&file.stable_id, hasher); | |
| 140 | ||
| 141 | // Hash both the length and the end location (line/column) of a span. If we hash only the | |
| 142 | // length, for example, then two otherwise equal spans with different end locations will | |
| 143 | // have the same hash. This can cause a problem during incremental compilation wherein a | |
| 144 | // previous result for a query that depends on the end location of a span will be | |
| 145 | // incorrectly reused when the end location of the span it depends on has changed (see | |
| 146 | // issue #74890). A similar analysis applies if some query depends specifically on the | |
| 147 | // length of the span, but we only hash the end location. So hash both. | |
| 148 | ||
| 149 | let col_lo_trunc = (col_lo.0 as u64) & 0xFF; | |
| 150 | let line_lo_trunc = ((line_lo as u64) & 0xFF_FF_FF) << 8; | |
| 151 | let col_hi_trunc = (col_hi.0 as u64) & 0xFF << 32; | |
| 152 | let line_hi_trunc = ((line_hi as u64) & 0xFF_FF_FF) << 40; | |
| 153 | let col_line = col_lo_trunc | line_lo_trunc | col_hi_trunc | line_hi_trunc; | |
| 154 | let len = (span.hi - span.lo).0; | |
| 155 | Hash::hash(&col_line, hasher); | |
| 156 | Hash::hash(&len, hasher); | |
| 157 | } | |
| 158 | ||
| 159 | #[inline] | |
| 160 | fn def_path_hash(&self, def_id: DefId) -> DefPathHash { | |
| 161 | if let Some(def_id) = def_id.as_local() { | |
| 162 | self.untracked.definitions.read().def_path_hash(def_id) | |
| 163 | } else { | |
| 164 | self.untracked.cstore.read().def_path_hash(def_id) | |
| 165 | } | |
| 166 | } | |
| 167 | ||
| 168 | /// Assert that the provided `HashStableContext` is configured with the default | |
| 169 | /// `HashingControls`. We should always have bailed out before getting to here with a | |
| 170 | /// non-default mode. With this check in place, we can avoid the need to maintain separate | |
| 171 | /// versions of `ExpnData` hashes for each permutation of `HashingControls` settings. | |
| 172 | #[inline] | |
| 173 | fn assert_default_hashing_controls(&self, msg: &str) { | |
| 174 | let hashing_controls = self.hashing_controls; | |
| 175 | let HashingControls { hash_spans } = hashing_controls; | |
| 176 | ||
| 177 | // Note that we require that `hash_spans` be the inverse of the global `-Z | |
| 178 | // incremental-ignore-spans` option. Normally, this option is disabled, in which case | |
| 179 | // `hash_spans` must be true. | |
| 180 | // | |
| 181 | // Span hashing can also be disabled without `-Z incremental-ignore-spans`. This is the | |
| 182 | // case for instance when building a hash for name mangling. Such configuration must not be | |
| 183 | // used for metadata. | |
| 184 | assert_eq!( | |
| 185 | hash_spans, !self.incremental_ignore_spans, | |
| 186 | "Attempted hashing of {msg} with non-default HashingControls: {hashing_controls:?}" | |
| 187 | ); | |
| 188 | } | |
| 189 | } |
compiler/rustc_middle/src/ich/impls_syntax.rs deleted-40| ... | ... | @@ -1,40 +0,0 @@ |
| 1 | //! This module contains `HashStable` implementations for various data types | |
| 2 | //! from various crates in no particular order. | |
| 3 | ||
| 4 | use rustc_ast as ast; | |
| 5 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 6 | ||
| 7 | use super::StableHashingContext; | |
| 8 | ||
| 9 | impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId { | |
| 10 | #[inline] | |
| 11 | fn hash_stable(&self, _: &mut StableHashingContext<'a>, _: &mut StableHasher) { | |
| 12 | panic!("Node IDs should not appear in incremental state"); | |
| 13 | } | |
| 14 | } | |
| 15 | ||
| 16 | impl<'tcx> HashStable<StableHashingContext<'tcx>> for rustc_feature::Features { | |
| 17 | fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) { | |
| 18 | // Unfortunately we cannot exhaustively list fields here, since the | |
| 19 | // struct has private fields (to ensure its invariant is maintained) | |
| 20 | self.enabled_lang_features().hash_stable(hcx, hasher); | |
| 21 | self.enabled_lib_features().hash_stable(hcx, hasher); | |
| 22 | } | |
| 23 | } | |
| 24 | ||
| 25 | impl<'tcx> HashStable<StableHashingContext<'tcx>> for rustc_feature::EnabledLangFeature { | |
| 26 | fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) { | |
| 27 | let rustc_feature::EnabledLangFeature { gate_name, attr_sp, stable_since } = self; | |
| 28 | gate_name.hash_stable(hcx, hasher); | |
| 29 | attr_sp.hash_stable(hcx, hasher); | |
| 30 | stable_since.hash_stable(hcx, hasher); | |
| 31 | } | |
| 32 | } | |
| 33 | ||
| 34 | impl<'tcx> HashStable<StableHashingContext<'tcx>> for rustc_feature::EnabledLibFeature { | |
| 35 | fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) { | |
| 36 | let rustc_feature::EnabledLibFeature { gate_name, attr_sp } = self; | |
| 37 | gate_name.hash_stable(hcx, hasher); | |
| 38 | attr_sp.hash_stable(hcx, hasher); | |
| 39 | } | |
| 40 | } |
compiler/rustc_middle/src/ich/mod.rs deleted-6| ... | ... | @@ -1,6 +0,0 @@ |
| 1 | //! ICH - Incremental Compilation Hash | |
| 2 | ||
| 3 | pub use self::hcx::StableHashingContext; | |
| 4 | ||
| 5 | mod hcx; | |
| 6 | mod impls_syntax; |
compiler/rustc_middle/src/middle/privacy.rs+3-4| ... | ... | @@ -6,13 +6,12 @@ use std::cmp::Ordering; |
| 6 | 6 | use std::hash::Hash; |
| 7 | 7 | |
| 8 | 8 | use rustc_data_structures::fx::{FxIndexMap, IndexEntry}; |
| 9 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 9 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 10 | 10 | use rustc_hir::def::DefKind; |
| 11 | 11 | use rustc_hir::{ItemKind, Node, UseKind}; |
| 12 | 12 | use rustc_macros::HashStable; |
| 13 | 13 | use rustc_span::def_id::{CRATE_DEF_ID, LocalDefId}; |
| 14 | 14 | |
| 15 | use crate::ich::StableHashingContext; | |
| 16 | 15 | use crate::ty::{TyCtxt, Visibility}; |
| 17 | 16 | |
| 18 | 17 | /// Represents the levels of effective visibility an item can have. |
| ... | ... | @@ -281,8 +280,8 @@ impl<Id> Default for EffectiveVisibilities<Id> { |
| 281 | 280 | } |
| 282 | 281 | } |
| 283 | 282 | |
| 284 | impl<'a> HashStable<StableHashingContext<'a>> for EffectiveVisibilities { | |
| 285 | fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { | |
| 283 | impl HashStable for EffectiveVisibilities { | |
| 284 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 286 | 285 | let EffectiveVisibilities { ref map } = *self; |
| 287 | 286 | map.hash_stable(hcx, hasher); |
| 288 | 287 | } |
compiler/rustc_middle/src/mir/basic_blocks.rs+3-3| ... | ... | @@ -2,7 +2,7 @@ use std::sync::{Arc, OnceLock}; |
| 2 | 2 | |
| 3 | 3 | use rustc_data_structures::graph; |
| 4 | 4 | use rustc_data_structures::graph::dominators::{Dominators, dominators}; |
| 5 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 5 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 6 | 6 | use rustc_index::{IndexSlice, IndexVec}; |
| 7 | 7 | use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable}; |
| 8 | 8 | use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; |
| ... | ... | @@ -171,7 +171,7 @@ impl<D: Decoder> Decodable<D> for Cache { |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | impl<Hcx> HashStable<Hcx> for Cache { | |
| 174 | impl HashStable for Cache { | |
| 175 | 175 | #[inline] |
| 176 | fn hash_stable(&self, _: &mut Hcx, _: &mut StableHasher) {} | |
| 176 | fn hash_stable<Hcx: HashStableContext>(&self, _: &mut Hcx, _: &mut StableHasher) {} | |
| 177 | 177 | } |
compiler/rustc_middle/src/mono.rs+7-6| ... | ... | @@ -5,7 +5,9 @@ use std::hash::Hash; |
| 5 | 5 | use rustc_data_structures::base_n::{BaseNString, CASE_INSENSITIVE, ToBaseN}; |
| 6 | 6 | use rustc_data_structures::fingerprint::Fingerprint; |
| 7 | 7 | use rustc_data_structures::fx::FxIndexMap; |
| 8 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; | |
| 8 | use rustc_data_structures::stable_hasher::{ | |
| 9 | HashStable, HashStableContext, StableHasher, ToStableHashKey, | |
| 10 | }; | |
| 9 | 11 | use rustc_data_structures::unord::UnordMap; |
| 10 | 12 | use rustc_hashes::Hash128; |
| 11 | 13 | use rustc_hir::ItemId; |
| ... | ... | @@ -19,7 +21,6 @@ use tracing::debug; |
| 19 | 21 | |
| 20 | 22 | use crate::dep_graph::dep_node::{make_compile_codegen_unit, make_compile_mono_item}; |
| 21 | 23 | use crate::dep_graph::{DepNode, WorkProduct, WorkProductId}; |
| 22 | use crate::ich::StableHashingContext; | |
| 23 | 24 | use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags; |
| 24 | 25 | use crate::ty::{self, GenericArgs, Instance, InstanceKind, SymbolName, Ty, TyCtxt}; |
| 25 | 26 | |
| ... | ... | @@ -325,10 +326,10 @@ impl<'tcx> fmt::Display for MonoItem<'tcx> { |
| 325 | 326 | } |
| 326 | 327 | } |
| 327 | 328 | |
| 328 | impl ToStableHashKey<StableHashingContext<'_>> for MonoItem<'_> { | |
| 329 | impl ToStableHashKey for MonoItem<'_> { | |
| 329 | 330 | type KeyType = Fingerprint; |
| 330 | 331 | |
| 331 | fn to_stable_hash_key(&self, hcx: &mut StableHashingContext<'_>) -> Self::KeyType { | |
| 332 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> Self::KeyType { | |
| 332 | 333 | let mut hasher = StableHasher::new(); |
| 333 | 334 | self.hash_stable(hcx, &mut hasher); |
| 334 | 335 | hasher.finish() |
| ... | ... | @@ -581,10 +582,10 @@ impl<'tcx> CodegenUnit<'tcx> { |
| 581 | 582 | } |
| 582 | 583 | } |
| 583 | 584 | |
| 584 | impl ToStableHashKey<StableHashingContext<'_>> for CodegenUnit<'_> { | |
| 585 | impl ToStableHashKey for CodegenUnit<'_> { | |
| 585 | 586 | type KeyType = String; |
| 586 | 587 | |
| 587 | fn to_stable_hash_key(&self, _: &mut StableHashingContext<'_>) -> Self::KeyType { | |
| 588 | fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> Self::KeyType { | |
| 588 | 589 | // Codegen unit names are conceptually required to be stable across |
| 589 | 590 | // compilation session so that object file names match up. |
| 590 | 591 | self.name.to_string() |
compiler/rustc_middle/src/query/keys.rs+1-2| ... | ... | @@ -11,7 +11,6 @@ use rustc_hir::hir_id::OwnerId; |
| 11 | 11 | use rustc_span::{DUMMY_SP, Ident, LocalExpnId, Span, Symbol}; |
| 12 | 12 | |
| 13 | 13 | use crate::dep_graph::DepNodeIndex; |
| 14 | use crate::ich::StableHashingContext; | |
| 15 | 14 | use crate::infer::canonical::CanonicalQueryInput; |
| 16 | 15 | use crate::mono::CollectionMode; |
| 17 | 16 | use crate::query::{DefIdCache, DefaultCache, SingleCache, VecCache}; |
| ... | ... | @@ -24,7 +23,7 @@ use crate::{mir, traits}; |
| 24 | 23 | #[derive(Copy, Clone, Debug)] |
| 25 | 24 | pub struct LocalCrate; |
| 26 | 25 | |
| 27 | pub trait QueryKeyBounds = Copy + Debug + Eq + Hash + for<'a> HashStable<StableHashingContext<'a>>; | |
| 26 | pub trait QueryKeyBounds = Copy + Debug + Eq + Hash + HashStable; | |
| 28 | 27 | |
| 29 | 28 | /// Controls what types can legally be used as the key for a query. |
| 30 | 29 | pub trait QueryKey: Sized + QueryKeyBounds { |
compiler/rustc_middle/src/ty/adt.rs+5-4| ... | ... | @@ -7,7 +7,9 @@ use rustc_abi::{FIRST_VARIANT, FieldIdx, ReprOptions, VariantIdx}; |
| 7 | 7 | use rustc_data_structures::fingerprint::Fingerprint; |
| 8 | 8 | use rustc_data_structures::fx::FxHashMap; |
| 9 | 9 | use rustc_data_structures::intern::Interned; |
| 10 | use rustc_data_structures::stable_hasher::{HashStable, HashingControls, StableHasher}; | |
| 10 | use rustc_data_structures::stable_hasher::{ | |
| 11 | HashStable, HashStableContext, HashingControls, StableHasher, | |
| 12 | }; | |
| 11 | 13 | use rustc_errors::ErrorGuaranteed; |
| 12 | 14 | use rustc_hir::def::{CtorKind, DefKind, Res}; |
| 13 | 15 | use rustc_hir::def_id::DefId; |
| ... | ... | @@ -23,7 +25,6 @@ use tracing::{debug, info, trace}; |
| 23 | 25 | use super::{ |
| 24 | 26 | AsyncDestructor, Destructor, FieldDef, GenericPredicates, Ty, TyCtxt, VariantDef, VariantDiscr, |
| 25 | 27 | }; |
| 26 | use crate::ich::StableHashingContext; | |
| 27 | 28 | use crate::mir::interpret::ErrorHandled; |
| 28 | 29 | use crate::ty::util::{Discr, IntTypeExt}; |
| 29 | 30 | use crate::ty::{self, ConstKind}; |
| ... | ... | @@ -151,8 +152,8 @@ impl Hash for AdtDefData { |
| 151 | 152 | } |
| 152 | 153 | } |
| 153 | 154 | |
| 154 | impl<'a> HashStable<StableHashingContext<'a>> for AdtDefData { | |
| 155 | fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { | |
| 155 | impl HashStable for AdtDefData { | |
| 156 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 156 | 157 | thread_local! { |
| 157 | 158 | static CACHE: RefCell<FxHashMap<(usize, HashingControls), Fingerprint>> = Default::default(); |
| 158 | 159 | } |
compiler/rustc_middle/src/ty/consts/int.rs+7-2| ... | ... | @@ -4,6 +4,7 @@ use std::num::NonZero; |
| 4 | 4 | use rustc_abi::Size; |
| 5 | 5 | use rustc_apfloat::Float; |
| 6 | 6 | use rustc_apfloat::ieee::{Double, Half, Quad, Single}; |
| 7 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext}; | |
| 7 | 8 | use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; |
| 8 | 9 | |
| 9 | 10 | use crate::ty::TyCtxt; |
| ... | ... | @@ -151,8 +152,12 @@ pub struct ScalarInt { |
| 151 | 152 | |
| 152 | 153 | // Cannot derive these, as the derives take references to the fields, and we |
| 153 | 154 | // can't take references to fields of packed structs. |
| 154 | impl<Hcx> crate::ty::HashStable<Hcx> for ScalarInt { | |
| 155 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut crate::ty::StableHasher) { | |
| 155 | impl HashStable for ScalarInt { | |
| 156 | fn hash_stable<Hcx: HashStableContext>( | |
| 157 | &self, | |
| 158 | hcx: &mut Hcx, | |
| 159 | hasher: &mut crate::ty::StableHasher, | |
| 160 | ) { | |
| 156 | 161 | // Using a block `{self.data}` here to force a copy instead of using `self.data` |
| 157 | 162 | // directly, because `hash_stable` takes `&self` and would thus borrow `self.data`. |
| 158 | 163 | // Since `Self` is a packed struct, that would create a possibly unaligned reference, |
compiler/rustc_middle/src/ty/context.rs+2-2| ... | ... | @@ -547,7 +547,7 @@ pub struct TyCtxtFeed<'tcx, KEY: Copy> { |
| 547 | 547 | |
| 548 | 548 | /// Never return a `Feed` from a query. Only queries that create a `DefId` are |
| 549 | 549 | /// allowed to feed queries for that `DefId`. |
| 550 | impl<KEY: Copy, Hcx> !HashStable<Hcx> for TyCtxtFeed<'_, KEY> {} | |
| 550 | impl<KEY: Copy> !HashStable for TyCtxtFeed<'_, KEY> {} | |
| 551 | 551 | |
| 552 | 552 | /// The same as `TyCtxtFeed`, but does not contain a `TyCtxt`. |
| 553 | 553 | /// Use this to pass around when you have a `TyCtxt` elsewhere. |
| ... | ... | @@ -562,7 +562,7 @@ pub struct Feed<'tcx, KEY: Copy> { |
| 562 | 562 | |
| 563 | 563 | /// Never return a `Feed` from a query. Only queries that create a `DefId` are |
| 564 | 564 | /// allowed to feed queries for that `DefId`. |
| 565 | impl<KEY: Copy, Hcx> !HashStable<Hcx> for Feed<'_, KEY> {} | |
| 565 | impl<KEY: Copy> !HashStable for Feed<'_, KEY> {} | |
| 566 | 566 | |
| 567 | 567 | impl<T: fmt::Debug + Copy> fmt::Debug for Feed<'_, T> { |
| 568 | 568 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
compiler/rustc_middle/src/ty/impls_ty.rs+15-16| ... | ... | @@ -7,19 +7,18 @@ use std::ptr; |
| 7 | 7 | use rustc_data_structures::fingerprint::Fingerprint; |
| 8 | 8 | use rustc_data_structures::fx::FxHashMap; |
| 9 | 9 | use rustc_data_structures::stable_hasher::{ |
| 10 | HashStable, HashingControls, StableHasher, ToStableHashKey, | |
| 10 | HashStable, HashStableContext, HashingControls, StableHasher, ToStableHashKey, | |
| 11 | 11 | }; |
| 12 | 12 | use tracing::trace; |
| 13 | 13 | |
| 14 | use crate::ich::StableHashingContext; | |
| 15 | 14 | use crate::middle::region; |
| 16 | 15 | use crate::{mir, ty}; |
| 17 | 16 | |
| 18 | impl<'a, 'tcx, H, T> HashStable<StableHashingContext<'a>> for &'tcx ty::list::RawList<H, T> | |
| 17 | impl<'tcx, H, T> HashStable for &'tcx ty::list::RawList<H, T> | |
| 19 | 18 | where |
| 20 | T: HashStable<StableHashingContext<'a>>, | |
| 19 | T: HashStable, | |
| 21 | 20 | { |
| 22 | fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { | |
| 21 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 23 | 22 | // Note: this cache makes an *enormous* performance difference on certain benchmarks. E.g. |
| 24 | 23 | // without it, compiling `diesel-2.2.10` can be 74% slower, and compiling |
| 25 | 24 | // `deeply-nested-multi` can be ~4,000x slower(!) |
| ... | ... | @@ -46,29 +45,29 @@ where |
| 46 | 45 | } |
| 47 | 46 | } |
| 48 | 47 | |
| 49 | impl<'a, 'tcx, H, T> ToStableHashKey<StableHashingContext<'a>> for &'tcx ty::list::RawList<H, T> | |
| 48 | impl<'tcx, H, T> ToStableHashKey for &'tcx ty::list::RawList<H, T> | |
| 50 | 49 | where |
| 51 | T: HashStable<StableHashingContext<'a>>, | |
| 50 | T: HashStable, | |
| 52 | 51 | { |
| 53 | 52 | type KeyType = Fingerprint; |
| 54 | 53 | |
| 55 | 54 | #[inline] |
| 56 | fn to_stable_hash_key(&self, hcx: &mut StableHashingContext<'a>) -> Fingerprint { | |
| 55 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> Fingerprint { | |
| 57 | 56 | let mut hasher = StableHasher::new(); |
| 58 | 57 | self.hash_stable(hcx, &mut hasher); |
| 59 | 58 | hasher.finish() |
| 60 | 59 | } |
| 61 | 60 | } |
| 62 | 61 | |
| 63 | impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::GenericArg<'tcx> { | |
| 64 | fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { | |
| 62 | impl<'tcx> HashStable for ty::GenericArg<'tcx> { | |
| 63 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 65 | 64 | self.kind().hash_stable(hcx, hasher); |
| 66 | 65 | } |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | 68 | // AllocIds get resolved to whatever they point to (to be stable) |
| 70 | impl<'a> HashStable<StableHashingContext<'a>> for mir::interpret::AllocId { | |
| 71 | fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { | |
| 69 | impl HashStable for mir::interpret::AllocId { | |
| 70 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 72 | 71 | ty::tls::with_opt(|tcx| { |
| 73 | 72 | trace!("hashing {:?}", *self); |
| 74 | 73 | let tcx = tcx.expect("can't hash AllocIds during hir lowering"); |
| ... | ... | @@ -77,17 +76,17 @@ impl<'a> HashStable<StableHashingContext<'a>> for mir::interpret::AllocId { |
| 77 | 76 | } |
| 78 | 77 | } |
| 79 | 78 | |
| 80 | impl<'a> HashStable<StableHashingContext<'a>> for mir::interpret::CtfeProvenance { | |
| 81 | fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { | |
| 79 | impl HashStable for mir::interpret::CtfeProvenance { | |
| 80 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 82 | 81 | self.into_parts().hash_stable(hcx, hasher); |
| 83 | 82 | } |
| 84 | 83 | } |
| 85 | 84 | |
| 86 | impl<'a> ToStableHashKey<StableHashingContext<'a>> for region::Scope { | |
| 85 | impl ToStableHashKey for region::Scope { | |
| 87 | 86 | type KeyType = region::Scope; |
| 88 | 87 | |
| 89 | 88 | #[inline] |
| 90 | fn to_stable_hash_key(&self, _: &mut StableHashingContext<'a>) -> region::Scope { | |
| 89 | fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> region::Scope { | |
| 91 | 90 | *self |
| 92 | 91 | } |
| 93 | 92 | } |
compiler/rustc_middle/src/ty/mod.rs+3-4| ... | ... | @@ -33,7 +33,7 @@ use rustc_ast::node_id::NodeMap; |
| 33 | 33 | pub use rustc_ast_ir::{Movability, Mutability, try_visit}; |
| 34 | 34 | use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; |
| 35 | 35 | use rustc_data_structures::intern::Interned; |
| 36 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 36 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 37 | 37 | use rustc_data_structures::steal::Steal; |
| 38 | 38 | use rustc_data_structures::unord::{UnordMap, UnordSet}; |
| 39 | 39 | use rustc_errors::{Diag, ErrorGuaranteed, LintBuffer}; |
| ... | ... | @@ -117,7 +117,6 @@ pub use self::typeck_results::{ |
| 117 | 117 | Rust2024IncompatiblePatInfo, TypeckResults, UserType, UserTypeAnnotationIndex, UserTypeKind, |
| 118 | 118 | }; |
| 119 | 119 | use crate::error::{OpaqueHiddenTypeMismatch, TypeMismatchReason}; |
| 120 | use crate::ich::StableHashingContext; | |
| 121 | 120 | use crate::metadata::{AmbigModChild, ModChild}; |
| 122 | 121 | use crate::middle::privacy::EffectiveVisibilities; |
| 123 | 122 | use crate::mir::{Body, CoroutineLayout, CoroutineSavedLocal, SourceInfo}; |
| ... | ... | @@ -558,8 +557,8 @@ impl<'tcx> From<Const<'tcx>> for Term<'tcx> { |
| 558 | 557 | } |
| 559 | 558 | } |
| 560 | 559 | |
| 561 | impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for Term<'tcx> { | |
| 562 | fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { | |
| 560 | impl<'tcx> HashStable for Term<'tcx> { | |
| 561 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 563 | 562 | self.kind().hash_stable(hcx, hasher); |
| 564 | 563 | } |
| 565 | 564 | } |
compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs+2-2| ... | ... | @@ -2,7 +2,7 @@ use std::mem; |
| 2 | 2 | use std::ops::ControlFlow; |
| 3 | 3 | |
| 4 | 4 | #[cfg(feature = "nightly")] |
| 5 | use rustc_macros::HashStable_NoContext; | |
| 5 | use rustc_macros::HashStable; | |
| 6 | 6 | use rustc_type_ir::data_structures::{HashMap, HashSet}; |
| 7 | 7 | use rustc_type_ir::inherent::*; |
| 8 | 8 | use rustc_type_ir::relate::Relate; |
| ... | ... | @@ -137,7 +137,7 @@ where |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | #[derive(PartialEq, Eq, Debug, Hash, Clone, Copy)] |
| 140 | #[cfg_attr(feature = "nightly", derive(HashStable_NoContext))] | |
| 140 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 141 | 141 | pub enum GenerateProofTree { |
| 142 | 142 | Yes, |
| 143 | 143 | No, |
compiler/rustc_session/src/config.rs+11-12| ... | ... | @@ -19,12 +19,11 @@ use rustc_errors::emitter::HumanReadableErrorType; |
| 19 | 19 | use rustc_errors::{ColorConfig, DiagCtxtFlags}; |
| 20 | 20 | use rustc_feature::UnstableFeatures; |
| 21 | 21 | use rustc_hashes::Hash64; |
| 22 | use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable_Generic}; | |
| 22 | use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable}; | |
| 23 | 23 | use rustc_span::edition::{DEFAULT_EDITION, EDITION_NAME_LIST, Edition, LATEST_STABLE_EDITION}; |
| 24 | 24 | use rustc_span::source_map::FilePathMapping; |
| 25 | 25 | use rustc_span::{ |
| 26 | FileName, HashStableContext, RealFileName, RemapPathScopeComponents, SourceFileHashAlgorithm, | |
| 27 | Symbol, sym, | |
| 26 | FileName, RealFileName, RemapPathScopeComponents, SourceFileHashAlgorithm, Symbol, sym, | |
| 28 | 27 | }; |
| 29 | 28 | use rustc_target::spec::{ |
| 30 | 29 | FramePointer, LinkSelfContainedComponents, LinkerFeatures, PanicStrategy, SplitDebuginfo, |
| ... | ... | @@ -89,7 +88,7 @@ pub enum CFProtection { |
| 89 | 88 | Full, |
| 90 | 89 | } |
| 91 | 90 | |
| 92 | #[derive(Clone, Copy, Debug, PartialEq, Hash, HashStable_Generic, Encodable, Decodable)] | |
| 91 | #[derive(Clone, Copy, Debug, PartialEq, Hash, HashStable, Encodable, Decodable)] | |
| 93 | 92 | pub enum OptLevel { |
| 94 | 93 | /// `-Copt-level=0` |
| 95 | 94 | No, |
| ... | ... | @@ -544,7 +543,7 @@ impl SwitchWithOptPath { |
| 544 | 543 | } |
| 545 | 544 | } |
| 546 | 545 | |
| 547 | #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable_Generic)] | |
| 546 | #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)] | |
| 548 | 547 | #[derive(Encodable, BlobDecodable)] |
| 549 | 548 | pub enum SymbolManglingVersion { |
| 550 | 549 | Legacy, |
| ... | ... | @@ -620,7 +619,7 @@ macro_rules! define_output_types { |
| 620 | 619 | } |
| 621 | 620 | ),* $(,)? |
| 622 | 621 | ) => { |
| 623 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, HashStable_Generic)] | |
| 622 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, HashStable)] | |
| 624 | 623 | #[derive(Encodable, Decodable)] |
| 625 | 624 | pub enum OutputType { |
| 626 | 625 | $( |
| ... | ... | @@ -637,10 +636,10 @@ macro_rules! define_output_types { |
| 637 | 636 | const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = (); |
| 638 | 637 | } |
| 639 | 638 | |
| 640 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for OutputType { | |
| 639 | impl ToStableHashKey for OutputType { | |
| 641 | 640 | type KeyType = Self; |
| 642 | 641 | |
| 643 | fn to_stable_hash_key(&self, _: &mut Hcx) -> Self::KeyType { | |
| 642 | fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> Self::KeyType { | |
| 644 | 643 | *self |
| 645 | 644 | } |
| 646 | 645 | } |
| ... | ... | @@ -841,7 +840,7 @@ pub enum ResolveDocLinks { |
| 841 | 840 | /// *Do not* switch `BTreeMap` out for an unsorted container type! That would break |
| 842 | 841 | /// dependency tracking for command-line arguments. Also only hash keys, since tracking |
| 843 | 842 | /// should only depend on the output types, not the paths they're written to. |
| 844 | #[derive(Clone, Debug, Hash, HashStable_Generic, Encodable, Decodable)] | |
| 843 | #[derive(Clone, Debug, Hash, HashStable, Encodable, Decodable)] | |
| 845 | 844 | pub struct OutputTypes(BTreeMap<OutputType, Option<OutFileName>>); |
| 846 | 845 | |
| 847 | 846 | impl OutputTypes { |
| ... | ... | @@ -1055,7 +1054,7 @@ impl Input { |
| 1055 | 1054 | } |
| 1056 | 1055 | } |
| 1057 | 1056 | |
| 1058 | #[derive(Clone, Hash, Debug, HashStable_Generic, PartialEq, Eq, Encodable, Decodable)] | |
| 1057 | #[derive(Clone, Hash, Debug, HashStable, PartialEq, Eq, Encodable, Decodable)] | |
| 1059 | 1058 | pub enum OutFileName { |
| 1060 | 1059 | Real(PathBuf), |
| 1061 | 1060 | Stdout, |
| ... | ... | @@ -1130,7 +1129,7 @@ impl OutFileName { |
| 1130 | 1129 | } |
| 1131 | 1130 | } |
| 1132 | 1131 | |
| 1133 | #[derive(Clone, Hash, Debug, HashStable_Generic, Encodable, Decodable)] | |
| 1132 | #[derive(Clone, Hash, Debug, HashStable, Encodable, Decodable)] | |
| 1134 | 1133 | pub struct OutputFilenames { |
| 1135 | 1134 | pub(crate) out_directory: PathBuf, |
| 1136 | 1135 | /// Crate name. Never contains '-'. |
| ... | ... | @@ -1524,7 +1523,7 @@ impl UnstableOptions { |
| 1524 | 1523 | } |
| 1525 | 1524 | |
| 1526 | 1525 | // The type of entry function, so users can have their own entry functions |
| 1527 | #[derive(Copy, Clone, PartialEq, Hash, Debug, HashStable_Generic)] | |
| 1526 | #[derive(Copy, Clone, PartialEq, Hash, Debug, HashStable)] | |
| 1528 | 1527 | pub enum EntryFnType { |
| 1529 | 1528 | Main { |
| 1530 | 1529 | /// Specifies what to do with `SIGPIPE` before calling `fn main()`. |
compiler/rustc_session/src/cstore.rs+11-11| ... | ... | @@ -12,14 +12,14 @@ use rustc_hir::def_id::{ |
| 12 | 12 | CrateNum, DefId, LOCAL_CRATE, LocalDefId, StableCrateId, StableCrateIdMap, |
| 13 | 13 | }; |
| 14 | 14 | use rustc_hir::definitions::{DefKey, DefPath, DefPathHash, Definitions}; |
| 15 | use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable_Generic}; | |
| 15 | use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable}; | |
| 16 | 16 | use rustc_span::{Span, Symbol}; |
| 17 | 17 | |
| 18 | 18 | // lonely orphan structs and enums looking for a better home |
| 19 | 19 | |
| 20 | 20 | /// Where a crate came from on the local filesystem. One of these three options |
| 21 | 21 | /// must be non-None. |
| 22 | #[derive(PartialEq, Clone, Debug, HashStable_Generic, Encodable, Decodable)] | |
| 22 | #[derive(PartialEq, Clone, Debug, HashStable, Encodable, Decodable)] | |
| 23 | 23 | pub struct CrateSource { |
| 24 | 24 | pub dylib: Option<PathBuf>, |
| 25 | 25 | pub rlib: Option<PathBuf>, |
| ... | ... | @@ -35,7 +35,7 @@ impl CrateSource { |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | #[derive(Encodable, BlobDecodable, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Debug)] |
| 38 | #[derive(HashStable_Generic)] | |
| 38 | #[derive(HashStable)] | |
| 39 | 39 | pub enum CrateDepKind { |
| 40 | 40 | /// A dependency that is only used for its macros. |
| 41 | 41 | MacrosOnly, |
| ... | ... | @@ -58,13 +58,13 @@ impl CrateDepKind { |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | #[derive(Copy, Debug, PartialEq, Clone, Encodable, BlobDecodable, HashStable_Generic)] | |
| 61 | #[derive(Copy, Debug, PartialEq, Clone, Encodable, BlobDecodable, HashStable)] | |
| 62 | 62 | pub enum LinkagePreference { |
| 63 | 63 | RequireDynamic, |
| 64 | 64 | RequireStatic, |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | #[derive(Debug, Encodable, Decodable, HashStable_Generic)] | |
| 67 | #[derive(Debug, Encodable, Decodable, HashStable)] | |
| 68 | 68 | pub struct NativeLib { |
| 69 | 69 | pub kind: NativeLibKind, |
| 70 | 70 | pub name: Symbol, |
| ... | ... | @@ -86,7 +86,7 @@ impl NativeLib { |
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | #[derive(Clone, Debug, Encodable, Decodable, HashStable_Generic)] | |
| 89 | #[derive(Clone, Debug, Encodable, Decodable, HashStable)] | |
| 90 | 90 | pub struct DllImport { |
| 91 | 91 | pub name: Symbol, |
| 92 | 92 | pub import_name_type: Option<PeImportNameType>, |
| ... | ... | @@ -101,7 +101,7 @@ pub struct DllImport { |
| 101 | 101 | pub size: rustc_abi::Size, |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | #[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable_Generic, PartialEq)] | |
| 104 | #[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable, PartialEq)] | |
| 105 | 105 | pub enum DllImportSymbolType { |
| 106 | 106 | Function, |
| 107 | 107 | Static, |
| ... | ... | @@ -127,7 +127,7 @@ impl DllImport { |
| 127 | 127 | /// |
| 128 | 128 | /// The usize value, where present, indicates the size of the function's argument list |
| 129 | 129 | /// in bytes. |
| 130 | #[derive(Clone, PartialEq, Debug, Encodable, Decodable, HashStable_Generic)] | |
| 130 | #[derive(Clone, PartialEq, Debug, Encodable, Decodable, HashStable)] | |
| 131 | 131 | pub enum DllCallingConvention { |
| 132 | 132 | C, |
| 133 | 133 | Stdcall(usize), |
| ... | ... | @@ -135,14 +135,14 @@ pub enum DllCallingConvention { |
| 135 | 135 | Vectorcall(usize), |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | #[derive(Clone, Encodable, Decodable, HashStable_Generic, Debug)] | |
| 138 | #[derive(Clone, Encodable, Decodable, HashStable, Debug)] | |
| 139 | 139 | pub struct ForeignModule { |
| 140 | 140 | pub foreign_items: Vec<DefId>, |
| 141 | 141 | pub def_id: DefId, |
| 142 | 142 | pub abi: ExternAbi, |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 145 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 146 | 146 | pub struct ExternCrate { |
| 147 | 147 | pub src: ExternCrateSource, |
| 148 | 148 | |
| ... | ... | @@ -175,7 +175,7 @@ impl ExternCrate { |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | #[derive(Copy, Clone, Debug, HashStable_Generic)] | |
| 178 | #[derive(Copy, Clone, Debug, HashStable)] | |
| 179 | 179 | pub enum ExternCrateSource { |
| 180 | 180 | /// Crate is loaded by `extern crate`. |
| 181 | 181 | Extern( |
compiler/rustc_session/src/search_paths.rs+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | use std::path::{Path, PathBuf}; |
| 2 | 2 | use std::sync::Arc; |
| 3 | 3 | |
| 4 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 4 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 5 | 5 | use rustc_target::spec::TargetTuple; |
| 6 | 6 | |
| 7 | 7 | use crate::EarlyDiagCtxt; |
| ... | ... | @@ -71,7 +71,7 @@ impl SearchPathFile { |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | #[derive(PartialEq, Clone, Copy, Debug, Hash, Eq, Encodable, Decodable, HashStable_Generic)] | |
| 74 | #[derive(PartialEq, Clone, Copy, Debug, Hash, Eq, Encodable, Decodable, HashStable)] | |
| 75 | 75 | pub enum PathKind { |
| 76 | 76 | Native, |
| 77 | 77 | Crate, |
compiler/rustc_session/src/session.rs+2-2| ... | ... | @@ -24,7 +24,7 @@ use rustc_errors::{ |
| 24 | 24 | }; |
| 25 | 25 | use rustc_feature::UnstableFeatures; |
| 26 | 26 | use rustc_hir::limit::Limit; |
| 27 | use rustc_macros::HashStable_Generic; | |
| 27 | use rustc_macros::HashStable; | |
| 28 | 28 | pub use rustc_span::def_id::StableCrateId; |
| 29 | 29 | use rustc_span::edition::Edition; |
| 30 | 30 | use rustc_span::source_map::{FilePathMapping, SourceMap}; |
| ... | ... | @@ -61,7 +61,7 @@ pub enum CtfeBacktrace { |
| 61 | 61 | Immediate, |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | #[derive(Clone, Copy, Debug, HashStable_Generic)] | |
| 64 | #[derive(Clone, Copy, Debug, HashStable)] | |
| 65 | 65 | pub struct Limits { |
| 66 | 66 | /// The maximum recursion limit for potentially infinitely recursive |
| 67 | 67 | /// operations such as auto-dereference and monomorphization. |
compiler/rustc_session/src/utils.rs+2-2| ... | ... | @@ -4,7 +4,7 @@ use std::sync::OnceLock; |
| 4 | 4 | use rustc_data_structures::profiling::VerboseTimingGuard; |
| 5 | 5 | use rustc_fs_util::try_canonicalize; |
| 6 | 6 | use rustc_hir::attrs::NativeLibKind; |
| 7 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 7 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 8 | 8 | |
| 9 | 9 | use crate::session::Session; |
| 10 | 10 | |
| ... | ... | @@ -19,7 +19,7 @@ impl Session { |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable)] |
| 22 | #[derive(HashStable_Generic)] | |
| 22 | #[derive(HashStable)] | |
| 23 | 23 | pub struct NativeLib { |
| 24 | 24 | pub name: String, |
| 25 | 25 | pub new_name: Option<String>, |
compiler/rustc_span/src/def_id.rs+50-25| ... | ... | @@ -3,14 +3,17 @@ use std::hash::{BuildHasherDefault, Hash, Hasher}; |
| 3 | 3 | |
| 4 | 4 | use rustc_data_structures::AtomicRef; |
| 5 | 5 | use rustc_data_structures::fingerprint::Fingerprint; |
| 6 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd, ToStableHashKey}; | |
| 6 | use rustc_data_structures::stable_hasher::{ | |
| 7 | HashStable, HashStableContext, RawDefId, RawDefPathHash, StableHasher, StableOrd, | |
| 8 | ToStableHashKey, | |
| 9 | }; | |
| 7 | 10 | use rustc_data_structures::unhash::Unhasher; |
| 8 | 11 | use rustc_hashes::Hash64; |
| 9 | 12 | use rustc_index::Idx; |
| 10 | use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable_Generic}; | |
| 13 | use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable}; | |
| 11 | 14 | use rustc_serialize::{Decodable, Encodable}; |
| 12 | 15 | |
| 13 | use crate::{HashStableContext, SpanDecoder, SpanEncoder, Symbol}; | |
| 16 | use crate::{SpanDecoder, SpanEncoder, Symbol}; | |
| 14 | 17 | |
| 15 | 18 | pub type StableCrateIdMap = |
| 16 | 19 | indexmap::IndexMap<StableCrateId, CrateNum, BuildHasherDefault<Unhasher>>; |
| ... | ... | @@ -91,7 +94,7 @@ impl fmt::Display for CrateNum { |
| 91 | 94 | /// collision occurring. For a big crate graph with 1000 crates in it, there is |
| 92 | 95 | /// a probability of 1 in 36,890,000,000,000 of a `StableCrateId` collision. |
| 93 | 96 | #[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Debug)] |
| 94 | #[derive(HashStable_Generic, Encodable, Decodable)] | |
| 97 | #[derive(HashStable, Encodable, Decodable)] | |
| 95 | 98 | pub struct DefPathHash(pub Fingerprint); |
| 96 | 99 | |
| 97 | 100 | impl DefPathHash { |
| ... | ... | @@ -114,6 +117,16 @@ impl DefPathHash { |
| 114 | 117 | pub fn new(stable_crate_id: StableCrateId, local_hash: Hash64) -> DefPathHash { |
| 115 | 118 | DefPathHash(Fingerprint::new(stable_crate_id.0, local_hash)) |
| 116 | 119 | } |
| 120 | ||
| 121 | #[inline] | |
| 122 | pub fn to_raw_def_path_hash(self) -> RawDefPathHash { | |
| 123 | RawDefPathHash(self.0.to_le_bytes()) | |
| 124 | } | |
| 125 | ||
| 126 | #[inline] | |
| 127 | pub fn from_raw_def_path_hash(RawDefPathHash(a): RawDefPathHash) -> DefPathHash { | |
| 128 | DefPathHash(Fingerprint::from_le_bytes(a)) | |
| 129 | } | |
| 117 | 130 | } |
| 118 | 131 | |
| 119 | 132 | impl Default for DefPathHash { |
| ... | ... | @@ -141,7 +154,7 @@ impl StableOrd for DefPathHash { |
| 141 | 154 | /// For more information on the possibility of hash collisions in rustc, |
| 142 | 155 | /// see the discussion in [`DefId`]. |
| 143 | 156 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] |
| 144 | #[derive(Hash, HashStable_Generic, Encodable, BlobDecodable)] | |
| 157 | #[derive(Hash, HashStable, Encodable, BlobDecodable)] | |
| 145 | 158 | pub struct StableCrateId(pub(crate) Hash64); |
| 146 | 159 | |
| 147 | 160 | impl StableCrateId { |
| ... | ... | @@ -312,6 +325,18 @@ impl DefId { |
| 312 | 325 | pub fn is_top_level_module(self) -> bool { |
| 313 | 326 | self.is_local() && self.is_crate_root() |
| 314 | 327 | } |
| 328 | ||
| 329 | #[inline] | |
| 330 | pub fn to_raw_def_id(self) -> RawDefId { | |
| 331 | // Field order must match `from_raw_def_id`. | |
| 332 | RawDefId(self.krate.as_u32(), self.index.as_u32()) | |
| 333 | } | |
| 334 | ||
| 335 | #[inline] | |
| 336 | pub fn from_raw_def_id(RawDefId(a, b): RawDefId) -> DefId { | |
| 337 | // Field order must match `to_raw_def_id`. | |
| 338 | DefId { krate: a.into(), index: b.into() } | |
| 339 | } | |
| 315 | 340 | } |
| 316 | 341 | |
| 317 | 342 | impl From<LocalDefId> for DefId { |
| ... | ... | @@ -402,66 +427,66 @@ rustc_data_structures::define_id_collections!( |
| 402 | 427 | LocalDefId |
| 403 | 428 | ); |
| 404 | 429 | |
| 405 | impl<Hcx: HashStableContext> HashStable<Hcx> for DefId { | |
| 430 | impl HashStable for DefId { | |
| 406 | 431 | #[inline] |
| 407 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 408 | hcx.def_path_hash(*self).hash_stable(hcx, hasher); | |
| 432 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 433 | self.to_stable_hash_key(hcx).hash_stable(hcx, hasher); | |
| 409 | 434 | } |
| 410 | 435 | } |
| 411 | 436 | |
| 412 | impl<Hcx: HashStableContext> HashStable<Hcx> for LocalDefId { | |
| 437 | impl HashStable for LocalDefId { | |
| 413 | 438 | #[inline] |
| 414 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 415 | hcx.def_path_hash(self.to_def_id()).local_hash().hash_stable(hcx, hasher); | |
| 439 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 440 | self.to_stable_hash_key(hcx).local_hash().hash_stable(hcx, hasher); | |
| 416 | 441 | } |
| 417 | 442 | } |
| 418 | 443 | |
| 419 | impl<Hcx: HashStableContext> HashStable<Hcx> for CrateNum { | |
| 444 | impl HashStable for CrateNum { | |
| 420 | 445 | #[inline] |
| 421 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 446 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 422 | 447 | self.as_def_id().to_stable_hash_key(hcx).stable_crate_id().hash_stable(hcx, hasher); |
| 423 | 448 | } |
| 424 | 449 | } |
| 425 | 450 | |
| 426 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for DefId { | |
| 451 | impl ToStableHashKey for DefId { | |
| 427 | 452 | type KeyType = DefPathHash; |
| 428 | 453 | |
| 429 | 454 | #[inline] |
| 430 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 431 | hcx.def_path_hash(*self) | |
| 455 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 456 | DefPathHash::from_raw_def_path_hash(hcx.def_path_hash(self.to_raw_def_id())) | |
| 432 | 457 | } |
| 433 | 458 | } |
| 434 | 459 | |
| 435 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for LocalDefId { | |
| 460 | impl ToStableHashKey for LocalDefId { | |
| 436 | 461 | type KeyType = DefPathHash; |
| 437 | 462 | |
| 438 | 463 | #[inline] |
| 439 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 440 | hcx.def_path_hash(self.to_def_id()) | |
| 464 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 465 | self.to_def_id().to_stable_hash_key(hcx) | |
| 441 | 466 | } |
| 442 | 467 | } |
| 443 | 468 | |
| 444 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for CrateNum { | |
| 469 | impl ToStableHashKey for CrateNum { | |
| 445 | 470 | type KeyType = DefPathHash; |
| 446 | 471 | |
| 447 | 472 | #[inline] |
| 448 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 473 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> DefPathHash { | |
| 449 | 474 | self.as_def_id().to_stable_hash_key(hcx) |
| 450 | 475 | } |
| 451 | 476 | } |
| 452 | 477 | |
| 453 | impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for DefPathHash { | |
| 478 | impl ToStableHashKey for DefPathHash { | |
| 454 | 479 | type KeyType = DefPathHash; |
| 455 | 480 | |
| 456 | 481 | #[inline] |
| 457 | fn to_stable_hash_key(&self, _: &mut Hcx) -> DefPathHash { | |
| 482 | fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> DefPathHash { | |
| 458 | 483 | *self |
| 459 | 484 | } |
| 460 | 485 | } |
| 461 | 486 | |
| 462 | 487 | macro_rules! typed_def_id { |
| 463 | 488 | ($Name:ident, $LocalName:ident) => { |
| 464 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)] | |
| 489 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)] | |
| 465 | 490 | pub struct $Name(DefId); |
| 466 | 491 | |
| 467 | 492 | impl $Name { |
| ... | ... | @@ -500,7 +525,7 @@ macro_rules! typed_def_id { |
| 500 | 525 | } |
| 501 | 526 | } |
| 502 | 527 | |
| 503 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)] | |
| 528 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)] | |
| 504 | 529 | pub struct $LocalName(LocalDefId); |
| 505 | 530 | |
| 506 | 531 | impl !Ord for $LocalName {} |
compiler/rustc_span/src/edition.rs+2-2| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | use std::fmt; |
| 2 | 2 | use std::str::FromStr; |
| 3 | 3 | |
| 4 | use rustc_macros::{BlobDecodable, Encodable, HashStable_Generic}; | |
| 4 | use rustc_macros::{BlobDecodable, Encodable, HashStable}; | |
| 5 | 5 | |
| 6 | 6 | /// The edition of the compiler. (See [RFC 2052](https://github.com/rust-lang/rfcs/blob/master/text/2052-epochs.md).) |
| 7 | 7 | #[derive(Clone, Copy, Hash, PartialEq, PartialOrd, Debug, Encodable, BlobDecodable, Eq)] |
| 8 | #[derive(HashStable_Generic)] | |
| 8 | #[derive(HashStable)] | |
| 9 | 9 | pub enum Edition { |
| 10 | 10 | // When adding new editions, be sure to do the following: |
| 11 | 11 | // |
compiler/rustc_span/src/hygiene.rs+19-17| ... | ... | @@ -30,12 +30,14 @@ use std::{fmt, iter, mem}; |
| 30 | 30 | |
| 31 | 31 | use rustc_data_structures::fingerprint::Fingerprint; |
| 32 | 32 | use rustc_data_structures::fx::{FxHashMap, FxHashSet}; |
| 33 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 33 | use rustc_data_structures::stable_hasher::{ | |
| 34 | HashStable, HashStableContext, StableHasher, ToStableHashKey, | |
| 35 | }; | |
| 34 | 36 | use rustc_data_structures::sync::Lock; |
| 35 | 37 | use rustc_data_structures::unhash::UnhashMap; |
| 36 | 38 | use rustc_hashes::Hash64; |
| 37 | 39 | use rustc_index::IndexVec; |
| 38 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 40 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 39 | 41 | use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; |
| 40 | 42 | use tracing::{debug, trace}; |
| 41 | 43 | |
| ... | ... | @@ -43,7 +45,7 @@ use crate::def_id::{CRATE_DEF_ID, CrateNum, DefId, LOCAL_CRATE, StableCrateId}; |
| 43 | 45 | use crate::edition::Edition; |
| 44 | 46 | use crate::source_map::SourceMap; |
| 45 | 47 | use crate::symbol::{Symbol, kw, sym}; |
| 46 | use crate::{DUMMY_SP, HashStableContext, Span, SpanDecoder, SpanEncoder, with_session_globals}; | |
| 48 | use crate::{DUMMY_SP, Span, SpanDecoder, SpanEncoder, with_session_globals}; | |
| 47 | 49 | |
| 48 | 50 | /// A `SyntaxContext` represents a chain of pairs `(ExpnId, Transparency)` named "marks". |
| 49 | 51 | /// |
| ... | ... | @@ -127,7 +129,7 @@ impl !Ord for LocalExpnId {} |
| 127 | 129 | impl !PartialOrd for LocalExpnId {} |
| 128 | 130 | |
| 129 | 131 | /// A unique hash value associated to an expansion. |
| 130 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Encodable, Decodable, HashStable_Generic)] | |
| 132 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Encodable, Decodable, HashStable)] | |
| 131 | 133 | pub struct ExpnHash(Fingerprint); |
| 132 | 134 | |
| 133 | 135 | impl ExpnHash { |
| ... | ... | @@ -161,7 +163,7 @@ impl ExpnHash { |
| 161 | 163 | /// A property of a macro expansion that determines how identifiers |
| 162 | 164 | /// produced by that expansion are resolved. |
| 163 | 165 | #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug, Encodable, Decodable)] |
| 164 | #[derive(HashStable_Generic)] | |
| 166 | #[derive(HashStable)] | |
| 165 | 167 | pub enum Transparency { |
| 166 | 168 | /// Identifier produced by a transparent expansion is always resolved at call-site. |
| 167 | 169 | /// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this. |
| ... | ... | @@ -963,7 +965,7 @@ impl Span { |
| 963 | 965 | |
| 964 | 966 | /// A subset of properties from both macro definition and macro call available through global data. |
| 965 | 967 | /// Avoid using this if you have access to the original definition or call structures. |
| 966 | #[derive(Clone, Debug, Encodable, Decodable, HashStable_Generic)] | |
| 968 | #[derive(Clone, Debug, Encodable, Decodable, HashStable)] | |
| 967 | 969 | pub struct ExpnData { |
| 968 | 970 | // --- The part unique to each expansion. |
| 969 | 971 | pub kind: ExpnKind, |
| ... | ... | @@ -1110,7 +1112,7 @@ impl ExpnData { |
| 1110 | 1112 | } |
| 1111 | 1113 | |
| 1112 | 1114 | /// Expansion kind. |
| 1113 | #[derive(Clone, Debug, PartialEq, Encodable, Decodable, HashStable_Generic)] | |
| 1115 | #[derive(Clone, Debug, PartialEq, Encodable, Decodable, HashStable)] | |
| 1114 | 1116 | pub enum ExpnKind { |
| 1115 | 1117 | /// No expansion, aka root expansion. Only `ExpnId::root()` has this kind. |
| 1116 | 1118 | Root, |
| ... | ... | @@ -1139,7 +1141,7 @@ impl ExpnKind { |
| 1139 | 1141 | |
| 1140 | 1142 | /// The kind of macro invocation or definition. |
| 1141 | 1143 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Hash, Debug)] |
| 1142 | #[derive(HashStable_Generic)] | |
| 1144 | #[derive(HashStable)] | |
| 1143 | 1145 | pub enum MacroKind { |
| 1144 | 1146 | /// A bang macro `foo!()`. |
| 1145 | 1147 | Bang, |
| ... | ... | @@ -1174,7 +1176,7 @@ impl MacroKind { |
| 1174 | 1176 | } |
| 1175 | 1177 | |
| 1176 | 1178 | /// The kind of AST transform. |
| 1177 | #[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic)] | |
| 1179 | #[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable)] | |
| 1178 | 1180 | pub enum AstPass { |
| 1179 | 1181 | StdImports, |
| 1180 | 1182 | TestHarness, |
| ... | ... | @@ -1192,7 +1194,7 @@ impl AstPass { |
| 1192 | 1194 | } |
| 1193 | 1195 | |
| 1194 | 1196 | /// The kind of compiler desugaring. |
| 1195 | #[derive(Clone, Copy, PartialEq, Debug, Encodable, Decodable, HashStable_Generic)] | |
| 1197 | #[derive(Clone, Copy, PartialEq, Debug, Encodable, Decodable, HashStable)] | |
| 1196 | 1198 | pub enum DesugaringKind { |
| 1197 | 1199 | QuestionMark, |
| 1198 | 1200 | TryBlock, |
| ... | ... | @@ -1514,11 +1516,11 @@ fn update_disambiguator(expn_data: &mut ExpnData, mut hcx: impl HashStableContex |
| 1514 | 1516 | }); |
| 1515 | 1517 | } |
| 1516 | 1518 | |
| 1517 | ExpnHash::new(hcx.def_path_hash(LOCAL_CRATE.as_def_id()).stable_crate_id(), expn_hash) | |
| 1519 | ExpnHash::new(LOCAL_CRATE.as_def_id().to_stable_hash_key(&mut hcx).stable_crate_id(), expn_hash) | |
| 1518 | 1520 | } |
| 1519 | 1521 | |
| 1520 | impl<Hcx: HashStableContext> HashStable<Hcx> for SyntaxContext { | |
| 1521 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 1522 | impl HashStable for SyntaxContext { | |
| 1523 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 1522 | 1524 | const TAG_EXPANSION: u8 = 0; |
| 1523 | 1525 | const TAG_NO_EXPANSION: u8 = 1; |
| 1524 | 1526 | |
| ... | ... | @@ -1533,8 +1535,8 @@ impl<Hcx: HashStableContext> HashStable<Hcx> for SyntaxContext { |
| 1533 | 1535 | } |
| 1534 | 1536 | } |
| 1535 | 1537 | |
| 1536 | impl<Hcx: HashStableContext> HashStable<Hcx> for ExpnId { | |
| 1537 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 1538 | impl HashStable for ExpnId { | |
| 1539 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 1538 | 1540 | hcx.assert_default_hashing_controls("ExpnId"); |
| 1539 | 1541 | let hash = if *self == ExpnId::root() { |
| 1540 | 1542 | // Avoid fetching TLS storage for a trivial often-used value. |
| ... | ... | @@ -1547,8 +1549,8 @@ impl<Hcx: HashStableContext> HashStable<Hcx> for ExpnId { |
| 1547 | 1549 | } |
| 1548 | 1550 | } |
| 1549 | 1551 | |
| 1550 | impl<Hcx: HashStableContext> HashStable<Hcx> for LocalExpnId { | |
| 1551 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 1552 | impl HashStable for LocalExpnId { | |
| 1553 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 1552 | 1554 | self.to_expn_id().hash_stable(hcx, hasher); |
| 1553 | 1555 | } |
| 1554 | 1556 | } |
compiler/rustc_span/src/lib.rs+14-42| ... | ... | @@ -31,8 +31,9 @@ |
| 31 | 31 | extern crate self as rustc_span; |
| 32 | 32 | |
| 33 | 33 | use derive_where::derive_where; |
| 34 | use rustc_data_structures::stable_hasher::HashStableContext; | |
| 34 | 35 | use rustc_data_structures::{AtomicRef, outline}; |
| 35 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 36 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 36 | 37 | use rustc_serialize::opaque::{FileEncoder, MemDecoder}; |
| 37 | 38 | use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; |
| 38 | 39 | use tracing::debug; |
| ... | ... | @@ -53,7 +54,7 @@ pub use hygiene::{ |
| 53 | 54 | DesugaringKind, ExpnData, ExpnHash, ExpnId, ExpnKind, LocalExpnId, MacroKind, SyntaxContext, |
| 54 | 55 | }; |
| 55 | 56 | pub mod def_id; |
| 56 | use def_id::{CrateNum, DefId, DefIndex, DefPathHash, LOCAL_CRATE, LocalDefId, StableCrateId}; | |
| 57 | use def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE, LocalDefId, StableCrateId}; | |
| 57 | 58 | pub mod edit_distance; |
| 58 | 59 | mod span_encoding; |
| 59 | 60 | pub use span_encoding::{DUMMY_SP, Span}; |
| ... | ... | @@ -90,7 +91,7 @@ use sha2::Sha256; |
| 90 | 91 | #[cfg(test)] |
| 91 | 92 | mod tests; |
| 92 | 93 | |
| 93 | #[derive(Clone, Encodable, Decodable, Debug, Copy, PartialEq, Hash, HashStable_Generic)] | |
| 94 | #[derive(Clone, Encodable, Decodable, Debug, Copy, PartialEq, Hash, HashStable)] | |
| 94 | 95 | pub struct Spanned<T> { |
| 95 | 96 | pub node: T, |
| 96 | 97 | pub span: Span, |
| ... | ... | @@ -1613,7 +1614,7 @@ impl fmt::Debug for SpanData { |
| 1613 | 1614 | } |
| 1614 | 1615 | |
| 1615 | 1616 | /// Identifies an offset of a multi-byte character in a `SourceFile`. |
| 1616 | #[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable_Generic)] | |
| 1617 | #[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable)] | |
| 1617 | 1618 | pub struct MultiByteChar { |
| 1618 | 1619 | /// The relative offset of the character in the `SourceFile`. |
| 1619 | 1620 | pub pos: RelativeBytePos, |
| ... | ... | @@ -1622,7 +1623,7 @@ pub struct MultiByteChar { |
| 1622 | 1623 | } |
| 1623 | 1624 | |
| 1624 | 1625 | /// Identifies an offset of a character that was normalized away from `SourceFile`. |
| 1625 | #[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable_Generic)] | |
| 1626 | #[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable)] | |
| 1626 | 1627 | pub struct NormalizedPos { |
| 1627 | 1628 | /// The relative offset of the character in the `SourceFile`. |
| 1628 | 1629 | pub pos: RelativeBytePos, |
| ... | ... | @@ -1665,7 +1666,7 @@ impl ExternalSource { |
| 1665 | 1666 | pub struct OffsetOverflowError; |
| 1666 | 1667 | |
| 1667 | 1668 | #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable)] |
| 1668 | #[derive(HashStable_Generic)] | |
| 1669 | #[derive(HashStable)] | |
| 1669 | 1670 | pub enum SourceFileHashAlgorithm { |
| 1670 | 1671 | Md5, |
| 1671 | 1672 | Sha1, |
| ... | ... | @@ -1700,7 +1701,7 @@ impl FromStr for SourceFileHashAlgorithm { |
| 1700 | 1701 | |
| 1701 | 1702 | /// The hash of the on-disk source file used for debug info and cargo freshness checks. |
| 1702 | 1703 | #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] |
| 1703 | #[derive(HashStable_Generic, Encodable, Decodable)] | |
| 1704 | #[derive(HashStable, Encodable, Decodable)] | |
| 1704 | 1705 | pub struct SourceFileHash { |
| 1705 | 1706 | pub kind: SourceFileHashAlgorithm, |
| 1706 | 1707 | value: [u8; 32], |
| ... | ... | @@ -2083,17 +2084,7 @@ impl fmt::Debug for SourceFile { |
| 2083 | 2084 | /// When `SourceFile`s are exported in crate metadata, the `StableSourceFileId` |
| 2084 | 2085 | /// is updated to incorporate the `StableCrateId` of the exporting crate. |
| 2085 | 2086 | #[derive( |
| 2086 | Debug, | |
| 2087 | Clone, | |
| 2088 | Copy, | |
| 2089 | Hash, | |
| 2090 | PartialEq, | |
| 2091 | Eq, | |
| 2092 | HashStable_Generic, | |
| 2093 | Encodable, | |
| 2094 | Decodable, | |
| 2095 | Default, | |
| 2096 | PartialOrd, | |
| 2087 | Debug, Clone, Copy, Hash, PartialEq, Eq, HashStable, Encodable, Decodable, Default, PartialOrd, | |
| 2097 | 2088 | Ord |
| 2098 | 2089 | )] |
| 2099 | 2090 | pub struct StableSourceFileId(Hash128); |
| ... | ... | @@ -2665,7 +2656,7 @@ impl_pos! { |
| 2665 | 2656 | pub struct BytePos(pub u32); |
| 2666 | 2657 | |
| 2667 | 2658 | /// A byte offset relative to file beginning. |
| 2668 | #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug, HashStable_Generic)] | |
| 2659 | #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug, HashStable)] | |
| 2669 | 2660 | pub struct RelativeBytePos(pub u32); |
| 2670 | 2661 | |
| 2671 | 2662 | /// A character offset. |
| ... | ... | @@ -2796,29 +2787,10 @@ impl InnerSpan { |
| 2796 | 2787 | } |
| 2797 | 2788 | } |
| 2798 | 2789 | |
| 2799 | /// This trait lets `HashStable` and `derive(HashStable_Generic)` be used in | |
| 2800 | /// this crate (and other crates upstream of `rustc_middle`), while leaving | |
| 2801 | /// certain operations to be defined in `rustc_middle` where more things are | |
| 2802 | /// visible. | |
| 2803 | pub trait HashStableContext { | |
| 2804 | /// The main event: stable hashing of a span. | |
| 2805 | fn span_hash_stable(&mut self, span: Span, hasher: &mut StableHasher); | |
| 2806 | ||
| 2807 | /// Compute a `DefPathHash`. | |
| 2808 | fn def_path_hash(&self, def_id: DefId) -> DefPathHash; | |
| 2809 | ||
| 2810 | /// Assert that the provided `HashStableContext` is configured with the default | |
| 2811 | /// `HashingControls`. We should always have bailed out before getting to here with a | |
| 2812 | fn assert_default_hashing_controls(&self, msg: &str); | |
| 2813 | } | |
| 2814 | ||
| 2815 | impl<Hcx> HashStable<Hcx> for Span | |
| 2816 | where | |
| 2817 | Hcx: HashStableContext, | |
| 2818 | { | |
| 2819 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 2790 | impl HashStable for Span { | |
| 2791 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 2820 | 2792 | // `span_hash_stable` does all the work. |
| 2821 | hcx.span_hash_stable(*self, hasher) | |
| 2793 | hcx.span_hash_stable(self.to_raw_span(), hasher) | |
| 2822 | 2794 | } |
| 2823 | 2795 | } |
| 2824 | 2796 | |
| ... | ... | @@ -2828,7 +2800,7 @@ where |
| 2828 | 2800 | /// The `()` field is necessary: it is non-`pub`, which means values of this |
| 2829 | 2801 | /// type cannot be constructed outside of this crate. |
| 2830 | 2802 | #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] |
| 2831 | #[derive(HashStable_Generic)] | |
| 2803 | #[derive(HashStable)] | |
| 2832 | 2804 | pub struct ErrorGuaranteed(()); |
| 2833 | 2805 | |
| 2834 | 2806 | impl ErrorGuaranteed { |
compiler/rustc_span/src/span_encoding.rs+13| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | use rustc_data_structures::fx::FxIndexSet; |
| 2 | use rustc_data_structures::stable_hasher::RawSpan; | |
| 2 | 3 | // This code is very hot and uses lots of arithmetic, avoid overflow checks for performance. |
| 3 | 4 | // See https://github.com/rust-lang/rust/pull/119440#issuecomment-1874255727 |
| 4 | 5 | use rustc_serialize::int_overflow::DebugStrictAdd; |
| ... | ... | @@ -441,6 +442,18 @@ impl Span { |
| 441 | 442 | Interned(span) => interned_parent(span.index), |
| 442 | 443 | } |
| 443 | 444 | } |
| 445 | ||
| 446 | #[inline] | |
| 447 | pub(crate) fn to_raw_span(self) -> RawSpan { | |
| 448 | // Field order must match `from_raw_span`. | |
| 449 | RawSpan(self.lo_or_index, self.len_with_tag_or_marker, self.ctxt_or_parent_or_marker) | |
| 450 | } | |
| 451 | ||
| 452 | #[inline] | |
| 453 | pub fn from_raw_span(RawSpan(a, b, c): RawSpan) -> Span { | |
| 454 | // Field order must match `to_raw_span`. | |
| 455 | Span { lo_or_index: a, len_with_tag_or_marker: b, ctxt_or_parent_or_marker: c } | |
| 456 | } | |
| 444 | 457 | } |
| 445 | 458 | |
| 446 | 459 | #[derive(Default)] |
compiler/rustc_span/src/symbol.rs+9-9| ... | ... | @@ -8,10 +8,10 @@ use std::{fmt, str}; |
| 8 | 8 | use rustc_arena::DroplessArena; |
| 9 | 9 | use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; |
| 10 | 10 | use rustc_data_structures::stable_hasher::{ |
| 11 | HashStable, StableCompare, StableHasher, ToStableHashKey, | |
| 11 | HashStable, HashStableContext, StableCompare, StableHasher, ToStableHashKey, | |
| 12 | 12 | }; |
| 13 | 13 | use rustc_data_structures::sync::Lock; |
| 14 | use rustc_macros::{Decodable, Encodable, HashStable_Generic, symbols}; | |
| 14 | use rustc_macros::{Decodable, Encodable, HashStable, symbols}; | |
| 15 | 15 | |
| 16 | 16 | use crate::edit_distance::find_best_match_for_name; |
| 17 | 17 | use crate::{DUMMY_SP, Edition, Span, with_session_globals}; |
| ... | ... | @@ -2308,7 +2308,7 @@ symbols! { |
| 2308 | 2308 | /// `proc_macro`. |
| 2309 | 2309 | pub const STDLIB_STABLE_CRATES: &[Symbol] = &[sym::std, sym::core, sym::alloc, sym::proc_macro]; |
| 2310 | 2310 | |
| 2311 | #[derive(Copy, Clone, Eq, HashStable_Generic, Encodable, Decodable)] | |
| 2311 | #[derive(Copy, Clone, Eq, HashStable, Encodable, Decodable)] | |
| 2312 | 2312 | pub struct Ident { |
| 2313 | 2313 | /// `name` should never be the empty symbol. If you are considering that, |
| 2314 | 2314 | /// you are probably conflating "empty identifier with "no identifier" and |
| ... | ... | @@ -2631,17 +2631,17 @@ impl fmt::Display for Symbol { |
| 2631 | 2631 | } |
| 2632 | 2632 | } |
| 2633 | 2633 | |
| 2634 | impl<Hcx> HashStable<Hcx> for Symbol { | |
| 2634 | impl HashStable for Symbol { | |
| 2635 | 2635 | #[inline] |
| 2636 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 2636 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 2637 | 2637 | self.as_str().hash_stable(hcx, hasher); |
| 2638 | 2638 | } |
| 2639 | 2639 | } |
| 2640 | 2640 | |
| 2641 | impl<Hcx> ToStableHashKey<Hcx> for Symbol { | |
| 2641 | impl ToStableHashKey for Symbol { | |
| 2642 | 2642 | type KeyType = String; |
| 2643 | 2643 | #[inline] |
| 2644 | fn to_stable_hash_key(&self, _: &mut Hcx) -> String { | |
| 2644 | fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> String { | |
| 2645 | 2645 | self.as_str().to_string() |
| 2646 | 2646 | } |
| 2647 | 2647 | } |
| ... | ... | @@ -2691,9 +2691,9 @@ impl fmt::Debug for ByteSymbol { |
| 2691 | 2691 | } |
| 2692 | 2692 | } |
| 2693 | 2693 | |
| 2694 | impl<Hcx> HashStable<Hcx> for ByteSymbol { | |
| 2694 | impl HashStable for ByteSymbol { | |
| 2695 | 2695 | #[inline] |
| 2696 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 2696 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 2697 | 2697 | self.as_byte_str().hash_stable(hcx, hasher); |
| 2698 | 2698 | } |
| 2699 | 2699 | } |
compiler/rustc_target/src/asm/mod.rs+7-7| ... | ... | @@ -2,7 +2,7 @@ use std::fmt; |
| 2 | 2 | |
| 3 | 3 | use rustc_abi::Size; |
| 4 | 4 | use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; |
| 5 | use rustc_macros::{Decodable, Encodable, HashStable_Generic}; | |
| 5 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 6 | 6 | use rustc_span::Symbol; |
| 7 | 7 | |
| 8 | 8 | use crate::spec::{Arch, CfgAbi, RelocModel, Target}; |
| ... | ... | @@ -25,7 +25,7 @@ macro_rules! def_reg_class { |
| 25 | 25 | $class:ident, |
| 26 | 26 | )* |
| 27 | 27 | }) => { |
| 28 | #[derive(Copy, Clone, rustc_macros::Encodable, rustc_macros::Decodable, Debug, Eq, PartialEq, PartialOrd, Hash, rustc_macros::HashStable_Generic)] | |
| 28 | #[derive(Copy, Clone, rustc_macros::Encodable, rustc_macros::Decodable, Debug, Eq, PartialEq, PartialOrd, Hash, rustc_macros::HashStable)] | |
| 29 | 29 | #[allow(non_camel_case_types)] |
| 30 | 30 | pub enum $arch_regclass { |
| 31 | 31 | $($class,)* |
| ... | ... | @@ -74,7 +74,7 @@ macro_rules! def_regs { |
| 74 | 74 | )* |
| 75 | 75 | }) => { |
| 76 | 76 | #[allow(unreachable_code)] |
| 77 | #[derive(Copy, Clone, rustc_macros::Encodable, rustc_macros::Decodable, Debug, Eq, PartialEq, PartialOrd, Hash, rustc_macros::HashStable_Generic)] | |
| 77 | #[derive(Copy, Clone, rustc_macros::Encodable, rustc_macros::Decodable, Debug, Eq, PartialEq, PartialOrd, Hash, rustc_macros::HashStable)] | |
| 78 | 78 | #[allow(non_camel_case_types)] |
| 79 | 79 | pub enum $arch_reg { |
| 80 | 80 | $($reg,)* |
| ... | ... | @@ -279,7 +279,7 @@ impl InlineAsmArch { |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] |
| 282 | #[derive(HashStable_Generic, Encodable, Decodable)] | |
| 282 | #[derive(HashStable, Encodable, Decodable)] | |
| 283 | 283 | pub enum InlineAsmReg { |
| 284 | 284 | X86(X86InlineAsmReg), |
| 285 | 285 | Arm(ArmInlineAsmReg), |
| ... | ... | @@ -467,7 +467,7 @@ impl InlineAsmReg { |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] |
| 470 | #[derive(HashStable_Generic, Encodable, Decodable)] | |
| 470 | #[derive(HashStable, Encodable, Decodable)] | |
| 471 | 471 | pub enum InlineAsmRegClass { |
| 472 | 472 | X86(X86InlineAsmRegClass), |
| 473 | 473 | Arm(ArmInlineAsmRegClass), |
| ... | ... | @@ -712,7 +712,7 @@ impl InlineAsmRegClass { |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] |
| 715 | #[derive(HashStable_Generic, Encodable, Decodable)] | |
| 715 | #[derive(HashStable, Encodable, Decodable)] | |
| 716 | 716 | pub enum InlineAsmRegOrRegClass { |
| 717 | 717 | Reg(InlineAsmReg), |
| 718 | 718 | RegClass(InlineAsmRegClass), |
| ... | ... | @@ -922,7 +922,7 @@ pub fn allocatable_registers( |
| 922 | 922 | } |
| 923 | 923 | |
| 924 | 924 | #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)] |
| 925 | #[derive(HashStable_Generic, Encodable, Decodable)] | |
| 925 | #[derive(HashStable, Encodable, Decodable)] | |
| 926 | 926 | pub enum InlineAsmClobberAbi { |
| 927 | 927 | X86, |
| 928 | 928 | X86_64Win, |
compiler/rustc_target/src/callconv/mod.rs+11-11| ... | ... | @@ -4,7 +4,7 @@ use rustc_abi::{ |
| 4 | 4 | AddressSpace, Align, BackendRepr, CanonAbi, ExternAbi, FieldsShape, HasDataLayout, Primitive, |
| 5 | 5 | Reg, RegKind, Scalar, Size, TyAbiInterface, TyAndLayout, Variants, |
| 6 | 6 | }; |
| 7 | use rustc_macros::HashStable_Generic; | |
| 7 | use rustc_macros::HashStable; | |
| 8 | 8 | |
| 9 | 9 | pub use crate::spec::AbiMap; |
| 10 | 10 | use crate::spec::{Arch, HasTargetSpec, HasX86AbiOpt}; |
| ... | ... | @@ -35,7 +35,7 @@ mod x86_win32; |
| 35 | 35 | mod x86_win64; |
| 36 | 36 | mod xtensa; |
| 37 | 37 | |
| 38 | #[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)] | |
| 38 | #[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable)] | |
| 39 | 39 | pub enum PassMode { |
| 40 | 40 | /// Ignore the argument. |
| 41 | 41 | /// |
| ... | ... | @@ -106,10 +106,10 @@ pub use attr_impl::ArgAttribute; |
| 106 | 106 | #[allow(non_upper_case_globals)] |
| 107 | 107 | #[allow(unused)] |
| 108 | 108 | mod attr_impl { |
| 109 | use rustc_macros::HashStable_Generic; | |
| 109 | use rustc_macros::HashStable; | |
| 110 | 110 | |
| 111 | 111 | // The subset of llvm::Attribute needed for arguments, packed into a bitfield. |
| 112 | #[derive(Clone, Copy, Default, Hash, PartialEq, Eq, HashStable_Generic)] | |
| 112 | #[derive(Clone, Copy, Default, Hash, PartialEq, Eq, HashStable)] | |
| 113 | 113 | pub struct ArgAttribute(u16); |
| 114 | 114 | bitflags::bitflags! { |
| 115 | 115 | impl ArgAttribute: u16 { |
| ... | ... | @@ -130,7 +130,7 @@ mod attr_impl { |
| 130 | 130 | /// Sometimes an ABI requires small integers to be extended to a full or partial register. This enum |
| 131 | 131 | /// defines if this extension should be zero-extension or sign-extension when necessary. When it is |
| 132 | 132 | /// not necessary to extend the argument, this enum is ignored. |
| 133 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)] | |
| 133 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable)] | |
| 134 | 134 | pub enum ArgExtension { |
| 135 | 135 | None, |
| 136 | 136 | Zext, |
| ... | ... | @@ -139,7 +139,7 @@ pub enum ArgExtension { |
| 139 | 139 | |
| 140 | 140 | /// A compact representation of LLVM attributes (at least those relevant for this module) |
| 141 | 141 | /// that can be manipulated without interacting with LLVM's Attribute machinery. |
| 142 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)] | |
| 142 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable)] | |
| 143 | 143 | pub struct ArgAttributes { |
| 144 | 144 | pub regular: ArgAttribute, |
| 145 | 145 | pub arg_ext: ArgExtension, |
| ... | ... | @@ -213,7 +213,7 @@ impl From<ArgAttribute> for ArgAttributes { |
| 213 | 213 | |
| 214 | 214 | /// An argument passed entirely registers with the |
| 215 | 215 | /// same kind (e.g., HFA / HVA on PPC64 and AArch64). |
| 216 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, HashStable_Generic)] | |
| 216 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, HashStable)] | |
| 217 | 217 | pub struct Uniform { |
| 218 | 218 | pub unit: Reg, |
| 219 | 219 | |
| ... | ... | @@ -262,7 +262,7 @@ impl Uniform { |
| 262 | 262 | /// `rest.unit` register type gets repeated often enough to cover `rest.size`. This describes the |
| 263 | 263 | /// actual type used for the call; the Rust type of the argument is then transmuted to this ABI type |
| 264 | 264 | /// (and all data in the padding between the registers is dropped). |
| 265 | #[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)] | |
| 265 | #[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable)] | |
| 266 | 266 | pub struct CastTarget { |
| 267 | 267 | pub prefix: [Option<Reg>; 8], |
| 268 | 268 | /// The offset of `rest` from the start of the value. Currently only implemented for a `Reg` |
| ... | ... | @@ -363,7 +363,7 @@ impl CastTarget { |
| 363 | 363 | |
| 364 | 364 | /// Information about how to pass an argument to, |
| 365 | 365 | /// or return a value from, a function, under some ABI. |
| 366 | #[derive(Clone, PartialEq, Eq, Hash, HashStable_Generic)] | |
| 366 | #[derive(Clone, PartialEq, Eq, Hash, HashStable)] | |
| 367 | 367 | pub struct ArgAbi<'a, Ty> { |
| 368 | 368 | pub layout: TyAndLayout<'a, Ty>, |
| 369 | 369 | pub mode: PassMode, |
| ... | ... | @@ -564,7 +564,7 @@ impl<'a, Ty> ArgAbi<'a, Ty> { |
| 564 | 564 | } |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)] | |
| 567 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable)] | |
| 568 | 568 | pub enum RiscvInterruptKind { |
| 569 | 569 | Machine, |
| 570 | 570 | Supervisor, |
| ... | ... | @@ -589,7 +589,7 @@ impl RiscvInterruptKind { |
| 589 | 589 | /// |
| 590 | 590 | /// I will do my best to describe this structure, but these |
| 591 | 591 | /// comments are reverse-engineered and may be inaccurate. -NDM |
| 592 | #[derive(Clone, PartialEq, Eq, Hash, HashStable_Generic)] | |
| 592 | #[derive(Clone, PartialEq, Eq, Hash, HashStable)] | |
| 593 | 593 | pub struct FnAbi<'a, Ty> { |
| 594 | 594 | /// The type, layout, and information about how each argument is passed. |
| 595 | 595 | pub args: Box<[ArgAbi<'a, Ty>]>, |
compiler/rustc_target/src/spec/mod.rs+5-5| ... | ... | @@ -52,7 +52,7 @@ use rustc_abi::{ |
| 52 | 52 | use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; |
| 53 | 53 | use rustc_error_messages::{DiagArgValue, IntoDiagArg, into_diag_arg_using_display}; |
| 54 | 54 | use rustc_fs_util::try_canonicalize; |
| 55 | use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable_Generic}; | |
| 55 | use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable}; | |
| 56 | 56 | use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; |
| 57 | 57 | use rustc_span::{Symbol, kw, sym}; |
| 58 | 58 | use serde_json::Value; |
| ... | ... | @@ -830,7 +830,7 @@ impl LinkerFeatures { |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | crate::target_spec_enum! { |
| 833 | #[derive(Encodable, BlobDecodable, HashStable_Generic)] | |
| 833 | #[derive(Encodable, BlobDecodable, HashStable)] | |
| 834 | 834 | pub enum PanicStrategy { |
| 835 | 835 | Unwind = "unwind", |
| 836 | 836 | Abort = "abort", |
| ... | ... | @@ -840,7 +840,7 @@ crate::target_spec_enum! { |
| 840 | 840 | parse_error_type = "panic strategy"; |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | #[derive(Clone, Copy, Debug, PartialEq, Hash, Encodable, BlobDecodable, HashStable_Generic)] | |
| 843 | #[derive(Clone, Copy, Debug, PartialEq, Hash, Encodable, BlobDecodable, HashStable)] | |
| 844 | 844 | pub enum OnBrokenPipe { |
| 845 | 845 | Default, |
| 846 | 846 | Kill, |
| ... | ... | @@ -1161,7 +1161,7 @@ impl ToJson for StackProbeType { |
| 1161 | 1161 | } |
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | #[derive(Default, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)] | |
| 1164 | #[derive(Default, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)] | |
| 1165 | 1165 | pub struct SanitizerSet(u16); |
| 1166 | 1166 | bitflags::bitflags! { |
| 1167 | 1167 | impl SanitizerSet: u16 { |
| ... | ... | @@ -1347,7 +1347,7 @@ impl FramePointer { |
| 1347 | 1347 | |
| 1348 | 1348 | crate::target_spec_enum! { |
| 1349 | 1349 | /// Controls use of stack canaries. |
| 1350 | #[derive(Encodable, BlobDecodable, HashStable_Generic)] | |
| 1350 | #[derive(Encodable, BlobDecodable, HashStable)] | |
| 1351 | 1351 | pub enum StackProtector { |
| 1352 | 1352 | /// Disable stack canary generation. |
| 1353 | 1353 | None = "none", |
compiler/rustc_target/src/target_features.rs+2-2| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | //! Note that these are similar to but not always identical to LLVM's feature names, |
| 3 | 3 | //! and Rust adds some features that do not correspond to LLVM features at all. |
| 4 | 4 | use rustc_data_structures::fx::{FxHashMap, FxHashSet}; |
| 5 | use rustc_macros::HashStable_Generic; | |
| 5 | use rustc_macros::HashStable; | |
| 6 | 6 | use rustc_span::{Symbol, sym}; |
| 7 | 7 | |
| 8 | 8 | use crate::spec::{Arch, FloatAbi, LlvmAbi, RustcAbi, Target}; |
| ... | ... | @@ -12,7 +12,7 @@ use crate::spec::{Arch, FloatAbi, LlvmAbi, RustcAbi, Target}; |
| 12 | 12 | pub const RUSTC_SPECIFIC_FEATURES: &[&str] = &["crt-static"]; |
| 13 | 13 | |
| 14 | 14 | /// Stability information for target features. |
| 15 | #[derive(Debug, Copy, Clone, HashStable_Generic)] | |
| 15 | #[derive(Debug, Copy, Clone, HashStable)] | |
| 16 | 16 | pub enum Stability { |
| 17 | 17 | /// This target feature is stable, it can be used in `#[target_feature]` and |
| 18 | 18 | /// `#[cfg(target_feature)]`. |
compiler/rustc_type_ir/src/binder.rs+2-6| ... | ... | @@ -5,7 +5,7 @@ use std::ops::{ControlFlow, Deref}; |
| 5 | 5 | |
| 6 | 6 | use derive_where::derive_where; |
| 7 | 7 | #[cfg(feature = "nightly")] |
| 8 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; | |
| 8 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable, HashStable_NoContext}; | |
| 9 | 9 | use rustc_type_ir_macros::{ |
| 10 | 10 | GenericTypeVisitable, Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic, |
| 11 | 11 | }; |
| ... | ... | @@ -951,10 +951,7 @@ impl<'a, I: Interner> ArgFolder<'a, I> { |
| 951 | 951 | /// solver, canonicalization is hot and there are some pathological cases where |
| 952 | 952 | /// this is needed (`post-mono-higher-ranked-hang`). |
| 953 | 953 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |
| 954 | #[cfg_attr( | |
| 955 | feature = "nightly", | |
| 956 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) | |
| 957 | )] | |
| 954 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 958 | 955 | #[derive(TypeVisitable_Generic, GenericTypeVisitable, TypeFoldable_Generic)] |
| 959 | 956 | pub enum BoundVarIndexKind { |
| 960 | 957 | Bound(DebruijnIndex), |
| ... | ... | @@ -1009,7 +1006,6 @@ where |
| 1009 | 1006 | feature = "nightly", |
| 1010 | 1007 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) |
| 1011 | 1008 | )] |
| 1012 | ||
| 1013 | 1009 | pub enum BoundRegionKind<I: Interner> { |
| 1014 | 1010 | /// An anonymous region parameter for a given fn (&T) |
| 1015 | 1011 | Anon, |
compiler/rustc_type_ir/src/const_kind.rs+5-8| ... | ... | @@ -2,9 +2,9 @@ use std::fmt; |
| 2 | 2 | |
| 3 | 3 | use derive_where::derive_where; |
| 4 | 4 | #[cfg(feature = "nightly")] |
| 5 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 5 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 6 | 6 | #[cfg(feature = "nightly")] |
| 7 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; | |
| 7 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable, HashStable_NoContext}; | |
| 8 | 8 | use rustc_type_ir_macros::{ |
| 9 | 9 | GenericTypeVisitable, Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic, |
| 10 | 10 | }; |
| ... | ... | @@ -117,8 +117,8 @@ impl fmt::Debug for InferConst { |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | #[cfg(feature = "nightly")] |
| 120 | impl<Hcx> HashStable<Hcx> for InferConst { | |
| 121 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 120 | impl HashStable for InferConst { | |
| 121 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 122 | 122 | match self { |
| 123 | 123 | InferConst::Var(_) => { |
| 124 | 124 | panic!("const variables should not be hashed: {self:?}") |
| ... | ... | @@ -201,10 +201,7 @@ impl<I: Interner> ValTreeKind<I> { |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] |
| 204 | #[cfg_attr( | |
| 205 | feature = "nightly", | |
| 206 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) | |
| 207 | )] | |
| 204 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 208 | 205 | pub enum AnonConstKind { |
| 209 | 206 | /// `feature(generic_const_exprs)` anon consts are allowed to use arbitrary generic parameters in scope |
| 210 | 207 | GCE, |
compiler/rustc_type_ir/src/fast_reject.rs+7-8| ... | ... | @@ -7,9 +7,11 @@ use rustc_ast_ir::Mutability; |
| 7 | 7 | #[cfg(feature = "nightly")] |
| 8 | 8 | use rustc_data_structures::fingerprint::Fingerprint; |
| 9 | 9 | #[cfg(feature = "nightly")] |
| 10 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; | |
| 10 | use rustc_data_structures::stable_hasher::{ | |
| 11 | HashStable, HashStableContext, StableHasher, ToStableHashKey, | |
| 12 | }; | |
| 11 | 13 | #[cfg(feature = "nightly")] |
| 12 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; | |
| 14 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable}; | |
| 13 | 15 | |
| 14 | 16 | use crate::inherent::*; |
| 15 | 17 | use crate::visit::TypeVisitableExt as _; |
| ... | ... | @@ -17,10 +19,7 @@ use crate::{self as ty, Interner}; |
| 17 | 19 | |
| 18 | 20 | /// See `simplify_type`. |
| 19 | 21 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |
| 20 | #[cfg_attr( | |
| 21 | feature = "nightly", | |
| 22 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) | |
| 23 | )] | |
| 22 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 24 | 23 | pub enum SimplifiedType<DefId> { |
| 25 | 24 | Bool, |
| 26 | 25 | Char, |
| ... | ... | @@ -50,11 +49,11 @@ pub enum SimplifiedType<DefId> { |
| 50 | 49 | } |
| 51 | 50 | |
| 52 | 51 | #[cfg(feature = "nightly")] |
| 53 | impl<Hcx, DefId: HashStable<Hcx>> ToStableHashKey<Hcx> for SimplifiedType<DefId> { | |
| 52 | impl<DefId: HashStable> ToStableHashKey for SimplifiedType<DefId> { | |
| 54 | 53 | type KeyType = Fingerprint; |
| 55 | 54 | |
| 56 | 55 | #[inline] |
| 57 | fn to_stable_hash_key(&self, hcx: &mut Hcx) -> Fingerprint { | |
| 56 | fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> Fingerprint { | |
| 58 | 57 | let mut hasher = StableHasher::new(); |
| 59 | 58 | self.hash_stable(hcx, &mut hasher); |
| 60 | 59 | hasher.finish() |
compiler/rustc_type_ir/src/lib.rs+6-6| ... | ... | @@ -15,7 +15,7 @@ use std::hash::Hash; |
| 15 | 15 | |
| 16 | 16 | use rustc_abi::{FieldIdx, VariantIdx}; |
| 17 | 17 | #[cfg(feature = "nightly")] |
| 18 | use rustc_macros::{Decodable, Encodable, HashStable_NoContext}; | |
| 18 | use rustc_macros::{Decodable, Encodable, HashStable}; | |
| 19 | 19 | |
| 20 | 20 | // These modules are `pub` since they are not glob-imported. |
| 21 | 21 | pub mod data_structures; |
| ... | ... | @@ -125,7 +125,7 @@ rustc_index::newtype_index! { |
| 125 | 125 | /// is the outer fn. |
| 126 | 126 | /// |
| 127 | 127 | /// [dbi]: https://en.wikipedia.org/wiki/De_Bruijn_index |
| 128 | #[stable_hash_no_context] | |
| 128 | #[stable_hash] | |
| 129 | 129 | #[encodable] |
| 130 | 130 | #[orderable] |
| 131 | 131 | #[debug_format = "DebruijnIndex({})"] |
| ... | ... | @@ -219,7 +219,7 @@ pub fn debug_bound_var<T: std::fmt::Write>( |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | #[derive(Copy, Clone, PartialEq, Eq, Hash, GenericTypeVisitable)] |
| 222 | #[cfg_attr(feature = "nightly", derive(Decodable, Encodable, HashStable_NoContext))] | |
| 222 | #[cfg_attr(feature = "nightly", derive(Decodable, Encodable, HashStable))] | |
| 223 | 223 | #[cfg_attr(feature = "nightly", rustc_pass_by_value)] |
| 224 | 224 | pub enum Variance { |
| 225 | 225 | Covariant, // T<A> <: T<B> iff A <: B -- e.g., function return type |
| ... | ... | @@ -335,7 +335,7 @@ rustc_index::newtype_index! { |
| 335 | 335 | /// declared, but a type name in a non-zero universe is a placeholder |
| 336 | 336 | /// type -- an idealized representative of "types in general" that we |
| 337 | 337 | /// use for checking generic functions. |
| 338 | #[stable_hash_no_context] | |
| 338 | #[stable_hash] | |
| 339 | 339 | #[encodable] |
| 340 | 340 | #[orderable] |
| 341 | 341 | #[debug_format = "U{}"] |
| ... | ... | @@ -390,7 +390,7 @@ impl Default for UniverseIndex { |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | rustc_index::newtype_index! { |
| 393 | #[stable_hash_generic] | |
| 393 | #[stable_hash] | |
| 394 | 394 | #[encodable] |
| 395 | 395 | #[orderable] |
| 396 | 396 | #[debug_format = "{}"] |
| ... | ... | @@ -405,7 +405,7 @@ rustc_index::newtype_index! { |
| 405 | 405 | /// You can get the environment type of a closure using |
| 406 | 406 | /// `tcx.closure_env_ty()`. |
| 407 | 407 | #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] |
| 408 | #[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_NoContext))] | |
| 408 | #[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable))] | |
| 409 | 409 | pub enum ClosureKind { |
| 410 | 410 | Fn, |
| 411 | 411 | FnMut, |
compiler/rustc_type_ir/src/predicate.rs+4-13| ... | ... | @@ -3,7 +3,7 @@ use std::{fmt, iter}; |
| 3 | 3 | |
| 4 | 4 | use derive_where::derive_where; |
| 5 | 5 | #[cfg(feature = "nightly")] |
| 6 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; | |
| 6 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable, HashStable_NoContext}; | |
| 7 | 7 | use rustc_type_ir_macros::{ |
| 8 | 8 | GenericTypeVisitable, Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic, |
| 9 | 9 | }; |
| ... | ... | @@ -270,10 +270,7 @@ impl<I: Interner> fmt::Debug for TraitPredicate<I> { |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] |
| 273 | #[cfg_attr( | |
| 274 | feature = "nightly", | |
| 275 | derive(Decodable_NoContext, Encodable_NoContext, HashStable_NoContext) | |
| 276 | )] | |
| 273 | #[cfg_attr(feature = "nightly", derive(Decodable_NoContext, Encodable_NoContext, HashStable))] | |
| 277 | 274 | pub enum ImplPolarity { |
| 278 | 275 | /// `impl Trait for Type` |
| 279 | 276 | Positive, |
| ... | ... | @@ -313,10 +310,7 @@ impl ImplPolarity { |
| 313 | 310 | /// Distinguished from [`ImplPolarity`] since we never compute goals with |
| 314 | 311 | /// "reservation" level. |
| 315 | 312 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] |
| 316 | #[cfg_attr( | |
| 317 | feature = "nightly", | |
| 318 | derive(Decodable_NoContext, Encodable_NoContext, HashStable_NoContext) | |
| 319 | )] | |
| 313 | #[cfg_attr(feature = "nightly", derive(Decodable_NoContext, Encodable_NoContext, HashStable))] | |
| 320 | 314 | pub enum PredicatePolarity { |
| 321 | 315 | /// `Type: Trait` |
| 322 | 316 | Positive, |
| ... | ... | @@ -1054,10 +1048,7 @@ pub struct CoercePredicate<I: Interner> { |
| 1054 | 1048 | impl<I: Interner> Eq for CoercePredicate<I> {} |
| 1055 | 1049 | |
| 1056 | 1050 | #[derive(Clone, Copy, Hash, PartialEq, Eq, Debug)] |
| 1057 | #[cfg_attr( | |
| 1058 | feature = "nightly", | |
| 1059 | derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext) | |
| 1060 | )] | |
| 1051 | #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))] | |
| 1061 | 1052 | pub enum BoundConstness { |
| 1062 | 1053 | /// `Type: const Trait` |
| 1063 | 1054 | /// |
compiler/rustc_type_ir/src/predicate_kind.rs+2-5| ... | ... | @@ -2,7 +2,7 @@ use std::fmt; |
| 2 | 2 | |
| 3 | 3 | use derive_where::derive_where; |
| 4 | 4 | #[cfg(feature = "nightly")] |
| 5 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; | |
| 5 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable, HashStable_NoContext}; | |
| 6 | 6 | use rustc_type_ir_macros::{GenericTypeVisitable, TypeFoldable_Generic, TypeVisitable_Generic}; |
| 7 | 7 | |
| 8 | 8 | use crate::{self as ty, Interner}; |
| ... | ... | @@ -114,10 +114,7 @@ pub enum PredicateKind<I: Interner> { |
| 114 | 114 | impl<I: Interner> Eq for PredicateKind<I> {} |
| 115 | 115 | |
| 116 | 116 | #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Copy)] |
| 117 | #[cfg_attr( | |
| 118 | feature = "nightly", | |
| 119 | derive(HashStable_NoContext, Encodable_NoContext, Decodable_NoContext) | |
| 120 | )] | |
| 117 | #[cfg_attr(feature = "nightly", derive(HashStable, Encodable_NoContext, Decodable_NoContext))] | |
| 121 | 118 | pub enum AliasRelationDirection { |
| 122 | 119 | Equate, |
| 123 | 120 | Subtype, |
compiler/rustc_type_ir/src/region_kind.rs+8-8| ... | ... | @@ -2,7 +2,7 @@ use std::fmt; |
| 2 | 2 | |
| 3 | 3 | use derive_where::derive_where; |
| 4 | 4 | #[cfg(feature = "nightly")] |
| 5 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 5 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 6 | 6 | #[cfg(feature = "nightly")] |
| 7 | 7 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext}; |
| 8 | 8 | use rustc_type_ir_macros::GenericTypeVisitable; |
| ... | ... | @@ -16,7 +16,7 @@ rustc_index::newtype_index! { |
| 16 | 16 | #[orderable] |
| 17 | 17 | #[debug_format = "'?{}"] |
| 18 | 18 | #[gate_rustc_only] |
| 19 | #[stable_hash_no_context] | |
| 19 | #[stable_hash] | |
| 20 | 20 | pub struct RegionVid {} |
| 21 | 21 | } |
| 22 | 22 | |
| ... | ... | @@ -217,15 +217,15 @@ impl<I: Interner> fmt::Debug for RegionKind<I> { |
| 217 | 217 | |
| 218 | 218 | #[cfg(feature = "nightly")] |
| 219 | 219 | // This is not a derived impl because a derive would require `I: HashStable` |
| 220 | impl<Hcx, I: Interner> HashStable<Hcx> for RegionKind<I> | |
| 220 | impl<I: Interner> HashStable for RegionKind<I> | |
| 221 | 221 | where |
| 222 | I::EarlyParamRegion: HashStable<Hcx>, | |
| 223 | I::LateParamRegion: HashStable<Hcx>, | |
| 224 | I::DefId: HashStable<Hcx>, | |
| 225 | I::Symbol: HashStable<Hcx>, | |
| 222 | I::EarlyParamRegion: HashStable, | |
| 223 | I::LateParamRegion: HashStable, | |
| 224 | I::DefId: HashStable, | |
| 225 | I::Symbol: HashStable, | |
| 226 | 226 | { |
| 227 | 227 | #[inline] |
| 228 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 228 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 229 | 229 | std::mem::discriminant(self).hash_stable(hcx, hasher); |
| 230 | 230 | match self { |
| 231 | 231 | ReErased | ReStatic | ReError(_) => { |
compiler/rustc_type_ir/src/search_graph/mod.rs+2-5| ... | ... | @@ -21,7 +21,7 @@ use std::marker::PhantomData; |
| 21 | 21 | |
| 22 | 22 | use derive_where::derive_where; |
| 23 | 23 | #[cfg(feature = "nightly")] |
| 24 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; | |
| 24 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable}; | |
| 25 | 25 | use rustc_type_ir::data_structures::HashMap; |
| 26 | 26 | use tracing::{debug, instrument, trace}; |
| 27 | 27 | |
| ... | ... | @@ -118,10 +118,7 @@ pub trait Delegate: Sized { |
| 118 | 118 | /// result. In the case we return an initial provisional result depending |
| 119 | 119 | /// on the kind of cycle. |
| 120 | 120 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
| 121 | #[cfg_attr( | |
| 122 | feature = "nightly", | |
| 123 | derive(Decodable_NoContext, Encodable_NoContext, HashStable_NoContext) | |
| 124 | )] | |
| 121 | #[cfg_attr(feature = "nightly", derive(Decodable_NoContext, Encodable_NoContext, HashStable))] | |
| 125 | 122 | pub enum PathKind { |
| 126 | 123 | /// A path consisting of only inductive/unproductive steps. Their initial |
| 127 | 124 | /// provisional result is `Err(NoSolution)`. We currently treat them as |
compiler/rustc_type_ir/src/solve/mod.rs+8-11| ... | ... | @@ -4,7 +4,7 @@ use std::hash::Hash; |
| 4 | 4 | |
| 5 | 5 | use derive_where::derive_where; |
| 6 | 6 | #[cfg(feature = "nightly")] |
| 7 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; | |
| 7 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable, HashStable_NoContext}; | |
| 8 | 8 | use rustc_type_ir_macros::{ |
| 9 | 9 | GenericTypeVisitable, Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic, |
| 10 | 10 | }; |
| ... | ... | @@ -25,7 +25,7 @@ pub type CanonicalResponse<I> = Canonical<I, Response<I>>; |
| 25 | 25 | pub type QueryResult<I> = Result<CanonicalResponse<I>, NoSolution>; |
| 26 | 26 | |
| 27 | 27 | #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] |
| 28 | #[cfg_attr(feature = "nightly", derive(HashStable_NoContext))] | |
| 28 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 29 | 29 | pub struct NoSolution; |
| 30 | 30 | |
| 31 | 31 | /// A goal is a statement, i.e. `predicate`, we want to prove |
| ... | ... | @@ -67,7 +67,7 @@ impl<I: Interner, P> Goal<I, P> { |
| 67 | 67 | /// |
| 68 | 68 | /// It is also used by proof tree visitors, e.g. for diagnostics purposes. |
| 69 | 69 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] |
| 70 | #[cfg_attr(feature = "nightly", derive(HashStable_NoContext))] | |
| 70 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 71 | 71 | pub enum GoalSource { |
| 72 | 72 | Misc, |
| 73 | 73 | /// A nested goal required to prove that types are equal/subtypes. |
| ... | ... | @@ -217,10 +217,7 @@ pub enum AliasBoundKind { |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | #[derive(Clone, Copy, Hash, PartialEq, Eq, Debug)] |
| 220 | #[cfg_attr( | |
| 221 | feature = "nightly", | |
| 222 | derive(HashStable_NoContext, Encodable_NoContext, Decodable_NoContext) | |
| 223 | )] | |
| 220 | #[cfg_attr(feature = "nightly", derive(HashStable, Encodable_NoContext, Decodable_NoContext))] | |
| 224 | 221 | pub enum BuiltinImplSource { |
| 225 | 222 | /// A built-in impl that is considered trivial, without any nested requirements. They |
| 226 | 223 | /// are preferred over where-clauses, and we want to track them explicitly. |
| ... | ... | @@ -286,7 +283,7 @@ impl<I: Interner> NestedNormalizationGoals<I> { |
| 286 | 283 | } |
| 287 | 284 | |
| 288 | 285 | #[derive(Clone, Copy, Hash, PartialEq, Eq, Debug)] |
| 289 | #[cfg_attr(feature = "nightly", derive(HashStable_NoContext))] | |
| 286 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 290 | 287 | pub enum Certainty { |
| 291 | 288 | Yes, |
| 292 | 289 | Maybe(MaybeInfo), |
| ... | ... | @@ -353,7 +350,7 @@ impl MaybeInfo { |
| 353 | 350 | /// a goal. It is good enough for now and only matters for very rare type inference |
| 354 | 351 | /// edge cases. We can improve this later on if necessary. |
| 355 | 352 | #[derive(Clone, Copy, Hash, PartialEq, Eq, Debug)] |
| 356 | #[cfg_attr(feature = "nightly", derive(HashStable_NoContext))] | |
| 353 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 357 | 354 | pub enum OpaqueTypesJank { |
| 358 | 355 | AllGood, |
| 359 | 356 | ErrorIfRigidSelfTy, |
| ... | ... | @@ -442,7 +439,7 @@ impl Certainty { |
| 442 | 439 | |
| 443 | 440 | /// Why we failed to evaluate a goal. |
| 444 | 441 | #[derive(Clone, Copy, Hash, PartialEq, Eq, Debug)] |
| 445 | #[cfg_attr(feature = "nightly", derive(HashStable_NoContext))] | |
| 442 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 446 | 443 | pub enum MaybeCause { |
| 447 | 444 | /// We failed due to ambiguity. This ambiguity can either |
| 448 | 445 | /// be a true ambiguity, i.e. there are multiple different answers, |
| ... | ... | @@ -515,7 +512,7 @@ pub enum AdtDestructorKind { |
| 515 | 512 | /// Which sizedness trait - `Sized`, `MetaSized`? `PointeeSized` is omitted as it is removed during |
| 516 | 513 | /// lowering. |
| 517 | 514 | #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] |
| 518 | #[cfg_attr(feature = "nightly", derive(HashStable_NoContext))] | |
| 515 | #[cfg_attr(feature = "nightly", derive(HashStable))] | |
| 519 | 516 | pub enum SizedTraitKind { |
| 520 | 517 | /// `Sized` trait |
| 521 | 518 | Sized, |
compiler/rustc_type_ir/src/ty_info.rs+3-3| ... | ... | @@ -3,7 +3,7 @@ use std::hash::{Hash, Hasher}; |
| 3 | 3 | use std::ops::Deref; |
| 4 | 4 | |
| 5 | 5 | #[cfg(feature = "nightly")] |
| 6 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 6 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 7 | 7 | use rustc_type_ir_macros::GenericTypeVisitable; |
| 8 | 8 | |
| 9 | 9 | use crate::{DebruijnIndex, TypeFlags}; |
| ... | ... | @@ -83,8 +83,8 @@ impl<T: Hash> Hash for WithCachedTypeInfo<T> { |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | #[cfg(feature = "nightly")] |
| 86 | impl<T: HashStable<Hcx>, Hcx> HashStable<Hcx> for WithCachedTypeInfo<T> { | |
| 87 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 86 | impl<T: HashStable> HashStable for WithCachedTypeInfo<T> { | |
| 87 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 88 | 88 | self.internee.hash_stable(hcx, hasher); |
| 89 | 89 | } |
| 90 | 90 | } |
compiler/rustc_type_ir/src/ty_kind.rs+3-3| ... | ... | @@ -6,7 +6,7 @@ use derive_where::derive_where; |
| 6 | 6 | use rustc_abi::ExternAbi; |
| 7 | 7 | use rustc_ast_ir::Mutability; |
| 8 | 8 | #[cfg(feature = "nightly")] |
| 9 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
| 9 | use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher}; | |
| 10 | 10 | #[cfg(feature = "nightly")] |
| 11 | 11 | use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext}; |
| 12 | 12 | use rustc_type_ir::data_structures::{NoError, UnifyKey, UnifyValue}; |
| ... | ... | @@ -707,8 +707,8 @@ impl UnifyKey for FloatVid { |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | #[cfg(feature = "nightly")] |
| 710 | impl<Hcx> HashStable<Hcx> for InferTy { | |
| 711 | fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 710 | impl HashStable for InferTy { | |
| 711 | fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) { | |
| 712 | 712 | use InferTy::*; |
| 713 | 713 | std::mem::discriminant(self).hash_stable(hcx, hasher); |
| 714 | 714 | match self { |
triagebot.toml+1-1| ... | ... | @@ -1590,7 +1590,7 @@ dep-bumps = [ |
| 1590 | 1590 | "/compiler/rustc_codegen_llvm/src/debuginfo" = ["compiler", "debuginfo"] |
| 1591 | 1591 | "/compiler/rustc_codegen_ssa" = ["compiler", "codegen"] |
| 1592 | 1592 | "/compiler/rustc_middle/src/dep_graph" = ["compiler", "incremental", "query-system"] |
| 1593 | "/compiler/rustc_middle/src/ich" = ["compiler", "incremental", "query-system"] | |
| 1593 | "/compiler/rustc_middle/src/ich.rs" = ["compiler", "incremental", "query-system"] | |
| 1594 | 1594 | "/compiler/rustc_middle/src/mir" = ["compiler", "mir"] |
| 1595 | 1595 | "/compiler/rustc_middle/src/traits" = ["compiler", "types"] |
| 1596 | 1596 | "/compiler/rustc_middle/src/query" = ["compiler", "query-system"] |