Skip to content

Clarify behavior of std::fs::hard_link when second path already exists. #130117

Closed
@geeklint

Description

@geeklint

Location

Documentation of the std::fs::hard_link function, e.g. https://doc.rust-lang.org/std/fs/fn.hard_link.html

Summary

The function currently doesn't specify what happens if the second parameter (link / "the destination") already exists.

The note for unix systems and linux's man pages lead me to believe it will return an error in this case, but I don't think one should have to read linux man pages to determine the behavior of a rust function and it's not obvious if this is the intended rust behavior across platforms or if the behavior would be platform-specific.

Assuming it's not platform-specific, I think it'd be sufficient to add a bullet point to the # Errors section as a second documented error case.

Metadata

Metadata

Assignees

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-filesystemArea: `std::fs`C-bugCategory: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions