From 72248a601a9ea28ac696f186e2cbe4c2f128a133 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sun, 29 Jun 2025 22:37:11 +0200 Subject: [PATCH] Update Rust nightly, stable. --- embassy-executor/build_common.rs | 32 --------- .../tests/ui/bad_return_impl_future.stderr | 32 ++++----- .../tests/ui/return_impl_send.stderr | 66 +++++++++---------- embassy-nrf/src/uarte.rs | 2 +- embassy-rp/src/flash.rs | 6 +- embassy-rp/src/relocate.rs | 2 +- .../src/can/fd/message_ram/extended_filter.rs | 8 +-- .../src/can/fd/message_ram/standard_filter.rs | 8 +-- .../can/fd/message_ram/txbuffer_element.rs | 18 ++--- embassy-stm32/src/cordic/utils.rs | 2 +- embassy-stm32/src/tsc/acquisition_banks.rs | 6 +- embassy-sync/src/pubsub/mod.rs | 8 +-- embassy-usb/src/class/web_usb.rs | 2 +- rust-toolchain-nightly.toml | 2 +- rust-toolchain.toml | 2 +- 15 files changed, 84 insertions(+), 112 deletions(-) diff --git a/embassy-executor/build_common.rs b/embassy-executor/build_common.rs index b15a8369f..4f24e6d37 100644 --- a/embassy-executor/build_common.rs +++ b/embassy-executor/build_common.rs @@ -92,35 +92,3 @@ pub fn set_target_cfgs(cfgs: &mut CfgSet) { cfgs.set("has_fpu", target.ends_with("-eabihf")); } - -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] -pub struct CompilerDate { - year: u16, - month: u8, - day: u8, -} - -impl CompilerDate { - fn parse(date: &str) -> Option { - let mut parts = date.split('-'); - let year = parts.next()?.parse().ok()?; - let month = parts.next()?.parse().ok()?; - let day = parts.next()?.parse().ok()?; - Some(Self { year, month, day }) - } -} - -impl PartialEq<&str> for CompilerDate { - fn eq(&self, other: &&str) -> bool { - let Some(other) = Self::parse(other) else { - return false; - }; - self.eq(&other) - } -} - -impl PartialOrd<&str> for CompilerDate { - fn partial_cmp(&self, other: &&str) -> Option { - Self::parse(other).map(|other| self.cmp(&other)) - } -} diff --git a/embassy-executor/tests/ui/bad_return_impl_future.stderr b/embassy-executor/tests/ui/bad_return_impl_future.stderr index 2980fd18b..57f147714 100644 --- a/embassy-executor/tests/ui/bad_return_impl_future.stderr +++ b/embassy-executor/tests/ui/bad_return_impl_future.stderr @@ -68,6 +68,22 @@ note: required by a bound in `task_pool_align` | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_align` = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) +error[E0277]: task futures must resolve to `()` or `!` + --> tests/ui/bad_return_impl_future.rs:5:4 + | +4 | #[embassy_executor::task] + | ------------------------- required by a bound introduced by this call +5 | fn task() -> impl Future { + | ^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Future {__task_task}` + | + = note: use `async fn` or change the return type to `impl Future` +note: required by a bound in `__task_pool_get` + --> tests/ui/bad_return_impl_future.rs:4:1 + | +4 | #[embassy_executor::task] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `__task_pool_get` + = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) + error[E0277]: task futures must resolve to `()` or `!` --> tests/ui/bad_return_impl_future.rs:5:4 | @@ -102,19 +118,3 @@ note: required by a bound in `task_pool_new` | F: TaskFn, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_new` = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: task futures must resolve to `()` or `!` - --> tests/ui/bad_return_impl_future.rs:5:4 - | -4 | #[embassy_executor::task] - | ------------------------- required by a bound introduced by this call -5 | fn task() -> impl Future { - | ^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Future {__task_task}` - | - = note: use `async fn` or change the return type to `impl Future` -note: required by a bound in `__task_pool_get` - --> tests/ui/bad_return_impl_future.rs:4:1 - | -4 | #[embassy_executor::task] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `__task_pool_get` - = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/embassy-executor/tests/ui/return_impl_send.stderr b/embassy-executor/tests/ui/return_impl_send.stderr index 7e3e468b8..cd693af2b 100644 --- a/embassy-executor/tests/ui/return_impl_send.stderr +++ b/embassy-executor/tests/ui/return_impl_send.stderr @@ -68,6 +68,39 @@ note: required by a bound in `task_pool_align` | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_align` = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) +error[E0277]: task futures must resolve to `()` or `!` + --> tests/ui/return_impl_send.rs:4:4 + | +3 | #[embassy_executor::task] + | ------------------------- required by a bound introduced by this call +4 | fn task() -> impl Send {} + | ^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Send {__task_task}` + | + = note: use `async fn` or change the return type to `impl Future` +note: required by a bound in `__task_pool_get` + --> tests/ui/return_impl_send.rs:3:1 + | +3 | #[embassy_executor::task] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `__task_pool_get` + = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: `impl Send` is not a future + --> tests/ui/return_impl_send.rs:3:1 + | +3 | #[embassy_executor::task] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ `impl Send` is not a future + | + = help: the trait `Future` is not implemented for `impl Send` +note: required by a bound in `TaskPool::::_spawn_async_fn` + --> src/raw/mod.rs + | + | impl TaskPool { + | ^^^^^^ required by this bound in `TaskPool::::_spawn_async_fn` +... + | pub unsafe fn _spawn_async_fn(&'static self, future: FutFn) -> SpawnToken + | --------------- required by a bound in this associated function + = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) + error[E0277]: task futures must resolve to `()` or `!` --> tests/ui/return_impl_send.rs:4:4 | @@ -102,36 +135,3 @@ note: required by a bound in `task_pool_new` | F: TaskFn, | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `task_pool_new` = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: task futures must resolve to `()` or `!` - --> tests/ui/return_impl_send.rs:4:4 - | -3 | #[embassy_executor::task] - | ------------------------- required by a bound introduced by this call -4 | fn task() -> impl Send {} - | ^^^^ the trait `TaskFn<_>` is not implemented for fn item `fn() -> impl Send {__task_task}` - | - = note: use `async fn` or change the return type to `impl Future` -note: required by a bound in `__task_pool_get` - --> tests/ui/return_impl_send.rs:3:1 - | -3 | #[embassy_executor::task] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `__task_pool_get` - = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: `impl Send` is not a future - --> tests/ui/return_impl_send.rs:3:1 - | -3 | #[embassy_executor::task] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ `impl Send` is not a future - | - = help: the trait `Future` is not implemented for `impl Send` -note: required by a bound in `TaskPool::::_spawn_async_fn` - --> src/raw/mod.rs - | - | impl TaskPool { - | ^^^^^^ required by this bound in `TaskPool::::_spawn_async_fn` -... - | pub unsafe fn _spawn_async_fn(&'static self, future: FutFn) -> SpawnToken - | --------------- required by a bound in this associated function - = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs index f377df49e..927a0ac08 100644 --- a/embassy-nrf/src/uarte.rs +++ b/embassy-nrf/src/uarte.rs @@ -245,7 +245,7 @@ impl<'d, T: Instance> Uarte<'d, T> { } /// Return the endtx event for use with PPI - pub fn event_endtx(&self) -> Event { + pub fn event_endtx(&self) -> Event<'_> { let r = T::regs(); Event::from_reg(r.events_endtx()) } diff --git a/embassy-rp/src/flash.rs b/embassy-rp/src/flash.rs index ef1cd9212..8c809090e 100644 --- a/embassy-rp/src/flash.rs +++ b/embassy-rp/src/flash.rs @@ -482,7 +482,11 @@ mod ram_helpers { /// # Safety /// /// `boot2` must contain a valid 2nd stage boot loader which can be called to re-initialize XIP mode - unsafe fn flash_function_pointers_with_boot2(erase: bool, write: bool, boot2: &[u32; 64]) -> FlashFunctionPointers { + unsafe fn flash_function_pointers_with_boot2( + erase: bool, + write: bool, + boot2: &[u32; 64], + ) -> FlashFunctionPointers<'_> { let boot2_fn_ptr = (boot2 as *const u32 as *const u8).offset(1); let boot2_fn: unsafe extern "C" fn() -> () = core::mem::transmute(boot2_fn_ptr); FlashFunctionPointers { diff --git a/embassy-rp/src/relocate.rs b/embassy-rp/src/relocate.rs index 34487819f..6ff40ddd7 100644 --- a/embassy-rp/src/relocate.rs +++ b/embassy-rp/src/relocate.rs @@ -39,7 +39,7 @@ pub struct RelocatedProgram<'a, const PROGRAM_SIZE: usize> { } impl<'a, const PROGRAM_SIZE: usize> RelocatedProgram<'a, PROGRAM_SIZE> { - pub fn new_with_origin(program: &Program, origin: u8) -> RelocatedProgram { + pub fn new_with_origin(program: &Program, origin: u8) -> RelocatedProgram<'_, PROGRAM_SIZE> { RelocatedProgram { program, origin } } diff --git a/embassy-stm32/src/can/fd/message_ram/extended_filter.rs b/embassy-stm32/src/can/fd/message_ram/extended_filter.rs index 453e9056e..ac47901a8 100644 --- a/embassy-stm32/src/can/fd/message_ram/extended_filter.rs +++ b/embassy-stm32/src/can/fd/message_ram/extended_filter.rs @@ -115,22 +115,22 @@ impl R { impl W { #[doc = "Byte 0 - Bits 0:28 - EFID1"] #[inline(always)] - pub fn efid1(&mut self) -> EFID1_W { + pub fn efid1(&mut self) -> EFID1_W<'_> { EFID1_W { w: self } } #[doc = "Byte 0 - Bits 29:31 - EFEC"] #[inline(always)] - pub fn efec(&mut self) -> EFEC_W { + pub fn efec(&mut self) -> EFEC_W<'_> { EFEC_W { w: self } } #[doc = "Byte 1 - Bits 0:28 - EFID2"] #[inline(always)] - pub fn efid2(&mut self) -> EFID2_W { + pub fn efid2(&mut self) -> EFID2_W<'_> { EFID2_W { w: self } } #[doc = "Byte 1 - Bits 30:31 - EFT"] #[inline(always)] - pub fn eft(&mut self) -> EFT_W { + pub fn eft(&mut self) -> EFT_W<'_> { EFT_W { w: self } } } diff --git a/embassy-stm32/src/can/fd/message_ram/standard_filter.rs b/embassy-stm32/src/can/fd/message_ram/standard_filter.rs index 3a3bbcf12..f52646bfe 100644 --- a/embassy-stm32/src/can/fd/message_ram/standard_filter.rs +++ b/embassy-stm32/src/can/fd/message_ram/standard_filter.rs @@ -115,22 +115,22 @@ impl R { impl W { #[doc = "Bits 0:10 - SFID2"] #[inline(always)] - pub fn sfid2(&mut self) -> SFID2_W { + pub fn sfid2(&mut self) -> SFID2_W<'_> { SFID2_W { w: self } } #[doc = "Bits 16:26 - SFID1"] #[inline(always)] - pub fn sfid1(&mut self) -> SFID1_W { + pub fn sfid1(&mut self) -> SFID1_W<'_> { SFID1_W { w: self } } #[doc = "Bits 27:29 - SFEC"] #[inline(always)] - pub fn sfec(&mut self) -> SFEC_W { + pub fn sfec(&mut self) -> SFEC_W<'_> { SFEC_W { w: self } } #[doc = "Bits 30:31 - SFT"] #[inline(always)] - pub fn sft(&mut self) -> SFT_W { + pub fn sft(&mut self) -> SFT_W<'_> { SFT_W { w: self } } } diff --git a/embassy-stm32/src/can/fd/message_ram/txbuffer_element.rs b/embassy-stm32/src/can/fd/message_ram/txbuffer_element.rs index 455406a1c..6d65a86cb 100644 --- a/embassy-stm32/src/can/fd/message_ram/txbuffer_element.rs +++ b/embassy-stm32/src/can/fd/message_ram/txbuffer_element.rs @@ -376,47 +376,47 @@ impl R { impl W { #[doc = "Byte 0 - Bits 0:28 - ID"] #[inline(always)] - pub fn id(&mut self) -> ID_W { + pub fn id(&mut self) -> ID_W<'_> { ID_W { w: self } } #[doc = "Byte 0 - Bit 29 - RTR"] #[inline(always)] - pub fn rtr(&mut self) -> RTR_W { + pub fn rtr(&mut self) -> RTR_W<'_> { RTR_W { w: self } } #[doc = "Byte 0 - Bit 30 - XTD"] #[inline(always)] - pub fn xtd(&mut self) -> XTD_W { + pub fn xtd(&mut self) -> XTD_W<'_> { XTD_W { w: self } } #[doc = "Byte 0 - Bit 31 - ESI"] #[inline(always)] - pub fn esi(&mut self) -> ESI_W { + pub fn esi(&mut self) -> ESI_W<'_> { ESI_W { w: self } } #[doc = "Byte 1 - Bit 16:19 - DLC"] #[inline(always)] - pub fn dlc(&mut self) -> DLC_W { + pub fn dlc(&mut self) -> DLC_W<'_> { DLC_W { w: self } } #[doc = "Byte 1 - Bit 20 - BRS"] #[inline(always)] - pub fn brs(&mut self) -> BRS_W { + pub fn brs(&mut self) -> BRS_W<'_> { BRS_W { w: self } } #[doc = "Byte 1 - Bit 21 - FDF"] #[inline(always)] - pub fn fdf(&mut self) -> FDF_W { + pub fn fdf(&mut self) -> FDF_W<'_> { FDF_W { w: self } } #[doc = "Byte 1 - Bit 23 - EFC"] #[inline(always)] - pub fn efc(&mut self) -> EFC_W { + pub fn efc(&mut self) -> EFC_W<'_> { EFC_W { w: self } } #[doc = "Byte 1 - Bit 24:31 - MM"] #[inline(always)] - pub fn mm(&mut self) -> MM_W { + pub fn mm(&mut self) -> MM_W<'_> { MM_W { w: self } } #[doc = "Convenience function for setting the data length and frame format"] diff --git a/embassy-stm32/src/cordic/utils.rs b/embassy-stm32/src/cordic/utils.rs index 008f50270..9afa8ef53 100644 --- a/embassy-stm32/src/cordic/utils.rs +++ b/embassy-stm32/src/cordic/utils.rs @@ -5,7 +5,7 @@ macro_rules! floating_fixed_convert { ($f_to_q:ident, $q_to_f:ident, $unsigned_bin_typ:ty, $signed_bin_typ:ty, $float_ty:ty, $offset:literal, $min_positive:literal) => { /// convert float point to fixed point format pub fn $f_to_q(value: $float_ty) -> Result<$unsigned_bin_typ, NumberOutOfRange> { - const MIN_POSITIVE: $float_ty = unsafe { core::mem::transmute($min_positive) }; + const MIN_POSITIVE: $float_ty = <$float_ty>::from_bits($min_positive); if value < -1.0 { return Err(NumberOutOfRange::BelowLowerBound) diff --git a/embassy-stm32/src/tsc/acquisition_banks.rs b/embassy-stm32/src/tsc/acquisition_banks.rs index 6791ef6c1..7d6442b48 100644 --- a/embassy-stm32/src/tsc/acquisition_banks.rs +++ b/embassy-stm32/src/tsc/acquisition_banks.rs @@ -32,7 +32,7 @@ impl AcquisitionBankPins { /// Returns an iterator over the pins in this acquisition bank. /// /// This method allows for easy traversal of all configured pins in the bank. - pub fn iter(&self) -> AcquisitionBankPinsIterator { + pub fn iter(&self) -> AcquisitionBankPinsIterator<'_> { AcquisitionBankPinsIterator(AcquisitionBankIterator::new(self)) } } @@ -90,7 +90,7 @@ impl<'a> Iterator for AcquisitionBankPinsIterator<'a> { impl AcquisitionBankPins { /// Returns an iterator over the available pins in the bank - pub fn pins_iterator(&self) -> AcquisitionBankPinsIterator { + pub fn pins_iterator(&self) -> AcquisitionBankPinsIterator<'_> { AcquisitionBankPinsIterator(AcquisitionBankIterator::new(self)) } } @@ -107,7 +107,7 @@ pub struct AcquisitionBank { impl AcquisitionBank { /// Returns an iterator over the available pins in the bank. - pub fn pins_iterator(&self) -> AcquisitionBankPinsIterator { + pub fn pins_iterator(&self) -> AcquisitionBankPinsIterator<'_> { self.pins.pins_iterator() } diff --git a/embassy-sync/src/pubsub/mod.rs b/embassy-sync/src/pubsub/mod.rs index 606efff0a..9206b9383 100644 --- a/embassy-sync/src/pubsub/mod.rs +++ b/embassy-sync/src/pubsub/mod.rs @@ -88,7 +88,7 @@ impl Result, Error> { + pub fn subscriber(&self) -> Result, Error> { self.inner.lock(|inner| { let mut s = inner.borrow_mut(); @@ -120,7 +120,7 @@ impl Result, Error> { + pub fn publisher(&self) -> Result, Error> { self.inner.lock(|inner| { let mut s = inner.borrow_mut(); @@ -151,13 +151,13 @@ impl ImmediatePublisher { + pub fn immediate_publisher(&self) -> ImmediatePublisher<'_, M, T, CAP, SUBS, PUBS> { ImmediatePublisher(ImmediatePub::new(self)) } /// Create a new publisher that can only send immediate messages. /// This kind of publisher does not take up a publisher slot. - pub fn dyn_immediate_publisher(&self) -> DynImmediatePublisher { + pub fn dyn_immediate_publisher(&self) -> DynImmediatePublisher<'_, T> { DynImmediatePublisher(ImmediatePub::new(self)) } diff --git a/embassy-usb/src/class/web_usb.rs b/embassy-usb/src/class/web_usb.rs index 405944f14..154b219ca 100644 --- a/embassy-usb/src/class/web_usb.rs +++ b/embassy-usb/src/class/web_usb.rs @@ -84,7 +84,7 @@ impl<'d> Control<'d> { } impl<'d> Handler for Control<'d> { - fn control_in(&mut self, req: Request, _data: &mut [u8]) -> Option { + fn control_in(&mut self, req: Request, _data: &mut [u8]) -> Option> { let landing_value = if self.landing_url.is_some() { 1 } else { 0 }; if req.request_type == RequestType::Vendor && req.recipient == Recipient::Device diff --git a/rust-toolchain-nightly.toml b/rust-toolchain-nightly.toml index e75ea40cc..411cc6946 100644 --- a/rust-toolchain-nightly.toml +++ b/rust-toolchain-nightly.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2025-03-12" +channel = "nightly-2025-06-29" components = [ "rust-src", "rustfmt", "llvm-tools", "miri" ] targets = [ "thumbv7em-none-eabi", diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 870904c3a..e24864037 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.85" +channel = "1.88" components = [ "rust-src", "rustfmt", "llvm-tools" ] targets = [ "thumbv7em-none-eabi",