Skip to content

dirfd dir operations (3/4) - #160533

Open
Qelxiros wants to merge 1 commit into
rust-lang:mainfrom
Qelxiros:dirfd-dirs
Open

dirfd dir operations (3/4)#160533
Qelxiros wants to merge 1 commit into
rust-lang:mainfrom
Qelxiros:dirfd-dirs

Conversation

@Qelxiros

@Qelxiros Qelxiros commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

View all comments

Previous PR: #150679
Reference: #139514
Tracking issue: #120426

@rustbot

rustbot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Any special-casing of Miri in the standard library requires review.

cc @rust-lang/miri

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 4, 2026
@rustbot

rustbot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from 6 candidates

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Comment thread library/std/src/sys/fs/unix/dir.rs Outdated
Comment thread library/std/src/fs.rs
Comment thread library/std/src/sys/fs/unix/dir.rs

@Mark-Simulacrum Mark-Simulacrum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

r=me with a few comments answered/nits addressed

View changes since this review

Comment thread library/std/src/sys/fs/unix/dir.rs Outdated
Comment thread library/std/src/fs.rs
///
/// # Errors
///
/// This function will return an error if `path` does not point to an existing directory.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we follow symlinks, right? Should we note that here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We do follow them, but I don't think we need to note it. Dir::open and File::open (and maybe others) also follow symlinks without documenting that fact. If we decide that we should note it, that's a follow-up PR.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 8, 2026
@rustbot

rustbot commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@Qelxiros

Qelxiros commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot r=@Mark-Simulacrum

@Qelxiros

Qelxiros commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 9, 2026
@Mark-Simulacrum

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 354d65e has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 9, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 9, 2026
…crum

dirfd dir operations (3/4)

Previous PR: rust-lang#150679
Reference: rust-lang#139514
Tracking issue: rust-lang#120426
rust-bors Bot pushed a commit that referenced this pull request Aug 10, 2026
Rollup of 7 pull requests

Successful merges:

 - #160533 (dirfd dir operations (3/4))
 - #160675 (bootstrap: Remove `PATH_REMAP` from command-line selector handling )
 - #160807 (Update rustc crate rkyv to 0.8.18)
 - #160560 (Add nightly-only support for Cargo unremap trim-paths files in `rust-gdb`)
 - #160804 (Change .expect message on net/parser to follow precondition style)
 - #160805 (`extern "custom"`: add tests)
 - #160816 (Mark const ptr methods and free functions as inline(always) to match *mut)
@jhpratt

jhpratt commented Aug 10, 2026

Copy link
Copy Markdown
Member

@bors r- #160823 (comment)

failures:

---- fs::tests::test_dir_create_dir stdout ----

thread 'fs::tests::test_dir_create_dir' (11204) panicked at library\std\src\fs\tests.rs:2753:5:
dir.create_dir("foo") failed with: creating or truncating a file requires write or append access
---- fs::tests::test_dir_create_dir stdout end ----
---- fs::tests::test_dir_open_dir stdout ----

thread 'fs::tests::test_dir_open_dir' (8216) panicked at library\std\src\fs\tests.rs:2761:5:
dir1.create_dir("foo") failed with: creating or truncating a file requires write or append access
---- fs::tests::test_dir_open_dir stdout end ----

failures:
    fs::tests::test_dir_create_dir
    fs::tests::test_dir_open_dir

test result: FAILED. 386 passed; 2 failed; 10 ignored; 0 measured; 0 filtered out; finished in 18.23s

error: test failed, to rerun pass `-p std --lib`
Bootstrap failed while executing `test --stage 2 --skip=compiler --skip=src --skip=src/tools/linkchecker`
Currently active steps:
test::Crate { build_compiler: Compiler { stage: 2, host: aarch64-pc-windows-msvc, forced_compiler: false }, target: aarch64-pc-windows-msvc, mode: Std, crates: ["alloc", "alloctests", "compiler_builtins", "core", "coretests", "panic_abort", "panic_unwind", "proc_macro", "rustc-std-workspace-core", "std", "std_detect", "sysroot", "test", "unwind"] } at src\bootstrap\src\core\build_steps\test.rs:3378
Build completed unsuccessfully in 1:31:30
make: *** [Makefile:115: ci-msvc-py] Error 1
  local time: Mon Aug 10 03:17:26 CUT 2026
  network time: Mon, 10 Aug 2026 03:17:26 GMT
##[error]Process completed with exit code 2.
##[group]Run echo "disk usage:"
echo "disk usage:"

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 10, 2026
@rust-bors

rust-bors Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#160823), which was unapproved.

View changes since this unapproval

@@ -87,6 +93,22 @@ impl Dir {
self.rename_native(&from, to_dir, &to, is_dir)
}

pub fn create_dir(&self, path: &Path) -> io::Result<()> {
let mut opts = OpenOptions::new();
opts.create_new(true);

@asder8215 asder8215 Aug 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it's preferable to chain this and write it as:

let opts = OpenOptions::new().read(true)
    .write(true)
    .create_new(true);

@Qelxiros

Copy link
Copy Markdown
Contributor Author

@rustbot ready
I'd love a try job for the windows tests before this gets approved again.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants