From a4700c7aa8987eee11184c642d30a453ad72c777 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 4 Feb 2025 14:47:35 -0600 Subject: [PATCH 1/2] Fix tests on nightly (#1999) Ensure that `PartialOrd` and `Ord` implementations for `Alignment` are the same instead of having one be manual and one be derived. This is required to account for a small behavior change in nightly Rust. --- crates/wit-parser/src/sizealign.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/wit-parser/src/sizealign.rs b/crates/wit-parser/src/sizealign.rs index f73dd9e88a..35fc2334a1 100644 --- a/crates/wit-parser/src/sizealign.rs +++ b/crates/wit-parser/src/sizealign.rs @@ -1,4 +1,5 @@ use std::{ + cmp::Ordering, num::NonZeroUsize, ops::{Add, AddAssign}, }; @@ -6,7 +7,7 @@ use std::{ use crate::{FlagsRepr, Int, Resolve, Type, TypeDef, TypeDefKind}; /// Architecture specific alignment -#[derive(Eq, PartialEq, PartialOrd, Clone, Copy)] +#[derive(Eq, PartialEq, Clone, Copy)] pub enum Alignment { /// This represents 4 byte alignment on 32bit and 8 byte alignment on 64bit architectures Pointer, @@ -29,11 +30,17 @@ impl std::fmt::Debug for Alignment { } } +impl PartialOrd for Alignment { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + impl Ord for Alignment { /// Needed for determining the max alignment of an object from its parts. /// The ordering is: Bytes(1) < Bytes(2) < Bytes(4) < Pointer < Bytes(8) /// as a Pointer is either four or eight byte aligned, depending on the architecture - fn cmp(&self, other: &Self) -> std::cmp::Ordering { + fn cmp(&self, other: &Self) -> Ordering { match (self, other) { (Alignment::Pointer, Alignment::Pointer) => std::cmp::Ordering::Equal, (Alignment::Pointer, Alignment::Bytes(b)) => { From c8b9f909da83c193afdd3cb142a65f3732ad7bb3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 4 Feb 2025 15:17:32 -0800 Subject: [PATCH 2/2] Pin CI module --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7de8c5348c..72462c24bc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,7 @@ jobs: with: submodules: true - uses: ./.github/actions/install-rust - - uses: bytecodealliance/wasmtime/.github/actions/binary-compatible-builds@main + - uses: bytecodealliance/wasmtime/.github/actions/binary-compatible-builds@release-28.0.0 with: name: ${{ matrix.build }} if: matrix.build != 'wasm32-wasip1'