From 4b28cfa57df1cac29be20ff99207f66e16599f6e Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sun, 8 Sep 2024 02:17:42 +0700 Subject: [PATCH] use assert! in const --- .github/workflows/ci.yml | 4 ++-- CHANGELOG.md | 7 ++++++- Cargo.lock | 2 +- Cargo.toml | 4 ++-- README.md | 2 +- src/internals/c.rs | 5 ++--- src/internals/c/nightly.rs | 2 +- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc8956db..fe26eaab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,8 +81,8 @@ jobs: runs-on: windows-latest # needs: [build] env: - # add_of_mut! requires for soundness - MSRV: 1.56.0 + # assert! in consts + MSRV: 1.57.0 steps: - uses: actions/checkout@v4 - run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f72b162..45558331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `Fixed` for any bug fixes. * `Security` in case of vulnerabilities. --> +## [v1.2.0] - 2024-09-08 +### Change MSRV from 1.56 to 1.57 +Minor refactorings to abuse assertions in constants that Rust 1.57.0 allows. + ## [v1.1.0] - 2024-04-30 ### Change MSRV from 1.51 to 1.56 @@ -62,7 +66,8 @@ It signals that the API is mature enough to be stable for a long time. First release -[v1.0.0]: https://github.com/lzutao/junction/compare/v1.0.0...v1.1.0 +[v1.2.0]: https://github.com/lzutao/junction/compare/v1.1.0...v1.2.0 +[v1.1.0]: https://github.com/lzutao/junction/compare/v1.0.0...v1.1.0 [v1.0.0]: https://github.com/lzutao/junction/compare/v0.2.1...v1.0.0 [v0.2.1]: https://github.com/lzutao/junction/compare/v0.2.0...v0.2.1 [v0.2.0]: https://github.com/lzutao/junction/compare/v0.1.0...v0.2.0 diff --git a/Cargo.lock b/Cargo.lock index 8a633159..56e89546 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,7 +38,7 @@ checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "junction" -version = "1.1.0" +version = "1.2.0" dependencies = [ "rustix", "scopeguard", diff --git a/Cargo.toml b/Cargo.toml index 7fc6481e..bc97f453 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "junction" -version = "1.1.0" # Also update `html_root_url` in lib.rs +version = "1.2.0" # Also update `html_root_url` in lib.rs authors = ["Lzu Tao "] categories = ["api-bindings", "os::windows-apis"] edition = "2021" -rust-version = "1.56" +rust-version = "1.57" exclude = [ "/.github", "/HOW-TO-RELEASE.md", diff --git a/README.md b/README.md index 37a76d00..5623c349 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Quoted from [Computer Hope](https://www.computerhope.com/jargon/j/junction.htm): ### Minimal Supported Rust versions -1.56.0 +1.57.0 ## All relevant references diff --git a/src/internals/c.rs b/src/internals/c.rs index 3cd1ee1f..77dba339 100644 --- a/src/internals/c.rs +++ b/src/internals/c.rs @@ -34,9 +34,8 @@ pub use windows_sys::Win32::System::IO::DeviceIoControl; const _: () = { let std_layout = Layout::new::(); let win_sys_layout = Layout::new::(); - // MSRV(Rust v1.57): use assert! instead - [(); 1][std_layout.size() - win_sys_layout.size()]; - [(); 1][std_layout.align() - win_sys_layout.align()]; + assert!(std_layout.size() == win_sys_layout.size()); + assert!(std_layout.align() == win_sys_layout.align()); }; // NOTE: to use `size_of` operator, below structs should be packed. diff --git a/src/internals/c/nightly.rs b/src/internals/c/nightly.rs index 90591e5a..0b4d9503 100644 --- a/src/internals/c/nightly.rs +++ b/src/internals/c/nightly.rs @@ -1,4 +1,4 @@ -#![allow(unused)] +#![expect(unused)] use std::mem::offset_of;