From 6dc58645d22ebebf6abe8d4d07bcc3001cac91c6 Mon Sep 17 00:00:00 2001 From: Til Blechschmidt Date: Wed, 23 Feb 2022 23:30:50 +0100 Subject: [PATCH] Change slice length check to use stable method --- embassy-nrf/src/lib.rs | 2 +- embassy-nrf/src/util.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index a9df231e..b448f6ab 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs @@ -1,7 +1,7 @@ #![no_std] #![cfg_attr( feature = "nightly", - feature(generic_associated_types, type_alias_impl_trait, slice_ptr_len) + feature(generic_associated_types, type_alias_impl_trait) )] #[cfg(not(any( diff --git a/embassy-nrf/src/util.rs b/embassy-nrf/src/util.rs index 84848e87..42265dc2 100644 --- a/embassy-nrf/src/util.rs +++ b/embassy-nrf/src/util.rs @@ -22,7 +22,8 @@ pub(crate) fn slice_in_ram(slice: *const [T]) -> bool { /// Return an error if slice is not in RAM. Skips check if slice is zero-length. #[cfg(not(feature = "nrf51"))] pub(crate) fn slice_in_ram_or(slice: *const [T], err: E) -> Result<(), E> { - if slice.len() > 0 && slice_in_ram(slice) { + let (_, len) = slice_ptr_parts(slice); + if len > 0 && slice_in_ram(slice) { Ok(()) } else { Err(err)