Skip to content

Commit 676e7d1

Browse files
committed
ignore tests
mdbook doesn't support no_std code
1 parent 5f36fc7 commit 676e7d1

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

src/panic-handler.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,30 @@ Below is shown an example where an application has a different panicking behavio
1717
whether is compiled using the dev profile (`cargo build`) or using the release profile (`cargo build
1818
--release`).
1919

20-
``` rust
21-
// crate: panic-semihosting -- log panic message to the host stderr using semihosting
20+
``` rust, ignore
21+
// crate: panic-semihosting -- log panic messages to the host stderr using semihosting
2222
2323
#![no_std]
2424
25+
use core::fmt::{Write, self};
26+
use core::panic::PanicInfo;
27+
28+
struct HStderr {
29+
// ..
30+
# _0: (),
31+
}
32+
#
33+
# impl HStderr {
34+
# fn new() -> HStderr { HStderr { _0: () } }
35+
# }
36+
#
37+
# impl fmt::Write for HStderr {
38+
# fn write_str(&mut self, _: &str) -> fmt::Result { Ok(()) }
39+
# }
40+
2541
#[panic_handler]
2642
fn panic(info: &PanicInfo) -> ! {
27-
let host_stderr = /* .. */;
43+
let mut host_stderr = HStderr::new();
2844
2945
// logs "panicked at '$reason', src/main.rs:27:4" to the host stderr
3046
writeln!(host_stderr, "{}", info).ok();
@@ -33,18 +49,20 @@ fn panic(info: &PanicInfo) -> ! {
3349
}
3450
```
3551

36-
``` rust
52+
``` rust, ignore
3753
// crate: panic-halt -- halt the thread on panic; messages are discarded
3854
3955
#![no_std]
4056
57+
use core::panic::PanicInfo;
58+
4159
#[panic_handler]
42-
fn panic(info: &PanicInfo) -> ! {
60+
fn panic(_info: &PanicInfo) -> ! {
4361
loop {}
4462
}
4563
```
4664

47-
``` rust
65+
``` rust, ignore
4866
// crate: app
4967
5068
#![no_std]

0 commit comments

Comments
 (0)