Skip to content

Doc of std::fs::canonicalize does not correspond to behavior #54056

@mrclmh

Description

@mrclmh

The doc for canonicalize state that the function will return an error if a component in a path is not a directory.

Using canonicalize on a path with a file component does not return an error for me, e.g.

fs::canonicalize("./src/../Cargo.toml").unwrap();

works without error.

Meta

rustc 1.28.0 (9634041 2018-07-30)
binary: rustc
commit-hash: 9634041
commit-date: 2018-07-30
host: x86_64-apple-darwin
release: 1.28.0
LLVM version: 6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions