Skip to content

std::PathBuff::join("/some/path") overrides the original path in the resulting PathBuf #59726

Open
@aruiz

Description

@aruiz

When join's argument start's with "/" then join overrides any path present in &self making this code valid:

let foo = PathBuf::new("/hello");
assert_eq!(foo.join("/world"), PathBuf::new("/world));

This is not documented and generates a lot of confusion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`C-enhancementCategory: An issue proposing an enhancement or a PR with one.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