From cc09cc8b3b14765dc520dae8b8cca9ca95a0c0cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 18:47:42 +0000 Subject: [PATCH 1/5] build(deps): Bump the gha-deps group across 1 directory with 2 updates Bumps the gha-deps group with 2 updates in the / directory: [actions/checkout](https://github.com/actions/checkout) and [ruby/setup-ruby](https://github.com/ruby/setup-ruby). Updates `actions/checkout` from 4.1.4 to 4.1.7 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4.1.4...v4.1.7) Updates `ruby/setup-ruby` from 1.175.1 to 1.183.0 - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb) - [Commits](https://github.com/ruby/setup-ruby/compare/1198b074305f9356bd56dd4b311757cc0dab2f1c...1d0e911f615a112e322369596f10ee0b95b010ae) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-patch dependency-group: gha-deps - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor dependency-group: gha-deps ... Signed-off-by: dependabot[bot] --- .github/workflows/audit.yaml | 6 +++--- .github/workflows/ci.yaml | 14 +++++++------- .github/workflows/markdown-link-check.yaml | 2 +- .github/workflows/repo-labels.yaml | 2 +- .github/workflows/rustdoc.yaml | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/audit.yaml b/.github/workflows/audit.yaml index cb49affe349..81611c206c6 100644 --- a/.github/workflows/audit.yaml +++ b/.github/workflows/audit.yaml @@ -16,10 +16,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4.1.4 + uses: actions/checkout@v4.1.7 - name: Install Ruby toolchain - uses: ruby/setup-ruby@1198b074305f9356bd56dd4b311757cc0dab2f1c # v1.175.1 + uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0 with: ruby-version: ".ruby-version" bundler-cache: true @@ -41,7 +41,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4.1.4 + uses: actions/checkout@v4.1.7 - name: Install Rust toolchain uses: artichoke/setup-rust/audit@v1.11.0 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d0e45ff54bb..e448b5b215f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,7 +22,7 @@ jobs: RUST_BACKTRACE: 1 steps: - name: Checkout repository - uses: actions/checkout@v4.1.4 + uses: actions/checkout@v4.1.7 - name: Install Rust toolchain uses: artichoke/setup-rust/build-and-test@v1.11.0 @@ -61,7 +61,7 @@ jobs: RUST_BACKTRACE: 1 steps: - name: Checkout repository - uses: actions/checkout@v4.1.4 + uses: actions/checkout@v4.1.7 - name: Install Rust toolchain uses: artichoke/setup-rust/build-and-test@v1.11.0 @@ -96,7 +96,7 @@ jobs: RUST_BACKTRACE: 1 steps: - name: Checkout repository - uses: actions/checkout@v4.1.4 + uses: actions/checkout@v4.1.7 - name: Install Rust toolchain uses: artichoke/setup-rust/lint-and-format@v1.11.0 @@ -114,10 +114,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4.1.4 + uses: actions/checkout@v4.1.7 - name: Install Ruby toolchain - uses: ruby/setup-ruby@1198b074305f9356bd56dd4b311757cc0dab2f1c # v1.175.1 + uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0 with: ruby-version: ".ruby-version" bundler-cache: true @@ -130,7 +130,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4.1.4 + uses: actions/checkout@v4.1.7 - name: Setup Node.js runtime uses: actions/setup-node@v4.0.2 @@ -148,7 +148,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4.1.4 + uses: actions/checkout@v4.1.7 - name: Setup Node.js runtime uses: actions/setup-node@v4.0.2 diff --git a/.github/workflows/markdown-link-check.yaml b/.github/workflows/markdown-link-check.yaml index f149944b270..42fe35661bb 100644 --- a/.github/workflows/markdown-link-check.yaml +++ b/.github/workflows/markdown-link-check.yaml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v4.1.4 + uses: actions/checkout@v4.1.7 - name: Check for broken links in markdown files uses: gaurav-nelson/github-action-markdown-link-check@d53a906aa6b22b8979d33bc86170567e619495ec # v1.0.15 diff --git a/.github/workflows/repo-labels.yaml b/.github/workflows/repo-labels.yaml index c1e15a08b29..cd133a0ec4a 100644 --- a/.github/workflows/repo-labels.yaml +++ b/.github/workflows/repo-labels.yaml @@ -20,7 +20,7 @@ jobs: name: Synchronize repository labels runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.4 + - uses: actions/checkout@v4.1.7 - name: Sync GitHub Issue Labels uses: crazy-max/ghaction-github-labeler@de749cf181958193cb7debf1a9c5bb28922f3e1b # v5.0.0 diff --git a/.github/workflows/rustdoc.yaml b/.github/workflows/rustdoc.yaml index 4c076dc364b..b396adfa7ad 100644 --- a/.github/workflows/rustdoc.yaml +++ b/.github/workflows/rustdoc.yaml @@ -23,7 +23,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4.1.4 + uses: actions/checkout@v4.1.7 - name: Install Rust toolchain uses: artichoke/setup-rust/rustdoc@v1.11.0 From 4464548d2a865b40968597304d4256ecf5317665 Mon Sep 17 00:00:00 2001 From: Ryan Lopopolo Date: Wed, 10 Jul 2024 15:20:54 -0700 Subject: [PATCH 2/5] Update Ruby and bundler --- .ruby-version | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ruby-version b/.ruby-version index 15a27998172..619b5376684 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.0 +3.3.3 diff --git a/Gemfile.lock b/Gemfile.lock index db5edbe42aa..9544dab50b3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,4 +47,4 @@ DEPENDENCIES rubocop-rake (~> 0.6) BUNDLED WITH - 2.5.3 + 2.5.15 From 524fa5e33f8d08583ce06649268871771fb0d64e Mon Sep 17 00:00:00 2001 From: Ryan Lopopolo Date: Wed, 10 Jul 2024 15:24:31 -0700 Subject: [PATCH 3/5] Address `clippy::missing_transmute_annotations` lint violations --- strudel-ffi/src/ffi/init.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/strudel-ffi/src/ffi/init.rs b/strudel-ffi/src/ffi/init.rs index 2fdfa45b8df..fb7a0d1401c 100644 --- a/strudel-ffi/src/ffi/init.rs +++ b/strudel-ffi/src/ffi/init.rs @@ -50,7 +50,10 @@ unsafe extern "C" fn strhash(arg: st_data_t) -> st_index_t { static type_strhash: st_hash_type = st_hash_type { compare: unsafe { - transmute(libc::strcmp as unsafe extern "C" fn(*const c_char, *const c_char) -> c_int) + transmute::< + unsafe extern "C" fn(*const c_char, *const c_char) -> c_int, + unsafe extern "C" fn(st_data_t, st_data_t) -> c_int, + >(libc::strcmp as _) }, hash: strhash, }; @@ -172,7 +175,7 @@ unsafe extern "C" fn st_locale_insensitive_strncasecmp( let s2 = slice::from_raw_parts(s2.as_const_c_char(), n); for (&left, &right) in s1.iter().zip(s2.iter()) { - match (transmute(left), transmute(right)) { + match (transmute::(left), transmute::(right)) { (b'\0', b'\0') => return 0, (_, b'\0') => return 1, (b'\0', _) => return -1, From 5d0315117988d102c361b9e259ffd580c1597e9d Mon Sep 17 00:00:00 2001 From: Ryan Lopopolo Date: Wed, 10 Jul 2024 15:32:47 -0700 Subject: [PATCH 4/5] Use c type imports from core::ffi --- strudel-ffi/src/bindings.rs | 2 +- strudel-ffi/src/ffi.rs | 3 +-- strudel-ffi/src/ffi/imp.rs | 3 +-- strudel-ffi/src/ffi/init.rs | 12 ++++++------ strudel-ffi/src/primitives.rs | 2 +- strudel-ffi/src/st_table/ffi.rs | 2 +- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/strudel-ffi/src/bindings.rs b/strudel-ffi/src/bindings.rs index 3186eef86f4..eff35d5a73d 100644 --- a/strudel-ffi/src/bindings.rs +++ b/strudel-ffi/src/bindings.rs @@ -1,4 +1,4 @@ -use std::os::raw::c_int; +use core::ffi::c_int; use crate::primitives::{st_data_t, st_index_t}; diff --git a/strudel-ffi/src/ffi.rs b/strudel-ffi/src/ffi.rs index 22615832187..a7b158cb725 100644 --- a/strudel-ffi/src/ffi.rs +++ b/strudel-ffi/src/ffi.rs @@ -10,8 +10,7 @@ //! //! [`StHashMap`]: strudel::StHashMap -use core::ffi::c_void; -use std::os::raw::c_int; +use core::ffi::{c_int, c_void}; use crate::bindings::{st_foreach_callback_func, st_hash_type, st_update_callback_func}; use crate::primitives::{st_data_t, st_hash_t, st_index_t}; diff --git a/strudel-ffi/src/ffi/imp.rs b/strudel-ffi/src/ffi/imp.rs index dc8b46a41e2..9b8a163b0f3 100644 --- a/strudel-ffi/src/ffi/imp.rs +++ b/strudel-ffi/src/ffi/imp.rs @@ -2,12 +2,11 @@ //! //! [`StHashMap`]: strudel::StHashMap -use core::ffi::c_void; +use core::ffi::{c_int, c_void}; use core::hash::Hasher; use core::mem; use core::ptr; use core::slice; -use std::os::raw::c_int; use fnv::FnvHasher; diff --git a/strudel-ffi/src/ffi/init.rs b/strudel-ffi/src/ffi/init.rs index fb7a0d1401c..d956e93b86c 100644 --- a/strudel-ffi/src/ffi/init.rs +++ b/strudel-ffi/src/ffi/init.rs @@ -1,8 +1,8 @@ +use core::ffi::{c_char, c_int, CStr}; use core::hash::Hasher; +use core::iter; use core::mem::transmute; use core::slice; -use std::ffi::CStr; -use std::os::raw::{c_char, c_int}; use fnv::FnvHasher; @@ -171,11 +171,11 @@ unsafe extern "C" fn st_locale_insensitive_strncasecmp( s2: st_data_t, n: libc::size_t, ) -> libc::c_int { - let s1 = slice::from_raw_parts(s1.as_const_c_char(), n); - let s2 = slice::from_raw_parts(s2.as_const_c_char(), n); + let s1 = slice::from_raw_parts(s1.as_const_c_char().cast::(), n); + let s2 = slice::from_raw_parts(s2.as_const_c_char().cast::(), n); - for (&left, &right) in s1.iter().zip(s2.iter()) { - match (transmute::(left), transmute::(right)) { + for (&left, &right) in iter::zip(s1, s2) { + match (left, right) { (b'\0', b'\0') => return 0, (_, b'\0') => return 1, (b'\0', _) => return -1, diff --git a/strudel-ffi/src/primitives.rs b/strudel-ffi/src/primitives.rs index f58bb704c6a..1e5acfdd5b0 100644 --- a/strudel-ffi/src/primitives.rs +++ b/strudel-ffi/src/primitives.rs @@ -1,5 +1,5 @@ +use core::ffi::c_char; use core::mem::size_of; -use std::os::raw::c_char; /// A type-safe typedef for data stored in the hashmap. /// diff --git a/strudel-ffi/src/st_table/ffi.rs b/strudel-ffi/src/st_table/ffi.rs index 4792e9b2086..e452b9bfd32 100644 --- a/strudel-ffi/src/st_table/ffi.rs +++ b/strudel-ffi/src/st_table/ffi.rs @@ -154,8 +154,8 @@ impl From for st_table { #[cfg(test)] mod tests { + use core::ffi::{c_uchar, c_uint}; use core::mem::size_of; - use std::os::raw::{c_uchar, c_uint}; use crate::bindings::st_hash_type; use crate::primitives::{st_data_t, st_hash_t, st_index_t}; From 93013a97d55d9e566612ed69001e9bff4945e989 Mon Sep 17 00:00:00 2001 From: Ryan Lopopolo Date: Wed, 10 Jul 2024 15:35:01 -0700 Subject: [PATCH 5/5] Upgrade to Rust 2021 edition and set minimum rust version --- Cargo.toml | 5 +++-- strudel-ffi/Cargo.toml | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4c7c970b8c7..6480f2a2049 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "strudel" -version = "1.0.0" +version = "1.1.0" authors = ["Ryan Lopopolo "] -edition = "2018" +edition = "2021" +rust-version = "1.65.0" description = "Rust port of the st_hash C library" repository = "https://github.com/artichoke/strudel" readme = "README.md" diff --git a/strudel-ffi/Cargo.toml b/strudel-ffi/Cargo.toml index 73dcbd74196..becf5f0be52 100644 --- a/strudel-ffi/Cargo.toml +++ b/strudel-ffi/Cargo.toml @@ -1,8 +1,9 @@ [package] name = "strudel-ffi" -version = "0.1.0" +version = "0.2.0" authors = ["Ryan Lopopolo "] -edition = "2018" +edition = "2021" +rust-version = "1.65.0" description = "Rust port of the st_hash C library" repository = "https://github.com/artichoke/strudel" readme = "README.md" @@ -18,7 +19,7 @@ name = "strudel_st" [dependencies] fnv = "1.0.7" libc = "0.2.118" -strudel = { version = "=1.0.0", path = ".." } +strudel = { version = "=1.1.0", path = ".." } [dev-dependencies] memoffset = "0.9.0"