tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 361b6c9ea57d0706b788998387e50c14be9eda66
parent 0c35bcdc52cf3aeb73cdb351e48e3f8ab0cec8dd
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date:   Tue, 28 Oct 2025 17:38:50 +0000

Bug 1996409 - Update cssparser. r=firefox-style-system-reviewers,layout-reviewers,supply-chain-reviewers,dshin

This updates cssparser to a version that doesn't include any api break
from the version we use currently, mostly dependency bumps, and updates
relevant dependencies as well.

Differential Revision: https://phabricator.services.mozilla.com/D270085

Diffstat:
M.cargo/config.toml.in | 4++--
MCargo.lock | 44++++++++++++++++++++++++++------------------
MCargo.toml | 8+++++++-
Abuild/rust/siphasher/Cargo.toml | 11+++++++++++
Abuild/rust/siphasher/lib.rs | 5+++++
Mbuild/workspace-hack/Cargo.toml | 2+-
Mservo/components/malloc_size_of/Cargo.toml | 2+-
Mservo/components/selectors/Cargo.toml | 6+++---
Mservo/components/style/Cargo.toml | 2+-
Mservo/components/style_traits/Cargo.toml | 2+-
Mservo/components/to_shmem/Cargo.toml | 2+-
Mservo/ports/geckolib/Cargo.toml | 2+-
Mservo/tests/unit/style/Cargo.toml | 2+-
Msupply-chain/audits.toml | 24++++++++++++++++++------
Msupply-chain/imports.lock | 26++++++++++++++++----------
Mthird_party/rust/cssparser-macros/.cargo-checksum.json | 4++--
Mthird_party/rust/cssparser-macros/lib.rs | 4++--
Mthird_party/rust/cssparser/.cargo-checksum.json | 4++--
Mthird_party/rust/cssparser/.github/workflows/main.yml | 2+-
Mthird_party/rust/cssparser/Cargo.toml | 6+++---
Mthird_party/rust/cssparser/src/lib.rs | 4++--
Mthird_party/rust/cssparser/src/parser.rs | 6+++---
Mthird_party/rust/cssparser/src/serializer.rs | 2+-
Mthird_party/rust/cssparser/src/tests.rs | 2+-
Mthird_party/rust/cssparser/src/tokenizer.rs | 4++--
Mthird_party/rust/phf/.cargo-checksum.json | 4++--
Mthird_party/rust/phf/CHANGELOG.md | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Athird_party/rust/phf/Cargo.lock | 136+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mthird_party/rust/phf/Cargo.toml | 41+++++++++++++++++++++++++++--------------
Mthird_party/rust/phf/README.md | 44+++++++++++++++++++++++++++++++++++++-------
Mthird_party/rust/phf/src/lib.rs | 54+++++++++++++++++++++++++++++++++++++++++++++++++-----
Mthird_party/rust/phf/src/map.rs | 35++++++++++++++++++++++++++---------
Mthird_party/rust/phf/src/ordered_map.rs | 46+++++++++++++++++++++++++++++++++-------------
Mthird_party/rust/phf/src/ordered_set.rs | 23+++++++++++++++++------
Mthird_party/rust/phf/src/set.rs | 19+++++++++++++++----
Mthird_party/rust/phf_codegen/.cargo-checksum.json | 4++--
Mthird_party/rust/phf_codegen/CHANGELOG.md | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Athird_party/rust/phf_codegen/Cargo.lock | 42++++++++++++++++++++++++++++++++++++++++++
Mthird_party/rust/phf_codegen/Cargo.toml | 18++++++++++++++----
Mthird_party/rust/phf_codegen/README.md | 44+++++++++++++++++++++++++++++++++++++-------
Mthird_party/rust/phf_codegen/src/lib.rs | 121++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
Mthird_party/rust/phf_generator/.cargo-checksum.json | 4++--
Mthird_party/rust/phf_generator/CHANGELOG.md | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Mthird_party/rust/phf_generator/Cargo.lock | 510+++++++++++++++++++++++++++++++++++++++++--------------------------------------
Mthird_party/rust/phf_generator/Cargo.toml | 32+++++++++++++++++++-------------
Mthird_party/rust/phf_generator/benches/benches.rs | 12+++++-------
Mthird_party/rust/phf_generator/src/bin/gen_hash_test.rs | 15++++++++-------
Mthird_party/rust/phf_generator/src/lib.rs | 203+++++++++++++++++++++++++++++++++++++++++++++++++------------------------------
Mthird_party/rust/phf_macros/.cargo-checksum.json | 4++--
Athird_party/rust/phf_macros/CHANGELOG.md | 401+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Athird_party/rust/phf_macros/Cargo.lock | 105+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mthird_party/rust/phf_macros/Cargo.toml | 40++++++++++++++++++++++++++++------------
Athird_party/rust/phf_macros/LICENSE | 20++++++++++++++++++++
Athird_party/rust/phf_macros/README.md | 157+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mthird_party/rust/phf_macros/src/lib.rs | 481++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
Mthird_party/rust/phf_shared/.cargo-checksum.json | 4++--
Mthird_party/rust/phf_shared/CHANGELOG.md | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Athird_party/rust/phf_shared/Cargo.lock | 39+++++++++++++++++++++++++++++++++++++++
Mthird_party/rust/phf_shared/Cargo.toml | 22++++++++++++++--------
Mthird_party/rust/phf_shared/src/lib.rs | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
Mthird_party/rust/siphasher/.cargo-checksum.json | 4++--
Mthird_party/rust/siphasher/COPYING | 2+-
Mthird_party/rust/siphasher/Cargo.toml | 8+++-----
Mthird_party/rust/siphasher/README.md | 60+++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
Mthird_party/rust/siphasher/src/lib.rs | 8+++++++-
Mthird_party/rust/siphasher/src/sip.rs | 27++++++++++++++++++++++++++-
Mthird_party/rust/siphasher/src/sip128.rs | 27++++++++++++++++++++++++++-
Mthird_party/rust/siphasher/src/tests.rs | 25++++++++++++++++++++++++-
Mthird_party/rust/siphasher/src/tests128.rs | 33++++++++++++++++++++++++++++++++-
Mtoolkit/crashreporter/client/app/Cargo.toml | 4++--
70 files changed, 2786 insertions(+), 682 deletions(-)

