Skip to content

Commit bbd49f1

Browse files
committed
swap out xxhash-rust for twox-hash due to licensing issue
1 parent a725ebe commit bbd49f1

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

Cargo.lock

+1-7
Original file line numberDiff line numberDiff line change
@@ -4775,8 +4775,8 @@ dependencies = [
47754775
"sha1",
47764776
"sha2",
47774777
"tracing",
4778+
"twox-hash",
47784779
"unicode-width",
4779-
"xxhash-rust",
47804780
]
47814781

47824782
[[package]]
@@ -6621,12 +6621,6 @@ version = "0.13.6"
66216621
source = "registry+https://github.com/rust-lang/crates.io-index"
66226622
checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4"
66236623

6624-
[[package]]
6625-
name = "xxhash-rust"
6626-
version = "0.8.10"
6627-
source = "registry+https://github.com/rust-lang/crates.io-index"
6628-
checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03"
6629-
66306624
[[package]]
66316625
name = "xz2"
66326626
version = "0.1.7"

compiler/rustc_span/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ scoped-tls = "1.0"
1818
sha1 = "0.10.0"
1919
sha2 = "0.10.1"
2020
tracing = "0.1"
21+
twox-hash = "1.6.3"
2122
unicode-width = "0.1.4"
22-
xxhash-rust = { version = "0.8.10", features = ["xxh3"] }
2323
# tidy-alphabetical-end

compiler/rustc_span/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
4343
use rustc_serialize::opaque::{FileEncoder, MemDecoder};
4444
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
4545
use tracing::debug;
46-
use xxhash_rust::xxh3;
46+
use twox_hash::xxh3::{self, HasherExt};
4747

4848
mod caching_source_map_view;
4949
pub mod source_map;
@@ -78,7 +78,7 @@ use rustc_data_structures::sync::{FreezeLock, FreezeWriteGuard, Lock, Lrc};
7878
use std::borrow::Cow;
7979
use std::cmp::{self, Ordering};
8080
use std::fmt::Display;
81-
use std::hash::Hash;
81+
use std::hash::{Hash, Hasher};
8282
use std::io::{self, Read};
8383
use std::ops::{Add, Range, Sub};
8484
use std::path::{Path, PathBuf};
@@ -1531,7 +1531,7 @@ impl SourceFileHash {
15311531
value.copy_from_slice(&Sha256::digest(data));
15321532
}
15331533
SourceFileHashAlgorithm::XxHash => {
1534-
value.copy_from_slice(&xxh3::xxh3_128(data).to_be_bytes());
1534+
value.copy_from_slice(&xxh3::hash128(data).to_be_bytes());
15351535
}
15361536
};
15371537
hash
@@ -1569,9 +1569,9 @@ impl SourceFileHash {
15691569
match kind {
15701570
SourceFileHashAlgorithm::XxHash => {
15711571
digest(
1572-
xxh3::Xxh3::new(),
1573-
|h, b| h.update(b),
1574-
|h, out| out.copy_from_slice(&h.digest128().to_be_bytes()),
1572+
xxh3::Hash128::default(),
1573+
|h, b| h.write(b),
1574+
|h, out| out.copy_from_slice(&h.finish_ext().to_be_bytes()),
15751575
src,
15761576
&mut buf,
15771577
value,

0 commit comments

Comments
 (0)