Skip to content

Commit 8aaf0f8

Browse files
committed
doc/book: fix tests for non-x86 architectures, such as aarch64
`rustdoc --test` gets confused when "main" exists for some architectures but not others.
1 parent 4e5e36f commit 8aaf0f8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/doc/book/inline-assembly.md

+8
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ asm!("xor %eax, %eax"
6060
: "eax"
6161
);
6262
# } }
63+
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
64+
# fn main() {}
6365
```
6466

6567
Whitespace also doesn't matter:
@@ -70,6 +72,8 @@ Whitespace also doesn't matter:
7072
# fn main() { unsafe {
7173
asm!("xor %eax, %eax" ::: "eax");
7274
# } }
75+
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
76+
# fn main() {}
7377
```
7478

7579
## Operands
@@ -129,6 +133,8 @@ stay valid.
129133
// Put the value 0x200 in eax
130134
asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "eax");
131135
# } }
136+
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
137+
# fn main() {}
132138
```
133139

134140
Input and output registers need not be listed since that information
@@ -164,6 +170,8 @@ unsafe {
164170
}
165171
println!("eax is currently {}", result);
166172
# }
173+
# #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
174+
# fn main() {}
167175
```
168176

169177
## More Information

0 commit comments

Comments
 (0)