Skip to content

Commit

Permalink
Adjust global_asm doc test to work on all platforms.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ehuss committed Feb 4, 2021
1 parent dc7746f commit 900648c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/doc/unstable-book/src/library-features/global-asm.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ 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"));
```

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#"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 900648c

Please sign in to comment.