Use float total_cmp instead of partial_cmp to get a total order.#2651
Merged
hecrj merged 1 commit intoiced-rs:masterfrom Oct 28, 2024
Merged
Use float total_cmp instead of partial_cmp to get a total order.#2651hecrj merged 1 commit intoiced-rs:masterfrom
hecrj merged 1 commit intoiced-rs:masterfrom
Conversation
Since Rust version 1.81, sort_by will panic if the provided comparison function does not implement a total order. See https://github.com/rust/lang/rust/issues/129561 for more details. The simplest fix seems to be to use total_cmp instead of partial_cmp.
1 task
mmaechtel
added a commit
to mmaechtel/X-Addon-Oxide
that referenced
this pull request
Feb 23, 2026
Backport of iced-rs/iced#2651 (merged into iced 0.14). Since Rust 1.81, sort_by() panics when the comparator violates total ordering. iced_graphics 0.13's damage::group() uses partial_cmp() on f32 distances with unwrap_or(Equal), which breaks transitivity when NaN values appear. This crashes the app on the tiny_skia fallback renderer path (GL backend / Wayland dmabuf failures). Fix: replace partial_cmp().unwrap_or(Equal) with total_cmp() in patches/iced_graphics/src/damage.rs (line 53-55). This is the exact same fix as upstream PR #2651. The patched crate is vendored under patches/iced_graphics/ and referenced via [patch.crates-io] in the workspace Cargo.toml. Remove this patch when upgrading to iced 0.14+. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 tasks
mmaechtel
added a commit
to mmaechtel/X-Addon-Oxide
that referenced
this pull request
Feb 23, 2026
Backport of iced-rs/iced#2651 (merged into iced 0.14). Since Rust 1.81, sort_by() panics when the comparator violates total ordering. iced_graphics 0.13's damage::group() uses partial_cmp() on f32 distances with unwrap_or(Equal), which breaks transitivity when NaN values appear. This crashes the app on the tiny_skia fallback renderer path (GL backend / Wayland dmabuf failures). Fix: replace partial_cmp().unwrap_or(Equal) with total_cmp() in patches/iced_graphics/src/damage.rs (line 53-55). This is the exact same fix as upstream PR #2651. The patched crate is vendored under patches/iced_graphics/ and referenced via [patch.crates-io] in the workspace Cargo.toml. Remove this patch when upgrading to iced 0.14+. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since Rust version 1.81, sort_by will panic if the provided comparison function does not implement a total order.
See rust-lang/rust#129561 for more details. Fixes #2650, and potentially addresses pop-os/cosmic-epoch#1016
I ran
cargo testandcargo clippy