`PartialOrd` doesn't work with new type
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với việc tái hiện trong crates/farmer/ab-proof-of-space-gpu/src/shader/sort_buckets.rs, đặc biệt là CustomPosition derive ở dòng 17 và phép so sánh ở dòng 80. So sánh đường dẫn PartialOrd được sinh ra cho CustomPosition với phép so sánh u32 trực tiếp, sau đó kiểm tra cách xử lý capability Int8 không mong muốn; được xem là hoàn tất khi các phép so sánh newtype biên dịch mà không yêu cầu Int8.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have the following trivial new type:
#[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, PartialEq, From, Into)]
pub struct CustomPosition(u32);
When trying to compare two values of this type, I'm getting an error:
error: `i8` type used without `OpCapability Int8`
|
note: used from within `<u32 as core::cmp::PartialOrd>::partial_cmp`
--> /home/nazar-pc/.rustup/toolchains/nightly-2025-06-23-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:1989:5
|
1989 | ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: called by `<ab_proof_of_space_gpu::shader::sort_buckets::CustomPosition as core::cmp::PartialOrd>::partial_cmp`
--> crates/farmer/ab-proof-of-space-gpu/src/shader/sort_buckets.rs:17:35
|
17 | #[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, PartialEq, From, Into)]
| ^^^^^^^^^^
note: called by `<ab_proof_of_space_gpu::shader::sort_buckets::CustomPosition as core::cmp::PartialOrd>::le`
--> /home/nazar-pc/.rustup/toolchains/nightly-2025-06-23-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:1403:14
|
1403 | self.partial_cmp(other).is_some_and(Ordering::is_le)
| ^^^^^^^^^^^^^^^^^^
note: called by `ab_proof_of_space_gpu::shader::sort_buckets::perform_compare_swap`
--> crates/farmer/ab-proof-of-space-gpu/src/shader/sort_buckets.rs:80:32
|
80 | let (smaller, larger) = if a <= b { (a, b) } else { (b, a) };
| ^^^^^^
At the same time, comparison of u32 directly works fine and doesn't require Int8 capability.
While this is likely related to discussion in https://github.com/Rust-GPU/rust-gpu/issues/307, I think it is distinct enough to be reported separately.
- Ngôn ngữ chính
- Rust
- Star
- 3.4k
- Fork
- 126
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Rust-GPU/rust-gpu
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
enhancement
Rust-GPU/rust-gpu#643 · 3 bình luận · 1 reaction · 1 người được giao ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
-
async functions cause ICE Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Tất cả issue của Rust-GPU/rust-gpu
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
ontola/atomic-server#1625 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
VirusTotal/yara-x#777 ·
-
has_tail_capacity wraps and get_writable_raw_unchecked commits raw_len before the bounds check Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
stratum-mining/stratum#2404 ·
-
bug ci good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100