Skip to content

Tracking Issue for normalize_lexically #134694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 of 4 tasks
ChrisDenton opened this issue Dec 23, 2024 · 1 comment
Open
2 of 4 tasks

Tracking Issue for normalize_lexically #134694

ChrisDenton opened this issue Dec 23, 2024 · 1 comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@ChrisDenton
Copy link
Member

ChrisDenton commented Dec 23, 2024

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 this take &mut self and normalize 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?

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@ChrisDenton ChrisDenton added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Dec 23, 2024
jhpratt added a commit to jhpratt/rust that referenced this issue May 25, 2025
…=workingjubilee

Implement `normalize_lexically`

Implements rust-lang#134694

This is, I think, the most straightforward implementation I could do, which will hopefully more easily allow experimentation if we decide to change the design here.
jhpratt added a commit to jhpratt/rust that referenced this issue May 26, 2025
…=workingjubilee

Implement `normalize_lexically`

Implements rust-lang#134694

This is, I think, the most straightforward implementation I could do, which will hopefully more easily allow experimentation if we decide to change the design here.
rust-timer added a commit that referenced this issue May 26, 2025
Rollup merge of #134696 - ChrisDenton:normalize-lexically, r=workingjubilee

Implement `normalize_lexically`

Implements #134694

This is, I think, the most straightforward implementation I could do, which will hopefully more easily allow experimentation if we decide to change the design here.
@ChrisDenton
Copy link
Member Author

The basic implementation is now implemented in nightly if people would like to experiment.

github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this issue May 30, 2025
…=workingjubilee

Implement `normalize_lexically`

Implements rust-lang#134694

This is, I think, the most straightforward implementation I could do, which will hopefully more easily allow experimentation if we decide to change the design here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant