Skip to content

Commit

Permalink
Remove all previously deprecated items
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Aug 19, 2024
1 parent 1167a81 commit b238672
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 112 deletions.
3 changes: 0 additions & 3 deletions src/coap_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@
pub mod v0_1;
pub mod v0_2;

#[deprecated(note = "Use through the v0_1 module.")]
pub use v0_1::*;
6 changes: 1 addition & 5 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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)),
})
Expand Down
4 changes: 2 additions & 2 deletions src/gnrc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
5 changes: 0 additions & 5 deletions src/i2c/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
28 changes: 2 additions & 26 deletions src/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
}

Expand All @@ -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() }
}

Expand Down Expand Up @@ -77,25 +75,3 @@ pub fn free<R, F: FnOnce(&CriticalSection) -> 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() };
}
};
}
6 changes: 0 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*`).
Expand Down
11 changes: 0 additions & 11 deletions src/main_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 0 additions & 28 deletions src/saul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self> {
match input as _ {
riot_sys::UNIT_NONE => Some(Unit::None),
Expand Down Expand Up @@ -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<const S: usize>(self) -> Option<heapless::String<S>> {
Expand Down
14 changes: 0 additions & 14 deletions src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,6 @@ pub trait CommandList<const BUFSIZE: usize = { riot_sys::SHELL_DEFAULT_BUFSIZE a
})
}

#[deprecated(
note = "Use run_once_with_buf, or just run_once_providing_buf, which will take over this name in the next breaking release"
)]
fn run_once(&mut self, linebuffer: &mut [u8]) {
self.run_once_with_buf(linebuffer)
}

fn run_forever_with_buf(&mut self, linebuffer: &mut [u8]) -> ! {
// unsafe: See unsafe in run_any where it's called
self.run_any(linebuffer, |built, buf, len| unsafe {
Expand All @@ -151,13 +144,6 @@ pub trait CommandList<const BUFSIZE: usize = { riot_sys::SHELL_DEFAULT_BUFSIZE a
})
}

#[deprecated(
note = "Use run_forever_with_buf, or just run_forever_providing_buf, which will take over this name in the next breaking release"
)]
fn run_forever(&mut self, linebuffer: &mut [u8]) -> ! {
self.run_forever_with_buf(linebuffer)
}

/// Run the shell prompt on stdio
///
/// See [shell_run_forever] for details.
Expand Down
2 changes: 1 addition & 1 deletion src/spi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
9 changes: 0 additions & 9 deletions src/thread/tokenparts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -186,11 +183,6 @@ impl<const MQ: bool> TokenParts<true, MQ, true> {
_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
Expand All @@ -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<Self, InIsr> {
#[allow(deprecated)] // It's deprecatedly pub
match crate::interrupt::irq_is_in() {
true => Err(unsafe { InIsr::new_unchecked() }),
false => Ok(unsafe { InThread::new_unchecked() }),
Expand Down

0 comments on commit b238672

Please sign in to comment.