Skip to content

Fix stability of compare_strings_ascii#823

Merged
lhecker merged 1 commit intomainfrom
dev/lhecker/ascii-sort
Apr 27, 2026
Merged

Fix stability of compare_strings_ascii#823
lhecker merged 1 commit intomainfrom
dev/lhecker/ascii-sort

Conversation

@lhecker
Copy link
Copy Markdown
Member

@lhecker lhecker commented Apr 27, 2026

Closes #822

Comment thread crates/edit/src/icu.rs
// case-insensitive equal, because then we use that as a fallback.
while let Some((&a, &b)) = iter.next() {
if a != b {
let mut order = a.cmp(&b);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value for order must always be la.cmp(&lb) (high weight: case-insensitive). Only if it's Equal must it fall back to a.cmp(&b) (low weight: case-sensitive).

@lhecker lhecker requested a review from DHowett April 27, 2026 19:05
@lhecker lhecker enabled auto-merge (squash) April 27, 2026 19:27
@lhecker lhecker closed this Apr 27, 2026
auto-merge was automatically disabled April 27, 2026 19:27

Pull request was closed

@lhecker lhecker reopened this Apr 27, 2026
@lhecker lhecker enabled auto-merge (squash) April 27, 2026 19:28
@lhecker lhecker merged commit 2bb7c10 into main Apr 27, 2026
10 checks passed
@lhecker lhecker deleted the dev/lhecker/ascii-sort branch April 27, 2026 19:31
@DHowett
Copy link
Copy Markdown
Member

DHowett commented Apr 27, 2026

@lhecker how on earth did this fix a crash in the file picker

@lhecker
Copy link
Copy Markdown
Member Author

lhecker commented Apr 27, 2026

@DHowett Rust detects non-deterministic sorters at runtime. This bug caused vmlinuz2 < w32process.ps1 < Willkommen, but also vmlinuz2 > Willkommen, which is impossible.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit crashes in the file picker

2 participants