From 3372966664518fece373ef8fc9c8f687fe795cf8 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 14 Jun 2018 08:24:37 +0200 Subject: [PATCH] Add missing core::panic::PanicInfo imports in code snippets (#440) --- .../second-edition/posts/01-freestanding-rust-binary/index.md | 4 ++++ .../second-edition/posts/02-minimal-rust-kernel/index.md | 2 ++ blog/content/second-edition/posts/04-unit-testing/index.md | 2 ++ 3 files changed, 8 insertions(+) diff --git a/blog/content/second-edition/posts/01-freestanding-rust-binary/index.md b/blog/content/second-edition/posts/01-freestanding-rust-binary/index.md index 4c4f1173..a7c5831b 100644 --- a/blog/content/second-edition/posts/01-freestanding-rust-binary/index.md +++ b/blog/content/second-edition/posts/01-freestanding-rust-binary/index.md @@ -200,6 +200,8 @@ To tell the Rust compiler that we don't want to use the normal entry point chain #![no_std] #![no_main] +use core::panic::PanicInfo; + /// This function is called on panic. #[panic_implementation] #[no_mangle] @@ -313,6 +315,8 @@ A minimal freestanding Rust binary looks like this: #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points +use core::panic::PanicInfo; + /// This function is called on panic. #[panic_implementation] #[no_mangle] diff --git a/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md b/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md index b71d6450..c6f8a9a3 100644 --- a/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md +++ b/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md @@ -201,6 +201,8 @@ Compiling for our new target will use Linux conventions (I'm not quite sure why, #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points +use core::panic::PanicInfo; + /// This function is called on panic. #[panic_implementation] #[no_mangle] diff --git a/blog/content/second-edition/posts/04-unit-testing/index.md b/blog/content/second-edition/posts/04-unit-testing/index.md index e9f26605..4ae7f021 100644 --- a/blog/content/second-edition/posts/04-unit-testing/index.md +++ b/blog/content/second-edition/posts/04-unit-testing/index.md @@ -45,6 +45,8 @@ The problem is that unit tests are built for the host machine, with the `std` li ```rust // in src/main.rs +use core::panic::PanicInfo; + #[cfg(not(test))] // only compile when the test flag is not set #[panic_implementation] #[no_mangle]