Draft
Conversation
5b4bec6 to
d2993fc
Compare
This was referenced Feb 15, 2025
d85c389 to
1ca5737
Compare
1ca5737 to
ba0d77b
Compare
Contributor
|
edit: nvm I missed that this actually attaches the path to the error. Didn't realize you could do that and still return a |
9011a9a to
2803c79
Compare
2803c79 to
37d51cd
Compare
2e6fbb3 to
c9df86b
Compare
Contributor
|
debian trixie has released with rust 1.85, though IIRC one of the other popular distro (centos or fedora, I can't remember) still on 1.84 |
429443f to
c87ede0
Compare
I'm testing specific compiler versions, not the MSRV. This seems to be the easiest way to do this reliably. I've also changed the cargo config to by-default allow incompatible versions. That way, people running `cargo test` locally will get the latest dependencies instead of outdated dependencies. I expect anyone working on tempfile to use the latest compiler anyways. Also, auto-detect MSRV
Otherwise it's really easy to pass a temporary file handle by reference, causing it to be dropped by the receiver deleting the underlying file. fixes #115
1. Default to "tmp" as the file prefix instead of ".tmp". 2. Make it possible to construct the builder in a constfn. 3. Use a single lifetime in the builder.
That way, we can pass through additional builder options. This new struct implements AsRef<Path> and Deref<Target=Path> so breakage should be minimal.
Cursors are stable in rust as of 1.79. This change lets us keep a global scratch file behind a Mutex.
c87ede0 to
9dbdde8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a stack of changes for tempfile v4. My plan is to wait for the next Debian stable release then set the MSRV to that, although I may merge and cut an RC before then. This version tries to be minimally breaking in "normal" code but it will still break some code (ideally code that was already broken/buggy).
Other than the MSRV bump (letting us drop
once_cell), changes include:AsRef<Path>on&NamedTempFile(and friends) instead of directly onNamedTempFile. That way, functions acceptingAsRef<Path>won't be able to take (then drop)NamedTempFileby value. See Got bitten by Drop impl running to early when passing TempDir to fn(p: impl AsRef<Path>) #115..by default. Temporary files shouldn't generally be hidden. Additionally, it's now possible to configure the default temporary-filename prefix via theenvpackage.Buildercan now has a single lifetime instead of separate ones forprefixandsuffix. It can also be constructed with a constBuilder::newif desired.Builder::makeused to take a&Pathbut now takes an&MakeParamsstruct (that dereferences to a&Path). This lets us pass additional builder parameters like the desired permissions.TempDir::into_pathis removed in favor ofTempDir::keep.SpooledTempDir::newis now const.tempfile::env::temp_dir()now returns a result and won't panic on platforms wherestd::env::temp_dirwould panic.TBD:
+t(sticky)? We can also make it configurable in the builder, the question will be: what's the default behavior?Fixes:
Builder(orcreate_helper) to check that the suppliedprefixandsuffixdon't contain/#59