Skip to content

std::path::Component makes platform specific assumptions; cannot be extended #18

Open
@ids1024

Description

The Component enum includes a Prefix variant that only appears on Windows, which is not ideal. Optimally, OS specific functionality should not be exposed on other OSs. Worse, operating systems with paths that are noticeably different from Unix and Windows cannot be represented by this enum.

This has been an issue for Redox OS, which includes "schemes" in paths, like file:/path/to/file and sys:uname. We haven't been able to add a variant to the enum, since this would be a breaking change (by breaking exhaustive match statements).

Resolving this without breaking backwards compatibility is problematic. Making the enum non-exhaustive and adding new variants presumably would not possible for a future edition of Rust (it would break the ABI of the enum, and there is no sane way to automatically fix exhaustive matches).

I guess that just leaves deprecating Component, and adding a better alternative alongside it? This does seem like a genuine portability issue, and I'm sure Redox is not the only OS that would run into difficulty here, though I can't immediately think of any others.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions