From 0e4c13937b309126a06a893d6923a812dbee8fd7 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 25 Jan 2019 13:41:07 +0100 Subject: [PATCH] Use `#![cfg_attr(not(test), no_std)]` instead of `#![no_std]` --- .../second-edition/posts/05-integration-tests/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/blog/content/second-edition/posts/05-integration-tests/index.md b/blog/content/second-edition/posts/05-integration-tests/index.md index a6c8db71..741a91bd 100644 --- a/blog/content/second-edition/posts/05-integration-tests/index.md +++ b/blog/content/second-edition/posts/05-integration-tests/index.md @@ -325,7 +325,7 @@ Cargo allows to add [additional executables] to a project by putting them inside ```rust // src/bin/test-something.rs -#![no_std] +#![cfg_attr(not(test), no_std)] #![cfg_attr(not(test), no_main)] #![cfg_attr(test, allow(dead_code, unused_macros, unused_imports))] @@ -383,8 +383,8 @@ pub unsafe fn exit_qemu() { ```rust // src/main.rs -#![no_std] // don't link the Rust standard library -#![cfg_attr(not(test), no_main)] // disable all Rust-level entry points +#![cfg_attr(not(test), no_std)] +#![cfg_attr(not(test), no_main)] #![cfg_attr(test, allow(dead_code, unused_macros, unused_imports))] use core::panic::PanicInfo; @@ -418,7 +418,7 @@ We are finally able to create our first integration test executable. We start si ```rust // in src/bin/test-basic-boot.rs -#![no_std] // don't link the Rust standard library +#![cfg_attr(not(test), no_std)] #![cfg_attr(not(test), no_main)] // disable all Rust-level entry points #![cfg_attr(test, allow(dead_code, unused_macros, unused_imports))] @@ -479,7 +479,7 @@ To test that our panic handler is really invoked on a panic, we create a `test-p ```rust // in src/bin/test-panic.rs -#![no_std] +#![cfg_attr(not(test), no_std)] #![cfg_attr(not(test), no_main)] #![cfg_attr(test, allow(dead_code, unused_macros, unused_imports))]