rust-lang / rust-lang/rust

Tracking Issue for `normalize_lexically`

Open
#134,694 53 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-tracking-issue I-libs-nominated T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

View all comments

Feature gate: #![feature(normalize_lexically)]

This is a tracking issue for Path::normalize_lexically that is used to normalize a path, including .. parent references, without touching the filesystem.

Public API
// std::path

impl Path {
    pub fn normalize_lexically(&self) -> Result<PathBuf, NormalizeError> {
}
Steps / History
Unresolved Questions
  • Should PathBuf have a method that normalizes in-place? Normalizing a path just removes components.
  • Should this disallow resolving to the empty path or the single . path.
  • Should this only allow paths without a root or prefix? It may be surprising that base_path.join(user_path.normalize_lexically()?) can still escape the base path.

The last two can be summarised as: should this strictly require paths to be sub-paths?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the public API for std::path::Path::normalize_lexically and read the linked API Change Proposal and implementation PR #134696. Review the unresolved questions about in-place normalization, empty or . results, and rooted or prefixed paths. Done means the design questions are resolved and the feature can proceed through the final comment period and stabilization PR.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.