Skip to content

Expand docs for fs::metadata and fs::symlink_metadata - #159804

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
schneems:schneems/symlink_metadata_docs
Jul 27, 2026
Merged

Expand docs for fs::metadata and fs::symlink_metadata#159804
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
schneems:schneems/symlink_metadata_docs

Conversation

@schneems

Copy link
Copy Markdown
Contributor

Several changes:

Link symlink_metadata from metadata

Someone reading metadata likely wants easy/quick access to symlink_metadata as well. Since this explicitly documents that it does follow symlinks, it made sense to leave a note stating how to perform the same action without that behavior.

Add symbolic link note to errors

It's intuitive that you cannot return the Metadata of a resolved file if the file could not be resolved. But it's not always obvious. Since we're stating "the path does not exist" (also an obvious case). It will help to have this gentle reminder.

Explicit behavior of directories and files in symlink_metadata

Reading the documentation, it was unclear whether symlink_metadata would also work on files and directories. I guessed it would, but it's nice to call it out. The wording also gave me an opportunity to cross-link to metadata so someone can easily jump back and forth between them.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 23, 2026
@schneems schneems changed the title Expand fs::metadata/fs::symlink_metadata behavior Expand docs for fs::metadata and fs::symlink_metadata Jul 23, 2026
Several changes:

## Link `symlink_metadata` from `metadata`

Someone reading `metadata` likely wants easy/quick access to `symlink_metadata` as well. Since this explicitly documents that it does follow symlinks, it made sense to leave a note stating how to perform the same action without that behavior.

## Add symbolic link note to errors

It's intuitive that you cannot return the `Metadata` of a resolved file if the file could not be resolved. But it's not always obvious. Since we're stating "the path does not exist" (also an obvious case). It will help to have this gentle reminder.

## Explicit behavior of directories and files in `symlink_metadata`

Reading the documentation, it was unclear whether `symlink_metadata` would also work on files and directories. I guessed it would, but it's nice to call it out. The wording also gave me an opportunity to cross-link to `metadata` so someone can easily jump back and forth between them.
@schneems
schneems force-pushed the schneems/symlink_metadata_docs branch from b613739 to bb3fba0 Compare July 24, 2026 03:08
@schneems
schneems marked this pull request as ready for review July 24, 2026 03:09
@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 Jul 24, 2026
@rustbot

rustbot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

r? @aapoalas

rustbot has assigned @aapoalas.
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

@joshtriplett

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

📌 Commit bb3fba0 has been approved by joshtriplett

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

Reason for tree closure: spurious failures

@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 Jul 27, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 27, 2026
…_docs, r=joshtriplett

Expand docs for fs::metadata and fs::symlink_metadata

Several changes:

## Link `symlink_metadata` from `metadata`

Someone reading `metadata` likely wants easy/quick access to `symlink_metadata` as well. Since this explicitly documents that it does follow symlinks, it made sense to leave a note stating how to perform the same action without that behavior.

## Add symbolic link note to errors

It's intuitive that you cannot return the `Metadata` of a resolved file if the file could not be resolved. But it's not always obvious. Since we're stating "the path does not exist" (also an obvious case). It will help to have this gentle reminder.

## Explicit behavior of directories and files in `symlink_metadata`

Reading the documentation, it was unclear whether `symlink_metadata` would also work on files and directories. I guessed it would, but it's nice to call it out. The wording also gave me an opportunity to cross-link to `metadata` so someone can easily jump back and forth between them.
rust-bors Bot pushed a commit that referenced this pull request Jul 27, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #158417 (Avoid ICE when cfg_eval recovers no item from derive input)
 - #159085 (Fix decoding attributes of `SyntheticCoroutineBody`)
 - #159554 (feat: Update method signature of int_from_ascii)
 - #159637 (Some place analysis tweaks)
 - #159649 (Normalize region obligations before regionck)
 - #159961 (sanitize_standard_fds: Miri supports poll now)
 - #159967 (rustc_target: callconv: mips64: Return structs with single f128 in FPRs)
 - #159253 (Add suggestions for using `#[export_name]` instead of `#[link_name]` on static)
 - #159804 (Expand docs for fs::metadata and fs::symlink_metadata)
 - #159821 (Update expect message using the recommended style in binary_heap module)
 - #159840 (Fix opaque type ICE in late lints under the next-generation trait solver)
 - #159956 (Fix observable intermediate state in `thread::add_spawn_hook`)
 - #159991 (std: make send_process_group_signal unsupported on VxWorks)
 - #159996 (Detect when a macro without exclamation mark uses square brackets)
@rust-bors
rust-bors Bot merged commit 65804b2 into rust-lang:main Jul 27, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 27, 2026
rust-timer added a commit that referenced this pull request Jul 27, 2026
Rollup merge of #159804 - schneems:schneems/symlink_metadata_docs, r=joshtriplett

Expand docs for fs::metadata and fs::symlink_metadata

Several changes:

## Link `symlink_metadata` from `metadata`

Someone reading `metadata` likely wants easy/quick access to `symlink_metadata` as well. Since this explicitly documents that it does follow symlinks, it made sense to leave a note stating how to perform the same action without that behavior.

## Add symbolic link note to errors

It's intuitive that you cannot return the `Metadata` of a resolved file if the file could not be resolved. But it's not always obvious. Since we're stating "the path does not exist" (also an obvious case). It will help to have this gentle reminder.

## Explicit behavior of directories and files in `symlink_metadata`

Reading the documentation, it was unclear whether `symlink_metadata` would also work on files and directories. I guessed it would, but it's nice to call it out. The wording also gave me an opportunity to cross-link to `metadata` so someone can easily jump back and forth between them.
@schneems

Copy link
Copy Markdown
Contributor Author

Thank you!

pull Bot pushed a commit to xtqqczze/rust-lang-miri that referenced this pull request Jul 28, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#158417 (Avoid ICE when cfg_eval recovers no item from derive input)
 - rust-lang/rust#159085 (Fix decoding attributes of `SyntheticCoroutineBody`)
 - rust-lang/rust#159554 (feat: Update method signature of int_from_ascii)
 - rust-lang/rust#159637 (Some place analysis tweaks)
 - rust-lang/rust#159649 (Normalize region obligations before regionck)
 - rust-lang/rust#159961 (sanitize_standard_fds: Miri supports poll now)
 - rust-lang/rust#159967 (rustc_target: callconv: mips64: Return structs with single f128 in FPRs)
 - rust-lang/rust#159253 (Add suggestions for using `#[export_name]` instead of `#[link_name]` on static)
 - rust-lang/rust#159804 (Expand docs for fs::metadata and fs::symlink_metadata)
 - rust-lang/rust#159821 (Update expect message using the recommended style in binary_heap module)
 - rust-lang/rust#159840 (Fix opaque type ICE in late lints under the next-generation trait solver)
 - rust-lang/rust#159956 (Fix observable intermediate state in `thread::add_spawn_hook`)
 - rust-lang/rust#159991 (std: make send_process_group_signal unsupported on VxWorks)
 - rust-lang/rust#159996 (Detect when a macro without exclamation mark uses square brackets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

4 participants