mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Add missing core::fmt::{self, Write} imports in testing post
This commit is contained in:
@@ -923,6 +923,8 @@ Checking the reported panic message is a bit more complicated. The reason is tha
|
||||
```rust
|
||||
// in tests/panic_handler.rs
|
||||
|
||||
use core::fmt;
|
||||
|
||||
/// Compares a `fmt::Arguments` instance with the `MESSAGE` string.
|
||||
///
|
||||
/// To use this type, write the `fmt::Arguments` instance to it using the
|
||||
@@ -956,6 +958,8 @@ With the `CompareMessage` type, we can finally implement our `check_message` fun
|
||||
|
||||
#![feature(panic_info_message)] // at the top of the file
|
||||
|
||||
use core::fmt::Write;
|
||||
|
||||
fn check_message(info: &PanicInfo) {
|
||||
let message = info.message().unwrap_or_else(|| fail("no message"));
|
||||
let mut compare_message = CompareMessage { equals: false };
|
||||
|
||||
Reference in New Issue
Block a user