diff --git a/.cargo/config.toml.in b/.cargo/config.toml.in @@ -120,9 +120,9 @@ git = "https://github.com/rust-lang/rust-bindgen" rev = "9366e0af8da529c958b4cd4fcbe492d951c86f5c" replace-with = "vendored-sources" -[source."git+https://github.com/servo/rust-cssparser?rev=958a3f098acb92ddacdce18a7ef2c4a87ac3326f"] +[source."git+https://github.com/servo/rust-cssparser?rev=03f982ed70ce1de67bef02de63b2e11e08a9e111"] git = "https://github.com/servo/rust-cssparser" -rev = "958a3f098acb92ddacdce18a7ef2c4a87ac3326f" +rev = "03f982ed70ce1de67bef02de63b2e11e08a9e111" replace-with = "vendored-sources" [source."git+https://github.com/servo/unicode-bidi?rev=ca612daf1c08c53abe07327cb3e6ef6e0a760f0c"] diff --git a/Cargo.lock b/Cargo.lock @@ -1336,8 +1336,8 @@ dependencies = [ [[package]] name = "cssparser" -version = "0.34.1" -source = "git+https://github.com/servo/rust-cssparser?rev=958a3f098acb92ddacdce18a7ef2c4a87ac3326f#958a3f098acb92ddacdce18a7ef2c4a87ac3326f" +version = "0.35.0" +source = "git+https://github.com/servo/rust-cssparser?rev=03f982ed70ce1de67bef02de63b2e11e08a9e111#03f982ed70ce1de67bef02de63b2e11e08a9e111" dependencies = [ "cssparser-macros", "dtoa-short", @@ -1349,7 +1349,7 @@ dependencies = [ [[package]] name = "cssparser-macros" version = "0.6.1" -source = "git+https://github.com/servo/rust-cssparser?rev=958a3f098acb92ddacdce18a7ef2c4a87ac3326f#958a3f098acb92ddacdce18a7ef2c4a87ac3326f" +source = "git+https://github.com/servo/rust-cssparser?rev=03f982ed70ce1de67bef02de63b2e11e08a9e111#03f982ed70ce1de67bef02de63b2e11e08a9e111" dependencies = [ "quote", "syn", @@ -5326,19 +5326,20 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "phf" -version = "0.11.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" dependencies = [ "phf_macros", "phf_shared", + "serde", ] [[package]] name = "phf_codegen" -version = "0.11.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" +checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" dependencies = [ "phf_generator", "phf_shared", @@ -5346,19 +5347,19 @@ dependencies = [ [[package]] name = "phf_generator" -version = "0.11.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" dependencies = [ + "fastrand", "phf_shared", - "rand", ] [[package]] name = "phf_macros" -version = "0.11.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" dependencies = [ "phf_generator", "phf_shared", @@ -5369,11 +5370,11 @@ dependencies = [ [[package]] name = "phf_shared" -version = "0.11.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" dependencies = [ - "siphasher", + "siphasher 1.0.1", ] [[package]] @@ -6432,9 +6433,16 @@ checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "siphasher" -version = "0.3.10" +version = "0.3.999" +dependencies = [ + "siphasher 1.0.1", +] + +[[package]] +name = "siphasher" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "slab" @@ -7432,7 +7440,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d226fc167754ce548c5ece9828c8a06f03bf1eea525d2659ba6bd648bd8e2f3" dependencies = [ "anyhow", - "siphasher", + "siphasher 0.3.999", "uniffi_internal_macros", "uniffi_pipeline", ] diff --git a/Cargo.toml b/Cargo.toml @@ -167,6 +167,10 @@ bindgen = { path = "build/rust/bindgen" } # Patch nix 0.29 to 0.30+ nix = { path = "build/rust/nix" } +# Patch siphasher 0.3 to 1.0 +# TODO: Remove once https://github.com/mozilla/uniffi-rs/pull/2709 lands in m-c. +siphasher = { path = "build/rust/siphasher" } + # Patch autocfg to hide rustc output. Workaround for https://github.com/cuviper/autocfg/issues/30 autocfg = { path = "third_party/rust/autocfg" } @@ -234,7 +238,9 @@ unicode-width = { path = "build/rust/unicode-width" } # To-be-published changes. unicode-bidi = { git = "https://github.com/servo/unicode-bidi", rev = "ca612daf1c08c53abe07327cb3e6ef6e0a760f0c" } nss-gk-api = { git = "https://github.com/beurdouche/nss-gk-api", rev = "e48a946811ffd64abc78de3ee284957d8d1c0d63" } -cssparser = { git = "https://github.com/servo/rust-cssparser", rev = "958a3f098acb92ddacdce18a7ef2c4a87ac3326f" } + +# Unpublished changes +cssparser = { git = "https://github.com/servo/rust-cssparser", rev = "03f982ed70ce1de67bef02de63b2e11e08a9e111" } # Other overrides any_all_workaround = { git = "https://github.com/hsivonen/any_all_workaround", rev = "7fb1b7034c9f172aade21ee1c8554e8d8a48af80" } diff --git a/build/rust/siphasher/Cargo.toml b/build/rust/siphasher/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "siphasher" +version = "0.3.999" +edition = "2018" +license = "MPL-2.0" + +[lib] +path = "lib.rs" + +[dependencies.siphasher] +version = "1" diff --git a/build/rust/siphasher/lib.rs b/build/rust/siphasher/lib.rs @@ -0,0 +1,5 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +pub use siphasher::*; diff --git a/build/workspace-hack/Cargo.toml b/build/workspace-hack/Cargo.toml @@ -53,7 +53,7 @@ num-traits = { version = "0.2", features = ["i128", "libm"], optional = true } object = { version = "0.36", default-features = false, features = ["read", "std"], optional = true } once_cell = { version = "1", optional = true } percent-encoding = { version = "2", optional = true } -phf = { version = "0.11", features = ["macros", "phf_macros"], optional = true } +phf = { version = "0.13", features = ["macros", "phf_macros"], optional = true } regex = { version = "1", optional = true } rkv = { version = "0.20", default-features = false, features = ["no-canonicalize-path"], optional = true } scroll = { version = "0.12", optional = true } diff --git a/servo/components/malloc_size_of/Cargo.toml b/servo/components/malloc_size_of/Cargo.toml @@ -15,7 +15,7 @@ servo = ["string_cache"] [dependencies] app_units = "0.7" -cssparser = "0.34" +cssparser = "0.35" euclid = "0.22" selectors = { path = "../selectors" } servo_arc = { path = "../servo_arc" } diff --git a/servo/components/selectors/Cargo.toml b/servo/components/selectors/Cargo.toml @@ -21,11 +21,11 @@ to_shmem = ["dep:to_shmem", "dep:to_shmem_derive"] [dependencies] bitflags = "2" -cssparser = "0.34" +cssparser = "0.35" derive_more = { version = "2", features = ["add", "add_assign"] } rustc-hash = "2.1.1" log = "0.4" -phf = "0.11" +phf = "0.13" precomputed-hash = "0.1" servo_arc = { version = "0.4", path = "../servo_arc" } smallvec = "1.0" @@ -34,4 +34,4 @@ to_shmem_derive = { version = "0.1", path = "../to_shmem_derive", optional = tru new_debug_unreachable = "1" [build-dependencies] -phf_codegen = "0.11" +phf_codegen = "0.13" diff --git a/servo/components/style/Cargo.toml b/servo/components/style/Cargo.toml @@ -55,7 +55,7 @@ arrayvec = "0.7" atomic_refcell = "0.1" bitflags = "2" byteorder = "1.0" -cssparser = "0.34" +cssparser = "0.35" derive_more = { version = "2", features = ["add", "add_assign", "deref", "deref_mut", "from"] } dom = { path = "../../../dom/base/rust" } new_debug_unreachable = "1.0" diff --git a/servo/components/style_traits/Cargo.toml b/servo/components/style_traits/Cargo.toml @@ -18,7 +18,7 @@ gecko = ["nsstring"] [dependencies] app_units = "0.7" bitflags = "2" -cssparser = "0.34" +cssparser = "0.35" euclid = "0.22" malloc_size_of = { path = "../malloc_size_of" } malloc_size_of_derive = { path = "../../../xpcom/rust/malloc_size_of_derive" } diff --git a/servo/components/to_shmem/Cargo.toml b/servo/components/to_shmem/Cargo.toml @@ -23,7 +23,7 @@ string_cache = ["dep:string_cache"] thin-vec = ["dep:thin-vec"] [dependencies] -cssparser = { version = "0.34", optional = true } +cssparser = { version = "0.35", optional = true } servo_arc = { version = "0.4.0", path = "../servo_arc", optional = true } smallbitvec = { version = "2.3.0", optional = true } smallvec = { version = "1.13", optional = true } diff --git a/servo/ports/geckolib/Cargo.toml b/servo/ports/geckolib/Cargo.toml @@ -15,7 +15,7 @@ gecko_refcount_logging = ["style/gecko_refcount_logging", "servo_arc/gecko_refco [dependencies] atomic_refcell = "0.1" -cssparser = "0.34" +cssparser = "0.35" cstr = "0.2" dom = { path = "../../../dom/base/rust" } ipdl_utils = { path = "../../../ipc/rust/ipdl_utils" } diff --git a/servo/tests/unit/style/Cargo.toml b/servo/tests/unit/style/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] byteorder = "1.0" app_units = "0.7" -cssparser = "0.34" +cssparser = "0.35" euclid = "0.22" html5ever = "0.22" parking_lot = "0.10" diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml @@ -1693,11 +1693,16 @@ delta = "0.33.0 -> 0.34.0" notes = "I'm the publisher of the crate, and either myself or other Mozilla folks have been authors or reviewers of all the changes." [[audits.cssparser]] -who = "Nicolas Chevobbe <chevobbe.nicolas@gmail.com>" +who = "Emilio Cobos Álvarez <emilio@crisal.io>" criteria = "safe-to-deploy" -delta = "0.34.0 -> 0.34.1@git:958a3f098acb92ddacdce18a7ef2c4a87ac3326f" -importable = false -notes = "Emilio is the publisher of the crate, and he or other Mozilla employees have been authors or reviewers of all the changes." +delta = "0.34.0 -> 0.35.0" +notes = "All non-trivial changes authored or reviewed by Mozilla employees." + +[[audits.cssparser]] +who = "Emilio Cobos Álvarez <emilio@crisal.io>" +criteria = "safe-to-deploy" +delta = "0.35.0 -> 0.35.0@git:03f982ed70ce1de67bef02de63b2e11e08a9e111" +notes = "Only dependency bumps and one trivial change with no unsafe change." [[audits.cssparser-color]] who = "Emilio Cobos Álvarez <emilio@crisal.io>" @@ -1720,10 +1725,11 @@ criteria = "safe-to-deploy" delta = "0.6.0 -> 0.6.1" [[audits.cssparser-macros]] -who = "Nicolas Chevobbe <chevobbe.nicolas@gmail.com>" +who = "Emilio Cobos Álvarez <emilio@crisal.io>" criteria = "safe-to-deploy" -delta = "0.6.1 -> 0.6.1@git:958a3f098acb92ddacdce18a7ef2c4a87ac3326f" +delta = "0.6.1 -> 0.6.1@git:03f982ed70ce1de67bef02de63b2e11e08a9e111" importable = false +notes = "Only formatting changes." [[audits.cssparser-macros]] who = "Emilio Cobos Álvarez <emilio@crisal.io>" @@ -5670,6 +5676,12 @@ who = "Max Inden <mail@max-inden.de>" criteria = "safe-to-deploy" delta = "1.1.0 -> 1.3.0" +[[audits.siphasher]] +who = "Emilio Cobos Álvarez <emilio@crisal.io>" +criteria = "safe-to-deploy" +delta = "0.3.11 -> 1.0.1" +notes = "Only change to the crate source is adding documentation." + [[audits.slab]] who = "Mike Hommey <mh+mozilla@glandium.org>" criteria = "safe-to-deploy" diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock @@ -499,36 +499,36 @@ user-login = "afranchuk" user-name = "Alex Franchuk" [[publisher.phf]] -version = "0.11.2" -when = "2023-06-24" +version = "0.13.1" +when = "2025-08-23" user-id = 51017 user-login = "JohnTitor" user-name = "Yuki Okushi" [[publisher.phf_codegen]] -version = "0.11.2" -when = "2023-06-24" +version = "0.13.1" +when = "2025-08-23" user-id = 51017 user-login = "JohnTitor" user-name = "Yuki Okushi" [[publisher.phf_generator]] -version = "0.11.2" -when = "2023-06-24" +version = "0.13.1" +when = "2025-08-23" user-id = 51017 user-login = "JohnTitor" user-name = "Yuki Okushi" [[publisher.phf_macros]] -version = "0.11.2" -when = "2023-06-24" +version = "0.13.1" +when = "2025-08-23" user-id = 51017 user-login = "JohnTitor" user-name = "Yuki Okushi" [[publisher.phf_shared]] -version = "0.11.2" -when = "2023-06-24" +version = "0.13.1" +when = "2025-08-23" user-id = 51017 user-login = "JohnTitor" user-name = "Yuki Okushi" @@ -3005,6 +3005,12 @@ criteria = "safe-to-deploy" delta = "0.11.1 -> 0.12.0" aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml" +[[audits.mozilla.audits.siphasher]] +who = "Jan-Erik Rediger <jrediger@mozilla.com>" +criteria = "safe-to-deploy" +delta = "0.3.10 -> 0.3.11" +aggregated-from = "https://raw.githubusercontent.com/mozilla/glean/main/supply-chain/audits.toml" + [[audits.mozilla.audits.smawk]] who = "Jan-Erik Rediger <jrediger@mozilla.com>" criteria = "safe-to-deploy" diff --git a/third_party/rust/cssparser-macros/.cargo-checksum.json b/third_party/rust/cssparser-macros/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"e56b8b43a23c7449e12a742aaa343eb8147ae3b97f96f60f4d600ba1f8376b3a","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","lib.rs":"6db0339c9883d6e1517c3c005da1c7977573d53edd649139b247464c7bca69da"},"package":null} -\ No newline at end of file +{"files":{"Cargo.toml":"e56b8b43a23c7449e12a742aaa343eb8147ae3b97f96f60f4d600ba1f8376b3a","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","lib.rs":"de5cd771d1388a799dc7aa05fed4f91dc340c4c691fa1bef58612788a68a792a"},"package":null} +\ No newline at end of file diff --git a/third_party/rust/cssparser-macros/lib.rs b/third_party/rust/cssparser-macros/lib.rs @@ -162,7 +162,7 @@ pub fn match_byte(input: TokenStream) -> TokenStream { for (i, ref arm) in arms.iter().enumerate() { let case_id = i + 1; let index = case_id as isize; - let name = syn::Ident::new(&format!("Case{}", case_id), arm.span()); + let name = syn::Ident::new(&format!("Case{case_id}"), arm.span()); let pat = &arm.pat; parse_pat_to_table(pat, case_id as u8, &mut wildcard, &mut table); @@ -177,7 +177,7 @@ pub fn match_byte(input: TokenStream) -> TokenStream { let mut table_content = Vec::new(); for entry in table.iter() { - let name: syn::Path = syn::parse_str(&format!("Case::Case{}", entry)).unwrap(); + let name: syn::Path = syn::parse_str(&format!("Case::Case{entry}")).unwrap(); table_content.push(name); } let table = quote::quote!(static __CASES: [Case; 256] = [#(#table_content),*];); diff --git a/third_party/rust/cssparser/.cargo-checksum.json b/third_party/rust/cssparser/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".github/workflows/main.yml":"5d018103c946a9bc9dcde4089357e17e78a3bd6f4f67ef047a495f5d66f77202","Cargo.toml":"b873cb37dbf79b35ee80cb7fa3b9e9dc39835a2d900295d4e6bdccf38b7ecc83","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"95e81e8f22062ba196eb8229a749327c063620ccf31ce1dd01b7ea0529840280","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"5edc02f840f6837580e800c860e91c8ea28c77f0dd157bffdf648827c476d01c","src/cow_rc_str.rs":"88edf6a4a1b3d4338885a8eacc29a9e7115d4fae0f227c9a81a4d53c5a546693","src/from_bytes.rs":"1223c1ccf619735ccf7c28a8d154d516aa117fdbddcf091e2e8952e68fe53a80","src/lib.rs":"13be989c091fb59ecab3e855e76e7c3468f465f63e7391303fa51f251441916a","src/macros.rs":"64ad9e506e5cea52767a5177779ac4a1cbdac1b2188abaa1291e9feb8f1653bf","src/nth.rs":"972cc94275126e747c95621e8c5f56ce5d869924e60bb0dc990f4c98f3d74890","src/parser.rs":"ff9b7e41dfbd019d1f45c6628cb9d468c9a018954e550110c90b1c0c15f97331","src/rules_and_declarations.rs":"19d11c37c523fba34b55ea6dd24b20d80c005e33f514d5922601b3802ff4c06d","src/serializer.rs":"5e825b0d674e2753a4fa95d86d55be394787f2b746f4fa75788540f09da63d95","src/size_of_tests.rs":"da0cbcaa304f7800e9122e2bce0a11d42a70b9012e646a723cb23ee74a6b858c","src/tests.rs":"a7b5366a7073dae9d5304eafab3dc27a9ca08d468b33dee765f9646711003596","src/tokenizer.rs":"f246afa3c98bbaa3d8ac52aa6b940768a22f09e0c445d1eb8df09eb880827501","src/unicode_range.rs":"7ea876f64e2c83679e9cecccf9f332bebffe512f487da47a0c06e423c8662110"},"package":null} -\ No newline at end of file +{"files":{".github/workflows/main.yml":"3f3d9cf32a5e948fdf3ff78f3e3502848318572fa0f0290fd7f35cfdf9be68c8","Cargo.toml":"2142fd672ece72f32e4fba87fb76b452b03a188093386db23c3e48094b54cafb","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"95e81e8f22062ba196eb8229a749327c063620ccf31ce1dd01b7ea0529840280","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"5edc02f840f6837580e800c860e91c8ea28c77f0dd157bffdf648827c476d01c","src/cow_rc_str.rs":"88edf6a4a1b3d4338885a8eacc29a9e7115d4fae0f227c9a81a4d53c5a546693","src/from_bytes.rs":"1223c1ccf619735ccf7c28a8d154d516aa117fdbddcf091e2e8952e68fe53a80","src/lib.rs":"846393d814c88f391706568aa697d7f6f8a6325bf4f6a187a8d81be1d1d013cf","src/macros.rs":"64ad9e506e5cea52767a5177779ac4a1cbdac1b2188abaa1291e9feb8f1653bf","src/nth.rs":"972cc94275126e747c95621e8c5f56ce5d869924e60bb0dc990f4c98f3d74890","src/parser.rs":"e7de003f1b42d80e2256972b7b90e39030dc2d362d52ef36fe33562fc4466ddb","src/rules_and_declarations.rs":"19d11c37c523fba34b55ea6dd24b20d80c005e33f514d5922601b3802ff4c06d","src/serializer.rs":"e3aa3e0ca294d34b3850e54680f4475143aa09fcb85129fa85d7084c4c9ea09e","src/size_of_tests.rs":"da0cbcaa304f7800e9122e2bce0a11d42a70b9012e646a723cb23ee74a6b858c","src/tests.rs":"c64f756d126004a47e7534777893db77625e7b27a60ccf5ba9e283319e04acd6","src/tokenizer.rs":"474d8f833ec65cffeda27cc73cb82668f4146cdff13f81cdede46ff5cd84e8d4","src/unicode_range.rs":"7ea876f64e2c83679e9cecccf9f332bebffe512f487da47a0c06e423c8662110"},"package":null} +\ No newline at end of file diff --git a/third_party/rust/cssparser/.github/workflows/main.yml b/third_party/rust/cssparser/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: - nightly - beta - stable - - 1.63.0 + - 1.66.0 features: - - --features dummy_match_byte diff --git a/third_party/rust/cssparser/Cargo.toml b/third_party/rust/cssparser/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2018" -rust-version = "1.63" +rust-version = "1.66" name = "cssparser" -version = "0.34.1" +version = "0.35.0" authors = ["Simon Sapin <simon.sapin@exyr.org>"] build = false exclude = [ @@ -60,7 +60,7 @@ optional = true default-features = false [dependencies.phf] -version = "0.11.2" +version = "0.13.1" features = ["macros"] [dependencies.serde] diff --git a/third_party/rust/cssparser/src/lib.rs b/third_party/rust/cssparser/src/lib.rs @@ -41,7 +41,7 @@ As a consequence, when calling another parsing function, either: Examples: -```{rust,ignore} +```rust,ignore // 'none' | <image> fn parse_background_image(context: &ParserContext, input: &mut Parser) -> Result<Option<Image>, ()> { @@ -53,7 +53,7 @@ fn parse_background_image(context: &ParserContext, input: &mut Parser) } ``` -```{rust,ignore} +```rust,ignore // [ <length> | <percentage> ] [ <length> | <percentage> ]? fn parse_border_spacing(_context: &ParserContext, input: &mut Parser) -> Result<(LengthOrPercentage, LengthOrPercentage), ()> { diff --git a/third_party/rust/cssparser/src/parser.rs b/third_party/rust/cssparser/src/parser.rs @@ -80,11 +80,11 @@ impl fmt::Display for BasicParseErrorKind<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { BasicParseErrorKind::UnexpectedToken(token) => { - write!(f, "unexpected token: {:?}", token) + write!(f, "unexpected token: {token:?}") } BasicParseErrorKind::EndOfInput => write!(f, "unexpected end of input"), BasicParseErrorKind::AtRuleInvalid(rule) => { - write!(f, "invalid @ rule encountered: '@{}'", rule) + write!(f, "invalid @ rule encountered: '@{rule}'") } BasicParseErrorKind::AtRuleBodyInvalid => write!(f, "invalid @ rule body encountered"), BasicParseErrorKind::QualifiedRuleInvalid => { @@ -295,7 +295,7 @@ impl BlockType { /// /// The union of two sets can be obtained with the `|` operator. Example: /// -/// ```{rust,ignore} +/// ```rust,ignore /// input.parse_until_before(Delimiter::CurlyBracketBlock | Delimiter::Semicolon) /// ``` #[derive(Copy, Clone, PartialEq, Eq, Debug)] diff --git a/third_party/rust/cssparser/src/serializer.rs b/third_party/rust/cssparser/src/serializer.rs @@ -286,7 +286,7 @@ where /// /// Typical usage: /// -/// ```{rust,ignore} +/// ```rust,ignore /// fn write_foo<W>(foo: &Foo, dest: &mut W) -> fmt::Result where W: fmt::Write { /// dest.write_str("\"")?; /// { diff --git a/third_party/rust/cssparser/src/tests.rs b/third_party/rust/cssparser/src/tests.rs @@ -794,7 +794,7 @@ fn delimiter_from_byte(b: &mut Bencher) { } #[cfg(feature = "bench")] -const BACKGROUND_IMAGE: &'static str = include_str!("big-data-url.css"); +const BACKGROUND_IMAGE: &str = include_str!("big-data-url.css"); #[cfg(feature = "bench")] #[bench] diff --git a/third_party/rust/cssparser/src/tokenizer.rs b/third_party/rust/cssparser/src/tokenizer.rs @@ -229,7 +229,7 @@ enum SeenStatus { impl<'a> Tokenizer<'a> { #[inline] - pub fn new(input: &str) -> Tokenizer { + pub fn new(input: &'a str) -> Self { Tokenizer { input, position: 0, @@ -891,7 +891,7 @@ fn consume_quoted_string<'a>( } #[inline] -fn is_ident_start(tokenizer: &mut Tokenizer) -> bool { +fn is_ident_start(tokenizer: &Tokenizer) -> bool { !tokenizer.is_eof() && match_byte! { tokenizer.next_byte_unchecked(), b'a'..=b'z' | b'A'..=b'Z' | b'_' | b'\0' => true, diff --git a/third_party/rust/phf/.cargo-checksum.json b/third_party/rust/phf/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"4bf264fe2d808d67eb51e9079d332e0ff7522b0c2db123a19a41085725792551","Cargo.toml":"d1a8275ce39ea72d65ad6e6dbdb39a7b330acf3ef24e9022c59dbe3ce546f1dd","LICENSE":"0ab4d106b6faac07fb6a051815fd1b4d862d730895e2d7d7358c2f13565e7a38","README.md":"cc039ae7021814495ef56d3680fa78f3d0d671c86223b35cfb6d50021c40b64e","src/lib.rs":"8b5c55694afdc819439fd0804106e376290de598e29d0e123b4fa15cbd7eb2ff","src/map.rs":"db6df0e2465d51b40640bb85cea28a9daca9ff1b0f57a3316608a55fc11879c5","src/ordered_map.rs":"5f849d7c8bea4322911b81a980a9ce988961ccec4029a2254d54ca68aed8cd45","src/ordered_set.rs":"0ed66947623c8a79b1ad2c206ef5a13af701f95c0f36544ab986c9617e2a24a3","src/set.rs":"065a501930c4667877168b99aeca00007dd222865bafc26451cbc9fdf08ad7e6"},"package":"ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"} -\ No newline at end of file +{"files":{"CHANGELOG.md":"0daf2d29e9a4f72c9375c6af57e79388acb4ba0ed684c7de84fd05b0bb3c50ca","Cargo.lock":"b9ee8de87f9af25e37b69a20649742e64aeabcb9975050caf097b7c4e49208e0","Cargo.toml":"5bf09dcab55c8fb28fc1ac96beb1b75b595ea026373e2f92b70cc395394579b0","LICENSE":"0ab4d106b6faac07fb6a051815fd1b4d862d730895e2d7d7358c2f13565e7a38","README.md":"a24f96850f0dc794dc8a18f9b8af1d2cec6b6eeca6ec9dced4b53847cb60d85a","src/lib.rs":"9050fcbeb507bfe6ad09b8253bb27f29daa82779ae74e273de3c6b05b9243a85","src/map.rs":"30f8c3e2dd1f3ffa8ac5ad361609931b25ec62c2ec18516eda25e02131b2ff4b","src/ordered_map.rs":"740b8b49b78095c9f980f44c9f6122a037354df4db77d69b06ebe094235d2dcd","src/ordered_set.rs":"340a36655d6e55549588449752f512c38c1163c798d826f7e0d3574fb113d7e0","src/set.rs":"6aa0775df28961141556a00726193992e6ceee79c4f11b94603d24f73c2ac4f1"},"package":"c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"} +\ No newline at end of file diff --git a/third_party/rust/phf/CHANGELOG.md b/third_party/rust/phf/CHANGELOG.md @@ -5,14 +5,92 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 0.12.0 (2025-06-19) + +<csr-id-08e74647f00f7d77cbb81e0cb73ed663798d000f/> +<csr-id-08897bd7603c362280ad4f24feca2c99be5e9a98/> + +### Chore + + - <csr-id-08e74647f00f7d77cbb81e0cb73ed663798d000f/> Update version number in docs + - <csr-id-08897bd7603c362280ad4f24feca2c99be5e9a98/> Turn off serde std feature on no-std + +### Chore + + - <csr-id-51d6baaa6ffce658fb9b56a96affaf0ddd0603e5/> Update changelog + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 10 commits contributed to the release over the course of 138 calendar days. + - 163 days passed between releases. + - 3 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Update changelog ([`51d6baa`](https://github.com/rust-phf/rust-phf/commit/51d6baaa6ffce658fb9b56a96affaf0ddd0603e5)) + - Update version number in docs ([`08e7464`](https://github.com/rust-phf/rust-phf/commit/08e74647f00f7d77cbb81e0cb73ed663798d000f)) + - Merge pull request #333 from JohnTitor/chore/serde-no-std ([`5c3ad85`](https://github.com/rust-phf/rust-phf/commit/5c3ad850fd55f8a9fd2ea8bce69fc458029242d6)) + - Turn off serde std feature on no-std ([`08897bd`](https://github.com/rust-phf/rust-phf/commit/08897bd7603c362280ad4f24feca2c99be5e9a98)) + - Merge pull request #289 from thaliaarchi/master ([`a6df856`](https://github.com/rust-phf/rust-phf/commit/a6df856ade4cfbf2666fcabbd70c666ea8234abf)) + - Add support for unicase::Ascii type ([`2806801`](https://github.com/rust-phf/rust-phf/commit/28068018dec5aab9b6ddc0da918431285db8cd34)) + - Merge pull request #309 from edef1c/uncased-macro ([`37a7794`](https://github.com/rust-phf/rust-phf/commit/37a779400b63b5d0b5d5ab63e2727bbfb9ce494d)) + - Merge branch 'master' into no-wasteful-allocations ([`33b8aff`](https://github.com/rust-phf/rust-phf/commit/33b8affe77cea8bdeccb5c8d6c730c78231fc138)) + - Update phf/examples/uncased-example/Cargo.toml ([`8193820`](https://github.com/rust-phf/rust-phf/commit/81938207ee77f787b3186a8d6060a2615fe199c6)) + - Merge branch 'master' into fastrand ([`576dd47`](https://github.com/rust-phf/rust-phf/commit/576dd47858a2db74eb4ef67a8385039ef17b867d)) +</details> + +## 0.11.3 (2025-01-07) + +<csr-id-a96a4e29d63fb1ab3cc10e050571e733f5d2d0d1/> + +### Chore + + - <csr-id-a96a4e29d63fb1ab3cc10e050571e733f5d2d0d1/> bump Cargo.toml version of phf and phf_macros + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 10 commits contributed to the release. + - 562 days passed between releases. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Adjusting changelogs prior to release of phf_shared v0.11.3, phf_generator v0.11.3, phf_macros v0.11.3, phf v0.11.3, phf_codegen v0.11.3 ([`e111f4b`](https://github.com/rust-phf/rust-phf/commit/e111f4b53a965c188fdcbf03950321107d9b3987)) + - Merge pull request #322 from JohnTitor/release-0.11.3 ([`dc64dd6`](https://github.com/rust-phf/rust-phf/commit/dc64dd6bace986a8858590455e08659d9ea4ae4b)) + - Reset version num ([`13581f8`](https://github.com/rust-phf/rust-phf/commit/13581f8e9eefe8b8b7cb1b1ad04f2d68d97b0ffd)) + - Merge pull request #315 from LunarLambda/master ([`695a0df`](https://github.com/rust-phf/rust-phf/commit/695a0df769f3c75150a67ed9bb316579b875289d)) + - Bump Cargo.toml version of phf and phf_macros ([`a96a4e2`](https://github.com/rust-phf/rust-phf/commit/a96a4e29d63fb1ab3cc10e050571e733f5d2d0d1)) + - Macro support for uncased ([`4359e17`](https://github.com/rust-phf/rust-phf/commit/4359e17371e4b93a45b8600cc56bc27aa95c5bb1)) + - Merge pull request #290 from thaliaarchi/eq-trait ([`f89fca4`](https://github.com/rust-phf/rust-phf/commit/f89fca430205ddcbd7f41fa7c4f4f2144ae62cdb)) + - Merge pull request #300 from JohnTitor/msrv-1.61 ([`323366d`](https://github.com/rust-phf/rust-phf/commit/323366d03966ddad2eaa3432df79c9da8339e319)) + - Bump MSRV to 1.61 ([`1795f7b`](https://github.com/rust-phf/rust-phf/commit/1795f7b66b16af0191f221dc957bc8a090c891ad)) + - Implement PartialEq and Eq for map and set types ([`6e5dc32`](https://github.com/rust-phf/rust-phf/commit/6e5dc322cd3fac4eea960a6f2778989ccf985f95)) +</details> + +## 0.11.2 (2023-06-24) ### Commit Statistics <csr-read-only-do-not-edit/> - - 8 commits contributed to the release over the course of 205 calendar days. - - 320 days passed between releases. + - 10 commits contributed to the release. + - 319 days passed between releases. - 0 commits were understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages @@ -23,6 +101,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 <details><summary>view details</summary> * **Uncategorized** + - Release phf_shared v0.11.2, phf_generator v0.11.2, phf_macros v0.11.2, phf v0.11.2, phf_codegen v0.11.2 ([`c9c35fd`](https://github.com/rust-phf/rust-phf/commit/c9c35fd8ba3f1bc228388b0cef6e3814a02a72c0)) + - Update changelogs ([`a1e5072`](https://github.com/rust-phf/rust-phf/commit/a1e5072b8e84b108f06389a1d41ac868426a03f7)) - Merge pull request #288 from JohnTitor/rm-phf-stats ([`8fd5b77`](https://github.com/rust-phf/rust-phf/commit/8fd5b7770d427aea5004d17ff585541d0856d40b)) - Remove mentions to `PHF_STATS` ([`0b7a826`](https://github.com/rust-phf/rust-phf/commit/0b7a82689ceab9e0e364c1d1dbe3639d2e99320a)) - Merge pull request #280 from jf2048/deref-bytestring ([`3776342`](https://github.com/rust-phf/rust-phf/commit/377634245c8c6f0569a2ed7b75d08366b54c8810)) @@ -63,7 +143,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 <csr-read-only-do-not-edit/> - - 310 commits contributed to the release over the course of 2957 calendar days. + - 310 commits contributed to the release. - 3 commits were understood as [conventional](https://www.conventionalcommits.org). - 1 unique issue was worked on: [#249](https://github.com/rust-phf/rust-phf/issues/249) diff --git a/third_party/rust/phf/Cargo.lock b/third_party/rust/phf/Cargo.lock @@ -0,0 +1,136 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "phf" +version = "0.13.1" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn", + "uncased", + "unicase", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", + "uncased", + "unicase", +] + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "syn" +version = "2.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "uncased" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicase" +version = "2.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" diff --git a/third_party/rust/phf/Cargo.toml b/third_party/rust/phf/Cargo.toml @@ -11,10 +11,16 @@ [package] edition = "2021" -rust-version = "1.60" +rust-version = "1.66" name = "phf" -version = "0.11.2" +version = "0.13.1" authors = ["Steven Fackler <sfackler@gmail.com>"] +build = false +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false description = "Runtime support for perfect hash function data structures" readme = "README.md" categories = [ @@ -33,29 +39,36 @@ all-features = false default-features = true features = ["macros"] +[features] +default = ["std"] +macros = ["phf_macros"] +std = [ + "phf_shared/std", + "serde?/std", +] +uncased = [ + "phf_macros?/uncased", + "phf_shared/uncased", +] +unicase = [ + "phf_macros?/unicase", + "phf_shared/unicase", +] + [lib] name = "phf" path = "src/lib.rs" test = false [dependencies.phf_macros] -version = "^0.11.2" +version = "^0.13.1" optional = true [dependencies.phf_shared] -version = "^0.11.2" +version = "^0.13.1" default-features = false [dependencies.serde] version = "1.0" optional = true - -[features] -default = ["std"] -macros = ["phf_macros"] -std = ["phf_shared/std"] -uncased = ["phf_shared/uncased"] -unicase = [ - "phf_macros?/unicase", - "phf_shared/unicase", -] +default-features = false diff --git a/third_party/rust/phf/README.md b/third_party/rust/phf/README.md @@ -11,7 +11,7 @@ It currently uses the [CHD algorithm](http://cmph.sourceforge.net/papers/esa09.pdf) and can generate a 100,000 entry map in roughly .4 seconds. -MSRV (minimum supported rust version) is Rust 1.60. +MSRV (minimum supported rust version) is Rust 1.66. ## Usage @@ -26,7 +26,7 @@ will not work, set `default-features = false` for the dependency: ```toml [dependencies] # to use `phf` in `no_std` environments -phf = { version = "0.11", default-features = false } +phf = { version = "0.13.1", default-features = false } ``` ### phf_macros @@ -51,22 +51,32 @@ static KEYWORDS: phf::Map<&'static str, Keyword> = phf_map! { "extern" => Keyword::Extern, }; +// You can also use OR (`|`) patterns to map multiple keys to the same value: +static OPERATORS: phf::Map<&'static str, &'static str> = phf_map! { + "+" | "add" | "plus" => "addition", + "-" | "sub" | "minus" => "subtraction", + "*" | "mul" | "times" => "multiplication", +}; + pub fn parse_keyword(keyword: &str) -> Option<Keyword> { KEYWORDS.get(keyword).cloned() } + +pub fn parse_operator(operator: &str) -> Option<&'static str> { + OPERATORS.get(operator).copied() +} ``` ```toml [dependencies] -phf = { version = "0.11", features = ["macros"] } +phf = { version = "0.13.1", features = ["macros"] } ``` #### Note Currently, the macro syntax has some limitations and may not -work as you want. See [#183] or [#196] for example. +work as you want. See [#196] for example. -[#183]: https://github.com/rust-phf/rust-phf/issues/183 [#196]: https://github.com/rust-phf/rust-phf/issues/196 ### phf_codegen @@ -75,8 +85,8 @@ To use `phf_codegen` on build.rs, you have to add dependencies under `[build-dep ```toml [build-dependencies] -phf = { version = "0.11.1", default-features = false } -phf_codegen = "0.11.1" +phf = { version = "0.13.1", default-features = false } +phf_codegen = "0.13.1" ``` Then put code on build.rs: @@ -104,6 +114,22 @@ fn main() { ) .unwrap(); write!(&mut file, ";\n").unwrap(); + + // Example with OR patterns (note: phf_codegen doesn't support OR patterns directly) + write!( + &mut file, + "static OPERATORS: phf::Map<&'static str, &'static str> = {}", + phf_codegen::Map::new() + .entry("+", "\"addition\"") + .entry("add", "\"addition\"") + .entry("plus", "\"addition\"") + .entry("-", "\"subtraction\"") + .entry("sub", "\"subtraction\"") + .entry("minus", "\"subtraction\"") + .build() + ) + .unwrap(); + write!(&mut file, ";\n").unwrap(); } ``` @@ -124,4 +150,8 @@ include!(concat!(env!("OUT_DIR"), "/codegen.rs")); pub fn parse_keyword(keyword: &str) -> Option<Keyword> { KEYWORDS.get(keyword).cloned() } + +pub fn parse_operator(operator: &str) -> Option<&'static str> { + OPERATORS.get(operator).copied() +} ``` diff --git a/third_party/rust/phf/src/lib.rs b/third_party/rust/phf/src/lib.rs @@ -5,7 +5,7 @@ //! [CHD algorithm](http://cmph.sourceforge.net/papers/esa09.pdf) and can generate //! a 100,000 entry map in roughly .4 seconds. //! -//! MSRV (minimum supported rust version) is Rust 1.60. +//! MSRV (minimum supported rust version) is Rust 1.66. //! //! ## Usage //! @@ -16,7 +16,7 @@ //! //!```toml //! [dependencies] -//! phf = { version = "0.11", features = ["macros"] } +//! phf = { version = "0.13.1", features = ["macros"] } //! ``` //! //! To compile the `phf` crate with a dependency on @@ -26,7 +26,7 @@ //! ```toml //! [dependencies] //! # to use `phf` in `no_std` environments -//! phf = { version = "0.11", default-features = false } +//! phf = { version = "0.13.1", default-features = false } //! ``` //! //! ## Example (with the `macros` feature enabled) @@ -69,7 +69,7 @@ //! [#183]: https://github.com/rust-phf/rust-phf/issues/183 //! [#196]: https://github.com/rust-phf/rust-phf/issues/196 -#![doc(html_root_url = "https://docs.rs/phf/0.11")] +#![doc(html_root_url = "https://docs.rs/phf/0.13.1")] #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] @@ -84,8 +84,11 @@ extern crate std as core; /// Supported key expressions are: /// - literals: bools, (byte) strings, bytes, chars, and integers (these must have a type suffix) /// - arrays of `u8` integers +/// - tuples of any supported key expressions /// - dereferenced byte string literals -/// - `UniCase::unicode(string)` or `UniCase::ascii(string)` if the `unicase` feature is enabled +/// - OR patterns using `|` to map multiple keys to the same value +/// - `UniCase::unicode(string)`, `UniCase::ascii(string)`, or `Ascii::new(string)` if the `unicase` feature is enabled +/// - `UncasedStr::new(string)` if the `uncased` feature is enabled /// /// # Example /// @@ -101,6 +104,26 @@ extern crate std as core; /// assert_eq!(MY_MAP["hello"], 1); /// } /// ``` +/// +/// # OR Patterns +/// +/// You can use OR patterns to map multiple keys to the same value: +/// +/// ``` +/// use phf::{phf_map, Map}; +/// +/// static OPERATORS: Map<&'static str, &'static str> = phf_map! { +/// "+" | "add" | "plus" => "addition", +/// "-" | "sub" | "minus" => "subtraction", +/// "*" | "mul" | "times" => "multiplication", +/// }; +/// +/// fn main() { +/// assert_eq!(OPERATORS["+"], "addition"); +/// assert_eq!(OPERATORS["add"], "addition"); +/// assert_eq!(OPERATORS["plus"], "addition"); +/// } +/// ``` pub use phf_macros::phf_map; #[cfg(feature = "macros")] @@ -128,6 +151,27 @@ pub use phf_macros::phf_ordered_map; /// assert!(MY_SET.contains("hello world")); /// } /// ``` +/// +/// # OR Patterns +/// +/// You can use OR patterns to include multiple keys in a single entry: +/// +/// ``` +/// use phf::{phf_set, Set}; +/// +/// static KEYWORDS: Set<&'static str> = phf_set! { +/// "if" | "elif" | "else", +/// "for" | "while" | "loop", +/// "fn" | "function" | "def", +/// }; +/// +/// fn main() { +/// assert!(KEYWORDS.contains("if")); +/// assert!(KEYWORDS.contains("elif")); +/// assert!(KEYWORDS.contains("else")); +/// assert!(KEYWORDS.contains("for")); +/// } +/// ``` pub use phf_macros::phf_set; #[cfg(feature = "macros")] diff --git a/third_party/rust/phf/src/map.rs b/third_party/rust/phf/src/map.rs @@ -52,6 +52,23 @@ impl<K, V> Default for Map<K, V> { } } +impl<K, V> PartialEq for Map<K, V> +where + K: PartialEq, + V: PartialEq, +{ + fn eq(&self, other: &Self) -> bool { + self.key == other.key && self.disps == other.disps && self.entries == other.entries + } +} + +impl<K, V> Eq for Map<K, V> +where + K: Eq, + V: Eq, +{ +} + impl<K, V> Map<K, V> { /// Create a new, empty, immutable map. #[inline] @@ -76,18 +93,18 @@ impl<K, V> Map<K, V> { } /// Determines if `key` is in the `Map`. - pub fn contains_key<T: ?Sized>(&self, key: &T) -> bool + pub fn contains_key<T>(&self, key: &T) -> bool where - T: Eq + PhfHash, + T: Eq + PhfHash + ?Sized, K: PhfBorrow<T>, { self.get(key).is_some() } /// Returns a reference to the value that `key` maps to. - pub fn get<T: ?Sized>(&self, key: &T) -> Option<&V> + pub fn get<T>(&self, key: &T) -> Option<&V> where - T: Eq + PhfHash, + T: Eq + PhfHash + ?Sized, K: PhfBorrow<T>, { self.get_entry(key).map(|e| e.1) @@ -97,18 +114,18 @@ impl<K, V> Map<K, V> { /// key. /// /// This can be useful for interning schemes. - pub fn get_key<T: ?Sized>(&self, key: &T) -> Option<&K> + pub fn get_key<T>(&self, key: &T) -> Option<&K> where - T: Eq + PhfHash, + T: Eq + PhfHash + ?Sized, K: PhfBorrow<T>, { self.get_entry(key).map(|e| e.0) } /// Like `get`, but returns both the key and the value. - pub fn get_entry<T: ?Sized>(&self, key: &T) -> Option<(&K, &V)> + pub fn get_entry<T>(&self, key: &T) -> Option<(&K, &V)> where - T: Eq + PhfHash, + T: Eq + PhfHash + ?Sized, K: PhfBorrow<T>, { if self.disps.is_empty() { @@ -190,7 +207,7 @@ impl<'a, K, V> Iterator for Entries<'a, K, V> { type Item = (&'a K, &'a V); fn next(&mut self) -> Option<(&'a K, &'a V)> { - self.iter.next().map(|&(ref k, ref v)| (k, v)) + self.iter.next().map(|(k, v)| (k, v)) } fn size_hint(&self) -> (usize, Option<usize>) { diff --git a/third_party/rust/phf/src/ordered_map.rs b/third_party/rust/phf/src/ordered_map.rs @@ -49,6 +49,26 @@ where } } +impl<K, V> PartialEq for OrderedMap<K, V> +where + K: PartialEq, + V: PartialEq, +{ + fn eq(&self, other: &Self) -> bool { + self.key == other.key + && self.disps == other.disps + && self.idxs == other.idxs + && self.entries == other.entries + } +} + +impl<K, V> Eq for OrderedMap<K, V> +where + K: Eq, + V: Eq, +{ +} + impl<K, V> OrderedMap<K, V> { /// Returns the number of entries in the `OrderedMap`. #[inline] @@ -63,9 +83,9 @@ impl<K, V> OrderedMap<K, V> { } /// Returns a reference to the value that `key` maps to. - pub fn get<T: ?Sized>(&self, key: &T) -> Option<&V> + pub fn get<T>(&self, key: &T) -> Option<&V> where - T: Eq + PhfHash, + T: Eq + PhfHash + ?Sized, K: PhfBorrow<T>, { self.get_entry(key).map(|e| e.1) @@ -75,18 +95,18 @@ impl<K, V> OrderedMap<K, V> { /// key. /// /// This can be useful for interning schemes. - pub fn get_key<T: ?Sized>(&self, key: &T) -> Option<&K> + pub fn get_key<T>(&self, key: &T) -> Option<&K> where - T: Eq + PhfHash, + T: Eq + PhfHash + ?Sized, K: PhfBorrow<T>, { self.get_entry(key).map(|e| e.0) } /// Determines if `key` is in the `OrderedMap`. - pub fn contains_key<T: ?Sized>(&self, key: &T) -> bool + pub fn contains_key<T>(&self, key: &T) -> bool where - T: Eq + PhfHash, + T: Eq + PhfHash + ?Sized, K: PhfBorrow<T>, { self.get(key).is_some() @@ -94,9 +114,9 @@ impl<K, V> OrderedMap<K, V> { /// Returns the index of the key within the list used to initialize /// the ordered map. - pub fn get_index<T: ?Sized>(&self, key: &T) -> Option<usize> + pub fn get_index<T>(&self, key: &T) -> Option<usize> where - T: Eq + PhfHash, + T: Eq + PhfHash + ?Sized, K: PhfBorrow<T>, { self.get_internal(key).map(|(i, _)| i) @@ -105,21 +125,21 @@ impl<K, V> OrderedMap<K, V> { /// Returns references to both the key and values at an index /// within the list used to initialize the ordered map. See `.get_index(key)`. pub fn index(&self, index: usize) -> Option<(&K, &V)> { - self.entries.get(index).map(|&(ref k, ref v)| (k, v)) + self.entries.get(index).map(|(k, v)| (k, v)) } /// Like `get`, but returns both the key and the value. - pub fn get_entry<T: ?Sized>(&self, key: &T) -> Option<(&K, &V)> + pub fn get_entry<T>(&self, key: &T) -> Option<(&K, &V)> where - T: Eq + PhfHash, + T: Eq + PhfHash + ?Sized, K: PhfBorrow<T>, { self.get_internal(key).map(|(_, e)| e) } - fn get_internal<T: ?Sized>(&self, key: &T) -> Option<(usize, (&K, &V))> + fn get_internal<T>(&self, key: &T) -> Option<(usize, (&K, &V))> where - T: Eq + PhfHash, + T: Eq + PhfHash + ?Sized, K: PhfBorrow<T>, { if self.disps.is_empty() { diff --git a/third_party/rust/phf/src/ordered_set.rs b/third_party/rust/phf/src/ordered_set.rs @@ -29,6 +29,17 @@ where } } +impl<T> PartialEq for OrderedSet<T> +where + T: PartialEq, +{ + fn eq(&self, other: &Self) -> bool { + self.map == other.map + } +} + +impl<T> Eq for OrderedSet<T> where T: Eq {} + impl<T> OrderedSet<T> { /// Returns the number of elements in the `OrderedSet`. #[inline] @@ -46,9 +57,9 @@ impl<T> OrderedSet<T> { /// key. /// /// This can be useful for interning schemes. - pub fn get_key<U: ?Sized>(&self, key: &U) -> Option<&T> + pub fn get_key<U>(&self, key: &U) -> Option<&T> where - U: Eq + PhfHash, + U: Eq + PhfHash + ?Sized, T: PhfBorrow<U>, { self.map.get_key(key) @@ -56,9 +67,9 @@ impl<T> OrderedSet<T> { /// Returns the index of the key within the list used to initialize /// the ordered set. - pub fn get_index<U: ?Sized>(&self, key: &U) -> Option<usize> + pub fn get_index<U>(&self, key: &U) -> Option<usize> where - U: Eq + PhfHash, + U: Eq + PhfHash + ?Sized, T: PhfBorrow<U>, { self.map.get_index(key) @@ -71,9 +82,9 @@ impl<T> OrderedSet<T> { } /// Returns true if `value` is in the `OrderedSet`. - pub fn contains<U: ?Sized>(&self, value: &U) -> bool + pub fn contains<U>(&self, value: &U) -> bool where - U: Eq + PhfHash, + U: Eq + PhfHash + ?Sized, T: PhfBorrow<U>, { self.map.contains_key(value) diff --git a/third_party/rust/phf/src/set.rs b/third_party/rust/phf/src/set.rs @@ -28,6 +28,17 @@ where } } +impl<T> PartialEq for Set<T> +where + T: PartialEq, +{ + fn eq(&self, other: &Self) -> bool { + self.map == other.map + } +} + +impl<T> Eq for Set<T> where T: Eq {} + impl<T> Set<T> { /// Returns the number of elements in the `Set`. #[inline] @@ -45,18 +56,18 @@ impl<T> Set<T> { /// key. /// /// This can be useful for interning schemes. - pub fn get_key<U: ?Sized>(&self, key: &U) -> Option<&T> + pub fn get_key<U>(&self, key: &U) -> Option<&T> where - U: Eq + PhfHash, + U: Eq + PhfHash + ?Sized, T: PhfBorrow<U>, { self.map.get_key(key) } /// Returns true if `value` is in the `Set`. - pub fn contains<U: ?Sized>(&self, value: &U) -> bool + pub fn contains<U>(&self, value: &U) -> bool where - U: Eq + PhfHash, + U: Eq + PhfHash + ?Sized, T: PhfBorrow<U>, { self.map.contains_key(value) diff --git a/third_party/rust/phf_codegen/.cargo-checksum.json b/third_party/rust/phf_codegen/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"5d36f47029fce4eefe7a274bc4aa80de163ed9335746394e89106731b187e019","Cargo.toml":"bd4600efa839936a8173610bd446392b73dfc7a0056f764db8f3e6cee83ab3ed","LICENSE":"0ab4d106b6faac07fb6a051815fd1b4d862d730895e2d7d7358c2f13565e7a38","README.md":"cc039ae7021814495ef56d3680fa78f3d0d671c86223b35cfb6d50021c40b64e","src/lib.rs":"18fc8047ee8e989520e83f5162721413c6e708bc75473b514bbd1159137fcba2"},"package":"e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a"} -\ No newline at end of file +{"files":{"CHANGELOG.md":"bde93bc18467cc82ac51001f1f2c9aa454eca4d45acb30ca06d246d964384497","Cargo.lock":"4a8cad83907292851c9ca1faadf80b6096f91ba15a62839b297988cd83a67d8e","Cargo.toml":"e60b819dc0d390ddaaeaa0646b495e4aab3f4cf68b7bd158f928f18892eba2e7","LICENSE":"0ab4d106b6faac07fb6a051815fd1b4d862d730895e2d7d7358c2f13565e7a38","README.md":"a24f96850f0dc794dc8a18f9b8af1d2cec6b6eeca6ec9dced4b53847cb60d85a","src/lib.rs":"4dbb09bc68e364b5325608d3101e25b088b4716a2fcde92ac1420be4a658be15"},"package":"49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1"} +\ No newline at end of file diff --git a/third_party/rust/phf_codegen/CHANGELOG.md b/third_party/rust/phf_codegen/CHANGELOG.md @@ -5,14 +5,77 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 0.12.0 (2025-06-19) + +<csr-id-08e74647f00f7d77cbb81e0cb73ed663798d000f/> + +### Chore + + - <csr-id-08e74647f00f7d77cbb81e0cb73ed663798d000f/> Update version number in docs + +### Chore + + - <csr-id-51d6baaa6ffce658fb9b56a96affaf0ddd0603e5/> Update changelog + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 8 commits contributed to the release over the course of 138 calendar days. + - 163 days passed between releases. + - 2 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Update changelog ([`51d6baa`](https://github.com/rust-phf/rust-phf/commit/51d6baaa6ffce658fb9b56a96affaf0ddd0603e5)) + - Update version number in docs ([`08e7464`](https://github.com/rust-phf/rust-phf/commit/08e74647f00f7d77cbb81e0cb73ed663798d000f)) + - Merge pull request #289 from thaliaarchi/master ([`a6df856`](https://github.com/rust-phf/rust-phf/commit/a6df856ade4cfbf2666fcabbd70c666ea8234abf)) + - Add support for unicase::Ascii type ([`2806801`](https://github.com/rust-phf/rust-phf/commit/28068018dec5aab9b6ddc0da918431285db8cd34)) + - Merge pull request #311 from GnomedDev/no-wasteful-allocations ([`03f7c51`](https://github.com/rust-phf/rust-phf/commit/03f7c51d2f9c5a52e4e8e1b48bd3ae7b9c6303a7)) + - Merge pull request #309 from edef1c/uncased-macro ([`37a7794`](https://github.com/rust-phf/rust-phf/commit/37a779400b63b5d0b5d5ab63e2727bbfb9ce494d)) + - Merge branch 'master' into no-wasteful-allocations ([`33b8aff`](https://github.com/rust-phf/rust-phf/commit/33b8affe77cea8bdeccb5c8d6c730c78231fc138)) + - Merge branch 'master' into fastrand ([`576dd47`](https://github.com/rust-phf/rust-phf/commit/576dd47858a2db74eb4ef67a8385039ef17b867d)) +</details> + +## 0.11.3 (2025-01-07) + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 5 commits contributed to the release over the course of 435 calendar days. + - 562 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Adjusting changelogs prior to release of phf_shared v0.11.3, phf_generator v0.11.3, phf_macros v0.11.3, phf v0.11.3, phf_codegen v0.11.3 ([`e111f4b`](https://github.com/rust-phf/rust-phf/commit/e111f4b53a965c188fdcbf03950321107d9b3987)) + - [codegen] Store Cow<'a, str> in Map instead of String ([`7af99f3`](https://github.com/rust-phf/rust-phf/commit/7af99f3819d793bede32802c90fb3b59ed992dfc)) + - Macro support for uncased ([`4359e17`](https://github.com/rust-phf/rust-phf/commit/4359e17371e4b93a45b8600cc56bc27aa95c5bb1)) + - Merge pull request #300 from JohnTitor/msrv-1.61 ([`323366d`](https://github.com/rust-phf/rust-phf/commit/323366d03966ddad2eaa3432df79c9da8339e319)) + - Bump MSRV to 1.61 ([`1795f7b`](https://github.com/rust-phf/rust-phf/commit/1795f7b66b16af0191f221dc957bc8a090c891ad)) +</details> + +## 0.11.2 (2023-06-24) ### Commit Statistics <csr-read-only-do-not-edit/> - - 4 commits contributed to the release over the course of 269 calendar days. - - 320 days passed between releases. + - 6 commits contributed to the release over the course of 268 calendar days. + - 319 days passed between releases. - 0 commits were understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages @@ -23,6 +86,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 <details><summary>view details</summary> * **Uncategorized** + - Release phf_shared v0.11.2, phf_generator v0.11.2, phf_macros v0.11.2, phf v0.11.2, phf_codegen v0.11.2 ([`c9c35fd`](https://github.com/rust-phf/rust-phf/commit/c9c35fd8ba3f1bc228388b0cef6e3814a02a72c0)) + - Update changelogs ([`a1e5072`](https://github.com/rust-phf/rust-phf/commit/a1e5072b8e84b108f06389a1d41ac868426a03f7)) - Merge pull request #274 from ankane/license-files ([`21baa73`](https://github.com/rust-phf/rust-phf/commit/21baa73941a0694ec48f437c0c0a6abfcc2f32d2)) - Include license files in crates ([`1229b2f`](https://github.com/rust-phf/rust-phf/commit/1229b2faa6b97542ab4850a1723b1723dea92814)) - Merge pull request #269 from JohnTitor/clarify-build-deps ([`3bc663e`](https://github.com/rust-phf/rust-phf/commit/3bc663eb82686caeab4f49848d867ce87d313765)) @@ -41,7 +106,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 <csr-read-only-do-not-edit/> - - 163 commits contributed to the release over the course of 2723 calendar days. + - 163 commits contributed to the release. - 1 commit was understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages diff --git a/third_party/rust/phf_codegen/Cargo.lock b/third_party/rust/phf_codegen/Cargo.lock @@ -0,0 +1,42 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "phf_codegen" +version = "0.13.1" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" diff --git a/third_party/rust/phf_codegen/Cargo.toml b/third_party/rust/phf_codegen/Cargo.toml @@ -11,10 +11,16 @@ [package] edition = "2021" -rust-version = "1.60" +rust-version = "1.66" name = "phf_codegen" -version = "0.11.2" +version = "0.13.1" authors = ["Steven Fackler <sfackler@gmail.com>"] +build = false +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false description = "Codegen library for PHF types" readme = "README.md" categories = ["data-structures"] @@ -22,8 +28,12 @@ license = "MIT" repository = "https://github.com/rust-phf/rust-phf" resolver = "1" +[lib] +name = "phf_codegen" +path = "src/lib.rs" + [dependencies.phf_generator] -version = "0.11.0" +version = "0.13.1" [dependencies.phf_shared] -version = "0.11.0" +version = "0.13.1" diff --git a/third_party/rust/phf_codegen/README.md b/third_party/rust/phf_codegen/README.md @@ -11,7 +11,7 @@ It currently uses the [CHD algorithm](http://cmph.sourceforge.net/papers/esa09.pdf) and can generate a 100,000 entry map in roughly .4 seconds. -MSRV (minimum supported rust version) is Rust 1.60. +MSRV (minimum supported rust version) is Rust 1.66. ## Usage @@ -26,7 +26,7 @@ will not work, set `default-features = false` for the dependency: ```toml [dependencies] # to use `phf` in `no_std` environments -phf = { version = "0.11", default-features = false } +phf = { version = "0.13.1", default-features = false } ``` ### phf_macros @@ -51,22 +51,32 @@ static KEYWORDS: phf::Map<&'static str, Keyword> = phf_map! { "extern" => Keyword::Extern, }; +// You can also use OR (`|`) patterns to map multiple keys to the same value: +static OPERATORS: phf::Map<&'static str, &'static str> = phf_map! { + "+" | "add" | "plus" => "addition", + "-" | "sub" | "minus" => "subtraction", + "*" | "mul" | "times" => "multiplication", +}; + pub fn parse_keyword(keyword: &str) -> Option<Keyword> { KEYWORDS.get(keyword).cloned() } + +pub fn parse_operator(operator: &str) -> Option<&'static str> { + OPERATORS.get(operator).copied() +} ``` ```toml [dependencies] -phf = { version = "0.11", features = ["macros"] } +phf = { version = "0.13.1", features = ["macros"] } ``` #### Note Currently, the macro syntax has some limitations and may not -work as you want. See [#183] or [#196] for example. +work as you want. See [#196] for example. -[#183]: https://github.com/rust-phf/rust-phf/issues/183 [#196]: https://github.com/rust-phf/rust-phf/issues/196 ### phf_codegen @@ -75,8 +85,8 @@ To use `phf_codegen` on build.rs, you have to add dependencies under `[build-dep ```toml [build-dependencies] -phf = { version = "0.11.1", default-features = false } -phf_codegen = "0.11.1" +phf = { version = "0.13.1", default-features = false } +phf_codegen = "0.13.1" ``` Then put code on build.rs: @@ -104,6 +114,22 @@ fn main() { ) .unwrap(); write!(&mut file, ";\n").unwrap(); + + // Example with OR patterns (note: phf_codegen doesn't support OR patterns directly) + write!( + &mut file, + "static OPERATORS: phf::Map<&'static str, &'static str> = {}", + phf_codegen::Map::new() + .entry("+", "\"addition\"") + .entry("add", "\"addition\"") + .entry("plus", "\"addition\"") + .entry("-", "\"subtraction\"") + .entry("sub", "\"subtraction\"") + .entry("minus", "\"subtraction\"") + .build() + ) + .unwrap(); + write!(&mut file, ";\n").unwrap(); } ``` @@ -124,4 +150,8 @@ include!(concat!(env!("OUT_DIR"), "/codegen.rs")); pub fn parse_keyword(keyword: &str) -> Option<Keyword> { KEYWORDS.get(keyword).cloned() } + +pub fn parse_operator(operator: &str) -> Option<&'static str> { + OPERATORS.get(operator).copied() +} ``` diff --git a/third_party/rust/phf_codegen/src/lib.rs b/third_party/rust/phf_codegen/src/lib.rs @@ -15,8 +15,8 @@ //! //! ```toml //! [build-dependencies] -//! phf = { version = "0.11.1", default-features = false } -//! phf_codegen = "0.11.1" +//! phf = { version = "0.13.1", default-features = false } +//! phf_codegen = "0.13.1" //! ``` //! //! Then put code on build.rs: @@ -78,22 +78,20 @@ //! use std::io::{BufWriter, Write}; //! use std::path::Path; //! -//! fn main() { -//! let path = Path::new(&env::var("OUT_DIR").unwrap()).join("codegen.rs"); -//! let mut file = BufWriter::new(File::create(&path).unwrap()); +//! let path = Path::new(&env::var("OUT_DIR").unwrap()).join("codegen.rs"); +//! let mut file = BufWriter::new(File::create(&path).unwrap()); //! -//! writeln!( -//! &mut file, -//! "static KEYWORDS: phf::Map<&'static [u8], Keyword> = \n{};\n", -//! phf_codegen::Map::<&[u8]>::new() -//! .entry(b"loop", "Keyword::Loop") -//! .entry(b"continue", "Keyword::Continue") -//! .entry(b"break", "Keyword::Break") -//! .entry(b"fn", "Keyword::Fn") -//! .entry(b"extern", "Keyword::Extern") -//! .build() -//! ).unwrap(); -//! } +//! writeln!( +//! &mut file, +//! "static KEYWORDS: phf::Map<&'static [u8], Keyword> = \n{};\n", +//! phf_codegen::Map::<&[u8]>::new() +//! .entry(b"loop", "Keyword::Loop") +//! .entry(b"continue", "Keyword::Continue") +//! .entry(b"break", "Keyword::Break") +//! .entry(b"fn", "Keyword::Fn") +//! .entry(b"extern", "Keyword::Extern") +//! .build() +//! ).unwrap(); //! ``` //! //! lib.rs: @@ -138,10 +136,11 @@ //! // ... //! ``` -#![doc(html_root_url = "https://docs.rs/phf_codegen/0.11")] +#![doc(html_root_url = "https://docs.rs/phf_codegen/0.13.1")] #![allow(clippy::new_without_default)] use phf_shared::{FmtConst, PhfHash}; +use std::borrow::Cow; use std::collections::HashSet; use std::fmt; use std::hash::Hash; @@ -157,15 +156,15 @@ impl<T: FmtConst> fmt::Display for Delegate<T> { } /// A builder for the `phf::Map` type. -pub struct Map<K> { +pub struct Map<'a, K> { keys: Vec<K>, - values: Vec<String>, - path: String, + values: Vec<Cow<'a, str>>, + path: Cow<'a, str>, } -impl<K: Hash + PhfHash + Eq + FmtConst> Map<K> { +impl<'a, K: Hash + PhfHash + Eq + FmtConst> Map<'a, K> { /// Creates a new `phf::Map` builder. - pub fn new() -> Map<K> { + pub fn new() -> Self { // FIXME rust#27438 // // On Windows/MSVC there are major problems with the handling of dllimport. @@ -179,22 +178,22 @@ impl<K: Hash + PhfHash + Eq + FmtConst> Map<K> { Map { keys: vec![], values: vec![], - path: String::from("::phf"), + path: Cow::Borrowed("::phf"), } } /// Set the path to the `phf` crate from the global namespace - pub fn phf_path(&mut self, path: &str) -> &mut Map<K> { - self.path = path.to_owned(); + pub fn phf_path(&mut self, path: impl Into<Cow<'a, str>>) -> &mut Self { + self.path = path.into(); self } /// Adds an entry to the builder. /// /// `value` will be written exactly as provided in the constructed source. - pub fn entry(&mut self, key: K, value: &str) -> &mut Map<K> { + pub fn entry(&mut self, key: K, value: impl Into<Cow<'a, str>>) -> &mut Self { self.keys.push(key); - self.values.push(value.to_owned()); + self.values.push(value.into()); self } @@ -215,10 +214,10 @@ impl<K: Hash + PhfHash + Eq + FmtConst> Map<K> { let state = phf_generator::generate_hash(&self.keys); DisplayMap { + state, path: &self.path, keys: &self.keys, values: &self.values, - state, } } } @@ -228,7 +227,7 @@ pub struct DisplayMap<'a, K> { path: &'a str, state: HashState, keys: &'a [K], - values: &'a [String], + values: &'a [Cow<'a, str>], } impl<'a, K: FmtConst + 'a> fmt::Display for DisplayMap<'a, K> { @@ -279,25 +278,39 @@ impl<'a, K: FmtConst + 'a> fmt::Display for DisplayMap<'a, K> { } } +impl<'a, K, V> FromIterator<(K, V)> for Map<'a, K> +where + K: Hash + PhfHash + Eq + FmtConst, + V: Into<Cow<'a, str>>, +{ + fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> Self { + let mut map = Map::new(); + for (key, value) in iter { + map.entry(key, value); + } + map + } +} + /// A builder for the `phf::Set` type. -pub struct Set<T> { - map: Map<T>, +pub struct Set<'a, T> { + map: Map<'a, T>, } -impl<T: Hash + PhfHash + Eq + FmtConst> Set<T> { +impl<'a, T: Hash + PhfHash + Eq + FmtConst> Set<'a, T> { /// Constructs a new `phf::Set` builder. - pub fn new() -> Set<T> { + pub fn new() -> Self { Set { map: Map::new() } } /// Set the path to the `phf` crate from the global namespace - pub fn phf_path(&mut self, path: &str) -> &mut Set<T> { + pub fn phf_path(&mut self, path: impl Into<Cow<'a, str>>) -> &mut Self { self.map.phf_path(path); self } /// Adds an entry to the builder. - pub fn entry(&mut self, entry: T) -> &mut Set<T> { + pub fn entry(&mut self, entry: T) -> &mut Self { self.map.entry(entry, "()"); self } @@ -327,34 +340,34 @@ impl<'a, T: FmtConst + 'a> fmt::Display for DisplaySet<'a, T> { } /// A builder for the `phf::OrderedMap` type. -pub struct OrderedMap<K> { +pub struct OrderedMap<'a, K> { keys: Vec<K>, - values: Vec<String>, - path: String, + values: Vec<Cow<'a, str>>, + path: Cow<'a, str>, } -impl<K: Hash + PhfHash + Eq + FmtConst> OrderedMap<K> { +impl<'a, K: Hash + PhfHash + Eq + FmtConst> OrderedMap<'a, K> { /// Constructs a enw `phf::OrderedMap` builder. - pub fn new() -> OrderedMap<K> { + pub fn new() -> Self { OrderedMap { keys: vec![], values: vec![], - path: String::from("::phf"), + path: Cow::Borrowed("::phf"), } } /// Set the path to the `phf` crate from the global namespace - pub fn phf_path(&mut self, path: &str) -> &mut OrderedMap<K> { - self.path = path.to_owned(); + pub fn phf_path(&mut self, path: impl Into<Cow<'a, str>>) -> &mut Self { + self.path = path.into(); self } /// Adds an entry to the builder. /// /// `value` will be written exactly as provided in the constructed source. - pub fn entry(&mut self, key: K, value: &str) -> &mut OrderedMap<K> { + pub fn entry(&mut self, key: K, value: impl Into<Cow<'a, str>>) -> &mut Self { self.keys.push(key); - self.values.push(value.to_owned()); + self.values.push(value.into()); self } @@ -376,8 +389,8 @@ impl<K: Hash + PhfHash + Eq + FmtConst> OrderedMap<K> { let state = phf_generator::generate_hash(&self.keys); DisplayOrderedMap { - path: &self.path, state, + path: &self.path, keys: &self.keys, values: &self.values, } @@ -389,7 +402,7 @@ pub struct DisplayOrderedMap<'a, K> { path: &'a str, state: HashState, keys: &'a [K], - values: &'a [String], + values: &'a [Cow<'a, str>], } impl<'a, K: FmtConst + 'a> fmt::Display for DisplayOrderedMap<'a, K> { @@ -448,26 +461,26 @@ impl<'a, K: FmtConst + 'a> fmt::Display for DisplayOrderedMap<'a, K> { } /// A builder for the `phf::OrderedSet` type. -pub struct OrderedSet<T> { - map: OrderedMap<T>, +pub struct OrderedSet<'a, T> { + map: OrderedMap<'a, T>, } -impl<T: Hash + PhfHash + Eq + FmtConst> OrderedSet<T> { +impl<'a, T: Hash + PhfHash + Eq + FmtConst> OrderedSet<'a, T> { /// Constructs a new `phf::OrderedSet` builder. - pub fn new() -> OrderedSet<T> { + pub fn new() -> Self { OrderedSet { map: OrderedMap::new(), } } /// Set the path to the `phf` crate from the global namespace - pub fn phf_path(&mut self, path: &str) -> &mut OrderedSet<T> { + pub fn phf_path(&mut self, path: impl Into<Cow<'a, str>>) -> &mut Self { self.map.phf_path(path); self } /// Adds an entry to the builder. - pub fn entry(&mut self, entry: T) -> &mut OrderedSet<T> { + pub fn entry(&mut self, entry: T) -> &mut Self { self.map.entry(entry, "()"); self } diff --git a/third_party/rust/phf_generator/.cargo-checksum.json b/third_party/rust/phf_generator/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"d78e6d23c613956f1ba98df524d3fc1538c34e4e87a0d067ac487252c55aa4a9","Cargo.lock":"27fe5fa261b662fbda29a5b352d5f42345092ad3cf4ac2e9ee02f7f8c15866e0","Cargo.toml":"659587b09be6440a832570a81270afe48ac132fa71d1d6ff2006cc877e779984","LICENSE":"0ab4d106b6faac07fb6a051815fd1b4d862d730895e2d7d7358c2f13565e7a38","README.md":"c750896a79b343bdeee6fa2e1c5cebc80408ebf8d6b5c1fd92dba5cb02026ff2","benches/benches.rs":"5d8dc7df14d19d46554908c66832e7075a6ae5f900b491e4f246ed34762ffcc1","src/bin/gen_hash_test.rs":"6837aa742812fb5f23e014a006d54ee9ad92b42b1ee8461e848e53b29e54c24f","src/lib.rs":"49d159510d4aa7341d1d068cc06d3ce576b79377c780fd92e3f778f828adea62"},"package":"48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"} -\ No newline at end of file +{"files":{"CHANGELOG.md":"c96cd8896e8df8ae351942a10e01741f23d103b9ab2553bcb3d35c40d53964ed","Cargo.lock":"3561dcd477fda20cdfb94aef30824ca22d89a0b267f836ef0ae8fc19b351cdeb","Cargo.toml":"cb36f4b88da746daff3dbf428941278844bfb848c9afb8c742a7f534c2cc9441","LICENSE":"0ab4d106b6faac07fb6a051815fd1b4d862d730895e2d7d7358c2f13565e7a38","README.md":"c750896a79b343bdeee6fa2e1c5cebc80408ebf8d6b5c1fd92dba5cb02026ff2","benches/benches.rs":"7559ed47e52a39d898ea66ab4decb319f01a5d6b7f2ef0542d2ffd23d1e60b78","src/bin/gen_hash_test.rs":"48e1137e53965800b325da3cb8621692f3fb72ea2e53aa2f463bab39e904dd11","src/lib.rs":"a7125fb080ba9487766dfb886deb9ee67357c7e704c976a6211d2745711d8148"},"package":"135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"} +\ No newline at end of file diff --git a/third_party/rust/phf_generator/CHANGELOG.md b/third_party/rust/phf_generator/CHANGELOG.md @@ -5,14 +5,77 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 0.12.0 (2025-06-19) + +<csr-id-08e74647f00f7d77cbb81e0cb73ed663798d000f/> + +### Chore + + - <csr-id-08e74647f00f7d77cbb81e0cb73ed663798d000f/> Update version number in docs + +### Chore + + - <csr-id-51d6baaa6ffce658fb9b56a96affaf0ddd0603e5/> Update changelog + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 5 commits contributed to the release over the course of 138 calendar days. + - 163 days passed between releases. + - 2 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Update changelog ([`51d6baa`](https://github.com/rust-phf/rust-phf/commit/51d6baaa6ffce658fb9b56a96affaf0ddd0603e5)) + - Update version number in docs ([`08e7464`](https://github.com/rust-phf/rust-phf/commit/08e74647f00f7d77cbb81e0cb73ed663798d000f)) + - Merge branch 'master' into no-wasteful-allocations ([`33b8aff`](https://github.com/rust-phf/rust-phf/commit/33b8affe77cea8bdeccb5c8d6c730c78231fc138)) + - Merge pull request #312 from goffrie/fastrand ([`24d8867`](https://github.com/rust-phf/rust-phf/commit/24d8867429d2338631b851db29c7057afccac987)) + - Merge branch 'master' into fastrand ([`576dd47`](https://github.com/rust-phf/rust-phf/commit/576dd47858a2db74eb4ef67a8385039ef17b867d)) +</details> + +## 0.11.3 (2025-01-07) + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 8 commits contributed to the release. + - 562 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Adjusting changelogs prior to release of phf_shared v0.11.3, phf_generator v0.11.3, phf_macros v0.11.3, phf v0.11.3, phf_codegen v0.11.3 ([`e111f4b`](https://github.com/rust-phf/rust-phf/commit/e111f4b53a965c188fdcbf03950321107d9b3987)) + - Switch from rand to fastrand ([`13ddcb5`](https://github.com/rust-phf/rust-phf/commit/13ddcb5e1028776da6ce23ae922f31a8749c2452)) + - Merge pull request #300 from JohnTitor/msrv-1.61 ([`323366d`](https://github.com/rust-phf/rust-phf/commit/323366d03966ddad2eaa3432df79c9da8339e319)) + - Bump MSRV to 1.61 ([`1795f7b`](https://github.com/rust-phf/rust-phf/commit/1795f7b66b16af0191f221dc957bc8a090c891ad)) + - Merge pull request #295 from Swatinem/intermediate-vec ([`ac49464`](https://github.com/rust-phf/rust-phf/commit/ac494646b0e05688671e652c87bc9a2e906cb3b0)) + - Merge pull request #294 from Swatinem/generate-with-fn ([`8ecc019`](https://github.com/rust-phf/rust-phf/commit/8ecc019c494207c7cc09bf9e9452a5e1627716b1)) + - Avoid intermediate `Vec` allocations ([`4d67564`](https://github.com/rust-phf/rust-phf/commit/4d67564a7e840a660d9ccd4fe8e9d04a19a95bd1)) + - Allow using an arbitrary hash_fn for generation ([`a714e10`](https://github.com/rust-phf/rust-phf/commit/a714e10eb8438f2b8aedb88a9bed9f632a8c3425)) +</details> + +## 0.11.2 (2023-06-24) ### Commit Statistics <csr-read-only-do-not-edit/> - - 2 commits contributed to the release over the course of 205 calendar days. - - 320 days passed between releases. + - 4 commits contributed to the release. + - 319 days passed between releases. - 0 commits were understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages @@ -23,6 +86,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 <details><summary>view details</summary> * **Uncategorized** + - Release phf_shared v0.11.2, phf_generator v0.11.2, phf_macros v0.11.2, phf v0.11.2, phf_codegen v0.11.2 ([`c9c35fd`](https://github.com/rust-phf/rust-phf/commit/c9c35fd8ba3f1bc228388b0cef6e3814a02a72c0)) + - Update changelogs ([`a1e5072`](https://github.com/rust-phf/rust-phf/commit/a1e5072b8e84b108f06389a1d41ac868426a03f7)) - Merge pull request #274 from ankane/license-files ([`21baa73`](https://github.com/rust-phf/rust-phf/commit/21baa73941a0694ec48f437c0c0a6abfcc2f32d2)) - Include license files in crates ([`1229b2f`](https://github.com/rust-phf/rust-phf/commit/1229b2faa6b97542ab4850a1723b1723dea92814)) </details> @@ -40,7 +105,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 <csr-read-only-do-not-edit/> - - 135 commits contributed to the release over the course of 2723 calendar days. + - 135 commits contributed to the release. - 1 commit was understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages diff --git a/third_party/rust/phf_generator/Cargo.lock b/third_party/rust/phf_generator/Cargo.lock @@ -3,33 +3,37 @@ version = 3 [[package]] -name = "atty" -version = "0.2.14" +name = "aho-corasick" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", + "memchr", ] [[package]] -name = "autocfg" -version = "1.1.0" +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + +[[package]] +name = "anstyle" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" [[package]] -name = "bitflags" -version = "1.3.2" +name = "autocfg" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "cast" @@ -39,42 +43,80 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] [[package]] name = "clap" -version = "2.34.0" +version = "4.5.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318" dependencies = [ - "bitflags", - "textwrap", - "unicode-width", + "clap_builder", ] [[package]] +name = "clap_builder" +version = "4.5.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8" +dependencies = [ + "anstyle", + "clap_lex", +] + +[[package]] +name = "clap_lex" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" + +[[package]] name = "criterion" -version = "0.3.6" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" +checksum = "3bf7af66b0989381bd0be551bd7cc91912a655a58c6918420c9527b1fd8b4679" dependencies = [ - "atty", + "anes", "cast", + "ciborium", "clap", "criterion-plot", - "csv", - "itertools", - "lazy_static", + "itertools 0.13.0", "num-traits", "oorandom", "plotters", "rayon", "regex", "serde", - "serde_cbor", - "serde_derive", "serde_json", "tinytemplate", "walkdir", @@ -82,219 +124,157 @@ dependencies = [ [[package]] name = "criterion-plot" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" dependencies = [ "cast", - "itertools", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" -dependencies = [ - "cfg-if", - "crossbeam-utils", + "itertools 0.10.5", ] [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "csv" -version = "1.2.2" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086" -dependencies = [ - "csv-core", - "itoa", - "ryu", - "serde", -] +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] -name = "csv-core" -version = "0.1.10" +name = "crunchy" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -dependencies = [ - "memchr", -] +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "either" -version = "1.8.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] -name = "half" -version = "1.8.2" +name = "fastrand" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] -name = "hermit-abi" -version = "0.1.19" +name = "half" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" dependencies = [ - "libc", + "cfg-if", + "crunchy", ] [[package]] -name = "hermit-abi" -version = "0.2.6" +name = "itertools" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ - "libc", + "either", ] [[package]] name = "itertools" -version = "0.10.5" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "wasm-bindgen", ] [[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.146" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" - -[[package]] name = "log" -version = "0.4.19" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memoffset" -version = "0.9.0" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi 0.2.6", - "libc", -] - -[[package]] name = "once_cell" -version = "1.18.0" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "oorandom" -version = "11.1.3" +version = "11.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" [[package]] name = "phf_generator" -version = "0.11.2" +version = "0.13.1" dependencies = [ "criterion", + "fastrand", "phf_shared", - "rand", ] [[package]] name = "phf_shared" -version = "0.11.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" dependencies = [ "siphasher", ] [[package]] name = "plotters" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" dependencies = [ "num-traits", "plotters-backend", @@ -305,57 +285,42 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" [[package]] name = "plotters-svg" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" dependencies = [ "plotters-backend", ] [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] [[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" - -[[package]] name = "rayon" -version = "1.7.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" dependencies = [ "either", "rayon-core", @@ -363,36 +328,54 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] name = "regex" -version = "1.8.4" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rustversion" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "same-file" @@ -404,32 +387,19 @@ dependencies = [ ] [[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] name = "serde" -version = "1.0.164" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" - -[[package]] -name = "serde_cbor" -version = "0.11.2" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ - "half", - "serde", + "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", @@ -438,26 +408,27 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.99" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" +checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "siphasher" -version = "0.3.10" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "syn" -version = "2.0.20" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb8d4cebc40aa517dfb69618fa647a346562e67228e2236ae0042ee6ac14775" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -465,15 +436,6 @@ dependencies = [ ] [[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -485,21 +447,15 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" - -[[package]] -name = "unicode-width" -version = "0.1.10" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -507,23 +463,24 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", + "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn", @@ -532,9 +489,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -542,9 +499,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", @@ -555,47 +512,108 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] -name = "winapi" -version = "0.3.9" +name = "winapi-util" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "0978bf7171b3d90bac376700cb56d606feb40f251a475a5d6634613564460b22" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "windows-sys", ] [[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" +name = "windows-link" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" [[package]] -name = "winapi-util" -version = "0.1.5" +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ - "winapi", + "windows-link", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" diff --git a/third_party/rust/phf_generator/Cargo.toml b/third_party/rust/phf_generator/Cargo.toml @@ -11,10 +11,16 @@ [package] edition = "2021" -rust-version = "1.60" +rust-version = "1.66" name = "phf_generator" -version = "0.11.2" +version = "0.13.1" authors = ["Steven Fackler <sfackler@gmail.com>"] +build = false +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false description = "PHF generation logic" readme = "README.md" categories = ["data-structures"] @@ -22,26 +28,26 @@ license = "MIT" repository = "https://github.com/rust-phf/rust-phf" resolver = "1" +[lib] +name = "phf_generator" +path = "src/lib.rs" + [[bin]] name = "gen_hash_test" -required-features = ["criterion"] +path = "src/bin/gen_hash_test.rs" [[bench]] name = "benches" +path = "benches/benches.rs" harness = false -[dependencies.criterion] -version = "0.3.6" -optional = true - -[dependencies.phf_shared] -version = "^0.11.2" +[dependencies.fastrand] +version = "2.1.0" default-features = false -[dependencies.rand] -version = "0.8" -features = ["small_rng"] +[dependencies.phf_shared] +version = "^0.13.1" default-features = false [dev-dependencies.criterion] -version = "0.3.6" +version = "0.6.0" diff --git a/third_party/rust/phf_generator/benches/benches.rs b/third_party/rust/phf_generator/benches/benches.rs @@ -1,17 +1,15 @@ +use std::iter; + use criterion::measurement::Measurement; use criterion::{criterion_group, criterion_main, Bencher, BenchmarkId, Criterion}; -use rand::distributions::Standard; -use rand::rngs::SmallRng; -use rand::{Rng, SeedableRng}; +use fastrand::Rng; use phf_generator::generate_hash; fn gen_vec(len: usize) -> Vec<u64> { - SmallRng::seed_from_u64(0xAAAAAAAAAAAAAAAA) - .sample_iter(Standard) - .take(len) - .collect() + let mut rng = Rng::with_seed(0xAAAAAAAAAAAAAAAA); + iter::repeat_with(|| rng.u64(..)).take(len).collect() } fn bench_hash<M: Measurement>(b: &mut Bencher<M>, len: &usize) { diff --git a/third_party/rust/phf_generator/src/bin/gen_hash_test.rs b/third_party/rust/phf_generator/src/bin/gen_hash_test.rs @@ -1,20 +1,21 @@ -use criterion::*; +use std::hint::black_box; +use std::iter; -use rand::distributions::Alphanumeric; -use rand::rngs::SmallRng; -use rand::{Rng, SeedableRng}; +use fastrand::Rng; use phf_generator::generate_hash; fn gen_vec(len: usize) -> Vec<String> { - let mut rng = SmallRng::seed_from_u64(0xAAAAAAAAAAAAAAAA).sample_iter(Alphanumeric); + let mut rng = Rng::with_seed(0xAAAAAAAAAAAAAAAA); + let mut chars = iter::repeat_with(|| rng.alphanumeric()); (0..len) - .map(move |_| rng.by_ref().take(64).collect::<String>()) + .map(move |_| chars.by_ref().take(64).collect::<String>()) .collect() } fn main() { let data = black_box(gen_vec(1_000_000)); - black_box(generate_hash(&data)); + let data_refs: Vec<&str> = data.iter().map(|s| s.as_str()).collect(); + black_box(generate_hash(&data_refs)); } diff --git a/third_party/rust/phf_generator/src/lib.rs b/third_party/rust/phf_generator/src/lib.rs @@ -2,11 +2,11 @@ //! //! [phf]: https://docs.rs/phf -#![doc(html_root_url = "https://docs.rs/phf_generator/0.11")] -use phf_shared::{HashKey, PhfHash}; -use rand::distributions::Standard; -use rand::rngs::SmallRng; -use rand::{Rng, SeedableRng}; +#![doc(html_root_url = "https://docs.rs/phf_generator/0.13.1")] +use std::iter; + +use fastrand::Rng; +use phf_shared::{HashKey, Hashes, PhfHash}; const DEFAULT_LAMBDA: usize = 5; @@ -19,91 +19,138 @@ pub struct HashState { } pub fn generate_hash<H: PhfHash>(entries: &[H]) -> HashState { - SmallRng::seed_from_u64(FIXED_SEED) - .sample_iter(Standard) - .find_map(|key| try_generate_hash(entries, key)) - .expect("failed to solve PHF") + generate_hash_with_hash_fn(entries, phf_shared::hash) } -fn try_generate_hash<H: PhfHash>(entries: &[H], key: HashKey) -> Option<HashState> { - struct Bucket { - idx: usize, - keys: Vec<usize>, - } +pub fn generate_hash_with_hash_fn<T, F>(entries: &[T], hash_fn: F) -> HashState +where + F: Fn(&T, &HashKey) -> Hashes, +{ + let mut generator = Generator::new(entries.len()); + let mut rng = Rng::with_seed(FIXED_SEED); - let hashes: Vec<_> = entries - .iter() - .map(|entry| phf_shared::hash(entry, &key)) - .collect(); + iter::repeat_with(|| rng.u64(..)) + .find(|key| { + let hashes = entries.iter().map(|entry| hash_fn(entry, key)); + generator.reset(hashes); - let buckets_len = (hashes.len() + DEFAULT_LAMBDA - 1) / DEFAULT_LAMBDA; - let mut buckets = (0..buckets_len) - .map(|i| Bucket { - idx: i, - keys: vec![], + generator.try_generate_hash() }) - .collect::<Vec<_>>(); + .map(|key| HashState { + key, + disps: generator.disps, + map: generator.map.into_iter().map(|i| i.unwrap()).collect(), + }) + .expect("failed to solve PHF") +} + +struct Bucket { + idx: usize, + keys: Vec<usize>, +} + +struct Generator { + hashes: Vec<Hashes>, + buckets: Vec<Bucket>, + disps: Vec<(u32, u32)>, + map: Vec<Option<usize>>, + try_map: Vec<u64>, +} - for (i, hash) in hashes.iter().enumerate() { - buckets[(hash.g % (buckets_len as u32)) as usize] - .keys - .push(i); +impl Generator { + fn new(table_len: usize) -> Self { + let hashes = Vec::with_capacity(table_len); + + let buckets_len = (table_len + DEFAULT_LAMBDA - 1) / DEFAULT_LAMBDA; + let buckets: Vec<_> = (0..buckets_len) + .map(|i| Bucket { + idx: i, + keys: vec![], + }) + .collect(); + let disps = vec![(0u32, 0u32); buckets_len]; + + let map = vec![None; table_len]; + let try_map = vec![0u64; table_len]; + + Self { + hashes, + buckets, + disps, + map, + try_map, + } + } + + fn reset<I>(&mut self, hashes: I) + where + I: Iterator<Item = Hashes>, + { + self.buckets.iter_mut().for_each(|b| b.keys.clear()); + self.buckets.sort_by_key(|b| b.idx); + self.disps.iter_mut().for_each(|d| *d = (0, 0)); + self.map.iter_mut().for_each(|m| *m = None); + self.try_map.iter_mut().for_each(|m| *m = 0); + + self.hashes.clear(); + self.hashes.extend(hashes); } - // Sort descending - buckets.sort_by(|a, b| a.keys.len().cmp(&b.keys.len()).reverse()); - - let table_len = hashes.len(); - let mut map = vec![None; table_len]; - let mut disps = vec![(0u32, 0u32); buckets_len]; - - // store whether an element from the bucket being placed is - // located at a certain position, to allow for efficient overlap - // checks. It works by storing the generation in each cell and - // each new placement-attempt is a new generation, so you can tell - // if this is legitimately full by checking that the generations - // are equal. (A u64 is far too large to overflow in a reasonable - // time for current hardware.) - let mut try_map = vec![0u64; table_len]; - let mut generation = 0u64; - - // the actual values corresponding to the markers above, as - // (index, key) pairs, for adding to the main map once we've - // chosen the right disps. - let mut values_to_add = vec![]; - - 'buckets: for bucket in &buckets { - for d1 in 0..(table_len as u32) { - 'disps: for d2 in 0..(table_len as u32) { - values_to_add.clear(); - generation += 1; - - for &key in &bucket.keys { - let idx = (phf_shared::displace(hashes[key].f1, hashes[key].f2, d1, d2) - % (table_len as u32)) as usize; - if map[idx].is_some() || try_map[idx] == generation { - continue 'disps; + fn try_generate_hash(&mut self) -> bool { + let buckets_len = self.buckets.len() as u32; + for (i, hash) in self.hashes.iter().enumerate() { + self.buckets[(hash.g % buckets_len) as usize].keys.push(i); + } + + // Sort descending + self.buckets + .sort_by(|a, b| a.keys.len().cmp(&b.keys.len()).reverse()); + + let table_len = self.hashes.len(); + + // store whether an element from the bucket being placed is + // located at a certain position, to allow for efficient overlap + // checks. It works by storing the generation in each cell and + // each new placement-attempt is a new generation, so you can tell + // if this is legitimately full by checking that the generations + // are equal. (A u64 is far too large to overflow in a reasonable + // time for current hardware.) + let mut generation = 0u64; + + // the actual values corresponding to the markers above, as + // (index, key) pairs, for adding to the main map once we've + // chosen the right disps. + let mut values_to_add = vec![]; + + 'buckets: for bucket in &self.buckets { + for d1 in 0..(table_len as u32) { + 'disps: for d2 in 0..(table_len as u32) { + values_to_add.clear(); + generation += 1; + + for &key in &bucket.keys { + let idx = + (phf_shared::displace(self.hashes[key].f1, self.hashes[key].f2, d1, d2) + % (table_len as u32)) as usize; + if self.map[idx].is_some() || self.try_map[idx] == generation { + continue 'disps; + } + self.try_map[idx] = generation; + values_to_add.push((idx, key)); } - try_map[idx] = generation; - values_to_add.push((idx, key)); - } - // We've picked a good set of disps - disps[bucket.idx] = (d1, d2); - for &(idx, key) in &values_to_add { - map[idx] = Some(key); + // We've picked a good set of disps + self.disps[bucket.idx] = (d1, d2); + for &(idx, key) in &values_to_add { + self.map[idx] = Some(key); + } + continue 'buckets; } - continue 'buckets; } - } - // Unable to find displacements for a bucket - return None; + // Unable to find displacements for a bucket + return false; + } + true } - - Some(HashState { - key, - disps, - map: map.into_iter().map(|i| i.unwrap()).collect(), - }) } diff --git a/third_party/rust/phf_macros/.cargo-checksum.json b/third_party/rust/phf_macros/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"bb96d324cf3ae2e078c9d7c351d5e4af3711560eb9417cc548661d9d56f3bf70","src/lib.rs":"57bd3f0432599ccc2dc9e1dd7c3b48e13318c1a89777020b7b50b16287b89f43"},"package":"3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"} -\ No newline at end of file +{"files":{"CHANGELOG.md":"31db3c33a42a6b9eb9c4cc5df96c3f4aedee3c0f111ecb913023b3f41abe347c","Cargo.lock":"38591ea4fb2b40540389562867b6342a36c83117b7f6d88c11e6a4bf53f1122e","Cargo.toml":"a197994797a8b6b345f1882f3639f95e3f363d2bf57eb4bb4d610b51079d58d0","LICENSE":"0ab4d106b6faac07fb6a051815fd1b4d862d730895e2d7d7358c2f13565e7a38","README.md":"a24f96850f0dc794dc8a18f9b8af1d2cec6b6eeca6ec9dced4b53847cb60d85a","src/lib.rs":"2d889e3f9deeaf4ac3d231bd415c5443d6e69742eadf3b949f1e7e2485a32e72"},"package":"812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef"} +\ No newline at end of file diff --git a/third_party/rust/phf_macros/CHANGELOG.md b/third_party/rust/phf_macros/CHANGELOG.md @@ -0,0 +1,401 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## 0.12.0 (2025-06-19) + +### Chore + + - <csr-id-51d6baaa6ffce658fb9b56a96affaf0ddd0603e5/> Update changelog + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 6 commits contributed to the release over the course of 138 calendar days. + - 163 days passed between releases. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Update changelog ([`51d6baa`](https://github.com/rust-phf/rust-phf/commit/51d6baaa6ffce658fb9b56a96affaf0ddd0603e5)) + - Merge pull request #289 from thaliaarchi/master ([`a6df856`](https://github.com/rust-phf/rust-phf/commit/a6df856ade4cfbf2666fcabbd70c666ea8234abf)) + - Add support for unicase::Ascii type ([`2806801`](https://github.com/rust-phf/rust-phf/commit/28068018dec5aab9b6ddc0da918431285db8cd34)) + - Merge pull request #309 from edef1c/uncased-macro ([`37a7794`](https://github.com/rust-phf/rust-phf/commit/37a779400b63b5d0b5d5ab63e2727bbfb9ce494d)) + - Merge branch 'master' into no-wasteful-allocations ([`33b8aff`](https://github.com/rust-phf/rust-phf/commit/33b8affe77cea8bdeccb5c8d6c730c78231fc138)) + - Merge branch 'master' into fastrand ([`576dd47`](https://github.com/rust-phf/rust-phf/commit/576dd47858a2db74eb4ef67a8385039ef17b867d)) +</details> + +## 0.11.3 (2025-01-07) + +<csr-id-9ed628fe2ca954fdc49a93331188a99b58c9363a/> +<csr-id-a96a4e29d63fb1ab3cc10e050571e733f5d2d0d1/> +<csr-id-3a86c8a152b587aa572bd17e318b3cf61133040d/> + +### Other + + - <csr-id-9ed628fe2ca954fdc49a93331188a99b58c9363a/> include LICENSE and changelog files in published crates + The restrictive "include" directive is only present in the phf_macros + crate but in none of the others. This commit brings phf_macros crate + in line with other crates in this workspace. + +### Other + + - <csr-id-3a86c8a152b587aa572bd17e318b3cf61133040d/> unwrap groups in call arguments + +### Bug Fixes + + - <csr-id-b54c740086a96da85056b0df28174122bd73d5b0/> Add isize/usize as valid key types + These types already implement PhfHash as of #262, but were not supported + as valid key expressions in `phf_map!` and co. + +### Chore + + - <csr-id-a96a4e29d63fb1ab3cc10e050571e733f5d2d0d1/> bump Cargo.toml version of phf and phf_macros + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 12 commits contributed to the release. + - 562 days passed between releases. + - 4 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Adjusting changelogs prior to release of phf_shared v0.11.3, phf_generator v0.11.3, phf_macros v0.11.3, phf v0.11.3, phf_codegen v0.11.3 ([`e111f4b`](https://github.com/rust-phf/rust-phf/commit/e111f4b53a965c188fdcbf03950321107d9b3987)) + - Merge pull request #322 from JohnTitor/release-0.11.3 ([`dc64dd6`](https://github.com/rust-phf/rust-phf/commit/dc64dd6bace986a8858590455e08659d9ea4ae4b)) + - Reset version num ([`13581f8`](https://github.com/rust-phf/rust-phf/commit/13581f8e9eefe8b8b7cb1b1ad04f2d68d97b0ffd)) + - Merge pull request #315 from LunarLambda/master ([`695a0df`](https://github.com/rust-phf/rust-phf/commit/695a0df769f3c75150a67ed9bb316579b875289d)) + - Bump Cargo.toml version of phf and phf_macros ([`a96a4e2`](https://github.com/rust-phf/rust-phf/commit/a96a4e29d63fb1ab3cc10e050571e733f5d2d0d1)) + - Add isize/usize as valid key types ([`b54c740`](https://github.com/rust-phf/rust-phf/commit/b54c740086a96da85056b0df28174122bd73d5b0)) + - Unwrap groups in call arguments ([`3a86c8a`](https://github.com/rust-phf/rust-phf/commit/3a86c8a152b587aa572bd17e318b3cf61133040d)) + - Macro support for uncased ([`4359e17`](https://github.com/rust-phf/rust-phf/commit/4359e17371e4b93a45b8600cc56bc27aa95c5bb1)) + - Merge pull request #300 from JohnTitor/msrv-1.61 ([`323366d`](https://github.com/rust-phf/rust-phf/commit/323366d03966ddad2eaa3432df79c9da8339e319)) + - Bump MSRV to 1.61 ([`1795f7b`](https://github.com/rust-phf/rust-phf/commit/1795f7b66b16af0191f221dc957bc8a090c891ad)) + - Merge pull request #293 from decathorpe/master ([`e03f456`](https://github.com/rust-phf/rust-phf/commit/e03f4562957afd89d8d95a19d563eda9f0db7e8c)) + - Include LICENSE and changelog files in published crates ([`9ed628f`](https://github.com/rust-phf/rust-phf/commit/9ed628fe2ca954fdc49a93331188a99b58c9363a)) +</details> + +## 0.11.2 (2023-06-24) + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 10 commits contributed to the release. + - 319 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Release phf_shared v0.11.2, phf_generator v0.11.2, phf_macros v0.11.2, phf v0.11.2, phf_codegen v0.11.2 ([`c9c35fd`](https://github.com/rust-phf/rust-phf/commit/c9c35fd8ba3f1bc228388b0cef6e3814a02a72c0)) + - Update changelogs ([`a1e5072`](https://github.com/rust-phf/rust-phf/commit/a1e5072b8e84b108f06389a1d41ac868426a03f7)) + - Merge pull request #280 from jf2048/deref-bytestring ([`3776342`](https://github.com/rust-phf/rust-phf/commit/377634245c8c6f0569a2ed7b75d08366b54c8810)) + - Merge pull request #284 from nickelc/deps/syn2 ([`5ec8936`](https://github.com/rust-phf/rust-phf/commit/5ec8936369ca9eb6392a4aeb878d9bfef88d0d17)) + - Update `syn` to 2.0 ([`8e3e3e5`](https://github.com/rust-phf/rust-phf/commit/8e3e3e554433a2bcb6bf84805b1d03a49780d8c3)) + - Allow using dereferenced bytestring literal keys in phf_map! ([`8c0d057`](https://github.com/rust-phf/rust-phf/commit/8c0d0572da8c0b5e188e7fda4ab8bd4bcb97f720)) + - Merge pull request #274 from ankane/license-files ([`21baa73`](https://github.com/rust-phf/rust-phf/commit/21baa73941a0694ec48f437c0c0a6abfcc2f32d2)) + - Include license files in crates ([`1229b2f`](https://github.com/rust-phf/rust-phf/commit/1229b2faa6b97542ab4850a1723b1723dea92814)) + - Merge pull request #271 from DavidS/bump-dep ([`ea8df2c`](https://github.com/rust-phf/rust-phf/commit/ea8df2caad5b20f927be1f0174dfa4e68e8a95f6)) + - Fix missed dependency bump in phf_macros ([`b7fd8f1`](https://github.com/rust-phf/rust-phf/commit/b7fd8f183f266cf7f0bf0ca8e89b03453f3f35b7)) +</details> + +## 0.11.1 (2022-08-08) + +<csr-id-d40d663ca96f668bcd6f86cc691085629111c0b5/> +<csr-id-8225c4b90d6ee71483304e71342c269fca86a044/> + +### Chore + + - <csr-id-d40d663ca96f668bcd6f86cc691085629111c0b5/> upgrade syn/proc-macro + +### Bug Fixes + + - <csr-id-caf1ce71aed110fb44206ce2291154572ebfe9b7/> remove now-unnecessary `proc-macro-hack` crate usage + Resolves <https://github.com/rust-phf/rust-phf/issues/255>. + + This resolves an issue with Windows Defender identifying `proc-macro-hack` as threats. It also sheds + a depedency that is no longer necessary, now that the MSRV of this crate is 1.46 and + `proc-macro-hack` is only useful for providing support for Rust versions 1.31 through 1.45. Per + [upstream](https://github.com/dtolnay/proc-macro-hack): + + > **Note:** _As of Rust 1.45 this crate is superseded by native support for #\[proc\_macro\] in + > expression position. Only consider using this crate if you care about supporting compilers between + > 1.31 and 1.45._ + +### Other + + - <csr-id-8225c4b90d6ee71483304e71342c269fca86a044/> Update code for changes in Rust + LitBinary is now LitByteStr + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 232 commits contributed to the release. + - 3 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Release phf_shared v0.11.1, phf_generator v0.11.1, phf_macros v0.11.1, phf v0.11.1, phf_codegen v0.11.1 ([`3897b21`](https://github.com/rust-phf/rust-phf/commit/3897b21c6d38e5adcaf9110b4bb33c19f6b41977)) + - Merge pull request #264 from rust-phf/tweak-changelog ([`97f997d`](https://github.com/rust-phf/rust-phf/commit/97f997d2be827ca636a29046c78e2c09c5c62650)) + - Replace handmade changelog with generated one by `cargo-smart-release` ([`cb84cf6`](https://github.com/rust-phf/rust-phf/commit/cb84cf6636ab52823c53e70d6abeac8f648a3482)) + - Merge pull request #260 from JohnTitor/fix-repo-link ([`1407ebe`](https://github.com/rust-phf/rust-phf/commit/1407ebe536b39611db92d765ddec4de0e6c8a16e)) + - Add category to crates ([`32a72c3`](https://github.com/rust-phf/rust-phf/commit/32a72c3859997fd6b590e9ec092ae789d2acdf55)) + - Update repository links on Cargo.toml ([`1af3b0f`](https://github.com/rust-phf/rust-phf/commit/1af3b0fe1f8fdcae7ccc1bc8d51de309fb16a6bf)) + - Merge pull request #258 from JohnTitor/release-0.11.0 ([`c0b9ef9`](https://github.com/rust-phf/rust-phf/commit/c0b9ef98e798f807f94544aeb0fff429ef280efc)) + - Release 0.11.0 ([`d2efdc0`](https://github.com/rust-phf/rust-phf/commit/d2efdc08a7eb1d0d6c414b7b2ac41ce1fe1f9a43)) + - Merge pull request #257 from JohnTitor/edition-2021 ([`36ec885`](https://github.com/rust-phf/rust-phf/commit/36ec8854a9da4f295618e98d94aaf7150df2173e)) + - Make crates edition 2021 ([`b9d25da`](https://github.com/rust-phf/rust-phf/commit/b9d25da58b912d9927fbc41901631cd77836462b)) + - Merge pull request #256 from NZXTCorp/remove-proc-macro-hack ([`a85f070`](https://github.com/rust-phf/rust-phf/commit/a85f070d641317a04b81da053cc4040619652e69)) + - Remove now-unnecessary `proc-macro-hack` crate usage ([`caf1ce7`](https://github.com/rust-phf/rust-phf/commit/caf1ce71aed110fb44206ce2291154572ebfe9b7)) + - Merge pull request #251 from JohnTitor/weak-deps ([`2e1167c`](https://github.com/rust-phf/rust-phf/commit/2e1167c2046cd20aed1a906b4e23b40303cf0c00)) + - Make "unicase + macros" features work ([`11bb242`](https://github.com/rust-phf/rust-phf/commit/11bb2426f0237b1ecea8c8038630b1231ede4871)) + - Merge pull request #241 from JohnTitor/extract-macro-tests ([`7b0a313`](https://github.com/rust-phf/rust-phf/commit/7b0a3130a55176d2570300f92cb7ddca6c23da83)) + - Extract `phf_macros` tests as a separated crate ([`8cf694d`](https://github.com/rust-phf/rust-phf/commit/8cf694d76e0991b4e24ecdc5d2a88bb74713d9cd)) + - Merge pull request #240 from JohnTitor/docs-update ([`da98b9e`](https://github.com/rust-phf/rust-phf/commit/da98b9e80fdb22cd6d48a4a42489840afe603756)) + - Remove some stuff which is now unnecessary ([`6941e82`](https://github.com/rust-phf/rust-phf/commit/6941e825d09a98c1ea29a08ecd5fd605611584a4)) + - Refine doc comments ([`d8cfc43`](https://github.com/rust-phf/rust-phf/commit/d8cfc436059a1c2c3ede1afb0f9ec2333c046fc6)) + - Merge pull request #234 from JohnTitor/fix-ci ([`eba4cc2`](https://github.com/rust-phf/rust-phf/commit/eba4cc28d92c1db95cc430985a0fbc9ca63d1307)) + - Fix CI failure ([`d9b5ff2`](https://github.com/rust-phf/rust-phf/commit/d9b5ff23367d2bbcc385ff8243c7d972f45d459c)) + - Fix `phf` dev dep version ([`3cc6f05`](https://github.com/rust-phf/rust-phf/commit/3cc6f05cb07933af4cf886645d1170bdcb306b6b)) + - Merge pull request #230 from JohnTitor/release-0.10 ([`3ea14b2`](https://github.com/rust-phf/rust-phf/commit/3ea14b2166553ad6e7b9afe7244144f5d661b6c6)) + - Prepare for release 0.10.0 ([`588ac25`](https://github.com/rust-phf/rust-phf/commit/588ac25dd5c0afccea084e6f94867328a6a30454)) + - Fix publish failure ([`fbb18f9`](https://github.com/rust-phf/rust-phf/commit/fbb18f925018fa621ce8a8d334f6746ae0f1d072)) + - Merge pull request #228 from JohnTitor/release-0.9.1 ([`d527f9d`](https://github.com/rust-phf/rust-phf/commit/d527f9d016adafe7d2930e37710291030b432838)) + - Prepare for v0.9.1 ([`9b71978`](https://github.com/rust-phf/rust-phf/commit/9b719789149ef195ef5eba093b7e73255fbef8dc)) + - Merge pull request #224 from bhgomes/const-fns ([`65deaf7`](https://github.com/rust-phf/rust-phf/commit/65deaf745b5175b6b8e645b6c66e53fc55bb3a85)) + - Remove Slice type and fix some docs ([`99d3533`](https://github.com/rust-phf/rust-phf/commit/99d353390f8124a283da9202fd4d163e68bc1949)) + - Merge pull request #223 from JohnTitor/minor-cleanup ([`c746106`](https://github.com/rust-phf/rust-phf/commit/c746106ad05917ad62f244504727b07e07c3e075)) + - Minor cleanups ([`8868d08`](https://github.com/rust-phf/rust-phf/commit/8868d088e2fed36fcd7741e9a1c5bf68bef4f46e)) + - Merge pull request #222 from JohnTitor/precisify-msrv ([`50f8a0d`](https://github.com/rust-phf/rust-phf/commit/50f8a0d3d3f4cc7e15146e29e0559ba057a25a4d)) + - Bless tests ([`dab668c`](https://github.com/rust-phf/rust-phf/commit/dab668ccc8b638548cd78678de8427ed5e765b21)) + - Merge pull request #220 from JohnTitor/fix-release-process ([`29f9100`](https://github.com/rust-phf/rust-phf/commit/29f910079b75623420a19f3bd91a341821e02118)) + - Fix the release failure ([`647f331`](https://github.com/rust-phf/rust-phf/commit/647f331d43dcf2b61625cccffbd31f95ad076d05)) + - Downgrade `phf` dev-dep version for now ([`7dd8a1b`](https://github.com/rust-phf/rust-phf/commit/7dd8a1b410fea96820bfe489f53f1c6fd9d64ba5)) + - Merge pull request #219 from JohnTitor/release-0.9.0 ([`307969f`](https://github.com/rust-phf/rust-phf/commit/307969ff3bb8cae320e648890a9525920035944b)) + - Prepare 0.9.0 release ([`2ca46c4`](https://github.com/rust-phf/rust-phf/commit/2ca46c4f9c9083c128fcc6add33dc5986638940f)) + - Cleanup cargo metadata ([`a9e4b0a`](https://github.com/rust-phf/rust-phf/commit/a9e4b0a1e84825004fa66e938b870f83d3147d0d)) + - Merge pull request #218 from JohnTitor/cleanup ([`76f9072`](https://github.com/rust-phf/rust-phf/commit/76f907239af9b0cca7dac4e6d702cedc72f6f371)) + - Fix test ([`ffa7e41`](https://github.com/rust-phf/rust-phf/commit/ffa7e41a767dd6021a7f42f012dab0befe6d0932)) + - Run rustfmt check on CI ([`1adfb30`](https://github.com/rust-phf/rust-phf/commit/1adfb305704cbced7c63e58b99bd53847298dbe6)) + - Run rustfmt ([`dd86c6c`](https://github.com/rust-phf/rust-phf/commit/dd86c6c103f25021b52144085b8fab0a94582bef)) + - Merge pull request #217 from JohnTitor/rename-feature ([`ff77659`](https://github.com/rust-phf/rust-phf/commit/ff77659a001c08f1f069a17cc5d2ff6fdd51569c)) + - Rename `unicase_support` to `unicase` ([`b47174b`](https://github.com/rust-phf/rust-phf/commit/b47174bb9ebbd68e41316e1aa39c6541a45356a6)) + - Merge pull request #215 from rust-phf/gha ([`12121ec`](https://github.com/rust-phf/rust-phf/commit/12121ec6d16d79d73cf9a2a7cdae1681798351b4)) + - Run UI tests only on stable ([`7522b16`](https://github.com/rust-phf/rust-phf/commit/7522b160e76e981e430f6586dbfa8747c85f2f76)) + - Merge pull request #205 from skyfloogle/ordered-stuff ([`9ae1678`](https://github.com/rust-phf/rust-phf/commit/9ae1678f2507d6d26a1b780385a2e17bdfbb0b5c)) + - Add back ordered_map, ordered_set ([`0ab0108`](https://github.com/rust-phf/rust-phf/commit/0ab01081e4bd8f40bc18ab554c95f217220228d5)) + - Merge pull request #209 from JohnTitor/unicase_support ([`ec43f5c`](https://github.com/rust-phf/rust-phf/commit/ec43f5c912e48d7f56a4126fca8247733baee18f)) + - Improve implementation for unicase support ([`6957e47`](https://github.com/rust-phf/rust-phf/commit/6957e470b6fcd3b389440bf3d2ddcb12e1d38911)) + - Restore unicase_support for phf_macros ([`77e6cce`](https://github.com/rust-phf/rust-phf/commit/77e6cce1931fe8b43e434061a369f3620b3e97e0)) + - Merge pull request #208 from JohnTitor/simplify-workspace ([`a47ac36`](https://github.com/rust-phf/rust-phf/commit/a47ac36b16dd8798659be3e24f74051cd1ed760d)) + - Use `[patch.crates-io]` section instead of path key ([`f47515b`](https://github.com/rust-phf/rust-phf/commit/f47515bce5c433214dbecee262a7a6f14e6a74d4)) + - Merge pull request #206 from Kazurin-775/master ([`7ebc9e7`](https://github.com/rust-phf/rust-phf/commit/7ebc9e7986ca9ae86c6e871b4fd495a401d6b5ca)) + - Fix phf_macros on no_std ([`d7af3dc`](https://github.com/rust-phf/rust-phf/commit/d7af3dc96a67070e2f9000158d074825f0a9d592)) + - Merge pull request #207 from JohnTitor/fix-ci ([`5b42ba6`](https://github.com/rust-phf/rust-phf/commit/5b42ba673ac03299799a69b317dfff90a994b240)) + - Update stderrs ([`0f1407e`](https://github.com/rust-phf/rust-phf/commit/0f1407ec8aa6df74e7ed95dd073685295958d5d5)) + - Merge pull request #201 from benesch/rand-08-redux ([`73a6799`](https://github.com/rust-phf/rust-phf/commit/73a6799f048228039af32c8e21246a63d977c9e3)) + - Update expected test case output for latest nightly ([`e387f69`](https://github.com/rust-phf/rust-phf/commit/e387f69540138026ab679537322c94500876fe8d)) + - Merge pull request #180 from abonander/master ([`81c7cc5`](https://github.com/rust-phf/rust-phf/commit/81c7cc5b48649108428671d3b8ad151f6fbdb359)) + - Release v0.8.0 ([`4060288`](https://github.com/rust-phf/rust-phf/commit/4060288dc2c1ebe3b0630e4016ed51935bb0c863)) + - Merge pull request #181 from mati865/criterion ([`696eee1`](https://github.com/rust-phf/rust-phf/commit/696eee1f38213fe4a404ddfb9ef10d8e61ef0700)) + - Avoid missing main error in tests ([`1992222`](https://github.com/rust-phf/rust-phf/commit/19922229dfe8c25076ab13344a0b876fe2c3bda3)) + - Merge pull request #179 from FauxFaux/bumps ([`5f86fa4`](https://github.com/rust-phf/rust-phf/commit/5f86fa46ebf28eb6ef83d70d58b1212795639ba3)) + - Upgrade syn/proc-macro ([`d40d663`](https://github.com/rust-phf/rust-phf/commit/d40d663ca96f668bcd6f86cc691085629111c0b5)) + - Merge pull request #171 from abonander/170-removals ([`0d00821`](https://github.com/rust-phf/rust-phf/commit/0d0082178568036736bb6d51cb91f95ca5a616c3)) + - Remove ordered_map, ordered_set, phf_builder ([`8ae2bb8`](https://github.com/rust-phf/rust-phf/commit/8ae2bb886841a69a4fc482f439e2374f2373ab15)) + - Merge pull request #166 from abonander/158-trybuild ([`50c6c75`](https://github.com/rust-phf/rust-phf/commit/50c6c75d406b529601f0377afba93e562bbff2aa)) + - Port compile-fail tests to trybuild ([`4a4256c`](https://github.com/rust-phf/rust-phf/commit/4a4256cf1963a349c8d63f4f93c7c562e8963d59)) + - Merge pull request #161 from abonander/display-builders ([`171f7ed`](https://github.com/rust-phf/rust-phf/commit/171f7edccb71766e9381600108a0d996513ec7ea)) + - Create `Display` adapters for `phf_codegen` builders ([`93aa7ae`](https://github.com/rust-phf/rust-phf/commit/93aa7ae1de87345ea19f38e747283bc712384650)) + - Merge pull request #164 from abonander/perf-improvements ([`70129c6`](https://github.com/rust-phf/rust-phf/commit/70129c6fbcdf428ce9f1014eea935301ac70e410)) + - Ignore compiletest ([`f1362b2`](https://github.com/rust-phf/rust-phf/commit/f1362b25674538ed02d41fcc9f7cc1c8ba6ec57c)) + - Merge pull request #160 from abonander/readme-edits ([`6e1f6ac`](https://github.com/rust-phf/rust-phf/commit/6e1f6ac9b1f917089a4501ccb32f4f477799e39c)) + - Proc_macro_hygiene is not needed with proc-macro-hack ([`ab473a4`](https://github.com/rust-phf/rust-phf/commit/ab473a4c7fcc1a8e8a99594c261fe00b4ad96865)) + - Merge pull request #149 from danielhenrymantilla/proc-macro-hack ([`ae649cd`](https://github.com/rust-phf/rust-phf/commit/ae649cd67d9ce1452092ee739971d8ee232505ee)) + - Made macros work in stable ([`4fc0d1a`](https://github.com/rust-phf/rust-phf/commit/4fc0d1a8c3bcc3950082b614d8bfa4a0f63d6962)) + - Merge branch 'master' into patch-1 ([`cd0d7ce`](https://github.com/rust-phf/rust-phf/commit/cd0d7ce1194252dcaca3153988ba2a4effa66b4f)) + - Merge pull request #155 from abonander/128-bit-ints ([`6749552`](https://github.com/rust-phf/rust-phf/commit/674955292a7028752f2eb25e34c27e881f6b11a1)) + - Implement support for 128-bit ints and fix high magnitude vals ([`5be5919`](https://github.com/rust-phf/rust-phf/commit/5be59199389c0703fff62f640eb1a0d19243fc48)) + - Merge pull request #146 from Benjamin-L/master ([`d41f27d`](https://github.com/rust-phf/rust-phf/commit/d41f27d3e2bcbb4a2868a62b0e022b4bdb267d8b)) + - Fixed typo in benchmark ([`f46b2e1`](https://github.com/rust-phf/rust-phf/commit/f46b2e19622de2f845ea5eb8e8d4f54ece364242)) + - Fix tests ([`ae4ef3e`](https://github.com/rust-phf/rust-phf/commit/ae4ef3ea68d6baca0916b5ef2a15245ad78674ae)) + - Release v0.7.24 ([`1287414`](https://github.com/rust-phf/rust-phf/commit/1287414b1302d2d717c5f4be81accf4c12ccad48)) + - Reexport macros through phf crate ([`588fd1a`](https://github.com/rust-phf/rust-phf/commit/588fd1a785492afa5ad76db0556097e32e24387d)) + - Convert phf_macros to new-style proc-macros ([`5ae4131`](https://github.com/rust-phf/rust-phf/commit/5ae413129c391223782bc2944ec0ffbded103791)) + - Release v0.7.23 ([`a050b6f`](https://github.com/rust-phf/rust-phf/commit/a050b6f2a6b825bf0824339266ab9545340420d4)) + - Update to nightly-2018-08-23 ([`e03f536`](https://github.com/rust-phf/rust-phf/commit/e03f536f32a8a2a31d07e43b19e05c7d4fd1cb82)) + - Release 0.7.22 ([`ab88405`](https://github.com/rust-phf/rust-phf/commit/ab884054fa17eef915db2bdb5259c7aa71fbfea6)) + - Fix build ([`2071d25`](https://github.com/rust-phf/rust-phf/commit/2071d2515ff37590c45ee2e88cead583cdb81089)) + - Update to latest nightly ([`fcf758f`](https://github.com/rust-phf/rust-phf/commit/fcf758faa21c6c2c93dbab9fe6ac82a36bab0dd9)) + - Upgrade rand ([`e7b5a35`](https://github.com/rust-phf/rust-phf/commit/e7b5a35d14f6927a748f3c55a1c87b5b751ececd)) + - Release v0.7.21 ([`6c7e2d9`](https://github.com/rust-phf/rust-phf/commit/6c7e2d9ce17ff1b87507925bdbe87e6e682ed3e4)) + - Merge pull request #101 from SimonSapin/rustup ([`8889199`](https://github.com/rust-phf/rust-phf/commit/888919958cd0b8bb1ca81b3e4d59fdb6716d30f1)) + - Upgrade to rustc 1.16.0-nightly (c07a6ae77 2017-01-17) ([`dc756bf`](https://github.com/rust-phf/rust-phf/commit/dc756bfb1400715eeedd0dfaa394296274f59be4)) + - Don't ICE on bad syntax ([`e87e95f`](https://github.com/rust-phf/rust-phf/commit/e87e95fb96cfad1cc6699b828fb8994d2429f424)) + - Link to docs.rs ([`61142c5`](https://github.com/rust-phf/rust-phf/commit/61142c5aa168cff1bf53a6961ddc12012b49e1bb)) + - Cleanup ([`9278c47`](https://github.com/rust-phf/rust-phf/commit/9278c470b33571de286314cae555c4de9dd7d177)) + - Fix tests ([`5947cd1`](https://github.com/rust-phf/rust-phf/commit/5947cd14b9aac452f4f8feb25b57fd11240970ee)) + - Remove time dependency ([`98f56e5`](https://github.com/rust-phf/rust-phf/commit/98f56e53c212795e048c7baa0f488e1b294e9c37)) + - Dependency cleanup ([`f106aa6`](https://github.com/rust-phf/rust-phf/commit/f106aa66d85abfba3d627d12fd46a9b080c83e95)) + - Release v0.7.20 ([`f631f50`](https://github.com/rust-phf/rust-phf/commit/f631f50abfaf6ea3d6fc8caaada47975b6df3a62)) + - Merge pull request #96 from nox/rustup ([`2f509ca`](https://github.com/rust-phf/rust-phf/commit/2f509ca1a5e7910c3bc7aec773418098bc27d3ea)) + - Update to Rust 1.15.0-nightly (7b3eeea22 2016-11-21) ([`39cc485`](https://github.com/rust-phf/rust-phf/commit/39cc485f777daaf2076f1da7337cc5ad7e9f00ad)) + - Merge branch 'release' ([`ea7e256`](https://github.com/rust-phf/rust-phf/commit/ea7e2562706663632a0af65ae9fa94e5cf78c4ea)) + - Merge branch 'release-v0.7.19' into release ([`81a4806`](https://github.com/rust-phf/rust-phf/commit/81a4806b05f14fb49aa972de27a42926a542ec44)) + - Release v0.7.19 ([`0a98dd1`](https://github.com/rust-phf/rust-phf/commit/0a98dd1865d12a3fa4cc27bdb38fa1e7374940d9)) + - Merge pull request #95 from nox/rustup ([`969bcd5`](https://github.com/rust-phf/rust-phf/commit/969bcd57629b97f06f3cf05453e36cd584cd85f7)) + - Update phf_macros to Rust 1.14.0-nightly (7c69b0d5a 2016-11-01) ([`b7d2d4d`](https://github.com/rust-phf/rust-phf/commit/b7d2d4d36cb43a8fa159135250bd2265cb30f523)) + - Merge branch 'release' ([`ecab54b`](https://github.com/rust-phf/rust-phf/commit/ecab54b8a028c88938f220dbb0a684e017bab62f)) + - Merge branch 'release-v0.7.18' into release ([`dfa970b`](https://github.com/rust-phf/rust-phf/commit/dfa970b229cc32cfb2da1692aa94ad8a266e704a)) + - Release v0.7.18 ([`3f71765`](https://github.com/rust-phf/rust-phf/commit/3f717650f4331f5dbb9d7a3f878228fcf1138729)) + - Merge pull request #94 from Bobo1239/master ([`81f2a5d`](https://github.com/rust-phf/rust-phf/commit/81f2a5d7bc9897711a064b343b8a8b6216e252b7)) + - Fix for latest nightly ([`35e991b`](https://github.com/rust-phf/rust-phf/commit/35e991b11efca3bd065a28f661ab76f423a83601)) + - Merge branch 'release' ([`5f08563`](https://github.com/rust-phf/rust-phf/commit/5f0856327731107d9fada1b0318f6f15f32957c2)) + - Merge branch 'release-v0.7.17' into release ([`e073dd2`](https://github.com/rust-phf/rust-phf/commit/e073dd262d1b4c95234222ee5048fc883b9c7301)) + - Release v0.7.17 ([`21ecf72`](https://github.com/rust-phf/rust-phf/commit/21ecf72101715e4754db95a64ecd7de5a37b7f14)) + - Merge pull request #92 from Bobo1239/master ([`d4b788d`](https://github.com/rust-phf/rust-phf/commit/d4b788dbce05fa8e103bd9d0a3022230ae738b81)) + - Fix for latest nightly ([`cb1ec95`](https://github.com/rust-phf/rust-phf/commit/cb1ec955442750fc712d155346beeb9562905602)) + - Merge pull request #91 from Bobo1239/master ([`bf472f2`](https://github.com/rust-phf/rust-phf/commit/bf472f2baed1552530a80c95ba5872a78fd68a5c)) + - Remove dead code ([`df0d8e8`](https://github.com/rust-phf/rust-phf/commit/df0d8e8ae9b23482fb19ca70f1f3bd6cdfe59358)) + - Add compile-fail test for equivalent UniCase keys ([`711515a`](https://github.com/rust-phf/rust-phf/commit/711515ad0ab53c14303b6c659a1fb3c2b3c86df5)) + - Add UniCase support to phf_macros and bump unicase version ([`2af3abb`](https://github.com/rust-phf/rust-phf/commit/2af3abb00cafc85d43755e43767a2a8b274f6670)) + - Merge branch 'release' ([`839f06d`](https://github.com/rust-phf/rust-phf/commit/839f06d5a10c1300353b8f3c972990624695b668)) + - Merge branch 'release-v0.7.16' into release ([`6f5575c`](https://github.com/rust-phf/rust-phf/commit/6f5575c9b12d3619ea17c0825a613fcac12820f4)) + - Release v0.7.16 ([`8bf29c1`](https://github.com/rust-phf/rust-phf/commit/8bf29c10a878c83d73cc40385f0e96cb9cc95afa)) + - Merge pull request #89 from Machtan/master ([`ce387c3`](https://github.com/rust-phf/rust-phf/commit/ce387c3e2fb64ee031e812b93a64064098c5d617)) + - Update the TokenTree import ([`f404629`](https://github.com/rust-phf/rust-phf/commit/f40462989e75ce85de8c88d6faaee934d05fe006)) + - Merge branch 'release' ([`b4ec398`](https://github.com/rust-phf/rust-phf/commit/b4ec398f415e5cac2cd4d794b1889788e644447f)) + - Merge branch 'release-v0.7.15' into release ([`6bbc9e2`](https://github.com/rust-phf/rust-phf/commit/6bbc9e249b9a84e2019432b7d3b178851d2d776e)) + - Release v0.7.15 ([`20f896e`](https://github.com/rust-phf/rust-phf/commit/20f896e6975cabb9cf9883b08eaa5b3da8597f11)) + - Merge branch 'release' ([`7c692d4`](https://github.com/rust-phf/rust-phf/commit/7c692d42970bf6cb2540f6b2d3c88d63b3fd1f7a)) + - Merge branch 'release-v0.7.14' into release ([`ea8dd65`](https://github.com/rust-phf/rust-phf/commit/ea8dd652c292746a20bf3a680e9f925f6f0530b1)) + - Release v0.7.14 ([`fee66fc`](https://github.com/rust-phf/rust-phf/commit/fee66fc20e33f2b119f830a8926f3b6e52abcf09)) + - Introduce a Slice abstraction for buffers ([`0cc3844`](https://github.com/rust-phf/rust-phf/commit/0cc38449c21f29bd9348e28c5719d650e16159cf)) + - Merge branch 'release' ([`d9351e1`](https://github.com/rust-phf/rust-phf/commit/d9351e1488bd42d1a4453e4a465177fb1c781fdc)) + - Merge branch 'release-v0.7.13' into release ([`b582e4e`](https://github.com/rust-phf/rust-phf/commit/b582e4ecec23be992ba915fc7873c0d5598f388a)) + - Release v0.7.13 ([`4769a6d`](https://github.com/rust-phf/rust-phf/commit/4769a6d2ce1d392da06e4b3cb833a1cdccb1f1aa)) + - Merge pull request #80 from nox/rustup ([`6d17c1f`](https://github.com/rust-phf/rust-phf/commit/6d17c1ffe01d82eaeb0d087762c73ed6ab288bbe)) + - Update to Rust 2016-02-22 ([`c995514`](https://github.com/rust-phf/rust-phf/commit/c9955143ffdb07bf85a525494811bd96517bf688)) + - Merge branch 'release' ([`5659a9d`](https://github.com/rust-phf/rust-phf/commit/5659a9db39bc5ee2179b264fce4cba4384d6d025)) + - Merge branch 'release-v0.7.12' into release ([`2f0a5de`](https://github.com/rust-phf/rust-phf/commit/2f0a5de9f01d9d22c774d8d85daec2a047a462e8)) + - Release v0.7.12 ([`9b75ee5`](https://github.com/rust-phf/rust-phf/commit/9b75ee5ed14060c45a5785fba0387be09e698624)) + - Merge pull request #77 from nox/byte-string-key ([`75606bc`](https://github.com/rust-phf/rust-phf/commit/75606bc371b532dddb814588bc65a9a2a5343ddb)) + - Support byte string keys in phf_macros (fixes #76) ([`652beae`](https://github.com/rust-phf/rust-phf/commit/652beae0cac6711ab0931d8dc844cd291559dad7)) + - Merge branch 'release' ([`87ffab8`](https://github.com/rust-phf/rust-phf/commit/87ffab863aaeefb5ac2164da62f0407122d8057e)) + - Merge branch 'release-v0.7.11' into release ([`7260d04`](https://github.com/rust-phf/rust-phf/commit/7260d04413349bacab484afb74f9a496335278e1)) + - Release v0.7.11 ([`a004227`](https://github.com/rust-phf/rust-phf/commit/a0042277b181ec95fcbf29751b9a453f4f962ebb)) + - Merge pull request #74 from djudd/fix-eat-retval ([`4791e96`](https://github.com/rust-phf/rust-phf/commit/4791e9602bc00e67bc9dd22fa55a58d7609d469c)) + - Update for changed return value of parser.eat ([`82da9f0`](https://github.com/rust-phf/rust-phf/commit/82da9f00f404634c09097f9116cda9e8e742d556)) + - Switch timing info back to a hint ([`771e781`](https://github.com/rust-phf/rust-phf/commit/771e781e704e581c1a103f56ed0f6f2a68917883)) + - Merge branch 'release' ([`1579bec`](https://github.com/rust-phf/rust-phf/commit/1579bec1448c7b833f5965fe39d4ef2df66c982c)) + - Merge branch 'release-v0.7.10' into release ([`25cea13`](https://github.com/rust-phf/rust-phf/commit/25cea133fb4eec938bdfa74f04adbc8d94e30d4e)) + - Release v0.7.10 ([`c43154b`](https://github.com/rust-phf/rust-phf/commit/c43154b2661dc09620a7879c16f37b47d6ec03ae)) + - Update for syntax changes ([`3be2db8`](https://github.com/rust-phf/rust-phf/commit/3be2db8d9254214bf1571fafd466ed7d6b96af55)) + - Merge branch 'release' ([`2c67ce5`](https://github.com/rust-phf/rust-phf/commit/2c67ce5a4129cd543178bf015f021a3bb83b6895)) + - Merge branch 'release-v0.7.9' into release ([`87206e1`](https://github.com/rust-phf/rust-phf/commit/87206e1c7b8d4089370dc168402ded0c0700a447)) + - Release v0.7.9 ([`b7d29df`](https://github.com/rust-phf/rust-phf/commit/b7d29dfe0df288b2da74de195f764eace1c8e443)) + - Merge pull request #71 from djudd/rustc-plugin-rename ([`260437e`](https://github.com/rust-phf/rust-phf/commit/260437ee8dc5fcad43654b07ccef101089cadabd)) + - Registry now seems to live in rustc_plugin instead of rustc::plugin ([`ba8d701`](https://github.com/rust-phf/rust-phf/commit/ba8d7019599cb779b9f7ab983f6cc2aa4f422991)) + - Merge branch 'release' ([`cd33902`](https://github.com/rust-phf/rust-phf/commit/cd339023e90ac1ce6971fa81badea65fb1f2b086)) + - Merge branch 'release-v0.7.8' into release ([`8bc23a0`](https://github.com/rust-phf/rust-phf/commit/8bc23a023908a038d668b6f7d8e94ee416995285)) + - Release v0.7.8 ([`aad0b9b`](https://github.com/rust-phf/rust-phf/commit/aad0b9b658fb970e3df60b066961aafca1a17c44)) + - Merge pull request #70 from nrc/rustup ([`2cc2ed3`](https://github.com/rust-phf/rust-phf/commit/2cc2ed36e30dea0ce0411784be87b184c0c68961)) + - Rustup ([`a6c43fa`](https://github.com/rust-phf/rust-phf/commit/a6c43fa25e06684121df6a93b2b90405d8e0fc2e)) + - Merge branch 'release' ([`dccff69`](https://github.com/rust-phf/rust-phf/commit/dccff69384729e3d4972174ce62d8f9db9429485)) + - Merge branch 'release-v0.7.7' into release ([`2d988b7`](https://github.com/rust-phf/rust-phf/commit/2d988b7dfb04d949246adc047f6b195263612246)) + - Release v0.7.7 ([`c9e7a93`](https://github.com/rust-phf/rust-phf/commit/c9e7a93f4d6f85a72651aba6187e4c956d8c1167)) + - Merge pull request #69 from nrc/rustup ([`8185728`](https://github.com/rust-phf/rust-phf/commit/81857284f30ff832f4c8eb7c68a2957f2acdb198)) + - Rustup for phf_macros ([`4c51ffc`](https://github.com/rust-phf/rust-phf/commit/4c51ffc6d63f768dea75cab65ad6cb809bce9bb4)) + - Run through rustfmt ([`58e2223`](https://github.com/rust-phf/rust-phf/commit/58e222380b7fc9609a055cb5a6110ba04e47d677)) + - Merge branch 'release' ([`776046c`](https://github.com/rust-phf/rust-phf/commit/776046c961456dee9e16a6b6574d336c66e259f8)) + - Merge branch 'release-v0.7.6' into release ([`2ea7d5c`](https://github.com/rust-phf/rust-phf/commit/2ea7d5cab5e9e54952ca618b43ec3583a33a4847)) + - Release v0.7.6 ([`5bcd5c9`](https://github.com/rust-phf/rust-phf/commit/5bcd5c95215f5aa29e133cb2912662085a8158f0)) + - Merge branch 'release' ([`1f770df`](https://github.com/rust-phf/rust-phf/commit/1f770df1290b586a8d641ecb0bbd105080afc0ea)) + - Merge branch 'release-v0.7.5' into release ([`bb65b8c`](https://github.com/rust-phf/rust-phf/commit/bb65b8cca30ef9d4518e3083558019a972873efa)) + - Release v0.7.5 ([`fda44f5`](https://github.com/rust-phf/rust-phf/commit/fda44f550401c1bd4aad29bb2c07030b86761028)) + - Merge pull request #65 from dinfuehr/master ([`fc1f6b0`](https://github.com/rust-phf/rust-phf/commit/fc1f6b00c5aeb00b1d1e5d418b5979c7cb8b8afd)) + - Update code for changes in Rust ([`8225c4b`](https://github.com/rust-phf/rust-phf/commit/8225c4b90d6ee71483304e71342c269fca86a044)) + - Macro assemble benchmark map and match to ensure sync ([`a2486ed`](https://github.com/rust-phf/rust-phf/commit/a2486eda19c647d16c9976bb33ba8634388a0569)) + - Merge pull request #63 from erickt/master ([`e879788`](https://github.com/rust-phf/rust-phf/commit/e8797888ff6f1a7a690a44844b692107cbf2c8a9)) + - Add benchmarks ([`9585cc3`](https://github.com/rust-phf/rust-phf/commit/9585cc3c0391725d02f6199eaed500ba5fafcaf3)) + - Merge branch 'release' ([`269b5dc`](https://github.com/rust-phf/rust-phf/commit/269b5dc41ebf82f423393d5219e8107e9c911a03)) + - Merge branch 'release-v0.7.4' into release ([`7c093e8`](https://github.com/rust-phf/rust-phf/commit/7c093e83ffe5192d9cdcd5402b6abb7800ffafb3)) + - Release v0.7.4 ([`c7c0d3c`](https://github.com/rust-phf/rust-phf/commit/c7c0d3c294126157f0275a05b7c3a65c419234a1)) + - Update PhfHash to mirror std::hash::Hash ([`96ef156`](https://github.com/rust-phf/rust-phf/commit/96ef156baae669b233673d6be2b96617ad48551e)) + - Release v0.7.3 ([`77ea239`](https://github.com/rust-phf/rust-phf/commit/77ea23917e908b10c4c5c463671a8409292f8661)) + - Release v0.7.2 ([`642b69d`](https://github.com/rust-phf/rust-phf/commit/642b69d0100a4ee7ec6e430ef1351bd1f28f9a4a)) + - Add an index test ([`f51f449`](https://github.com/rust-phf/rust-phf/commit/f51f449261ddd8ad30bfb5507b166e7980df1aa7)) + - Release v0.7.1 ([`9cb9de9`](https://github.com/rust-phf/rust-phf/commit/9cb9de911ad4e16964f0def29780dde1630c3619)) + - Fix phf-macros ([`6c98e9f`](https://github.com/rust-phf/rust-phf/commit/6c98e9f16a6d9ebf11e0a9c8e9ff91b4b320d2af)) + - Release v0.7.0 ([`555a690`](https://github.com/rust-phf/rust-phf/commit/555a690561673597aee068650ac884bbcc2e31cf)) + - Stabilize phf ([`e215273`](https://github.com/rust-phf/rust-phf/commit/e2152739cbdd471116d88bb4a9cea4cdfede1e42)) + - Release v0.6.19 ([`5810d30`](https://github.com/rust-phf/rust-phf/commit/5810d30ef2162f33cfb4da99c65b7344c7f2913b)) + - Release v0.6.18 ([`36efc72`](https://github.com/rust-phf/rust-phf/commit/36efc721478d097fba1e5458cbdd9f288637abae)) + - Fix for upstream changes ([`eabadcf`](https://github.com/rust-phf/rust-phf/commit/eabadcf7e8af351ba8f07d86746e35adc8c5812e)) + - Release v0.6.17 ([`271ccc2`](https://github.com/rust-phf/rust-phf/commit/271ccc27d885363d4d8c549f75624d08c48e56c5)) + - Release v0.6.15 ([`ede14df`](https://github.com/rust-phf/rust-phf/commit/ede14df1e574674852b09bcafff4ad549ebfd4ae)) + - Remove broken test ([`f54adb7`](https://github.com/rust-phf/rust-phf/commit/f54adb783a71678c9397b4d7c1e02ee82b9646b8)) + - Release v0.6.14 ([`cf64ebb`](https://github.com/rust-phf/rust-phf/commit/cf64ebb8f769c9f12c9a03d05713dde6b8caf371)) + - Release v0.6.13 ([`4fdb533`](https://github.com/rust-phf/rust-phf/commit/4fdb5331fd9978ca3e180a06fb2e34627f50fb77)) + - Fix warnings and use debug builders ([`4d28684`](https://github.com/rust-phf/rust-phf/commit/4d28684b72333e911e23b898b5780947d49822a5)) + - Release v0.6.12 ([`59ca586`](https://github.com/rust-phf/rust-phf/commit/59ca58637206c9806c13cc24cb35cb7d0ce9d23f)) + - Fix phf_macros ([`6567152`](https://github.com/rust-phf/rust-phf/commit/6567152be9e018a99fedf6e54017d827812b8f13)) + - Release v0.6.11 ([`e1e6d3b`](https://github.com/rust-phf/rust-phf/commit/e1e6d3b40a6babddd0989406f2b4e952443ff52e)) + - Release v0.6.10 ([`fc45373`](https://github.com/rust-phf/rust-phf/commit/fc45373b34a461664f532c5108f3d2625172c128)) + - Add doc URLs ([`4605db3`](https://github.com/rust-phf/rust-phf/commit/4605db3e7e0c4bef09ccf6c09c7dbcc36b707a9f)) + - Add documentation for phf_macros ([`8eca797`](https://github.com/rust-phf/rust-phf/commit/8eca79711f33d04ad773a023581b6bd0a6f1efdc)) + - Move generation logic to its own crate ([`cfeee87`](https://github.com/rust-phf/rust-phf/commit/cfeee8714caa4ecb3199df2a2ac149fe6a28ecc0)) + - Move tests to phf_macros ([`40dbc32`](https://github.com/rust-phf/rust-phf/commit/40dbc328456003484716021cc317156967f1b2c1)) + - Release v0.6.9 ([`822f4e3`](https://github.com/rust-phf/rust-phf/commit/822f4e3fb127dc02d36d802803d71aa5b98bed3c)) + - More fixes ([`0c04b9c`](https://github.com/rust-phf/rust-phf/commit/0c04b9cb2679a63394778a7362ef14441b6c2032)) + - Release v0.6.8 ([`cd637ca`](https://github.com/rust-phf/rust-phf/commit/cd637cafb6d37b1901b6c119a7d26f253e9a288e)) + - Release v0.6.7 ([`bfc36c9`](https://github.com/rust-phf/rust-phf/commit/bfc36c979225f652cdb72f3b1f2a25e77b50ab8c)) + - Fix for upstream changes ([`5ff7040`](https://github.com/rust-phf/rust-phf/commit/5ff70403a1b12c30206b128ac619b31c69e42eb4)) + - Merge pull request #47 from globin/fix/rustup ([`5aac93b`](https://github.com/rust-phf/rust-phf/commit/5aac93bad40ccac195e1f66614a29a9240dcaf54)) + - Rustup to current master ([`f6922e2`](https://github.com/rust-phf/rust-phf/commit/f6922e245752b4932f9a3a420c1f8d10e66e0b78)) + - Release v0.6.6 ([`b09a174`](https://github.com/rust-phf/rust-phf/commit/b09a174a166c7744c5989bedc6ba68340f6f7fd1)) + - Release v0.6.5 ([`271e784`](https://github.com/rust-phf/rust-phf/commit/271e7848f35b31d6ce9fc9268de173738464bfc8)) + - Move docs to this repo and auto build them ([`f8ef160`](https://github.com/rust-phf/rust-phf/commit/f8ef160480e2d4ce72fa7afb6ebce70e45acbc76)) + - Release v0.6.4 ([`6866c1b`](https://github.com/rust-phf/rust-phf/commit/6866c1bf5ad5091bc969f1356884aa86c27458cb)) + - Remove unused feature ([`2ee5f78`](https://github.com/rust-phf/rust-phf/commit/2ee5f788d493d929b669550c144ff23aad52721b)) + - Merge pull request #45 from Manishearth/internedstring ([`9b9c009`](https://github.com/rust-phf/rust-phf/commit/9b9c00934e33d920ab287765458d26ab321d8ab4)) + - InternedString.get() removal; brings us to rustc 1.0.0-dev (80627cd3c 2015-02-07 12:01:31 +0000) ([`3150bf0`](https://github.com/rust-phf/rust-phf/commit/3150bf0d608b051f2c8db3826ee21ce593f4f61c)) + - Release v0.6.3 ([`b0c5e3c`](https://github.com/rust-phf/rust-phf/commit/b0c5e3cb69742f81160ea80a3ba1782a0b4e01a2)) + - Use out of tree rand ([`9e1623b`](https://github.com/rust-phf/rust-phf/commit/9e1623bc7d1b8a432cdae47187eab40fa168401f)) + - Release v0.6.2 ([`d9ddf45`](https://github.com/rust-phf/rust-phf/commit/d9ddf45b15ba812b0d3acedffb08e901742e56c4)) + - Release v0.6.1 ([`ca0e9f6`](https://github.com/rust-phf/rust-phf/commit/ca0e9f6b9c737f3d11bcad2f4624bb5603a8170e)) + - Fix for stability changes ([`f7fb510`](https://github.com/rust-phf/rust-phf/commit/f7fb510dfe67f11522a2d214bd14d21f910bfd7b)) + - Release v0.6.0 ([`09d6870`](https://github.com/rust-phf/rust-phf/commit/09d687053caf4d321f72907528573b3334fae3c2)) + - Rename phf_mac to phf_macros ([`c50d107`](https://github.com/rust-phf/rust-phf/commit/c50d1077b1d53fccd703021911a7100b8937bbc7)) +</details> + diff --git a/third_party/rust/phf_macros/Cargo.lock b/third_party/rust/phf_macros/Cargo.lock @@ -0,0 +1,105 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn", + "uncased", + "unicase", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", + "uncased", + "unicase", +] + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "syn" +version = "2.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "uncased" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicase" +version = "2.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" diff --git a/third_party/rust/phf_macros/Cargo.toml b/third_party/rust/phf_macros/Cargo.toml @@ -11,11 +11,16 @@ [package] edition = "2021" -rust-version = "1.60" +rust-version = "1.66" name = "phf_macros" -version = "0.11.2" +version = "0.13.1" authors = ["Steven Fackler <sfackler@gmail.com>"] -include = ["src/lib.rs"] +build = false +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false description = "Macros to generate types in the phf crate" readme = "README.md" categories = ["data-structures"] @@ -23,18 +28,30 @@ license = "MIT" repository = "https://github.com/rust-phf/rust-phf" resolver = "1" +[features] +uncased = [ + "uncased_", + "phf_shared/uncased", +] +unicase = [ + "unicase_", + "phf_shared/unicase", +] + [lib] +name = "phf_macros" +path = "src/lib.rs" proc-macro = true [dependencies.phf_generator] -version = "0.11.1" +version = "0.13.1" [dependencies.phf_shared] -version = "^0.11.2" +version = "^0.13.1" default-features = false [dependencies.proc-macro2] -version = "1" +version = "1.0.95" [dependencies.quote] version = "1" @@ -43,13 +60,12 @@ version = "1" version = "2" features = ["full"] +[dependencies.uncased_] +version = "0.9.7" +optional = true +package = "uncased" + [dependencies.unicase_] version = "2.4.0" optional = true package = "unicase" - -[features] -unicase = [ - "unicase_", - "phf_shared/unicase", -] diff --git a/third_party/rust/phf_macros/LICENSE b/third_party/rust/phf_macros/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014-2022 Steven Fackler, Yuki Okushi + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/third_party/rust/phf_macros/README.md b/third_party/rust/phf_macros/README.md @@ -0,0 +1,157 @@ +# Rust-PHF + +[![CI](https://github.com/rust-phf/rust-phf/actions/workflows/ci.yml/badge.svg)](https://github.com/rust-phf/rust-phf/actions/workflows/ci.yml) [![Latest Version](https://img.shields.io/crates/v/phf.svg)](https://crates.io/crates/phf) + +[Documentation](https://docs.rs/phf) + +Rust-PHF is a library to generate efficient lookup tables at compile time using +[perfect hash functions](http://en.wikipedia.org/wiki/Perfect_hash_function). + +It currently uses the +[CHD algorithm](http://cmph.sourceforge.net/papers/esa09.pdf) and can generate +a 100,000 entry map in roughly .4 seconds. + +MSRV (minimum supported rust version) is Rust 1.66. + +## Usage + +PHF data structures can be constructed via either the procedural +macros in the `phf_macros` crate or code generation supported by the +`phf_codegen` crate. + +To compile the `phf` crate with a dependency on +libcore instead of libstd, enabling use in environments where libstd +will not work, set `default-features = false` for the dependency: + +```toml +[dependencies] +# to use `phf` in `no_std` environments +phf = { version = "0.13.1", default-features = false } +``` + +### phf_macros + +```rust +use phf::phf_map; + +#[derive(Clone)] +pub enum Keyword { + Loop, + Continue, + Break, + Fn, + Extern, +} + +static KEYWORDS: phf::Map<&'static str, Keyword> = phf_map! { + "loop" => Keyword::Loop, + "continue" => Keyword::Continue, + "break" => Keyword::Break, + "fn" => Keyword::Fn, + "extern" => Keyword::Extern, +}; + +// You can also use OR (`|`) patterns to map multiple keys to the same value: +static OPERATORS: phf::Map<&'static str, &'static str> = phf_map! { + "+" | "add" | "plus" => "addition", + "-" | "sub" | "minus" => "subtraction", + "*" | "mul" | "times" => "multiplication", +}; + +pub fn parse_keyword(keyword: &str) -> Option<Keyword> { + KEYWORDS.get(keyword).cloned() +} + +pub fn parse_operator(operator: &str) -> Option<&'static str> { + OPERATORS.get(operator).copied() +} +``` + +```toml +[dependencies] +phf = { version = "0.13.1", features = ["macros"] } +``` + +#### Note + +Currently, the macro syntax has some limitations and may not +work as you want. See [#196] for example. + +[#196]: https://github.com/rust-phf/rust-phf/issues/196 + +### phf_codegen + +To use `phf_codegen` on build.rs, you have to add dependencies under `[build-dependencies]`: + +```toml +[build-dependencies] +phf = { version = "0.13.1", default-features = false } +phf_codegen = "0.13.1" +``` + +Then put code on build.rs: + +```rust +use std::env; +use std::fs::File; +use std::io::{BufWriter, Write}; +use std::path::Path; + +fn main() { + let path = Path::new(&env::var("OUT_DIR").unwrap()).join("codegen.rs"); + let mut file = BufWriter::new(File::create(&path).unwrap()); + + write!( + &mut file, + "static KEYWORDS: phf::Map<&'static str, Keyword> = {}", + phf_codegen::Map::new() + .entry("loop", "Keyword::Loop") + .entry("continue", "Keyword::Continue") + .entry("break", "Keyword::Break") + .entry("fn", "Keyword::Fn") + .entry("extern", "Keyword::Extern") + .build() + ) + .unwrap(); + write!(&mut file, ";\n").unwrap(); + + // Example with OR patterns (note: phf_codegen doesn't support OR patterns directly) + write!( + &mut file, + "static OPERATORS: phf::Map<&'static str, &'static str> = {}", + phf_codegen::Map::new() + .entry("+", "\"addition\"") + .entry("add", "\"addition\"") + .entry("plus", "\"addition\"") + .entry("-", "\"subtraction\"") + .entry("sub", "\"subtraction\"") + .entry("minus", "\"subtraction\"") + .build() + ) + .unwrap(); + write!(&mut file, ";\n").unwrap(); +} +``` + +and lib.rs: + +```rust +#[derive(Clone)] +enum Keyword { + Loop, + Continue, + Break, + Fn, + Extern, +} + +include!(concat!(env!("OUT_DIR"), "/codegen.rs")); + +pub fn parse_keyword(keyword: &str) -> Option<Keyword> { + KEYWORDS.get(keyword).cloned() +} + +pub fn parse_operator(operator: &str) -> Option<&'static str> { + OPERATORS.get(operator).copied() +} +``` diff --git a/third_party/rust/phf_macros/src/lib.rs b/third_party/rust/phf_macros/src/lib.rs @@ -11,9 +11,11 @@ use std::collections::HashSet; use std::hash::Hasher; use syn::parse::{self, Parse, ParseStream}; use syn::punctuated::Punctuated; -use syn::{parse_macro_input, Error, Expr, ExprLit, Lit, Token, UnOp}; +use syn::{parse_macro_input, BinOp, Error, Expr, ExprLit, Lit, Token, UnOp}; +#[cfg(feature = "uncased")] +use uncased_::Uncased; #[cfg(feature = "unicase")] -use unicase_::UniCase; +use unicase_::{Ascii, UniCase}; #[derive(Hash, PartialEq, Eq, Clone)] enum ParsedKey { @@ -25,14 +27,21 @@ enum ParsedKey { I32(i32), I64(i64), I128(i128), + Isize(isize), U8(u8), U16(u16), U32(u32), U64(u64), U128(u128), + Usize(usize), Bool(bool), + Tuple(Vec<ParsedKey>), #[cfg(feature = "unicase")] UniCase(UniCase<String>), + #[cfg(feature = "unicase")] + UniCaseAscii(Ascii<String>), + #[cfg(feature = "uncased")] + Uncased(Uncased<'static>), } impl PhfHash for ParsedKey { @@ -49,14 +58,25 @@ impl PhfHash for ParsedKey { ParsedKey::I32(s) => s.phf_hash(state), ParsedKey::I64(s) => s.phf_hash(state), ParsedKey::I128(s) => s.phf_hash(state), + ParsedKey::Isize(s) => s.phf_hash(state), ParsedKey::U8(s) => s.phf_hash(state), ParsedKey::U16(s) => s.phf_hash(state), ParsedKey::U32(s) => s.phf_hash(state), ParsedKey::U64(s) => s.phf_hash(state), ParsedKey::U128(s) => s.phf_hash(state), + ParsedKey::Usize(s) => s.phf_hash(state), ParsedKey::Bool(s) => s.phf_hash(state), + ParsedKey::Tuple(elements) => { + for element in elements { + element.phf_hash(state); + } + } #[cfg(feature = "unicase")] ParsedKey::UniCase(s) => s.phf_hash(state), + #[cfg(feature = "unicase")] + ParsedKey::UniCaseAscii(s) => s.phf_hash(state), + #[cfg(feature = "uncased")] + ParsedKey::Uncased(s) => s.phf_hash(state), } } } @@ -78,11 +98,21 @@ impl ParsedKey { "i32" => Some(ParsedKey::I32(s.base10_parse::<u32>().unwrap() as i32)), "i64" => Some(ParsedKey::I64(s.base10_parse::<u64>().unwrap() as i64)), "i128" => Some(ParsedKey::I128(s.base10_parse::<u128>().unwrap() as i128)), + "isize" => Some(ParsedKey::Isize(s.base10_parse::<usize>().unwrap() as isize)), "u8" => Some(ParsedKey::U8(s.base10_parse::<u8>().unwrap())), "u16" => Some(ParsedKey::U16(s.base10_parse::<u16>().unwrap())), "u32" => Some(ParsedKey::U32(s.base10_parse::<u32>().unwrap())), "u64" => Some(ParsedKey::U64(s.base10_parse::<u64>().unwrap())), "u128" => Some(ParsedKey::U128(s.base10_parse::<u128>().unwrap())), + "usize" => Some(ParsedKey::Usize(s.base10_parse::<usize>().unwrap())), + // Handle unsuffixed integer literals, default to i32 + "" => { + if let Ok(val) = s.base10_parse::<i32>() { + Some(ParsedKey::I32(val)) + } else { + None + } + } _ => None, }, Lit::Bool(s) => Some(ParsedKey::Bool(s.value)), @@ -105,12 +135,19 @@ impl ParsedKey { Some(ParsedKey::Binary(buf)) } Expr::Unary(unary) => { - // if we received an integer literal (always unsigned) greater than i__::max_value() + // Handle negation for signed integer types + // If we received an integer literal (always unsigned) greater than i__::max_value() // then casting it to a signed integer type of the same width will negate it to // the same absolute value so we don't need to negate it here - macro_rules! try_negate ( - ($val:expr) => {if $val < 0 { $val } else { -$val }} - ); + macro_rules! try_negate { + ($val:expr) => { + if $val < 0 { + $val + } else { + -$val + } + }; + } match unary.op { UnOp::Neg(_) => match ParsedKey::from_expr(&unary.expr)? { @@ -119,6 +156,7 @@ impl ParsedKey { ParsedKey::I32(v) => Some(ParsedKey::I32(try_negate!(v))), ParsedKey::I64(v) => Some(ParsedKey::I64(try_negate!(v))), ParsedKey::I128(v) => Some(ParsedKey::I128(try_negate!(v))), + ParsedKey::Isize(v) => Some(ParsedKey::Isize(try_negate!(v))), _ => None, }, UnOp::Deref(_) => { @@ -137,35 +175,56 @@ impl ParsedKey { _ => None, } } - Expr::Group(group) => ParsedKey::from_expr(&group.expr), - #[cfg(feature = "unicase")] - Expr::Call(call) => { - if let Expr::Path(ep) = call.func.as_ref() { - let segments = &mut ep.path.segments.iter().rev(); - let last = &segments.next()?.ident; - let last_ahead = &segments.next()?.ident; - let is_unicode = last_ahead == "UniCase" && last == "unicode"; - let is_ascii = last_ahead == "UniCase" && last == "ascii"; - if call.args.len() == 1 && (is_unicode || is_ascii) { - if let Some(Expr::Lit(ExprLit { - attrs: _, - lit: Lit::Str(s), - })) = call.args.first() - { - let v = if is_unicode { - UniCase::unicode(s.value()) - } else { - UniCase::ascii(s.value()) - }; - Some(ParsedKey::UniCase(v)) - } else { - None - } + Expr::Tuple(tuple) => { + let mut elements = Vec::new(); + for elem in &tuple.elems { + if let Some(parsed_elem) = ParsedKey::from_expr(elem) { + elements.push(parsed_elem); } else { - None + return None; } + } + Some(ParsedKey::Tuple(elements)) + } + Expr::Group(group) => ParsedKey::from_expr(&group.expr), + Expr::Call(call) if call.args.len() == 1 => { + let last; + let last_ahead; + + if let Expr::Path(ep) = call.func.as_ref() { + let mut segments = ep.path.segments.iter(); + last = segments.next_back()?.ident.to_string(); + last_ahead = segments.next_back()?.ident.to_string(); } else { - None + return None; + } + + let mut arg = call.args.first().unwrap(); + + while let Expr::Group(group) = arg { + arg = &group.expr; + } + + let _value = match arg { + Expr::Lit(ExprLit { + attrs: _, + lit: Lit::Str(s), + }) => s.value(), + _ => { + return None; + } + }; + + match (&*last_ahead, &*last) { + #[cfg(feature = "unicase")] + ("UniCase", "unicode") => Some(ParsedKey::UniCase(UniCase::unicode(_value))), + #[cfg(feature = "unicase")] + ("UniCase", "ascii") => Some(ParsedKey::UniCase(UniCase::ascii(_value))), + #[cfg(feature = "unicase")] + ("Ascii", "new") => Some(ParsedKey::UniCaseAscii(Ascii::new(_value))), + #[cfg(feature = "uncased")] + ("UncasedStr", "new") => Some(ParsedKey::Uncased(Uncased::new(_value))), + _ => None, } } _ => None, @@ -173,9 +232,11 @@ impl ParsedKey { } } +#[derive(Clone)] struct Key { - parsed: ParsedKey, - expr: Expr, + parsed: Vec<ParsedKey>, + expr: Vec<Expr>, + attrs: Vec<syn::Attribute>, } impl PhfHash for Key { @@ -183,23 +244,68 @@ impl PhfHash for Key { where H: Hasher, { - self.parsed.phf_hash(state) + // For OR patterns, we hash the first key (they should all hash to the same value) + if let Some(first) = self.parsed.first() { + first.phf_hash(state); + } } } impl Parse for Key { fn parse(input: ParseStream<'_>) -> parse::Result<Key> { - let expr = input.parse()?; - let parsed = ParsedKey::from_expr(&expr) - .ok_or_else(|| Error::new_spanned(&expr, "unsupported key expression"))?; + let attrs = input.call(syn::Attribute::parse_outer)?; + + // Parse the expression (which might contain OR patterns) + let expr = input.parse::<Expr>()?; + + // Extract all keys from the expression (handling OR patterns) + let (exprs, parsed_keys) = extract_keys_from_expr(&expr)?; + + Ok(Key { + parsed: parsed_keys, + expr: exprs, + attrs, + }) + } +} - Ok(Key { parsed, expr }) +/// Extract all keys from an expression, handling OR patterns +fn extract_keys_from_expr(expr: &Expr) -> parse::Result<(Vec<Expr>, Vec<ParsedKey>)> { + match expr { + Expr::Binary(binary) => { + if let BinOp::BitOr(_) = binary.op { + // Handle OR pattern: left | right + let (left_exprs, left_keys) = extract_keys_from_expr(&binary.left)?; + let (right_exprs, right_keys) = extract_keys_from_expr(&binary.right)?; + + let mut exprs = left_exprs; + exprs.extend(right_exprs); + + let mut keys = left_keys; + keys.extend(right_keys); + + Ok((exprs, keys)) + } else { + // Single key + let parsed = ParsedKey::from_expr(expr) + .ok_or_else(|| Error::new_spanned(expr, "unsupported key expression"))?; + Ok((vec![expr.clone()], vec![parsed])) + } + } + _ => { + // Single key + let parsed = ParsedKey::from_expr(expr) + .ok_or_else(|| Error::new_spanned(expr, "unsupported key expression"))?; + Ok((vec![expr.clone()], vec![parsed])) + } } } +#[derive(Clone)] struct Entry { key: Key, value: Expr, + attrs: Vec<syn::Attribute>, } impl PhfHash for Entry { @@ -213,10 +319,11 @@ impl PhfHash for Entry { impl Parse for Entry { fn parse(input: ParseStream<'_>) -> parse::Result<Entry> { + let attrs = input.call(syn::Attribute::parse_outer)?; let key = input.parse()?; input.parse::<Token![=>]>()?; let value = input.parse()?; - Ok(Entry { key, value }) + Ok(Entry { key, value, attrs }) } } @@ -225,9 +332,41 @@ struct Map(Vec<Entry>); impl Parse for Map { fn parse(input: ParseStream<'_>) -> parse::Result<Map> { let parsed = Punctuated::<Entry, Token![,]>::parse_terminated(input)?; - let map = parsed.into_iter().collect::<Vec<_>>(); - check_duplicates(&map)?; - Ok(Map(map)) + let mut expanded_entries = Vec::new(); + + // Expand OR patterns into multiple entries + for entry in parsed { + for (i, (parsed_key, expr)) in entry + .key + .parsed + .iter() + .zip(entry.key.expr.iter()) + .enumerate() + { + let expanded_key = Key { + parsed: vec![parsed_key.clone()], + expr: vec![expr.clone()], + attrs: if i == 0 { + entry.key.attrs.clone() + } else { + Vec::new() + }, + }; + let expanded_entry = Entry { + key: expanded_key, + value: entry.value.clone(), + attrs: if i == 0 { + entry.attrs.clone() + } else { + Vec::new() + }, + }; + expanded_entries.push(expanded_entry); + } + } + + check_duplicates(&expanded_entries)?; + Ok(Map(expanded_entries)) } } @@ -236,23 +375,47 @@ struct Set(Vec<Entry>); impl Parse for Set { fn parse(input: ParseStream<'_>) -> parse::Result<Set> { let parsed = Punctuated::<Key, Token![,]>::parse_terminated(input)?; - let set = parsed - .into_iter() - .map(|key| Entry { - key, - value: syn::parse_str("()").unwrap(), - }) - .collect::<Vec<_>>(); - check_duplicates(&set)?; - Ok(Set(set)) + let unit_value: Expr = syn::parse_str("()").expect("Failed to parse unit value"); + + let mut expanded_entries = Vec::new(); + + // Expand OR patterns into multiple entries + for key in parsed { + for (i, (parsed_key, expr)) in key.parsed.iter().zip(key.expr.iter()).enumerate() { + let expanded_key = Key { + parsed: vec![parsed_key.clone()], + expr: vec![expr.clone()], + attrs: if i == 0 { + key.attrs.clone() + } else { + Vec::new() + }, + }; + let expanded_entry = Entry { + key: expanded_key, + value: unit_value.clone(), + attrs: if i == 0 { + key.attrs.clone() + } else { + Vec::new() + }, + }; + expanded_entries.push(expanded_entry); + } + } + + check_duplicates(&expanded_entries)?; + Ok(Set(expanded_entries)) } } fn check_duplicates(entries: &[Entry]) -> parse::Result<()> { let mut keys = HashSet::new(); for entry in entries { - if !keys.insert(&entry.key.parsed) { - return Err(Error::new_spanned(&entry.key.expr, "duplicate key")); + if let Some(first) = entry.key.parsed.first() { + if !keys.insert(first) { + return Err(Error::new_spanned(&entry.key.expr[0], "duplicate key")); + } } } Ok(()) @@ -262,8 +425,10 @@ fn build_map(entries: &[Entry], state: HashState) -> proc_macro2::TokenStream { let key = state.key; let disps = state.disps.iter().map(|&(d1, d2)| quote!((#d1, #d2))); let entries = state.map.iter().map(|&idx| { - let key = &entries[idx].key.expr; - let value = &entries[idx].value; + let entry = &entries[idx]; + let key = &entry.key.expr[0]; // Use the first expression + let value = &entry.value; + // Don't include attributes since we've filtered at macro expansion time quote!((#key, #value)) }); @@ -281,8 +446,9 @@ fn build_ordered_map(entries: &[Entry], state: HashState) -> proc_macro2::TokenS let disps = state.disps.iter().map(|&(d1, d2)| quote!((#d1, #d2))); let idxs = state.map.iter().map(|idx| quote!(#idx)); let entries = entries.iter().map(|entry| { - let key = &entry.key.expr; + let key = &entry.key.expr[0]; // Use the first expression let value = &entry.value; + // Don't include attributes since we've filtered at macro expansion time quote!((#key, #value)) }); @@ -299,33 +465,214 @@ fn build_ordered_map(entries: &[Entry], state: HashState) -> proc_macro2::TokenS #[proc_macro] pub fn phf_map(input: TokenStream) -> TokenStream { let map = parse_macro_input!(input as Map); - let state = phf_generator::generate_hash(&map.0); - build_map(&map.0, state).into() + // Check if any entries have cfg attributes + let has_cfg_attrs = map.0.iter().any(|entry| !entry.attrs.is_empty()); + + if !has_cfg_attrs { + // No cfg attributes - use the simple approach + let state = phf_generator::generate_hash(&map.0); + build_map(&map.0, state).into() + } else { + // Has cfg attributes - need to generate conditional map code + build_conditional_phf_map(&map.0).into() + } +} + +/// Generate conditional cfg conditions for a given mask and conditional entries +fn build_cfg_conditions(mask: usize, conditional: &[&Entry]) -> Vec<proc_macro2::TokenStream> { + let mut conditions = Vec::new(); + for (i, &entry) in conditional.iter().enumerate() { + let include = (mask & (1 << i)) != 0; + if let Some(attr) = entry.attrs.first() { + if let Ok(meta) = attr.meta.require_list() { + let tokens = &meta.tokens; + if include { + conditions.push(quote!(cfg!(#tokens))); + } else { + conditions.push(quote!(!cfg!(#tokens))); + } + } + } + } + conditions +} + +/// Combine multiple conditions into a single condition expression +fn combine_conditions(conditions: Vec<proc_macro2::TokenStream>) -> proc_macro2::TokenStream { + if conditions.is_empty() { + quote!(true) + } else if conditions.len() == 1 { + conditions[0].clone() + } else { + quote!(#(#conditions)&&*) + } +} + +/// Generate nested if-else chain from variants +fn build_nested_conditional( + variants: Vec<(proc_macro2::TokenStream, proc_macro2::TokenStream)>, +) -> proc_macro2::TokenStream { + if variants.is_empty() { + return quote!(compile_error!("No valid variants found")); + } + + if variants.len() == 1 { + return variants[0].1.clone(); + } + + let mut result = variants.last().unwrap().1.clone(); + for (condition, tokens) in variants.iter().rev().skip(1) { + result = quote! { + if #condition { + #tokens + } else { + #result + } + }; + } + quote! { { #result } } +} + +/// Generic function to build conditional PHF structures +fn build_conditional_phf<F>( + entries: &[Entry], + simple_builder: F, + empty_structure: proc_macro2::TokenStream, +) -> proc_macro2::TokenStream +where + F: Fn(&[Entry], HashState) -> proc_macro2::TokenStream, +{ + let unconditional: Vec<_> = entries.iter().filter(|e| e.attrs.is_empty()).collect(); + let conditional: Vec<_> = entries.iter().filter(|e| !e.attrs.is_empty()).collect(); + + if conditional.is_empty() { + let state = phf_generator::generate_hash(entries); + return simple_builder(entries, state); + } + + let mut variants = Vec::new(); + let num_conditional = conditional.len(); + + for mask in 0..(1 << num_conditional) { + let mut variant_entries = unconditional.clone(); + + for (i, &entry) in conditional.iter().enumerate() { + if (mask & (1 << i)) != 0 { + variant_entries.push(entry); + } + } + + if variant_entries.is_empty() { + continue; + } + + let entries_vec: Vec<Entry> = variant_entries.into_iter().cloned().collect(); + let state = phf_generator::generate_hash(&entries_vec); + let structure_tokens = simple_builder(&entries_vec, state); + + let conditions = build_cfg_conditions(mask, &conditional); + let condition = combine_conditions(conditions); + + variants.push((condition, structure_tokens)); + } + + if variants.is_empty() { + empty_structure + } else { + build_nested_conditional(variants) + } +} + +fn build_conditional_phf_map(entries: &[Entry]) -> proc_macro2::TokenStream { + build_conditional_phf( + entries, + build_map, + quote! { + phf::Map { + key: 0, + disps: &[], + entries: &[], + } + }, + ) } #[proc_macro] pub fn phf_set(input: TokenStream) -> TokenStream { let set = parse_macro_input!(input as Set); - let state = phf_generator::generate_hash(&set.0); - let map = build_map(&set.0, state); - quote!(phf::Set { map: #map }).into() + // Check if any entries have cfg attributes + let has_cfg_attrs = set.0.iter().any(|entry| !entry.attrs.is_empty()); + + if !has_cfg_attrs { + // No cfg attributes - use the simple approach + let state = phf_generator::generate_hash(&set.0); + let map = build_map(&set.0, state); + quote!(phf::Set { map: #map }).into() + } else { + // Has cfg attributes - need to generate conditional set code + build_conditional_phf_set(&set.0).into() + } +} + +fn build_conditional_phf_set(entries: &[Entry]) -> proc_macro2::TokenStream { + // Similar to conditional map but wraps in Set + let map_tokens = build_conditional_phf_map(entries); + quote!(phf::Set { map: #map_tokens }) } #[proc_macro] pub fn phf_ordered_map(input: TokenStream) -> TokenStream { let map = parse_macro_input!(input as Map); - let state = phf_generator::generate_hash(&map.0); - build_ordered_map(&map.0, state).into() + // Check if any entries have cfg attributes + let has_cfg_attrs = map.0.iter().any(|entry| !entry.attrs.is_empty()); + + if !has_cfg_attrs { + // No cfg attributes - use the simple approach + let state = phf_generator::generate_hash(&map.0); + build_ordered_map(&map.0, state).into() + } else { + // Has cfg attributes - need to generate conditional ordered map code + build_conditional_phf_ordered_map(&map.0).into() + } +} + +fn build_conditional_phf_ordered_map(entries: &[Entry]) -> proc_macro2::TokenStream { + build_conditional_phf( + entries, + build_ordered_map, + quote! { + phf::OrderedMap { + key: 0, + disps: &[], + idxs: &[], + entries: &[], + } + }, + ) } #[proc_macro] pub fn phf_ordered_set(input: TokenStream) -> TokenStream { let set = parse_macro_input!(input as Set); - let state = phf_generator::generate_hash(&set.0); - let map = build_ordered_map(&set.0, state); - quote!(phf::OrderedSet { map: #map }).into() + let has_cfg_attrs = set.0.iter().any(|entry| !entry.attrs.is_empty()); + + if !has_cfg_attrs { + // No cfg attributes - use the simple approach + let state = phf_generator::generate_hash(&set.0); + let map = build_ordered_map(&set.0, state); + quote!(phf::OrderedSet { map: #map }).into() + } else { + // Has cfg attributes - need to generate conditional ordered set code + build_conditional_phf_ordered_set(&set.0).into() + } +} + +fn build_conditional_phf_ordered_set(entries: &[Entry]) -> proc_macro2::TokenStream { + // Similar to conditional ordered map but wraps in OrderedSet + let map_tokens = build_conditional_phf_ordered_map(entries); + quote!(phf::OrderedSet { map: #map_tokens }) } diff --git a/third_party/rust/phf_shared/.cargo-checksum.json b/third_party/rust/phf_shared/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"8a5b66176a7779a8dae0667bf3546d0c0b4ddfdee7d99c1b333d483a602e37f8","Cargo.toml":"396a421175772dcf27a8e6e6fa5a09f762b420f49fc18d14b1ae032c74de3c4f","LICENSE":"0ab4d106b6faac07fb6a051815fd1b4d862d730895e2d7d7358c2f13565e7a38","README.md":"9fe30ff85b7670ed85175c5f572cf499d0ed231f1b60de4189aff394afa8fe9d","src/lib.rs":"b92f3c92cdb10a2f55f75a8b463cfffab061dbc0d50f9374e70d294b9205cabc"},"package":"90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"} -\ No newline at end of file +{"files":{"CHANGELOG.md":"b02f7b92559e6feeeb238365be367eb4ff0ff1b53c3448e13318e4076b1de39d","Cargo.lock":"3d9bcbe7bf559d28bd143f242198e3f668079d6279501fd738c76f4d0105e57f","Cargo.toml":"3d20d918764d9c014251ee6c51c41275b075ef63cbf81ee138ef39ed485e807d","LICENSE":"0ab4d106b6faac07fb6a051815fd1b4d862d730895e2d7d7358c2f13565e7a38","README.md":"9fe30ff85b7670ed85175c5f572cf499d0ed231f1b60de4189aff394afa8fe9d","src/lib.rs":"dda1722c8af7bf2283b90b77f1dbbe8c1ec3cca36ec2f16c984539c1438f7073"},"package":"e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266"} +\ No newline at end of file diff --git a/third_party/rust/phf_shared/CHANGELOG.md b/third_party/rust/phf_shared/CHANGELOG.md @@ -5,14 +5,80 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 0.12.0 (2025-06-19) + +<csr-id-08e74647f00f7d77cbb81e0cb73ed663798d000f/> + +### Chore + + - <csr-id-08e74647f00f7d77cbb81e0cb73ed663798d000f/> Update version number in docs + +### Chore + + - <csr-id-51d6baaa6ffce658fb9b56a96affaf0ddd0603e5/> Update changelog + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 6 commits contributed to the release over the course of 138 calendar days. + - 163 days passed between releases. + - 2 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Update changelog ([`51d6baa`](https://github.com/rust-phf/rust-phf/commit/51d6baaa6ffce658fb9b56a96affaf0ddd0603e5)) + - Update version number in docs ([`08e7464`](https://github.com/rust-phf/rust-phf/commit/08e74647f00f7d77cbb81e0cb73ed663798d000f)) + - Merge pull request #289 from thaliaarchi/master ([`a6df856`](https://github.com/rust-phf/rust-phf/commit/a6df856ade4cfbf2666fcabbd70c666ea8234abf)) + - Add support for unicase::Ascii type ([`2806801`](https://github.com/rust-phf/rust-phf/commit/28068018dec5aab9b6ddc0da918431285db8cd34)) + - Merge branch 'master' into no-wasteful-allocations ([`33b8aff`](https://github.com/rust-phf/rust-phf/commit/33b8affe77cea8bdeccb5c8d6c730c78231fc138)) + - Merge branch 'master' into fastrand ([`576dd47`](https://github.com/rust-phf/rust-phf/commit/576dd47858a2db74eb4ef67a8385039ef17b867d)) +</details> + +## 0.11.3 (2025-01-07) + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 10 commits contributed to the release. + - 562 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Adjusting changelogs prior to release of phf_shared v0.11.3, phf_generator v0.11.3, phf_macros v0.11.3, phf v0.11.3, phf_codegen v0.11.3 ([`e111f4b`](https://github.com/rust-phf/rust-phf/commit/e111f4b53a965c188fdcbf03950321107d9b3987)) + - Merge branch 'master' into master ([`43e9bb6`](https://github.com/rust-phf/rust-phf/commit/43e9bb69aca9ab8ddf8e2041d33d4ec08a6a0ce1)) + - Merge pull request #314 from TGODiamond/master ([`4abd9a0`](https://github.com/rust-phf/rust-phf/commit/4abd9a0a5eaddb1b4c18d678b2924a1cda818f85)) + - Add `PhfBorrow<[u8; N]>` ([`e44fb71`](https://github.com/rust-phf/rust-phf/commit/e44fb714ea4d5fb85bfad1496dd887313cbfa3b5)) + - Merge pull request #304 from serprex/master ([`999e6a2`](https://github.com/rust-phf/rust-phf/commit/999e6a260f03d82aa9d159465113294e7ed019e7)) + - Update siphasher to 1.0 ([`7e0482e`](https://github.com/rust-phf/rust-phf/commit/7e0482e8e80e14d66cd46dde5ee6a16f34630ab3)) + - Merge pull request #300 from JohnTitor/msrv-1.61 ([`323366d`](https://github.com/rust-phf/rust-phf/commit/323366d03966ddad2eaa3432df79c9da8339e319)) + - Bump MSRV to 1.61 ([`1795f7b`](https://github.com/rust-phf/rust-phf/commit/1795f7b66b16af0191f221dc957bc8a090c891ad)) + - Merge pull request #291 from Manishearth/uncased-transmute ([`b7116ff`](https://github.com/rust-phf/rust-phf/commit/b7116ff519415d302c070aa313831cd473b1a911)) + - Bump uncased dep; remove generated transmute ([`c70bb63`](https://github.com/rust-phf/rust-phf/commit/c70bb636dea1c5902ca0cae68df2ec387eb1d2bc)) +</details> + +## 0.11.2 (2023-06-24) ### Commit Statistics <csr-read-only-do-not-edit/> - - 7 commits contributed to the release over the course of 269 calendar days. - - 320 days passed between releases. + - 9 commits contributed to the release over the course of 268 calendar days. + - 319 days passed between releases. - 0 commits were understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages @@ -23,6 +89,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 <details><summary>view details</summary> * **Uncategorized** + - Release phf_shared v0.11.2, phf_generator v0.11.2, phf_macros v0.11.2, phf v0.11.2, phf_codegen v0.11.2 ([`c9c35fd`](https://github.com/rust-phf/rust-phf/commit/c9c35fd8ba3f1bc228388b0cef6e3814a02a72c0)) + - Update changelogs ([`a1e5072`](https://github.com/rust-phf/rust-phf/commit/a1e5072b8e84b108f06389a1d41ac868426a03f7)) - Merge pull request #274 from ankane/license-files ([`21baa73`](https://github.com/rust-phf/rust-phf/commit/21baa73941a0694ec48f437c0c0a6abfcc2f32d2)) - Include license files in crates ([`1229b2f`](https://github.com/rust-phf/rust-phf/commit/1229b2faa6b97542ab4850a1723b1723dea92814)) - Merge pull request #273 from drewkett/impl-phf-hash-for-slices ([`757012b`](https://github.com/rust-phf/rust-phf/commit/757012bba5eb5056a29c30c708e5c37993c2be1d)) @@ -50,7 +118,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 <csr-read-only-do-not-edit/> - - 197 commits contributed to the release over the course of 2946 calendar days. + - 197 commits contributed to the release. - 2 commits were understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages diff --git a/third_party/rust/phf_shared/Cargo.lock b/third_party/rust/phf_shared/Cargo.lock @@ -0,0 +1,39 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "phf_shared" +version = "0.13.1" +dependencies = [ + "siphasher", + "uncased", + "unicase", +] + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "uncased" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicase" +version = "2.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" diff --git a/third_party/rust/phf_shared/Cargo.toml b/third_party/rust/phf_shared/Cargo.toml @@ -11,10 +11,16 @@ [package] edition = "2021" -rust-version = "1.60" +rust-version = "1.66" name = "phf_shared" -version = "0.11.2" +version = "0.13.1" authors = ["Steven Fackler <sfackler@gmail.com>"] +build = false +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false description = "Support code shared by PHF libraries" readme = "README.md" categories = ["data-structures"] @@ -22,23 +28,23 @@ license = "MIT" repository = "https://github.com/rust-phf/rust-phf" resolver = "1" +[features] +default = ["std"] +std = [] + [lib] name = "phf_shared" path = "src/lib.rs" test = false [dependencies.siphasher] -version = "0.3" +version = "1.0" [dependencies.uncased] -version = "0.9.6" +version = "0.9.9" optional = true default-features = false [dependencies.unicase] version = "2.4.0" optional = true - -[features] -default = ["std"] -std = [] diff --git a/third_party/rust/phf_shared/src/lib.rs b/third_party/rust/phf_shared/src/lib.rs @@ -2,7 +2,7 @@ //! //! [phf]: https://docs.rs/phf -#![doc(html_root_url = "https://docs.rs/phf_shared/0.11")] +#![doc(html_root_url = "https://docs.rs/phf_shared/0.13.1")] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(feature = "std")] @@ -91,7 +91,7 @@ pub trait FmtConst { /// The same semantic requirements apply: /// /// > In particular `Eq`, `Ord` and `Hash` must be equivalent for borrowed and owned values: -/// `x.borrow() == y.borrow()` should give the same result as `x == y`. +/// > `x.borrow() == y.borrow()` should give the same result as `x == y`. /// /// (This crate's API only requires `Eq` and `PhfHash`, however.) /// @@ -233,18 +233,24 @@ impl<'a, T: 'a + FmtConst + ?Sized> FmtConst for &'a T { } } -impl<'a> PhfBorrow<str> for &'a str { +impl PhfBorrow<str> for &str { fn borrow(&self) -> &str { self } } -impl<'a> PhfBorrow<[u8]> for &'a [u8] { +impl PhfBorrow<[u8]> for &[u8] { fn borrow(&self) -> &[u8] { self } } +impl<const N: usize> PhfBorrow<[u8; N]> for &[u8; N] { + fn borrow(&self) -> &[u8; N] { + self + } +} + impl PhfHash for str { #[inline] fn phf_hash<H: Hasher>(&self, state: &mut H) { @@ -302,6 +308,36 @@ impl<'b, 'a: 'b, S: ?Sized + 'a> PhfBorrow<unicase::UniCase<&'b S>> for unicase: } } +#[cfg(feature = "unicase")] +impl<S> PhfHash for unicase::Ascii<S> +where + unicase::Ascii<S>: Hash, +{ + #[inline] + fn phf_hash<H: Hasher>(&self, state: &mut H) { + self.hash(state) + } +} + +#[cfg(feature = "unicase")] +impl<S> FmtConst for unicase::Ascii<S> +where + S: AsRef<str>, +{ + fn fmt_const(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str("Ascii::new(")?; + self.as_ref().fmt_const(f)?; + f.write_str(")") + } +} + +#[cfg(feature = "unicase")] +impl<'b, 'a: 'b, S: ?Sized + 'a> PhfBorrow<unicase::Ascii<&'b S>> for unicase::Ascii<&'a S> { + fn borrow(&self) -> &unicase::Ascii<&'b S> { + self + } +} + #[cfg(feature = "uncased")] impl PhfHash for uncased::UncasedStr { #[inline] @@ -313,12 +349,9 @@ impl PhfHash for uncased::UncasedStr { #[cfg(feature = "uncased")] impl FmtConst for uncased::UncasedStr { fn fmt_const(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - // transmute is not stable in const fns (rust-lang/rust#53605), so - // `UncasedStr::new` can't be a const fn itself, but we can inline the - // call to transmute here in the meantime. - f.write_str("unsafe { ::core::mem::transmute::<&'static str, &'static UncasedStr>(")?; + f.write_str("UncasedStr::new(")?; self.as_str().fmt_const(f)?; - f.write_str(") }") + f.write_str(")") } } @@ -440,3 +473,52 @@ slice_impl!(u128); slice_impl!(i128); slice_impl!(bool); slice_impl!(char); + +macro_rules! tuple_impl { + ($($t:ident),+) => { + impl<$($t: PhfHash),+> PhfHash for ($($t,)+) { + fn phf_hash<HS: Hasher>(&self, state: &mut HS) { + #[allow(non_snake_case)] + let ($($t,)+) = self; + $( + $t.phf_hash(state); + )+ + } + } + + impl<$($t: PhfHash),+> PhfBorrow<($($t,)+)> for ($($t,)+) { + fn borrow(&self) -> &($($t,)+) { + self + } + } + + impl<$($t: FmtConst),+> FmtConst for ($($t,)+) { + fn fmt_const(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + #[allow(non_snake_case)] + let ($($t,)+) = self; + write!(f, "(")?; + let mut first = true; + $( + if !core::mem::replace(&mut first, false) { + write!(f, ", ")?; + } + $t.fmt_const(f)?; + )+ + write!(f, ")") + } + } + }; +} + +tuple_impl!(A); +tuple_impl!(A, B); +tuple_impl!(A, B, C); +tuple_impl!(A, B, C, D); +tuple_impl!(A, B, C, D, E); +tuple_impl!(A, B, C, D, E, F); +tuple_impl!(A, B, C, D, E, F, G); +tuple_impl!(A, B, C, D, E, F, G, HT); +tuple_impl!(A, B, C, D, E, F, G, HT, I); +tuple_impl!(A, B, C, D, E, F, G, HT, I, J); +tuple_impl!(A, B, C, D, E, F, G, HT, I, J, K); +tuple_impl!(A, B, C, D, E, F, G, HT, I, J, K, L); diff --git a/third_party/rust/siphasher/.cargo-checksum.json b/third_party/rust/siphasher/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"COPYING":"2667c3da82a038bfbbd64cdb0fde6ecabda683e473fc1c10cc2b31c1c65e7fb6","Cargo.toml":"2fbdfdfc2ef4b57aca5b08df1a3bd62b8a05c049f1c8a6f9d138a25873db6a51","README.md":"c0ffa167eca7e8aa8efc05c0514234aff3f522fc2e327edf6f86d4fbfa8502a8","src/lib.rs":"dac421e799bfb49f9721af1083101af6846fef78268362172450f2a2c0f6250c","src/sip.rs":"7efabe8cfd561d743f31decb68af305133ee4f572db8088bb223a3505f23e438","src/sip128.rs":"b6a5308c623257826107adad5795918b241295fc3e84361090b16413e203cc15","src/tests.rs":"18637799bba7e7bac147257f01f0229eae527295d40dc9a03f0cb2f076c2e74b","src/tests128.rs":"b85b8893c14a3b4ea782d2084b6de414456ef6dd0b55d1c29c68a3e46516d07c"},"package":"7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"} -\ No newline at end of file +{"files":{"COPYING":"4d40ffd1478e61d103063fe87b133d13b6784688b8855acd7ebc2aeb64095c6d","Cargo.toml":"e8484156079f567495be38cbd1c0ef9592542403c94e54e37e3674b77c07f2ae","README.md":"af6d54563bbcc675b002349cd883e44d607e45cbdd640ed452804533fef00bab","src/lib.rs":"ac6d8c8d89e5017c70e0c32610a391a715a02a84de1d8f615323b1beffec12b6","src/sip.rs":"b2f0067642100232f78f046167299972ec4e64bf8b9a48d5283ab9e0101e12da","src/sip128.rs":"eccfff86293b02af3e22a087592afcea08995f54c551e9fe0ec087e13d9e6eea","src/tests.rs":"99c299d1951aee4c70cd01bea8baabc151a7b316904e5d31de847807a671eaf5","src/tests128.rs":"227986a432d65be2c947a500209adb7767a376b49d82e448487db6a2215476cc"},"package":"56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"} +\ No newline at end of file diff --git a/third_party/rust/siphasher/COPYING b/third_party/rust/siphasher/COPYING @@ -1,5 +1,5 @@ Copyright 2012-2016 The Rust Project Developers. -Copyright 2016-2021 Frank Denis. +Copyright 2016-2024 Frank Denis. Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license diff --git a/third_party/rust/siphasher/Cargo.toml b/third_party/rust/siphasher/Cargo.toml @@ -12,7 +12,7 @@ [package] edition = "2018" name = "siphasher" -version = "0.3.10" +version = "1.0.1" authors = ["Frank Denis <github@pureftpd.org>"] description = "SipHash-2-4, SipHash-1-3 and 128-bit variants in pure Rust" homepage = "https://docs.rs/siphasher" @@ -40,8 +40,9 @@ version = "1.0" features = ["derive"] optional = true -[dev-dependencies.serde_json] +[dependencies.serde_json] version = "1.0" +optional = true [features] default = ["std"] @@ -51,6 +52,3 @@ serde_std = [ "serde/std", ] std = [] - -[badges.travis-ci] -repository = "jedisct1/rust-siphash" diff --git a/third_party/rust/siphasher/README.md b/third_party/rust/siphasher/README.md @@ -13,31 +13,81 @@ module implements the 128-bit mode. Usage ----- + In `Cargo.toml`: ```toml [dependencies] -siphasher = "0.3" +siphasher = "1" ``` If you want [serde](https://github.com/serde-rs/serde) support, include the feature like this: ```toml [dependencies] -siphasher = { version = "0.3", features = ["serde"] } +siphasher = { version = "1", features = ["serde"] } ``` 64-bit mode: -```rust -extern crate siphasher; +```rust use siphasher::sip::{SipHasher, SipHasher13, SipHasher24}; + +// one-shot: + +let array: &[u8] = &[1, 2, 3]; +let key: &[u8; 16] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; +let hasher = SipHasher13::new_with_key(key); +let h = hasher.hash(array); + +// incremental: + +use core::hash::Hasher; + +let array1: &[u8] = &[1, 2, 3]; +let array2: &[u8] = &[4, 5, 6]; +let key: &[u8; 16] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; +let mut hasher = SipHasher13::new_with_key(key); +hasher.write(array1); +hasher.write(array2); +let h = hasher.finish(); ``` 128-bit mode: + ```rust -use siphasher::sip128::{Hasher128, Siphasher, SipHasher13, SipHasher24}; +use siphasher::sip128::{Hasher128, SipHasher, SipHasher13, SipHasher24}; + +// one-shot: + +let array: &[u8] = &[1, 2, 3]; +let key: &[u8; 16] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; +let hasher = SipHasher13::new_with_key(key); +let h = hasher.hash(array).as_bytes(); + +// incremental: + +use core::hash::Hasher; + +let array1: &[u8] = &[1, 2, 3]; +let array2: &[u8] = &[4, 5, 6]; +let key: &[u8; 16] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; +let mut hasher = SipHasher13::new_with_key(key); +hasher.write(array1); +hasher.write(array2); +let h = hasher.finish128().as_bytes(); ``` [API documentation](https://docs.rs/siphasher/) ----------------------------------------------- + +Note +---- + +Due to a confusing and not well documented API, methods from the `Hasher` trait of the standard library (`std::hash::Hasher`, `core::hash::Hasher`) produce non-portable results. + +This is not specific to SipHash, and affects all hash functions. + +The only safe methods in that trait are `write()` and `finish()`. + +It is thus recommended to use SipHash (and all other hash functions, actually) as documented above. diff --git a/third_party/rust/siphasher/src/lib.rs b/third_party/rust/siphasher/src/lib.rs @@ -1,3 +1,5 @@ +#![doc = include_str!("../README.md")] + #![cfg_attr(not(test), no_std)] #![allow(clippy::unreadable_literal)] #![allow(clippy::cast_lossless)] @@ -15,10 +17,14 @@ mod tests128; #[cfg(any(feature = "serde", feature = "serde_std", feature = "serde_no_std"))] pub mod reexports { pub use serde; + #[cfg(feature = "serde_json")] + pub use serde_json; } pub mod prelude { - pub use crate::{sip, sip128}; pub use core::hash::Hasher as _; + pub use sip128::Hasher128 as _; + + pub use crate::{sip, sip128}; } diff --git a/third_party/rust/siphasher/src/sip.rs b/third_party/rust/siphasher/src/sip.rs @@ -12,6 +12,7 @@ use core::cmp; use core::hash; +use core::hash::Hasher as _; use core::marker::PhantomData; use core::mem; use core::ptr; @@ -178,6 +179,14 @@ impl SipHasher { bytes[8..16].copy_from_slice(&self.0.hasher.k1.to_le_bytes()); bytes } + + /// Hash a byte array - This is the easiest and safest way to use SipHash. + #[inline] + pub fn hash(&self, bytes: &[u8]) -> u64 { + let mut hasher = self.0.hasher; + hasher.write(bytes); + hasher.finish() + } } impl SipHasher13 { @@ -218,6 +227,14 @@ impl SipHasher13 { bytes[8..16].copy_from_slice(&self.hasher.k1.to_le_bytes()); bytes } + + /// Hash a byte array - This is the easiest and safest way to use SipHash. + #[inline] + pub fn hash(&self, bytes: &[u8]) -> u64 { + let mut hasher = self.hasher; + hasher.write(bytes); + hasher.finish() + } } impl SipHasher24 { @@ -258,6 +275,14 @@ impl SipHasher24 { bytes[8..16].copy_from_slice(&self.hasher.k1.to_le_bytes()); bytes } + + /// Hash a byte array - This is the easiest and safest way to use SipHash. + #[inline] + pub fn hash(&self, bytes: &[u8]) -> u64 { + let mut hasher = self.hasher; + hasher.write(bytes); + hasher.finish() + } } impl<S: Sip> Hasher<S> { @@ -458,7 +483,7 @@ impl<S: Sip> hash::Hasher for Hasher<S> { #[inline] fn write_u64(&mut self, i: u64) { - self.short_write(i, i.to_le() as u64); + self.short_write(i, i.to_le()); } #[inline] diff --git a/third_party/rust/siphasher/src/sip128.rs b/third_party/rust/siphasher/src/sip128.rs @@ -12,6 +12,7 @@ use core::cmp; use core::hash; +use core::hash::Hasher as _; use core::marker::PhantomData; use core::mem; use core::ptr; @@ -199,6 +200,14 @@ impl SipHasher { bytes[8..16].copy_from_slice(&self.0.hasher.k1.to_le_bytes()); bytes } + + /// Hash a byte array - This is the easiest and safest way to use SipHash. + #[inline] + pub fn hash(&self, bytes: &[u8]) -> Hash128 { + let mut hasher = self.0.hasher; + hasher.write(bytes); + hasher.finish128() + } } impl Hasher128 for SipHasher { @@ -247,6 +256,14 @@ impl SipHasher13 { bytes[8..16].copy_from_slice(&self.hasher.k1.to_le_bytes()); bytes } + + /// Hash a byte array - This is the easiest and safest way to use SipHash. + #[inline] + pub fn hash(&self, bytes: &[u8]) -> Hash128 { + let mut hasher = self.hasher; + hasher.write(bytes); + hasher.finish128() + } } impl Hasher128 for SipHasher13 { @@ -295,6 +312,14 @@ impl SipHasher24 { bytes[8..16].copy_from_slice(&self.hasher.k1.to_le_bytes()); bytes } + + /// Hash a byte array - This is the easiest and safest way to use SipHash. + #[inline] + pub fn hash(&self, bytes: &[u8]) -> Hash128 { + let mut hasher = self.hasher; + hasher.write(bytes); + hasher.finish128() + } } impl Hasher128 for SipHasher24 { @@ -526,7 +551,7 @@ impl<S: Sip> hash::Hasher for Hasher<S> { #[inline] fn write_u64(&mut self, i: u64) { - self.short_write(i, i.to_le() as u64); + self.short_write(i, i.to_le()); } #[inline] diff --git a/third_party/rust/siphasher/src/tests.rs b/third_party/rust/siphasher/src/tests.rs @@ -8,9 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use super::sip::{SipHasher, SipHasher13, SipHasher24}; use std::hash::{Hash, Hasher}; +use super::sip::{SipHasher, SipHasher13, SipHasher24}; + // Hash just the bytes of the slice, without length prefix struct Bytes<'a>(&'a [u8]); @@ -300,6 +301,28 @@ fn test_hash_no_concat_alias() { } #[test] +fn test_hash_simple() { + let array: &[u8] = &[1, 2, 3]; + let key: &[u8; 16] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + let hasher = SipHasher13::new_with_key(key); + let h = hasher.hash(array); + _ = h; +} + +#[test] +fn test_hash_incremental() { + let array1: &[u8] = &[1, 2, 3]; + let array2: &[u8] = &[4, 5, 6]; + let key: &[u8; 16] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + let mut hasher = SipHasher13::new_with_key(key); + hasher.write(array1); + hasher.write(array2); + let h = hasher.finish(); + _ = h; +} + +#[test] +#[cfg(all(feature = "serde", feature = "serde_json"))] fn test_hash_serde() { let val64 = 0xdead_beef_dead_beef_u64; let hash = hash(&val64); diff --git a/third_party/rust/siphasher/src/tests128.rs b/third_party/rust/siphasher/src/tests128.rs @@ -8,9 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use super::sip128::{Hasher128, SipHasher, SipHasher13, SipHasher24}; use std::hash::{Hash, Hasher}; +use super::sip128::{Hasher128, SipHasher, SipHasher13, SipHasher24}; + // Hash just the bytes of the slice, without length prefix struct Bytes<'a>(&'a [u8]); @@ -32,6 +33,14 @@ fn hash<T: Hash>(x: &T) -> [u8; 16] { } #[test] +fn test_siphash128_idempotent() { + let val64 = 0xdead_beef_dead_beef_u64; + assert_eq!(hash(&val64), hash(&val64)); + let val32 = 0xdeadbeef_u32; + assert_eq!(hash(&val32), hash(&val32)); +} + +#[test] #[allow(unused_must_use)] fn test_siphash128_1_3() { let vecs: [[u8; 16]; 1] = [[ @@ -94,6 +103,28 @@ fn test_siphash128_2_4() { } #[test] +fn test_siphash128_simple() { + let array: &[u8] = &[1, 2, 3]; + let key: &[u8; 16] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + let hasher = SipHasher13::new_with_key(key); + let h = hasher.hash(array).as_bytes(); + _ = h; +} + +#[test] +fn test_siphash128_incremental() { + let array1: &[u8] = &[1, 2, 3]; + let array2: &[u8] = &[4, 5, 6]; + let key: &[u8; 16] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + let mut hasher = SipHasher13::new_with_key(key); + hasher.write(array1); + hasher.write(array2); + let h = hasher.finish128().as_bytes(); + _ = h; +} + +#[test] +#[cfg(all(feature = "serde", feature = "serde_json"))] fn test_siphash128_serde() { let val64 = 0xdead_beef_dead_beef_u64; let hash = hash(&val64); diff --git a/toolkit/crashreporter/client/app/Cargo.toml b/toolkit/crashreporter/client/app/Cargo.toml @@ -22,7 +22,7 @@ minidump-analyzer = { path = "../../minidump-analyzer" } mozbuild = "0.1" mozilla-central-workspace-hack = { version = "0.1", features = ["crashreporter"], optional = true } once_cell = "1" -phf = "0.11" +phf = "0.13" rand = "0.8.5" serde = { version = "1", features = ["derive"] } serde_json = "1" @@ -67,7 +67,7 @@ mock = [] bindgen = { version = "0.69", default-features = false, features = ["runtime"] } embed-manifest = "1.4" mozbuild = "0.1" -phf_codegen = "0.11" +phf_codegen = "0.13" yaml-rust = { version = "0.10", package = "yaml-rust2" } [dev-dependencies]