From b238672cea4df9533b4111669fe6fed098ec7a24 Mon Sep 17 00:00:00 2001 From: chrysn Date: Mon, 19 Aug 2024 09:24:11 +0200 Subject: [PATCH] Remove all previously deprecated items --- src/coap_handler/mod.rs | 3 --- src/error.rs | 6 +----- src/gnrc.rs | 4 ++-- src/i2c/mod.rs | 5 ----- src/interrupt.rs | 28 ++-------------------------- src/lib.rs | 6 ------ src/main_module.rs | 11 ----------- src/saul.rs | 28 ---------------------------- src/shell.rs | 14 -------------- src/spi/mod.rs | 2 +- src/thread.rs | 3 +-- src/thread/tokenparts.rs | 9 --------- 12 files changed, 7 insertions(+), 112 deletions(-) diff --git a/src/coap_handler/mod.rs b/src/coap_handler/mod.rs index 65d33a7f..5e223d53 100644 --- a/src/coap_handler/mod.rs +++ b/src/coap_handler/mod.rs @@ -3,6 +3,3 @@ pub mod v0_1; pub mod v0_2; - -#[deprecated(note = "Use through the v0_1 module.")] -pub use v0_1::*; diff --git a/src/error.rs b/src/error.rs index dd0d4284..10252dbf 100644 --- a/src/error.rs +++ b/src/error.rs @@ -25,8 +25,7 @@ pub trait NegativeErrorExt { /// manually implemented newtype around isize that'd be used to represent the Result. #[derive(Debug, PartialEq, Eq)] pub struct NumericError { - #[deprecated(note = "Use the .number() method")] - pub number: isize, + number: isize, } impl NumericError { @@ -56,13 +55,11 @@ impl NumericError { name > 0, "Error names are expected to be positive for conversion into negative error numbers." ); - #[allow(deprecated)] // it's deprecated *pub* NumericError { number: -name } } /// Numeric value of the error pub const fn number(&self) -> isize { - #[allow(deprecated)] // it's deprecated *pub* self.number } @@ -94,7 +91,6 @@ where if self >= Self::zero() { Ok(self) } else { - #[allow(deprecated)] // it's deprecated *pub* Err(NumericError { number: self.try_into().unwrap_or(-(riot_sys::EOVERFLOW as isize)), }) diff --git a/src/gnrc.rs b/src/gnrc.rs index 53839700..088edb80 100644 --- a/src/gnrc.rs +++ b/src/gnrc.rs @@ -5,8 +5,8 @@ pub mod ipv6; pub mod netapi; pub mod netreg; -#[deprecated(note = "moved to gnrc_pktbuf toplevel module")] -pub use crate::gnrc_pktbuf as pktbuf; +#[deprecated(note = "Internally, use gnrc_pktbuf directly")] +pub(crate) use crate::gnrc_pktbuf as pktbuf; use riot_sys::{gnrc_netif_iter, gnrc_netif_t}; diff --git a/src/i2c/mod.rs b/src/i2c/mod.rs index 7bd09683..2526e384 100644 --- a/src/i2c/mod.rs +++ b/src/i2c/mod.rs @@ -25,8 +25,3 @@ impl I2CDevice { I2CDevice { dev } } } - -#[deprecated( - note = "This error type applies to embedded-hal 0.2 only, use it through the impl_0_2 module." -)] -pub use impl_0_2::Error; diff --git a/src/interrupt.rs b/src/interrupt.rs index a458a232..d4034a62 100644 --- a/src/interrupt.rs +++ b/src/interrupt.rs @@ -27,8 +27,7 @@ /// [`irq_is_in`](https://doc.riot-os.org/group__core__irq.html#ga83decbeef665d955290f730125ef0e3f) /// /// Returns true when called from an interrupt service routine -#[deprecated(note = "Use crate::thread::InThread::new() instead")] -pub fn irq_is_in() -> bool { +pub(crate) fn irq_is_in() -> bool { unsafe { riot_sys::irq_is_in() } } @@ -38,8 +37,7 @@ pub fn irq_is_in() -> bool { /// Returns true if interrupts are currently enabled /// /// Note that this only returns reliable values when called from a thread context. -#[deprecated(note = "use crate::thread::InThread::irq_is_enabled() instead")] -pub fn irq_is_enabled() -> bool { +pub(crate) fn irq_is_enabled() -> bool { unsafe { riot_sys::irq_is_enabled() } } @@ -77,25 +75,3 @@ pub fn free R>(f: F) -> R { unsafe { riot_sys::irq_restore(stored) }; ret } - -/// Wrap a Rust interrupt handler in an extern "C" wrapper that does the post-return cleaups. -/// -/// As with all code executed in interrupt contexts, the wrapped function should not panic. -/// -/// ## Caveats -/// -/// This is Cortex-M specific. -#[deprecated( - note = "See module documentation: This needs to be done manually per platform; it is incomplete as riot-wrappers provides no method of enabling platform specific interrupts, and provides no other access to configure the peripheral through registers. If it is re-introduced, it will likely carry an `InIsr` token into the function." -)] -#[macro_export] -macro_rules! interrupt { - ($isr_name:ident, $rust_handler:expr) => { - #[no_mangle] - pub extern "C" fn $isr_name() -> () { - $rust_handler(); - - unsafe { riot_sys::inline::cortexm_isr_end() }; - } - }; -} diff --git a/src/lib.rs b/src/lib.rs index b08230f6..1d8dd2de 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -55,12 +55,6 @@ pub const BOARD: &'static str = { b }; -/// Name of the RIOT board that is being used -#[deprecated(note = "Access BOARD instead")] -pub const fn board() -> &'static str { - BOARD -} - /// Cast pointers around before passing them in to functions; this is sometimes needed when a /// struct is used from bindgen (`riot_sys::*`) but passed to a C2Rust function that uses its own /// definition (`riot_sys::inline::*`). diff --git a/src/main_module.rs b/src/main_module.rs index c0943517..96dcea3b 100644 --- a/src/main_module.rs +++ b/src/main_module.rs @@ -121,17 +121,6 @@ macro_rules! riot_main { }; } -#[deprecated(note = "Use `riot_main` instead, which takes multiple signatures")] -#[macro_export] -macro_rules! riot_main_with_tokens { - ($main:ident) => { - #[export_name = "main"] - pub extern "C" fn c_main() -> i32 { - unsafe { <_ as $crate::main::UsableAsMain<_>>::call_main(&$main) } - } - }; -} - /// A result trait for main methods, analogous to std::process::Termination pub trait Termination { fn report(self) -> i32; diff --git a/src/saul.rs b/src/saul.rs index 275812fd..1cd8ab34 100644 --- a/src/saul.rs +++ b/src/saul.rs @@ -393,18 +393,6 @@ pub enum Unit { } impl Unit { - // Note that on the C side the code still uses the aliases on the C side -- they're deprecated, - // but we'd need to introduce a marker, and given they'll stay deprecated on C for a release, - // we can just switch over before they go. - #[deprecated(note = "Use the GForce variant instead")] - pub const G: Self = Unit::GForce; - #[allow(non_upper_case_globals)] - #[deprecated(note = "Use the Gram variant instead")] - pub const Gr: Self = Unit::Gram; - #[allow(non_upper_case_globals)] - #[deprecated(note = "Use the Gauss variant instead")] - pub const Gs: Self = Unit::Gauss; - fn from_c(input: u8) -> Option { match input as _ { riot_sys::UNIT_NONE => Some(Unit::None), @@ -485,22 +473,6 @@ impl Unit { }) as _ } - /// String representation of a given unit (e.g. `V` or `m`) - #[deprecated( - note = "RIOT's mechanism changed; this returns None unconditionally, use .name_owned() instead" - )] - pub fn name(self) -> Option<&'static str> { - None - } - - /// Like [`.name()`](Unit::name), but with additional names like "none" or "time". - #[deprecated( - note = "RIOT's mechanism changed; this returns None unconditionally, use .name_owned() instead" - )] - pub fn name_verbose(self) -> Option<&'static str> { - None - } - /// String representation of a given unit (e.g. `V`, `m`, `none` or `time`) #[doc(alias = "phydat_unit_write")] pub fn name_owned(self) -> Option> { diff --git a/src/shell.rs b/src/shell.rs index 03c5d6a4..3f995177 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -136,13 +136,6 @@ pub trait CommandList ! { // unsafe: See unsafe in run_any where it's called self.run_any(linebuffer, |built, buf, len| unsafe { @@ -151,13 +144,6 @@ pub trait CommandList ! { - self.run_forever_with_buf(linebuffer) - } - /// Run the shell prompt on stdio /// /// See [shell_run_forever] for details. diff --git a/src/spi/mod.rs b/src/spi/mod.rs index f8ed4410..53db151f 100644 --- a/src/spi/mod.rs +++ b/src/spi/mod.rs @@ -4,7 +4,7 @@ use riot_sys::{ spi_acquire, spi_clk_t, spi_cs_t, spi_mode_t, spi_release, spi_t, spi_transfer_bytes, }; -pub struct SPIDevice(#[deprecated(note = "Use constructor instead")] pub spi_t); +pub struct SPIDevice(spi_t); pub struct AcquiredSPI<'a> { device: &'a mut SPIDevice, diff --git a/src/thread.rs b/src/thread.rs index aa9e964a..93e950bb 100644 --- a/src/thread.rs +++ b/src/thread.rs @@ -23,8 +23,7 @@ pub use riot_c::*; mod tokenparts; #[cfg(doc)] pub use tokenparts::TokenParts; -#[allow(deprecated)] -pub use tokenparts::{EndToken, InIsr, InThread, StartToken, TerminationToken, ValueInThread}; +pub use tokenparts::{EndToken, InIsr, InThread, StartToken, ValueInThread}; mod stack_stats; pub use stack_stats::{StackStats, StackStatsError}; diff --git a/src/thread/tokenparts.rs b/src/thread/tokenparts.rs index ccd4afc8..a3644c74 100644 --- a/src/thread/tokenparts.rs +++ b/src/thread/tokenparts.rs @@ -18,9 +18,6 @@ pub struct EndToken { _not_send: PhantomData<*const ()>, } -#[deprecated(note = "Renamed to EndToken")] -pub type TerminationToken = EndToken; - /// A [StartToken] that has possibly already lost some of its properties. /// /// Note that while this item shows up in the documentation, the type is actually hidden and only @@ -186,11 +183,6 @@ impl TokenParts { _not_send: PhantomData, } } - - #[deprecated(note = "Renamed to can_end")] - pub fn termination(self) -> EndToken { - self.can_end() - } } /// Zero-size statement that the current code is not running in an interrupt @@ -217,7 +209,6 @@ impl InThread { /// Note that this is actually running code; to avoid that, call [`TokenParts::in_thread()`], /// which is a purely type-level procedure. pub fn new() -> Result { - #[allow(deprecated)] // It's deprecatedly pub match crate::interrupt::irq_is_in() { true => Err(unsafe { InIsr::new_unchecked() }), false => Ok(unsafe { InThread::new_unchecked() }),