Skip to content

Commit b12f047

Browse files
Rollup merge of rust-lang#42335 - jcowgill:fingerprint-be, r=michaelwoerister
Don't byteswap Fingerprints when encoding Byteswapping Fingerprints when encoding is unnessesary and breaks if the Fingerprint is later decoded on a machine with different endianness to the one it was encoded on. Fixes rust-lang#42239 This PR fixes a regression caused by rust-lang#42082. @michaelwoerister
2 parents 88d3e07 + edefcb2 commit b12f047

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

Diff for: src/librustc/ich/fingerprint.rs

+1-19
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
1211
use rustc_data_structures::stable_hasher;
1312
use std::mem;
1413
use std::slice;
1514

16-
#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15+
#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Clone, Copy, RustcEncodable, RustcDecodable)]
1716
pub struct Fingerprint(u64, u64);
1817

1918
impl Fingerprint {
@@ -37,23 +36,6 @@ impl Fingerprint {
3736
}
3837
}
3938

40-
impl Encodable for Fingerprint {
41-
#[inline]
42-
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
43-
s.emit_u64(self.0.to_le())?;
44-
s.emit_u64(self.1.to_le())
45-
}
46-
}
47-
48-
impl Decodable for Fingerprint {
49-
#[inline]
50-
fn decode<D: Decoder>(d: &mut D) -> Result<Fingerprint, D::Error> {
51-
let _0 = u64::from_le(d.read_u64()?);
52-
let _1 = u64::from_le(d.read_u64()?);
53-
Ok(Fingerprint(_0, _1))
54-
}
55-
}
56-
5739
impl ::std::fmt::Display for Fingerprint {
5840
fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
5941
write!(formatter, "{:x}-{:x}", self.0, self.1)

0 commit comments

Comments
 (0)