Skip to content

Set modified#84

Merged
andrewhickman merged 4 commits intoandrewhickman:mainfrom
reillysiemens:set-modified
Dec 24, 2025
Merged

Set modified#84
andrewhickman merged 4 commits intoandrewhickman:mainfrom
reillysiemens:set-modified

Conversation

@reillysiemens
Copy link
Copy Markdown
Contributor

@reillysiemens reillysiemens commented Dec 21, 2025

Forgive me if I've missed something rather major, but I think this will resolve #54 if I've done it correctly. I went ahead and did File::set_times as well because it seemed related, but didn't make set_modified a pass through to set_times like std::fs because I think this way the error message is improved.

I didn't add the corresponding methods for tokio because they don't (yet) exist in tokio itself. This was mentioned in tokio-rs/tokio#6368, but they're still waiting for a shift in MSRV before adding those methods. They're up to 1.71, but these methods weren't added until 1.75.

If MSRV is an issue for this crate it'd be a bummer, but totally understandable.

Copy link
Copy Markdown
Owner

@andrewhickman andrewhickman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crate uses autocfg to allow wrapping new methods without bumping the MSRV. Please could you gate the new methods so they only appear in Rust 1.75+?

@reillysiemens
Copy link
Copy Markdown
Contributor Author

Ah. I see that now. I wasn't familiar with autocfg before this. It's late here, but I'll happily fix that up tomorrow. Thanks for having a look.

@reillysiemens
Copy link
Copy Markdown
Contributor Author

@andrewhickman, I believe I've handled gating these methods to Rust 1.75 with autocfg correctly now. I didn't use #[cfg(rustc_1_75)] on the ErrorKind enum because I saw that other gated methods like lock and unlock don't have their respective ErrorKind::Lock and ErrorKind::Unlock variants gated.

Let me know if there's anything else I should do here.

Copy link
Copy Markdown
Owner

@andrewhickman andrewhickman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@reillysiemens
Copy link
Copy Markdown
Contributor Author

That latest failure is on me (and only slightly embarrassing). Looks like I forgot to apply autocfg to the imports?

@reillysiemens
Copy link
Copy Markdown
Contributor Author

Yeah, I believe that was the issue. I tested locally that this compiles now with

rustup toolchain install 1.40
cargo +1.40 check

and saw only unused variant lints for ErrorKind::SetTimes, ErrorKind::SetModified, ErrorKind::Lock, and ErrorKind::Unlock, which is expected with the current implementation.

I'm reasonably confident the CI should pass now. Please have another look when you're able and sorry for the trouble, @andrewhickman. Also, Happy Holidays! 🎄

@andrewhickman andrewhickman merged commit 2e5a971 into andrewhickman:main Dec 24, 2025
6 checks passed
@andrewhickman
Copy link
Copy Markdown
Owner

I've released version 3.2.2 with this change. Thanks again and happy holidays!

@reillysiemens reillysiemens deleted the set-modified branch December 24, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add wrapper for File.set_modified

2 participants