Skip to content

Draft: Path::is_normalized and is_lexically_bounded#152740

Draft
MikkelPaulson wants to merge 2 commits intorust-lang:mainfrom
MikkelPaulson:path_normalize
Draft

Draft: Path::is_normalized and is_lexically_bounded#152740
MikkelPaulson wants to merge 2 commits intorust-lang:mainfrom
MikkelPaulson:path_normalize

Conversation

@MikkelPaulson
Copy link

@MikkelPaulson MikkelPaulson commented Feb 17, 2026

Draft proposal for #134694. See parent task for discussion.

  • Update normalize_lexically to be infallible and return Cow
  • Add (for discussion) is_normalized to shortcut the distinction between Cow::Borrowed and Cow::Owned
  • Add (for discussion) is_lexically_bounded to broadly handle the use case of the Result previously returned by normalize_lexically

To do (if the draft is approved):

  • add unit tests, and move some of the excessive doctests there
  • add tests for non-Unix environments, and fix the inevitable bugs therefrom
  • clean up is_normalized, including Const path separators libs-team#744
    • some logic from is_normalized may need to be moved to Components to keep things from being too brittle

Draft proposal for rust-lang#134694.

* Update `normalize_lexically` to be infallible and return `Cow`
* Add (for discussion) `is_normalized` to shortcut the distinction
  between `Cow::Borrowed` and `Cow::Owned`
* Add (for discussion) `is_lexically_bounded` to broadly handle the use
  case of the `Result` previously returned by `normalize_lexically`

TODO: doctests are handled (maybe excessively), but unit tests are needed
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 17, 2026
@rust-log-analyzer

This comment has been minimized.

Update behaviour of Path::is_lexically_bounded to consider the working
directory unbounded, as promised by the doc comment description but not
by the doctest.
@rust-log-analyzer
Copy link
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
fmt: checked 6703 files
tidy check
tidy [rustdoc_json (src)]: `rustdoc-json-types` modified, checking format version
tidy: Skipping binary file check, read-only filesystem
tidy [style (library)]: /checkout/library/std/src/path.rs:3361: TODO is used for tasks that should be done before merging a PR; If you want to leave a message in the codebase use FIXME
tidy [style (library)]: /checkout/library/std/src/path.rs:3389: TODO is used for tasks that should be done before merging a PR; If you want to leave a message in the codebase use FIXME
tidy [style (library)]: /checkout/library/std/src/path.rs:3413: TODO is used for tasks that should be done before merging a PR; If you want to leave a message in the codebase use FIXME
tidy [style (library)]: FAIL
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (25.3)
Collecting pip
---
info: ES-Check: there were no ES version matching errors!  🎉
typechecking javascript files
tidy: The following check failed: style (library)
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy --root-path=/checkout --cargo-path=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo --output-dir=/checkout/obj/build --concurrency=4 --npm-path=/node/bin/yarn --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1612:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1365:29

Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:02:54
  local time: Tue Feb 17 04:57:33 UTC 2026
  network time: Tue, 17 Feb 2026 04:57:33 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 4, 2026

☔ The latest upstream changes (presumably #153377) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants