From ffccee88fe3fc54eb0412d22f7f3f34c58ff70ab Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 23 Aug 2024 00:31:55 +0200 Subject: [PATCH] doc: Make all doctests buildable once more --- src/gpio/mod.rs | 5 +++++ src/main_module.rs | 3 ++- src/msg/v2.rs | 10 ++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gpio/mod.rs b/src/gpio/mod.rs index 2de0ba53..2fd3edf3 100644 --- a/src/gpio/mod.rs +++ b/src/gpio/mod.rs @@ -88,7 +88,12 @@ impl GPIO { /// Create a GPIO from its port and pin numbers /// /// ``` + /// # #![no_std] + /// # #![no_main] + /// # fn f() { + /// use riot_wrappers::gpio::GPIO; /// let pin_c8 = GPIO::from_port_and_pin(3, 8); + /// # } /// ``` /// /// See [from_c] for safety constraints. diff --git a/src/main_module.rs b/src/main_module.rs index 99befa3b..14dfaf5a 100644 --- a/src/main_module.rs +++ b/src/main_module.rs @@ -91,7 +91,8 @@ impl ((), EndToken)> UsableAsMain<[u8; 3]> for F { /// /// ``` /// # #![no_std] -/// # use riot_wrappers::riot_main; +/// # #![no_main] +/// use riot_wrappers::riot_main; /// riot_main!(main); /// /// fn main() { diff --git a/src/msg/v2.rs b/src/msg/v2.rs index 88288990..2fb60930 100644 --- a/src/msg/v2.rs +++ b/src/msg/v2.rs @@ -171,16 +171,14 @@ pub trait MessageSemantics: Sized { /// /// ``` /// # #![no_std] - /// # #![feature(start)] - /// # #[start] - /// # fn main(_argc: isize, _argv: *const *const u8) -> isize { - /// # use riot_wrappers::msg::v2::*; - /// # let message_semantics = unsafe { NoConfiguredMessages::new() }; + /// # #![no_main] + /// # fn f() { + /// use riot_wrappers::msg::v2::*; + /// # let message_semantics = NoConfiguredMessages; // FIXME: constructing this should not be possible publicly /// type NumberReceived = ReceivePort; /// type BoolReceived = ReceivePort; /// let (message_semantics, receive_num, send_num): (_, NumberReceived, _) = message_semantics.split_off(); /// let (message_semantics, receive_bool, send_bool): (_, BoolReceived, _) = message_semantics.split_off(); - /// # 0 /// # } /// ``` ///