@@ -159,61 +159,3 @@ impl FingerprintDecoder for opaque::Decoder<'_> {
159
159
Fingerprint :: decode_opaque ( self )
160
160
}
161
161
}
162
-
163
- // `PackedFingerprint` wraps a `Fingerprint`. Its purpose is to, on certain
164
- // architectures, behave like a `Fingerprint` without alignment requirements.
165
- // This behavior is only enabled on x86 and x86_64, where the impact of
166
- // unaligned accesses is tolerable in small doses.
167
- //
168
- // This may be preferable to use in large collections of structs containing
169
- // fingerprints, as it can reduce memory consumption by preventing the padding
170
- // that the more strictly-aligned `Fingerprint` can introduce. An application of
171
- // this is in the query dependency graph, which contains a large collection of
172
- // `DepNode`s. As of this writing, the size of a `DepNode` decreases by ~30%
173
- // (from 24 bytes to 17) by using the packed representation here, which
174
- // noticeably decreases total memory usage when compiling large crates.
175
- //
176
- // The wrapped `Fingerprint` is private to reduce the chance of a client
177
- // invoking undefined behavior by taking a reference to the packed field.
178
- #[ cfg_attr( any( target_arch = "x86" , target_arch = "x86_64" ) , repr( packed) ) ]
179
- #[ derive( Eq , PartialEq , Ord , PartialOrd , Debug , Clone , Copy , Hash ) ]
180
- pub struct PackedFingerprint ( Fingerprint ) ;
181
-
182
- impl std:: fmt:: Display for PackedFingerprint {
183
- #[ inline]
184
- fn fmt ( & self , formatter : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
185
- // Copy to avoid taking reference to packed field.
186
- let copy = self . 0 ;
187
- copy. fmt ( formatter)
188
- }
189
- }
190
-
191
- impl < E : rustc_serialize:: Encoder > Encodable < E > for PackedFingerprint {
192
- #[ inline]
193
- fn encode ( & self , s : & mut E ) -> Result < ( ) , E :: Error > {
194
- // Copy to avoid taking reference to packed field.
195
- let copy = self . 0 ;
196
- copy. encode ( s)
197
- }
198
- }
199
-
200
- impl < D : rustc_serialize:: Decoder > Decodable < D > for PackedFingerprint {
201
- #[ inline]
202
- fn decode ( d : & mut D ) -> Result < Self , D :: Error > {
203
- Fingerprint :: decode ( d) . map ( PackedFingerprint )
204
- }
205
- }
206
-
207
- impl From < Fingerprint > for PackedFingerprint {
208
- #[ inline]
209
- fn from ( f : Fingerprint ) -> PackedFingerprint {
210
- PackedFingerprint ( f)
211
- }
212
- }
213
-
214
- impl From < PackedFingerprint > for Fingerprint {
215
- #[ inline]
216
- fn from ( f : PackedFingerprint ) -> Fingerprint {
217
- f. 0
218
- }
219
- }
0 commit comments