ignore tests

mdbook doesn't support no_std code
pull/75/head
Jorge Aparicio 6 years ago
parent 5f36fc705b
commit 676e7d1aaa

@ -17,14 +17,30 @@ Below is shown an example where an application has a different panicking behavio
whether is compiled using the dev profile (`cargo build`) or using the release profile (`cargo build whether is compiled using the dev profile (`cargo build`) or using the release profile (`cargo build
--release`). --release`).
``` rust ``` rust, ignore
// crate: panic-semihosting -- log panic message to the host stderr using semihosting // crate: panic-semihosting -- log panic messages to the host stderr using semihosting
#![no_std] #![no_std]
use core::fmt::{Write, self};
use core::panic::PanicInfo;
struct HStderr {
// ..
# _0: (),
}
#
# impl HStderr {
# fn new() -> HStderr { HStderr { _0: () } }
# }
#
# impl fmt::Write for HStderr {
# fn write_str(&mut self, _: &str) -> fmt::Result { Ok(()) }
# }
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(info: &PanicInfo) -> ! {
let host_stderr = /* .. */; let mut host_stderr = HStderr::new();
// logs "panicked at '$reason', src/main.rs:27:4" to the host stderr // logs "panicked at '$reason', src/main.rs:27:4" to the host stderr
writeln!(host_stderr, "{}", info).ok(); writeln!(host_stderr, "{}", info).ok();
@ -33,18 +49,20 @@ fn panic(info: &PanicInfo) -> ! {
} }
``` ```
``` rust ``` rust, ignore
// crate: panic-halt -- halt the thread on panic; messages are discarded // crate: panic-halt -- halt the thread on panic; messages are discarded
#![no_std] #![no_std]
use core::panic::PanicInfo;
#[panic_handler] #[panic_handler]
fn panic(info: &PanicInfo) -> ! { fn panic(_info: &PanicInfo) -> ! {
loop {} loop {}
} }
``` ```
``` rust ``` rust, ignore
// crate: app // crate: app
#![no_std] #![no_std]

Loading…
Cancel
Save