-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(std): clarify remove_dir_all errors #105745
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon. Please see the contribution instructions for more information. |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
I'm a bit conflicted here. There are a number of other error cases documented at the linked functions. e.g. not being a directory, not having permissions to delete it and so on. Perhaps instead of that specific a note it should say something like ' |
Hm, that seems reasonable, but I'd want to draw particular attention to it failing if you try to delete a non-existent directory. Perhaps something like
|
I'd prefer to change the behavior instead, if possible. Currently, it appears like this function can easily fail if multiple threads/processes are deleting things. |
That would also be fine with me, but what would be the desired behaviour be in the cases of a) another thread/process deleting something that this function is about to delete and b) another thread/process creating something that this function is not aware of in its deletion? The answers to these seem like they might be difficult/OS-dependent. |
If the directory at
Accept
If something is created between the |
Seems reasonable to me. I'm not in a position to fix up the implementations, but I'm fine with someone else implementing that. |
rust-lang/libs-team#170 has been closed; if I understand correctly, T-libs-api doesn't want to make that change. So I think this documentation change is an improvement :) Can you change the documentation to what you suggested in #105745 (comment) ? r=me with that done. |
This comment has been minimized.
This comment has been minimized.
@rustbot review (hope I did this right!) |
Thanks! @bors r+ rollup |
docs(std): clarify remove_dir_all errors When using `remove_dir_all`, I assumed that the function was idempotent and that I could always call it to remove a directory if it existed. That's not the case and it bit me in production, so I figured I'd submit this to clarify the docs.
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#105745 (docs(std): clarify remove_dir_all errors) - rust-lang#106456 (Correct `std::prelude` comment) - rust-lang#106599 (Change memory ordering in System wrapper example) - rust-lang#110838 (More `Typefoldable`/`TypeVisitable` cleanups) - rust-lang#110851 (compiletest: emit assembly-output header in error) - rust-lang#110853 (compiletest: add bpf-linker assembly support) - rust-lang#110878 (Add `known-bug` tests for 4 unsound issues) - rust-lang#110886 (`DepGraph` cleanups) - rust-lang#110905 (Remove invalid value from scraped-examples.md) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
When using
remove_dir_all
, I assumed that the function was idempotent and that I could always call it to remove a directory if it existed. That's not the case and it bit me in production, so I figured I'd submit this to clarify the docs.