diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e750d1dc..4baa3f18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,14 +7,17 @@ on: - '!gh-pages' pull_request: +env: + SPARSE_TOOLCHAIN: nightly-2023-02-25 + jobs: build: + if: false runs-on: windows-latest env: RUST_BACKTRACE: 1 CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse MINGW_URL: https://ci-mirrors.rust-lang.org/rustc - RUSTC_TOOLCHAIN: nightly-2023-02-25 MIRIFLAGS: -Zmiri-disable-isolation strategy: matrix: @@ -29,9 +32,8 @@ jobs: steps: - uses: actions/checkout@v3 - run: | - echo "${RUSTC_TOOLCHAIN}" - rustup toolchain install "nightly-2023-02-25-${{ matrix.target }}" - rustup default "nightly-2023-02-25-${{ matrix.target }}" + rustup toolchain install "${{ env.SPARSE_TOOLCHAIN }}-${{ matrix.target }}" + rustup default "${{ env.SPARSE_TOOLCHAIN }}-${{ matrix.target }}" - name: Check out MinGW toolchain run: | set -x @@ -63,6 +65,27 @@ jobs: dir /aL C:\Users shell: cmd + msrv: + runs-on: windows-latest + # needs: [build] + env: + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse + # add_of_mut! requires for soundness + MSRV: 1.51.0 + steps: + - uses: actions/checkout@v3 + - run: | + rustup toolchain install ${{ env.MSRV }} + rustup toolchain install ${{ env.SPARSE_TOOLCHAIN }} + rustup default ${{ env.MSRV }} + - run: | + rustup run ${{ env.SPARSE_TOOLCHAIN }} cargo generate-lockfile + rustup run ${{ env.SPARSE_TOOLCHAIN }} cargo fetch + - run: | + cargo build --all-targets --locked + - run: | + cargo test + rustfmt: runs-on: ubuntu-latest steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index cf6df313..f6aa7fda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `Security` in case of vulnerabilities. --> +## [v1.0.0] - 2023-02-26 +### First major version +The public API of this crate has been unchanged around 3 years without complains. +It signals that the API is mature enough to be stable for a long time. + ## [v0.2.1] - 2023-02-25 ### Fixed * Fix weird build failure when cross-compiling from non-Windows hosts @@ -52,6 +57,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 First release +[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 [v0.1.5]: https://github.com/lzutao/junction/compare/v0.1.4...v0.1.5 [v0.1.4]: https://github.com/lzutao/junction/compare/v0.1.3...v0.1.4 diff --git a/Cargo.toml b/Cargo.toml index 9b6bbfc6..de93f597 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "junction" -version = "0.2.1" # Also update `html_root_url` in lib.rs +version = "1.0.0" # Also update `html_root_url` in lib.rs authors = ["Lzu Tao "] categories = ["api-bindings", "os::windows-apis"] documentation = "https://docs.rs/junction/*/x86_64-pc-windows-msvc/junction/" diff --git a/README.md b/README.md index 495267da..2917708e 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ Library for working with NTFS junctions. [![Documentation](https://docs.rs/junction/badge.svg)](https://docs.rs/junction) [![Crates.io](https://img.shields.io/crates/v/junction.svg)](https://crates.io/crates/junction) -### Supported Rust versions +### Minimal Supported Rust versions -Latest stable +1.48.0 ## All relevant references diff --git a/src/internals.rs b/src/internals.rs index a8a43dde..71b03863 100644 --- a/src/internals.rs +++ b/src/internals.rs @@ -20,8 +20,9 @@ const _: () = { use std::alloc::Layout; let std_layout = Layout::new::(); let winapi_layout = Layout::new::(); - assert!(std_layout.size() == winapi_layout.size()); - assert!(std_layout.align() == winapi_layout.align()); + // MSVR(Rust v1.57): use assert! instead + [(); 1][!(std_layout.size() == winapi_layout.size()) as usize]; + [(); 1][!(std_layout.align() == winapi_layout.align()) as usize]; }; /// This prefix indicates to NTFS that the path is to be treated as a non-interpreted @@ -141,14 +142,12 @@ pub fn get_target(junction: &Path) -> io::Result { if rdb.reparse_tag == IO_REPARSE_TAG_MOUNT_POINT { let offset = rdb.reparse_buffer.substitute_name_offset / WCHAR_SIZE; let len = rdb.reparse_buffer.substitute_name_length / WCHAR_SIZE; - let mut wide = unsafe { + let wide = unsafe { let buf = rdb.reparse_buffer.path_buffer.as_ptr().add(offset as usize); slice::from_raw_parts(buf, len as usize) }; // In case of "\??\C:\foo\bar" - if wide.starts_with(&NON_INTERPRETED_PATH_PREFIX) { - wide = &wide[(NON_INTERPRETED_PATH_PREFIX.len())..]; - } + let wide = wide.strip_prefix(&NON_INTERPRETED_PATH_PREFIX).unwrap_or(wide); Ok(PathBuf::from(OsString::from_wide(wide))) } else { Err(io::Error::new(io::ErrorKind::Other, "not a reparse tag mount point")) diff --git a/src/lib.rs b/src/lib.rs index 038c5b23..5f86f792 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,7 @@ if the directory `D:\SYMLINK` specified `C:\WINNT\SYSTEM32` as its target, then an application accessing `D:\SYMLINK\DRIVERS` would in reality be accessing `C:\WINNT\SYSTEM32\DRIVERS`. */ -#![doc(html_root_url = "https://docs.rs/junction/0.2.1")] +#![doc(html_root_url = "https://docs.rs/junction/~1")] #![cfg(windows)] #![deny(rust_2018_idioms)]