Skip to content

feat: providing PartialOrd<OsStr> for str#151567

Open
WrldEngine wants to merge 3 commits intorust-lang:mainfrom
WrldEngine:patch-1-kamran
Open

feat: providing PartialOrd<OsStr> for str#151567
WrldEngine wants to merge 3 commits intorust-lang:mainfrom
WrldEngine:patch-1-kamran

Conversation

@WrldEngine
Copy link

#19470

Make PartialOrd OsStr for str, issue was above

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 24, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 24, 2026

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@tgross35
Copy link
Contributor

#19470

Looks like this isn't the right issue link, that's from 2014

@WrldEngine
Copy link
Author

#19470

Looks like this isn't the right issue link, that's from 2014

I see this issue in comments

@tgross35
Copy link
Contributor

Please link it then, neither PartialOrd and OsStr show up in that thread from what I can see.

Removed comments about instability and coherence issues.
@WrldEngine
Copy link
Author

WrldEngine commented Jan 24, 2026

Please link it then, neither PartialOrd and OsStr show up in that thread from what I can see.

// FIXME (#19470): cannot provide PartialOrd<OsStr> for str until we
// have more flexible coherence rules.

This commented by Aaron Turon, maybe it is related issue

@tgross35
Copy link
Contributor

Oh, duh, I missed that. You can delete that comment.

Nominating as this is an insta-stable trait implementation:

@rustbot label +I-libs-api-nominated

@rustbot rustbot added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Jan 24, 2026
@WrldEngine
Copy link
Author

WrldEngine commented Jan 24, 2026

image

@tgross35 can you look at this please?

Looks like it is not direct error to this implementation, It is impls conflict, can it be serious problem for the review? Should I close this PR?

And with the addition of this tag (libs-api-nominated), should I expect more reviewers? Or not?

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] corebenches test:true 9.727
error[E0277]: can't compare `str` with `&str`
##[error]   --> alloctests/../alloc/src/collections/btree/set/tests.rs:540:32
    |
540 |             self.0.partial_cmp(&other.0)
    |                    ----------- ^^^^^^^^ no implementation for `str < &str` and `str > &str`
    |                    |
    |                    required by a bound introduced by this call
    |
    = help: the trait `PartialOrd<&str>` is not implemented for `str`
help: the following other types implement trait `PartialOrd<Rhs>`
   --> library/std/src/ffi/os_str.rs:1555:0
    |
    = note: `str` implements `PartialOrd<OsStr>`
   --> library/core/src/str/traits.rs:46:0
    |
    = note: `str` implements `PartialOrd`

For more information about this error, try `rustc --explain E0277`.
[RUSTC-TIMING] alloctests test:true 6.433
error: could not compile `alloctests` (lib test) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] alloctests test:true 16.629
[RUSTC-TIMING] coretests test:true 67.044
env -u RUSTC_WRAPPER CARGO_ENCODED_RUSTDOCFLAGS="-Csymbol-mangling-version=v0\u{1f}-Zannotate-moves\u{1f}-Zrandomize-layout\u{1f}-Zunstable-options\u{1f}--check-cfg=cfg(bootstrap)\u{1f}-Wrustdoc::invalid_codeblock_attributes\u{1f}--crate-version\u{1f}1.95.0-nightly\t(0c4fe2e7a\t2026-01-24)" CARGO_ENCODED_RUSTFLAGS="-Csymbol-mangling-version=v0\u{1f}-Zannotate-moves\u{1f}-Zrandomize-layout\u{1f}-Zunstable-options\u{1f}--check-cfg=cfg(bootstrap)\u{1f}-Zmacro-backtrace\u{1f}-Csplit-debuginfo=off\u{1f}-Clink-arg=-L/usr/lib/llvm-20/lib\u{1f}-Cllvm-args=-import-instr-limit=10\u{1f}-Clink-args=-Wl,-z,origin\u{1f}-Clink-args=-Wl,-rpath,$ORIGIN/../lib\u{1f}-Alinker-messages\u{1f}--cap-lints=allow\u{1f}--cfg\u{1f}randomized_layouts" RUSTC="/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif/dist/rustc-clif" RUSTDOC="/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif/dist/rustdoc-clif" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "test" "--manifest-path" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif/build/sysroot_tests/Cargo.toml" "--target-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif/build/sysroot_tests_target" "--locked" "--target" "aarch64-unknown-linux-gnu" "-p" "coretests" "-p" "alloctests" "--tests" "--" "-q" exited with status ExitStatus(unix_wait_status(25856))
Command `/checkout/obj/build/aarch64-unknown-linux-gnu/stage0/bin/cargo run -Zwarnings --target aarch64-unknown-linux-gnu -Zbinary-dep-depinfo -j 4 -Zroot-dir=/checkout --locked --color=always --profile=release --manifest-path /checkout/compiler/rustc_codegen_cranelift/build_system/Cargo.toml -- test --download-dir /checkout/obj/build/cg_clif_download --out-dir /checkout/obj/build/aarch64-unknown-linux-gnu/stage2-codegen/cg_clif --no-unstable-features --use-backend cranelift --sysroot llvm --skip-test testsuite.extended_sysroot [workdir=/checkout/compiler/rustc_codegen_cranelift]` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/test.rs:3867:25
Executed at: src/bootstrap/src/core/build_steps/test.rs:3912:26

Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `--stage 2 test --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest`
Build completed unsuccessfully in 0:26:12
  local time: Sat Jan 24 05:49:22 UTC 2026
  network time: Sat, 24 Jan 2026 05:49:23 GMT
