From 11bb2426f0237b1ecea8c8038630b1231ede4871 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 3 May 2022 09:22:45 +0900 Subject: [PATCH] Make "unicase + macros" features work --- .github/workflows/ci.yml | 9 ++++++--- CHANGELOG.md | 5 +++++ Cargo.toml | 1 + README.md | 2 +- phf/Cargo.toml | 3 ++- phf/examples/unicase-example/Cargo.toml | 11 +++++++++++ phf/examples/unicase-example/src/main.rs | 9 +++++++++ phf/src/lib.rs | 2 +- phf_codegen/Cargo.toml | 1 + phf_generator/Cargo.toml | 1 + phf_macros/Cargo.toml | 1 + phf_macros_tests/Cargo.toml | 1 + phf_shared/Cargo.toml | 1 + 13 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 phf/examples/unicase-example/Cargo.toml create mode 100644 phf/examples/unicase-example/src/main.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d628a42c..c727ff70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: # MSRV and nightly - version: [1.51.0, nightly] + version: [1.60.0, nightly] steps: - uses: actions/checkout@v2 @@ -23,7 +23,7 @@ jobs: rustup override set ${{ matrix.version }} - name: Rustfmt check - if: matrix.version == '1.51.0' + if: matrix.version == '1.60.0' run: | rustup component add rustfmt cargo fmt --all -- --check @@ -32,7 +32,7 @@ jobs: run: cargo test --workspace --exclude=phf_codegen_test - name: phf_macros UI test - if: matrix.version == '1.51.0' + if: matrix.version == '1.60.0' working-directory: phf_macros_tests run: cargo test -- --ignored --test-threads=1 @@ -42,3 +42,6 @@ jobs: - name: no_std build check working-directory: phf run: cargo build --no-default-features + + - name: unicase + macros features check + run: cargo check -p unicase-example diff --git a/CHANGELOG.md b/CHANGELOG.md index 73813f46..cc9810e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Unreleased + +* Bump up MSRV to 1.60 +* Now the `unicase` feature works fine with the `macros` feature, doesn't need to import `phf-macros` directly. + ## 0.10.1 * Allow serializing `Map` ([#244]) diff --git a/Cargo.toml b/Cargo.toml index 13b416d0..a784d1a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = [ "phf", + "phf/examples/unicase-example", "phf_codegen", "phf_codegen/test", "phf_generator", diff --git a/README.md b/README.md index 64a24b61..4d7b9fdd 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ a 100,000 entry map in roughly .4 seconds. By default statistics are not produced, but if you set the environment variable `PHF_STATS` it will issue a compiler note about how long it took. -MSRV (minimum supported rust version) is Rust 1.46. +MSRV (minimum supported rust version) is Rust 1.60. ## Usage diff --git a/phf/Cargo.toml b/phf/Cargo.toml index 692dfd72..b2873131 100644 --- a/phf/Cargo.toml +++ b/phf/Cargo.toml @@ -7,6 +7,7 @@ description = "Runtime support for perfect hash function data structures" repository = "https://github.com/sfackler/rust-phf" edition = "2018" readme = "../README.md" +rust-version = "1.60" [lib] name = "phf" @@ -17,7 +18,7 @@ test = false default = ["std"] std = ["phf_shared/std"] uncased = ["phf_shared/uncased"] -unicase = ["phf_shared/unicase"] +unicase = ["phf_macros?/unicase", "phf_shared/unicase"] macros = [ "phf_macros", "proc-macro-hack", diff --git a/phf/examples/unicase-example/Cargo.toml b/phf/examples/unicase-example/Cargo.toml new file mode 100644 index 00000000..b264ff5f --- /dev/null +++ b/phf/examples/unicase-example/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "unicase-example" +version = "0.1.0" +edition = "2021" +rust-version = "1.60" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +phf = { version = "0.10", features = ["macros", "unicase"] } +unicase = "2" diff --git a/phf/examples/unicase-example/src/main.rs b/phf/examples/unicase-example/src/main.rs new file mode 100644 index 00000000..34ba613f --- /dev/null +++ b/phf/examples/unicase-example/src/main.rs @@ -0,0 +1,9 @@ +use phf::phf_map; +use unicase::UniCase; + +pub static MAP: phf::Map, isize> = phf_map!( + UniCase::ascii("Foo") => 0, + UniCase::unicode("Bar") => 1, +); + +fn main() {} diff --git a/phf/src/lib.rs b/phf/src/lib.rs index e60f524b..252dc71b 100644 --- a/phf/src/lib.rs +++ b/phf/src/lib.rs @@ -7,7 +7,7 @@ //! produced, but if you set the environment variable `PHF_STATS` it will issue //! a compiler note about how long it took. //! -//! MSRV (minimum supported rust version) is Rust 1.46. +//! MSRV (minimum supported rust version) is Rust 1.60. //! //! ## Usage //! diff --git a/phf_codegen/Cargo.toml b/phf_codegen/Cargo.toml index 6e6c90d9..7cbb0792 100644 --- a/phf_codegen/Cargo.toml +++ b/phf_codegen/Cargo.toml @@ -7,6 +7,7 @@ description = "Codegen library for PHF types" repository = "https://github.com/sfackler/rust-phf" edition = "2018" readme = "../README.md" +rust-version = "1.60" [dependencies] phf_generator = "0.10.0" diff --git a/phf_generator/Cargo.toml b/phf_generator/Cargo.toml index 806b4412..f44a2333 100644 --- a/phf_generator/Cargo.toml +++ b/phf_generator/Cargo.toml @@ -6,6 +6,7 @@ license = "MIT" description = "PHF generation logic" repository = "https://github.com/sfackler/rust-phf" edition = "2018" +rust-version = "1.60" [dependencies] rand = { version = "0.8", features = ["small_rng"] } diff --git a/phf_macros/Cargo.toml b/phf_macros/Cargo.toml index a3454a36..d15edc3e 100644 --- a/phf_macros/Cargo.toml +++ b/phf_macros/Cargo.toml @@ -8,6 +8,7 @@ description = "Macros to generate types in the phf crate" repository = "https://github.com/sfackler/rust-phf" readme = "../README.md" include = ["src/lib.rs"] +rust-version = "1.60" [lib] proc-macro = true diff --git a/phf_macros_tests/Cargo.toml b/phf_macros_tests/Cargo.toml index bc2478c7..b57147d5 100644 --- a/phf_macros_tests/Cargo.toml +++ b/phf_macros_tests/Cargo.toml @@ -3,6 +3,7 @@ name = "phf_macros_tests" version = "0.1.0" authors = ["Yuki Okushi "] edition = "2018" +rust-version = "1.60" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/phf_shared/Cargo.toml b/phf_shared/Cargo.toml index 73f0594d..67f63e41 100644 --- a/phf_shared/Cargo.toml +++ b/phf_shared/Cargo.toml @@ -6,6 +6,7 @@ license = "MIT" description = "Support code shared by PHF libraries" repository = "https://github.com/sfackler/rust-phf" edition = "2018" +rust-version = "1.60" [lib] name = "phf_shared"