diff options
| author | bors <bors@rust-lang.org> | 2024-01-06 09:56:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-06 09:56:00 +0000 |
| commit | e21f4cd98fcf03fb7895f13421699f58132e4beb (patch) | |
| tree | 335591df79611c47f490696a7da548e097b77e38 /compiler/rustc_data_structures/src | |
| parent | 5cb2e7dfc362662b0036faad3bab88d73027fd05 (diff) | |
| parent | 8fb8e6eefb27313523be937ff9de557dd3bcf4fe (diff) | |
| download | rust-e21f4cd98fcf03fb7895f13421699f58132e4beb.tar.gz rust-e21f4cd98fcf03fb7895f13421699f58132e4beb.zip | |
Auto merge of #119478 - bjorn3:no_serialize_specialization, r=wesleywiser
Avoid specialization in the metadata serialization code With the exception of a perf-only specialization for byte slices and byte vectors. This uses the same trick of introducing a new trait and having the Encodable and Decodable derives add a bound to it as used for TyEncoder/TyDecoder. The new code is clearer about which encoder/decoder uses which impl and it reduces the dependency of rustc on specialization, making it easier to remove support for specialization entirely or turn it into a construct that is only allowed for perf optimizations if we decide to do this.
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/sorted_map.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/svh.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/unord.rs | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_data_structures/src/sorted_map.rs b/compiler/rustc_data_structures/src/sorted_map.rs index ed2e558bffa..1436628139f 100644 --- a/compiler/rustc_data_structures/src/sorted_map.rs +++ b/compiler/rustc_data_structures/src/sorted_map.rs @@ -16,7 +16,7 @@ pub use index_map::SortedIndexMultiMap; /// stores data in a more compact way. It also supports accessing contiguous /// ranges of elements as a slice, and slices of already sorted elements can be /// inserted efficiently. -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable_Generic, Decodable_Generic)] pub struct SortedMap<K, V> { data: Vec<(K, V)>, } diff --git a/compiler/rustc_data_structures/src/svh.rs b/compiler/rustc_data_structures/src/svh.rs index 71679086f16..1cfc9fecd47 100644 --- a/compiler/rustc_data_structures/src/svh.rs +++ b/compiler/rustc_data_structures/src/svh.rs @@ -10,7 +10,7 @@ use std::fmt; use crate::stable_hasher; -#[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, Hash)] +#[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable_Generic, Decodable_Generic, Hash)] pub struct Svh { hash: Fingerprint, } diff --git a/compiler/rustc_data_structures/src/unord.rs b/compiler/rustc_data_structures/src/unord.rs index bd4dff6f62f..907c866b3ed 100644 --- a/compiler/rustc_data_structures/src/unord.rs +++ b/compiler/rustc_data_structures/src/unord.rs @@ -226,7 +226,7 @@ trait UnordCollection {} /// /// See [MCP 533](https://github.com/rust-lang/compiler-team/issues/533) /// for more information. -#[derive(Debug, Eq, PartialEq, Clone, Encodable, Decodable)] +#[derive(Debug, Eq, PartialEq, Clone, Encodable_Generic, Decodable_Generic)] pub struct UnordSet<V: Eq + Hash> { inner: FxHashSet<V>, } @@ -417,7 +417,7 @@ impl<HCX, V: Hash + Eq + HashStable<HCX>> HashStable<HCX> for UnordSet<V> { /// /// See [MCP 533](https://github.com/rust-lang/compiler-team/issues/533) /// for more information. -#[derive(Debug, Eq, PartialEq, Clone, Encodable, Decodable)] +#[derive(Debug, Eq, PartialEq, Clone, Encodable_Generic, Decodable_Generic)] pub struct UnordMap<K: Eq + Hash, V> { inner: FxHashMap<K, V>, } @@ -626,7 +626,7 @@ impl<HCX, K: Hash + Eq + HashStable<HCX>, V: HashStable<HCX>> HashStable<HCX> fo /// /// See [MCP 533](https://github.com/rust-lang/compiler-team/issues/533) /// for more information. -#[derive(Default, Debug, Eq, PartialEq, Clone, Encodable, Decodable)] +#[derive(Default, Debug, Eq, PartialEq, Clone, Encodable_Generic, Decodable_Generic)] pub struct UnordBag<V> { inner: Vec<V>, } |