##[error]Process completed with exit code 1.

@WrldEngine WrldEngine requested a review from tgross35 January 24, 2026 08:59
@WrldEngine WrldEngine closed this Jan 25, 2026
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 25, 2026
@WrldEngine WrldEngine reopened this Jan 25, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 25, 2026
@rust-log-analyzer
Copy link
Collaborator

The job pr-check-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
REPOSITORY                                   TAG       IMAGE ID       CREATED      SIZE
ghcr.io/dependabot/dependabot-updater-core   latest    354d02aa29ac   5 days ago   783MB
=> Removing docker images...
Deleted Images:
untagged: ghcr.io/dependabot/dependabot-updater-core:latest
untagged: ghcr.io/dependabot/dependabot-updater-core@sha256:596da3f22bcbdff2c96fd7126001278022c834c1621c5efa2ad1a7794590636c
deleted: sha256:354d02aa29acf525570c732b6e006ecf138de6d63ca525d552eb4b24880ddc6c
deleted: sha256:8b7af0e426bc2cbeeacfd96b8354d3b80016991520977197e62090e47abaede8
deleted: sha256:cadf11ef1de7fdd5eab563757942353684047f09b212dc99d6ed48e8acf34d62
deleted: sha256:569b0caf9d5285db44ccd2629a3470139eea755be423a33a54d8a24cb3926bfa
deleted: sha256:f9dc5feb048d8f9fd43137e3998f59e9acfbd76c47a4e14984d109654119e282
---
[RUSTC-TIMING] build_script_build test:false 0.183
error[E0277]: can't compare `str` with `String`
   --> /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/find-msvc-tools-0.1.5/src/find_tools.rs:888:29
    |
888 |                     && name > &version_file
    |                             ^ no implementation for `str < String` and `str > String`
    |
    = help: the trait `PartialOrd<String>` is not implemented for `str`
    = note: required for `&str` to implement `PartialOrd<&String>`
help: consider dereferencing both sides of the expression
    |
888 -                     && name > &version_file
888 +                     && *name > *version_file
    |

For more information about this error, try `rustc --explain E0277`.
[RUSTC-TIMING] find_msvc_tools test:false 0.619
error: could not compile `find-msvc-tools` (lib) due to 1 previous error

@tgross35 tgross35 removed the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Jan 26, 2026
@tgross35
Copy link
Contributor

I don't have a chance to take validate right now, but I'm guessing it might not auto-deref now that there are multiple possible implementations? You can ask on zulip to see if anyone has any ideas. Or change the part giving you the error and we can crater it.

If it winds up that we can't really change this, it would be worthwhile to update the comment with the new details.

Un-nominated until that issue can be figured out.

@tgross35
Copy link
Contributor

@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 26, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 26, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 26, 2026
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.

4 participants