diff --git a/crates/board/CHANGELOG.md b/crates/board/CHANGELOG.md index 66d5a45c..1724e944 100644 --- a/crates/board/CHANGELOG.md +++ b/crates/board/CHANGELOG.md @@ -13,6 +13,7 @@ ### Patch +- Use `derive-where` instead of `derivative` - Update dependencies - Remove workaround lint false positive diff --git a/crates/board/Cargo.lock b/crates/board/Cargo.lock index 62bdcb57..a7886495 100644 --- a/crates/board/Cargo.lock +++ b/crates/board/Cargo.lock @@ -227,14 +227,14 @@ dependencies = [ ] [[package]] -name = "derivative" -version = "2.2.0" +name = "derive-where" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.66", ] [[package]] @@ -738,7 +738,7 @@ dependencies = [ "ccm", "crypto-common", "defmt", - "derivative", + "derive-where", "digest", "ecdsa", "elliptic-curve", diff --git a/crates/board/Cargo.toml b/crates/board/Cargo.toml index 75cb2275..e8d06412 100644 --- a/crates/board/Cargo.toml +++ b/crates/board/Cargo.toml @@ -22,7 +22,7 @@ bytemuck = { version = "1.16.0", default-features = false, optional = true } ccm = { version = "0.5.0", default-features = false, optional = true } crypto-common = { version = "0.1.6", default-features = false, optional = true } defmt = { version = "0.3.8", default-features = false, optional = true } -derivative = { version = "2.2.0", default-features = false, features = ["use_core"] } +derive-where = { version = "1.2.7", default-features = false, features = ["nightly"] } digest = { version = "0.10.7", default-features = false, optional = true } ecdsa = { version = "0.16.9", default-features = false, optional = true } elliptic-curve = { version = "0.13.8", default-features = false, optional = true } diff --git a/crates/board/src/button.rs b/crates/board/src/button.rs index 9e15d5f3..41cbf868 100644 --- a/crates/board/src/button.rs +++ b/crates/board/src/button.rs @@ -17,14 +17,13 @@ //! A button is an input interface with 2 states: pressed and released. Buttons must support //! triggering events when changing state. Events may be enabled or disabled per button. -use derivative::Derivative; +use derive_where::derive_where; use crate::{Error, Id, Support}; /// Button event. #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Derivative)] -#[derivative(Debug(bound = ""), PartialEq(bound = ""), Eq(bound = ""))] +#[derive_where(Debug, PartialEq, Eq)] pub struct Event { /// The button that triggered the event. pub button: Id>, diff --git a/crates/board/src/lib.rs b/crates/board/src/lib.rs index 93900f53..fb1beca7 100644 --- a/crates/board/src/lib.rs +++ b/crates/board/src/lib.rs @@ -26,7 +26,7 @@ extern crate alloc; use core::marker::PhantomData; use core::ops::Deref; -use derivative::Derivative; +use derive_where::derive_where; use wasefire_error::Code; pub use wasefire_error::Error; @@ -151,8 +151,7 @@ pub trait Singleton: Sized { /// Events are de-duplicated if the previous one was not processed yet, because some events may /// trigger repeatedly. #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Derivative)] -#[derivative(Debug(bound = ""), PartialEq(bound = ""), Eq(bound = ""))] +#[derive_where(Debug, PartialEq, Eq)] pub enum Event { /// Button event. #[cfg(feature = "api-button")] @@ -186,11 +185,8 @@ pub enum Event { /// /// This type is useful when the type parameter `B` needs to be mentioned in an enum. This type can /// be destructed by calling its unreachable method. -#[derive(Derivative)] -#[derivative(Debug(bound = ""), Copy(bound = ""), Hash(bound = ""))] -#[derivative(PartialEq(bound = ""), Eq(bound = ""), Ord(bound = ""))] -#[derivative(Ord = "feature_allow_slow_enum")] -pub struct Impossible(Void, PhantomData); +#[derive_where(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +pub struct Impossible(!, PhantomData); #[cfg(feature = "defmt")] impl defmt::Format for Impossible { @@ -199,20 +195,6 @@ impl defmt::Format for Impossible { } } -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use Clone(bound = "") instead. -impl Clone for Impossible { - fn clone(&self) -> Self { - *self - } -} - -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use PartialOrd(bound = "") instead. -impl PartialOrd for Impossible { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - impl Impossible { /// Provides a static proof of dead code. pub fn unreachable(&self) -> ! { @@ -220,9 +202,6 @@ impl Impossible { } } -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] -enum Void {} - /// Button interface. #[cfg(feature = "api-button")] pub type Button = ::Button; @@ -271,9 +250,7 @@ pub type Uart = ::Uart; pub type Usb = ::Usb; /// Valid identifier for a countable API. -#[derive(Derivative)] -#[derivative(Debug(bound = ""), Copy(bound = ""), Hash(bound = ""))] -#[derivative(PartialEq(bound = ""), Eq(bound = ""), Ord(bound = ""))] +#[derive_where(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct Id + ?Sized> { // Invariant: value < T::SUPPORT value: usize, @@ -287,20 +264,6 @@ impl + ?Sized> defmt::Format for Id { } } -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use Clone(bound = "") instead. -impl + ?Sized> Clone for Id { - fn clone(&self) -> Self { - *self - } -} - -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use PartialOrd(bound = "") instead. -impl + ?Sized> PartialOrd for Id { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - impl> Id { /// Creates a safe identifier for an API with countable support. pub fn new(value: usize) -> Result { diff --git a/crates/board/src/timer.rs b/crates/board/src/timer.rs index d520666c..bfb97a0f 100644 --- a/crates/board/src/timer.rs +++ b/crates/board/src/timer.rs @@ -16,14 +16,13 @@ //! //! A timer triggers an event after a given amount of time (possibly periodically). -use derivative::Derivative; +use derive_where::derive_where; use crate::{Error, Id, Support}; /// Timer event. #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Derivative)] -#[derivative(Debug(bound = ""), PartialEq(bound = ""), Eq(bound = ""))] +#[derive_where(Debug, PartialEq, Eq)] pub struct Event { /// The timer that triggered the event. pub timer: Id>, diff --git a/crates/board/src/uart.rs b/crates/board/src/uart.rs index cd612c37..c05a2d3b 100644 --- a/crates/board/src/uart.rs +++ b/crates/board/src/uart.rs @@ -14,14 +14,13 @@ //! UART interface. -use derivative::Derivative; +use derive_where::derive_where; use crate::{Error, Id, Support}; /// UART event. #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Derivative)] -#[derivative(Debug(bound = ""), PartialEq(bound = ""), Eq(bound = ""))] +#[derive_where(Debug, PartialEq, Eq)] pub struct Event { /// The UART that triggered the event. pub uart: Id>, diff --git a/crates/cli-tools/Cargo.lock b/crates/cli-tools/Cargo.lock index d0f4c4a6..66989c0f 100644 --- a/crates/cli-tools/Cargo.lock +++ b/crates/cli-tools/Cargo.lock @@ -81,7 +81,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -97,14 +97,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] -name = "derivative" -version = "2.2.0" +name = "derive-where" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] @@ -194,7 +194,7 @@ checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -263,7 +263,7 @@ checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -286,17 +286,6 @@ dependencies = [ "serde", ] -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.66" @@ -325,7 +314,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -378,7 +367,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" name = "wasefire-board-api" version = "0.8.0-git" dependencies = [ - "derivative", + "derive-where", "wasefire-error", "wasefire-logger", "wasefire-store", @@ -456,7 +445,7 @@ version = "0.1.1-git" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] diff --git a/crates/cli/Cargo.lock b/crates/cli/Cargo.lock index c79ccd06..8668d5bb 100644 --- a/crates/cli/Cargo.lock +++ b/crates/cli/Cargo.lock @@ -135,7 +135,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -157,14 +157,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] -name = "derivative" -version = "2.2.0" +name = "derive-where" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] @@ -260,7 +260,7 @@ checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -329,7 +329,7 @@ checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -358,17 +358,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.66" @@ -397,7 +386,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -456,7 +445,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" name = "wasefire-board-api" version = "0.8.0-git" dependencies = [ - "derivative", + "derive-where", "wasefire-error", "wasefire-logger", "wasefire-store", @@ -545,7 +534,7 @@ version = "0.1.1-git" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] diff --git a/crates/protocol-usb/Cargo.lock b/crates/protocol-usb/Cargo.lock index 48e23183..42ae5c58 100644 --- a/crates/protocol-usb/Cargo.lock +++ b/crates/protocol-usb/Cargo.lock @@ -59,14 +59,14 @@ dependencies = [ ] [[package]] -name = "derivative" -version = "2.2.0" +name = "derive-where" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.66", ] [[package]] @@ -209,7 +209,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", - "quote", "unicode-ident", ] @@ -277,7 +276,7 @@ name = "wasefire-board-api" version = "0.8.0-git" dependencies = [ "defmt", - "derivative", + "derive-where", "wasefire-error", "wasefire-logger", "wasefire-store", diff --git a/crates/protocol/crates/schema/Cargo.lock b/crates/protocol/crates/schema/Cargo.lock index 748ee500..9f176400 100644 --- a/crates/protocol/crates/schema/Cargo.lock +++ b/crates/protocol/crates/schema/Cargo.lock @@ -81,7 +81,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -97,14 +97,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] -name = "derivative" -version = "2.2.0" +name = "derive-where" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] @@ -194,7 +194,7 @@ checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -274,7 +274,7 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -297,17 +297,6 @@ dependencies = [ "serde", ] -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.66" @@ -336,7 +325,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -389,7 +378,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" name = "wasefire-board-api" version = "0.8.0-git" dependencies = [ - "derivative", + "derive-where", "wasefire-error", "wasefire-logger", "wasefire-store", @@ -467,7 +456,7 @@ version = "0.1.1-git" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] diff --git a/crates/runner-host/Cargo.lock b/crates/runner-host/Cargo.lock index a6d86a3d..8c34f414 100644 --- a/crates/runner-host/Cargo.lock +++ b/crates/runner-host/Cargo.lock @@ -419,14 +419,14 @@ dependencies = [ ] [[package]] -name = "derivative" -version = "2.2.0" +name = "derive-where" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.66", ] [[package]] @@ -1911,7 +1911,7 @@ dependencies = [ "aes-gcm", "ccm", "crypto-common", - "derivative", + "derive-where", "digest", "ecdsa", "elliptic-curve", @@ -1996,7 +1996,7 @@ name = "wasefire-scheduler" version = "0.3.2-git" dependencies = [ "bytemuck", - "derivative", + "derive-where", "digest", "generic-array", "typenum", diff --git a/crates/runner-nordic/Cargo.lock b/crates/runner-nordic/Cargo.lock index 6cc06caf..75eb2a3d 100644 --- a/crates/runner-nordic/Cargo.lock +++ b/crates/runner-nordic/Cargo.lock @@ -327,14 +327,14 @@ dependencies = [ ] [[package]] -name = "derivative" -version = "2.2.0" +name = "derive-where" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.66", ] [[package]] @@ -1133,7 +1133,7 @@ dependencies = [ "bytemuck", "crypto-common", "defmt", - "derivative", + "derive-where", "digest", "ecdsa", "elliptic-curve", @@ -1199,7 +1199,7 @@ version = "0.3.2-git" dependencies = [ "bytemuck", "defmt", - "derivative", + "derive-where", "digest", "generic-array", "typenum", diff --git a/crates/scheduler/CHANGELOG.md b/crates/scheduler/CHANGELOG.md index ef9ac667..7c3d330f 100644 --- a/crates/scheduler/CHANGELOG.md +++ b/crates/scheduler/CHANGELOG.md @@ -4,6 +4,7 @@ ### Patch +- Use `derive-where` instead of `derivative` - Implement `defmt::Format` for `Key` when `defmt` is enabled - Stop using `log::Debug2Format()` when logging events - Make applet optional diff --git a/crates/scheduler/Cargo.lock b/crates/scheduler/Cargo.lock index 2ed9398b..94776ae8 100644 --- a/crates/scheduler/Cargo.lock +++ b/crates/scheduler/Cargo.lock @@ -227,14 +227,14 @@ dependencies = [ ] [[package]] -name = "derivative" -version = "2.2.0" +name = "derive-where" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.66", ] [[package]] @@ -753,7 +753,7 @@ dependencies = [ "ccm", "crypto-common", "defmt", - "derivative", + "derive-where", "digest", "ecdsa", "elliptic-curve", @@ -811,7 +811,7 @@ version = "0.3.2-git" dependencies = [ "bytemuck", "defmt", - "derivative", + "derive-where", "digest", "generic-array", "typenum", diff --git a/crates/scheduler/Cargo.toml b/crates/scheduler/Cargo.toml index 9c518981..7059c692 100644 --- a/crates/scheduler/Cargo.toml +++ b/crates/scheduler/Cargo.toml @@ -18,7 +18,7 @@ features = ["std", "wasm"] [dependencies] bytemuck = { version = "1.16.0", default-features = false } defmt = { version = "0.3.8", default-features = false, optional = true } -derivative = { version = "2.2.0", default-features = false, features = ["use_core"] } +derive-where = { version = "1.2.7", default-features = false, features = ["nightly"] } digest = { version = "0.10.7", default-features = false, features = ["mac"], optional = true } generic-array = { version = "=0.14.7", default-features = false, optional = true } typenum = { version = "1.17.0", default-features = false, optional = true } diff --git a/crates/scheduler/src/event.rs b/crates/scheduler/src/event.rs index 92305c54..6ecb5a1f 100644 --- a/crates/scheduler/src/event.rs +++ b/crates/scheduler/src/event.rs @@ -15,7 +15,7 @@ use alloc::vec; use core::borrow::Borrow; -use derivative::Derivative; +use derive_where::derive_where; use wasefire_board_api::{Api as Board, Event, Impossible}; #[cfg(feature = "wasm")] pub use wasefire_interpreter::InstId; @@ -42,10 +42,7 @@ pub struct InstId; // TODO: This could be encoded into a u32 for performance/footprint. #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Derivative)] -#[derivative(Debug(bound = ""), Copy(bound = ""), Hash(bound = ""))] -#[derivative(PartialEq(bound = ""), Eq(bound = ""), Ord(bound = ""))] -#[derivative(Ord = "feature_allow_slow_enum")] +#[derive_where(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub enum Key { #[cfg(feature = "board-api-button")] Button(button::Key), @@ -62,20 +59,6 @@ pub enum Key { _Impossible(Impossible), } -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use Clone(bound = "") instead. -impl Clone for Key { - fn clone(&self) -> Self { - *self - } -} - -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use PartialOrd(bound = "") instead. -impl PartialOrd for Key { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - #[cfg_attr(not(feature = "board-api-button"), allow(unused_macros))] macro_rules! or_unreachable { ($feature:literal, [$($event:ident)*], $expr:expr) => {{ @@ -123,10 +106,7 @@ impl<'a, B: Board> From<&'a Event> for Key { } } -#[derive(Derivative)] -#[derivative(Debug(bound = ""), Clone(bound = ""))] -#[derivative(PartialEq(bound = ""), Eq(bound = ""), Ord(bound = ""))] -#[derivative(Ord = "feature_allow_slow_enum")] +#[derive_where(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct Handler { pub key: Key, pub inst: InstId, @@ -134,13 +114,6 @@ pub struct Handler { pub data: u32, } -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use PartialOrd(bound = "") instead. -impl PartialOrd for Handler { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - impl Borrow> for Handler { fn borrow(&self) -> &Key { &self.key diff --git a/crates/scheduler/src/event/button.rs b/crates/scheduler/src/event/button.rs index f7d3400c..3c13417a 100644 --- a/crates/scheduler/src/event/button.rs +++ b/crates/scheduler/src/event/button.rs @@ -14,32 +14,16 @@ use alloc::vec::Vec; -use derivative::Derivative; +use derive_where::derive_where; use wasefire_board_api::button::Event; use wasefire_board_api::{self as board, Api as Board, Id}; #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Derivative)] -#[derivative(Debug(bound = ""), Copy(bound = ""), Hash(bound = ""))] -#[derivative(PartialEq(bound = ""), Eq(bound = ""), Ord(bound = ""))] +#[derive_where(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct Key { pub button: Id>, } -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use Clone(bound = "") instead. -impl Clone for Key { - fn clone(&self) -> Self { - *self - } -} - -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use PartialOrd(bound = "") instead. -impl PartialOrd for Key { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - impl From> for crate::event::Key { fn from(key: Key) -> Self { crate::event::Key::Button(key) diff --git a/crates/scheduler/src/event/timer.rs b/crates/scheduler/src/event/timer.rs index 4c01f500..83dd5792 100644 --- a/crates/scheduler/src/event/timer.rs +++ b/crates/scheduler/src/event/timer.rs @@ -12,32 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -use derivative::Derivative; +use derive_where::derive_where; use wasefire_board_api::timer::Event; use wasefire_board_api::{self as board, Api as Board, Id}; #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Derivative)] -#[derivative(Debug(bound = ""), Copy(bound = ""), Hash(bound = ""))] -#[derivative(PartialEq(bound = ""), Eq(bound = ""), Ord(bound = ""))] +#[derive_where(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct Key { pub timer: Id>, } -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use Clone(bound = "") instead. -impl Clone for Key { - fn clone(&self) -> Self { - *self - } -} - -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use PartialOrd(bound = "") instead. -impl PartialOrd for Key { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - impl From> for crate::event::Key { fn from(key: Key) -> Self { crate::event::Key::Timer(key) diff --git a/crates/scheduler/src/event/uart.rs b/crates/scheduler/src/event/uart.rs index b2bba761..1002ddeb 100644 --- a/crates/scheduler/src/event/uart.rs +++ b/crates/scheduler/src/event/uart.rs @@ -12,33 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -use derivative::Derivative; +use derive_where::derive_where; use wasefire_board_api::uart::{Direction, Event}; use wasefire_board_api::{self as board, Api as Board, Id}; #[cfg_attr(feature = "defmt", derive(defmt::Format))] -#[derive(Derivative)] -#[derivative(Debug(bound = ""), Copy(bound = ""), Hash(bound = ""))] -#[derivative(PartialEq(bound = ""), Eq(bound = ""), Ord(bound = ""))] +#[derive_where(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct Key { pub uart: Id>, pub direction: Direction, } -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use Clone(bound = "") instead. -impl Clone for Key { - fn clone(&self) -> Self { - *self - } -} - -// TODO(https://github.com/mcarton/rust-derivative/issues/112): Use PartialOrd(bound = "") instead. -impl PartialOrd for Key { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - impl From> for crate::event::Key { fn from(key: Key) -> Self { crate::event::Key::Uart(key) diff --git a/crates/scheduler/src/lib.rs b/crates/scheduler/src/lib.rs index e0649780..2c195b19 100644 --- a/crates/scheduler/src/lib.rs +++ b/crates/scheduler/src/lib.rs @@ -26,7 +26,7 @@ use alloc::vec::Vec; use core::ffi::CStr; use core::marker::PhantomData; -use derivative::Derivative; +use derive_where::derive_where; use event::Key; use wasefire_applet_api::{self as api, Api, ArrayU32, Dispatch, Id, Signature, U32}; #[cfg(feature = "board-api-storage")] @@ -58,8 +58,7 @@ mod protocol; #[cfg(all(feature = "native", not(target_pointer_width = "32")))] compile_error!("Only 32-bits architectures support native applets."); -#[derive(Derivative)] -#[derivative(Default(bound = ""))] +#[derive_where(Default)] pub struct Events(VecDeque>); impl Events { diff --git a/crates/xtask/Cargo.lock b/crates/xtask/Cargo.lock index 6664fa66..8bcd89d8 100644 --- a/crates/xtask/Cargo.lock +++ b/crates/xtask/Cargo.lock @@ -423,14 +423,14 @@ dependencies = [ ] [[package]] -name = "derivative" -version = "2.2.0" +name = "derive-where" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.66", ] [[package]] @@ -1684,7 +1684,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" name = "wasefire-board-api" version = "0.8.0-git" dependencies = [ - "derivative", + "derive-where", "wasefire-error", "wasefire-logger", "wasefire-store", diff --git a/examples/rust/protocol/host/Cargo.lock b/examples/rust/protocol/host/Cargo.lock index b8f16477..c91f3760 100644 --- a/examples/rust/protocol/host/Cargo.lock +++ b/examples/rust/protocol/host/Cargo.lock @@ -103,7 +103,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -119,14 +119,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] -name = "derivative" -version = "2.2.0" +name = "derive-where" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] @@ -230,7 +230,7 @@ checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]] @@ -302,17 +302,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.66" @@ -346,7 +335,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" name = "wasefire-board-api" version = "0.8.0-git" dependencies = [ - "derivative", + "derive-where", "wasefire-error", "wasefire-logger", "wasefire-store", @@ -407,7 +396,7 @@ version = "0.1.1-git" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn", ] [[package]]