diff --git a/blog/content/second-edition/posts/04-testing/index.md b/blog/content/second-edition/posts/04-testing/index.md index d6d16989..f94e48e3 100644 --- a/blog/content/second-edition/posts/04-testing/index.md +++ b/blog/content/second-edition/posts/04-testing/index.md @@ -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 };