Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #50 +/- ##
=======================================
Coverage 98.27% 98.27%
=======================================
Files 11 11
Lines 753 755 +2
=======================================
+ Hits 740 742 +2
Misses 13 13
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR refines platform/MSRV handling for fs4 by (1) clarifying and centralizing the rationale for raw-handle/raw-fd usage at FFI boundaries, (2) tightening cfg gating so non-Unix/Windows targets can compile without the OS-backed extension APIs, and (3) strengthening CI’s MSRV coverage across feature flags.
Changes:
- Document and standardize the “single code path via
AsRaw*+Borrowed*::borrow_raw” approach for supported file wrapper types. - Gate
file_ext+ filesystem stat APIs tocfg(any(unix, windows))so unsupported targets build without those backends. - Update CI MSRV checking to validate feature-gated code paths via
cargo hack, with a separate MSRV track forasync-std/smol.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/windows.rs |
Adds rationale for using AsRawHandle at the FFI boundary to support multiple file wrapper types. |
src/unix.rs |
Documents why BorrowedFd::borrow_raw is used to keep one implementation across file types. |
src/unix/sync_impl.rs |
Adds cross-reference comment explaining BorrowedFd::borrow_raw choice in allocation path. |
src/unix/async_impl.rs |
Adds cross-reference comment explaining BorrowedFd::borrow_raw choice in allocation path. |
src/lib.rs |
Gates backend-dependent modules/APIs to Unix/Windows so non-backend targets can still compile. |
.github/workflows/ci.yml |
Expands MSRV checks to --each-feature and adds a separate MSRV job for async runtimes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
--no-default-featuresbuild: the stats API and feature re-exports now gate oncfg(any(unix, windows))sowasm32-wasip1compiles (rustix does not exposestatvfs/flock/fallocatethere); on WASI the crate reduces toFsStats+TryLockError.minrustnow runscargo hack check --each-featureat 1.75.0 (skippingasync-std/smol, which documented MSRV is higher), and a newminrust-asyncjob pins 1.85.0 to catch future drift inasync-std/smoltransitive deps.AsFd/AsHandlecleanup (declined):async_std::fs::File,smol::fs::File, and bothfs_err{2,3}::tokio::Filewrappers only exposeAsRawFd/AsRawHandleupstream. Splitting the macros into safe/raw variants would be churn without soundness benefit (reviewer already noted the existing lifetimes are fine). Added explanatory comments insrc/unix.rs,src/unix/{sync,async}_impl.rs, andsrc/windows.rsso this isn't re-opened.allow(unused_macros)socargo clippy --no-default-featuresno longer errors on the feature-gatedcfg_*!macros.github.com/al8n/fs4-rs→github.com/al8n/fs4(Cargo.tomlrepository, README badges/links).Test plan
cargo test --all-features -- --test-threads 1(90 passed)cargo clippy --all-features -- -Dwarningscargo clippy --no-default-features -- -Dwarnings(reproduced reported failure, now green)cargo clippy --no-default-features --features <each>for sync / async-std / tokio / smol / fs-err2 / fs-err3 / fs-err2-tokio / fs-err3-tokiocargo check --target wasm32-wasip1 --no-default-features(previously failed to compile)cargo check --target wasm32-wasip1 --no-default-features --features sync | fs-err2 | fs-err3cargo fmt --all -- --checkminrust(1.75.0, cargo-hack --skip async-std,smol) andminrust-async(1.85.0) jobs both pass