From 900648cfd68c246ab7774bee1126b770955e3e6b Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Thu, 4 Feb 2021 09:41:15 -0800 Subject: [PATCH] Adjust global_asm doc test to work on all platforms. The cfg isn't actually necessary, since `--emit=metadata` does not actually do enough validation for it to fail on any platform. However, I feel a little more comfortable leaving it in. Unhide the feature flag, since I think that is important to display. --- src/doc/unstable-book/src/library-features/global-asm.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/doc/unstable-book/src/library-features/global-asm.md b/src/doc/unstable-book/src/library-features/global-asm.md index c5ff68ec7d39..ce1155a977cd 100644 --- a/src/doc/unstable-book/src/library-features/global-asm.md +++ b/src/doc/unstable-book/src/library-features/global-asm.md @@ -25,7 +25,7 @@ conventions of the assembler in your toolchain. A simple usage looks like this: ```rust,ignore (requires-external-file) -# #![feature(global_asm)] +#![feature(global_asm)] # // you also need relevant target_arch cfgs global_asm!(include_str!("something_neato.s")); ``` @@ -33,8 +33,9 @@ global_asm!(include_str!("something_neato.s")); And a more complicated usage looks like this: ```rust,no_run -# #![feature(global_asm)] -# #![cfg(any(target_arch = "x86", target_arch = "x86_64"))] +#![feature(global_asm)] +# #[cfg(any(target_arch="x86", target_arch="x86_64"))] +# mod x86 { pub mod sally { global_asm!(r#" @@ -64,6 +65,7 @@ pub mod harry { #[no_mangle] pub unsafe extern "C" fn quux() {} } +# } ``` You may use `global_asm!` multiple times, anywhere in your crate, in