Skip to content

Commit

Permalink
Update libloading from 0.6 to 0.8 (#346)
Browse files Browse the repository at this point in the history
* Update libloading from 0.6 to 0.8

Deal with the fact that libloading::Library::new was declared unsafe in
libloading 0.7; see nagisa/rust_libloading#86
and
https://github.com/nagisa/rust_libloading/blob/0.8.3/src/changelog.rs#L96-L151
for details.

Fixes #345.

* Update MSRV to 1.56 to support libloading 0.8.2 and later
  • Loading branch information
musicinmybrain authored Apr 21, 2024
1 parent 8b7bcfe commit 0916dc2
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/00-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: './.github/workflows/01-build-and-test-unix.yml'
with:
os: 'ubuntu-latest'
toolchain: '1.46.0'
toolchain: '1.56.0'
msrv: true

# Nightly check is performed on ubuntu only.
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
# rust < 1.54 does not work on macos >= 12:
# https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20How.20can.20I.20fix.20Rust.201.2E53.2E0.20or.20earlier.20to.20run.20on.20macOS.2012.2E6.3F/near/299263887
os: 'macos-11'
toolchain: '1.46.0'
toolchain: '1.56.0'
msrv: true

build-and-test-windows-stable:
Expand All @@ -78,7 +78,7 @@ jobs:
uses: './.github/workflows/01-build-and-test-windows.yml'
with:
os: 'windows-latest'
toolchain: '1.46.0'
toolchain: '1.56.0'
msrv: true
secrets:
NPCAP_OEM_PASSWORD: ${{ secrets.NPCAP_OEM_PASSWORD }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Changed

- MSRV is now `1.56.0`.

## [1.3.0] - 2024-03-15

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tempdir = "0.3"
eui48 = "1.1"

[build-dependencies]
libloading = "0.6"
libloading = "0.8"
regex = "1"
pkg-config = "0.3"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Use the `lending-iter` feature to enable the lending packet iterator. See `lendi

## Minimum Supported Rust Version (MSRV)

This crate uses Rust 2018 and requires a compiler version >= 1.46.
This crate uses Rust 2018 and requires a compiler version >= 1.56.

The feature `capture-stream` depends on `tokio = "1.0"`. Therefore, when `capture-stream` is enabled, this crate requires a compiler version new enough to compile the `tokio` crate.

Expand Down
9 changes: 8 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ fn get_libpcap_version(libdirpath: Option<PathBuf>) -> Result<Version, Box<dyn s
libfile = libdir.join(libfile);
}

let lib = if let Ok(lib) = libloading::Library::new(libfile) {
let lib = if let Ok(lib) = unsafe {
// Loading a shared library is unsafe in the general case since initialization and
// termination routines could have arbitrary behavior. This is sound as long as the shared
// library is "well-behaved." See https://github.com/nagisa/rust_libloading/issues/86 and
// https://github.com/nagisa/rust_libloading/blob/0.8.3/src/changelog.rs#L96-L151 for
// details.
libloading::Library::new(libfile)
} {
lib
} else {
return Ok(Version::max());
Expand Down
82 changes: 74 additions & 8 deletions msrv.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "aho-corasick"
version = "0.7.18"
Expand Down Expand Up @@ -385,12 +387,12 @@ checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"

[[package]]
name = "libloading"
version = "0.6.7"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883"
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
dependencies = [
"cfg-if 1.0.0",
"winapi 0.3.9",
"windows-targets",
]

[[package]]
Expand Down Expand Up @@ -1144,43 +1146,107 @@ version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
dependencies = [
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_msvc",
"windows_aarch64_msvc 0.36.1",
"windows_i686_gnu 0.36.1",
"windows_i686_msvc 0.36.1",
"windows_x86_64_gnu 0.36.1",
"windows_x86_64_msvc 0.36.1",
]

[[package]]
name = "windows-targets"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.52.5",
"windows_i686_gnu 0.52.5",
"windows_i686_gnullvm",
"windows_i686_msvc 0.52.5",
"windows_x86_64_gnu 0.52.5",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.52.5",
]

[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"

[[package]]
name = "windows_aarch64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"

[[package]]
name = "windows_aarch64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"

[[package]]
name = "windows_i686_gnu"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"

[[package]]
name = "windows_i686_gnu"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"

[[package]]
name = "windows_i686_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"

[[package]]
name = "windows_i686_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"

[[package]]
name = "windows_i686_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"

[[package]]
name = "windows_x86_64_gnu"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"

[[package]]
name = "windows_x86_64_gnu"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"

[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"

[[package]]
name = "windows_x86_64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"

[[package]]
name = "windows_x86_64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"

[[package]]
name = "ws2_32-sys"
version = "0.2.1"
Expand Down

0 comments on commit 0916dc2

Please sign in to comment.