Skip to content

Insufficiently precise documentation of std::file! macro #113044

Open
@JohnScience

Description

@JohnScience

Location

https://doc.rust-lang.org/std/macro.file.html

Summary

When describing properties of paths, it's useful to specify whether the given path is absolute or relative. After reading the documentation of std::file, which didn't mention whether it expands to absolute or relative path, I assumed (and rightly so!) that the path must be absolute. However, in my case it expanded to src/lib\nifti_image.rs, to a relative path with alternating component separators. Based on that, I assume that std::file expands to a path that is either

  • relative to manifest, regardless of the platform.
  • relative to manifest or absolute, depending on the platform.

Since it returns &str instead of OsStr, it would be weird if it would attempt to return absolute paths. However, this is not immediately obvious (to me).

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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions