Skip to content

Commit

Permalink
third party: Upgrade rustc_hash
Browse files Browse the repository at this point in the history
Summary:
To 2.1

Unfortunately, I can't remove the old version of the crate. The problem is that it appears in the [public API](https://docs.rs/tiktoken-rs/latest/tiktoken_rs/struct.CoreBPE.html#method.new) of `tiktoken_rs`, which we also import. That crate has a PR to upgrade its dependency [here](zurawiki/tiktoken-rs#95) but that has not been merged. Alternatives here are:

 1. Fork `tiktoken_rs`. This seems worse.
 2. It's strictly speaking possible to use generics combined with some other tricks to avoid needing to name v1 of `FxHashMap` in fbsource. However, that makes that code extraordinarily hard to change and work with, and doesn't seem all that clearly motivated.

If there's something else I should be doing here, all ears

Reviewed By: zertosh

Differential Revision: D68064854

fbshipit-source-id: bd1c96abbc0ebaa178a55826bc85c61eb35e8301
  • Loading branch information
JakobDegen authored and facebook-github-bot committed Jan 13, 2025
1 parent de68be9 commit 29bb259
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion eden/mononoke/git/packfile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mononoke_types = { version = "0.1.0", path = "../../mononoke_types" }
packfile_thrift = { version = "0.1.0", path = "if" }
pin-project = "0.4.30"
quickcheck = "1.0"
rustc-hash = "1.1.0"
rustc-hash = "2.1.0"
sha1 = "0.10.5"
thiserror = "2"
tokio = { version = "1.41.0", features = ["full", "test-util", "tracing"] }
Expand Down
8 changes: 2 additions & 6 deletions eden/mononoke/git/packfile/src/pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

use std::collections::HashMap;
use std::hash::BuildHasherDefault;
use std::io::Write;

use anyhow::Context;
Expand All @@ -17,8 +16,8 @@ use gix_hash::ObjectId;
use gix_pack::data::header;
use gix_pack::data::output::Entry;
use gix_pack::data::Version;
use rustc_hash::FxBuildHasher;
use rustc_hash::FxHashMap;
use rustc_hash::FxHasher;
use thiserror::Error;
use tokio::io::AsyncWrite;
use tokio::io::AsyncWriteExt;
Expand Down Expand Up @@ -85,10 +84,7 @@ impl<T: AsyncWrite + Unpin> PackfileWriter<T> {
// Git uses V2 right now so we do the same
header_info: Some((Version::V2, count)),
object_offset_with_validity: Vec::with_capacity(count as usize),
object_id_with_index: HashMap::with_capacity_and_hasher(
count as usize,
BuildHasherDefault::<FxHasher>::default(),
),
object_id_with_index: HashMap::with_capacity_and_hasher(count as usize, FxBuildHasher),
delta_form,
}
}
Expand Down
2 changes: 1 addition & 1 deletion eden/mononoke/git/protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ packfile = { version = "0.1.0", path = "../packfile" }
repo_blobstore = { version = "0.1.0", path = "../../blobrepo/repo_blobstore" }
repo_derived_data = { version = "0.1.0", path = "../../repo_attributes/repo_derived_data" }
repo_identity = { version = "0.1.0", path = "../../repo_attributes/repo_identity" }
rustc-hash = "1.1.0"
rustc-hash = "2.1.0"
scuba_ext = { version = "0.1.0", path = "../../common/scuba_ext" }
tempfile = "3.8"
tokio = { version = "1.41.0", features = ["full", "test-util", "tracing"] }
2 changes: 1 addition & 1 deletion eden/mononoke/git_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ repo_authorization = { version = "0.1.0", path = "../repo_authorization" }
repo_blobstore = { version = "0.1.0", path = "../blobrepo/repo_blobstore" }
repo_identity = { version = "0.1.0", path = "../repo_attributes/repo_identity" }
repo_permission_checker = { version = "0.1.0", path = "../repo_attributes/repo_permission_checker" }
rustc-hash = "1.1.0"
rustc-hash = "2.1.0"
sapling-clientinfo = { version = "0.1.0", path = "../../scm/lib/clientinfo" }
scuba_ext = { version = "0.1.0", path = "../common/scuba_ext" }
secure_utils = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
Expand Down

0 comments on commit 29bb259

Please sign in to comment.