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.
This commit is contained in:
Eric Huss 2021-02-04 09:41:15 -08:00
parent dc7746f334
commit 900648cfd6
1 changed files with 5 additions and 3 deletions

View File

@ -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