@@ -171,7 +171,6 @@ As with format strings, positional arguments must appear before named arguments
171171
172172``` rust,compile_fail
173173# #[cfg(target_arch = "x86_64")] {
174- let x = 5;
175174// Named operands need to come after positional ones
176175unsafe { core::arch::asm!("/* {x} {} */", x = const 5, in(reg) 5); }
177176// ERROR: positional arguments cannot follow named arguments or explicit register arguments
@@ -181,7 +180,6 @@ unsafe { core::arch::asm!("/* {x} {} */", x = const 5, in(reg) 5); }
181180
182181``` rust,compile_fail
183182# #[cfg(target_arch = "x86_64")] {
184- let x = 5;
185183// We also can't put explicit registers before positional operands
186184unsafe { core::arch::asm!("/* {} */", in("eax") 0, in(reg) 5); }
187185// ERROR: positional arguments cannot follow named arguments or explicit register arguments
@@ -194,7 +192,6 @@ Explicit register operands cannot be used by placeholders in the template string
194192
195193``` rust,compile_fail
196194# #[cfg(target_arch = "x86_64")] {
197- let x = 5;
198195// Explicit register operands don't get substituted, use `eax` explicitly in the string
199196unsafe { core::arch::asm!("/* {} */", in("eax") 5); }
200197// ERROR: invalid reference to argument at index 0
@@ -207,7 +204,6 @@ All other named and positional operands must appear at least once in the templat
207204
208205``` rust,compile_fail
209206# #[cfg(target_arch = "x86_64")] {
210- let x = 5;
211207// We have to name all of the operands in the format string
212208unsafe { core::arch::asm!("", in(reg) 5, x = const 5); }
213209// ERROR: multiple unused asm arguments
@@ -407,7 +403,6 @@ Because `global_asm!` exists outside a function, it can only use `sym` and `cons
407403
408404``` rust,compile_fail
409405# fn main() {}
410- let x = 5;
411406// register operands aren't allowed, since we aren't in a function
412407# #[cfg(target_arch = "x86_64")]
413408core::arch::global_asm!("", in(reg) 5);
@@ -469,7 +464,6 @@ Additionally, it is also a compile-time error to use overlapping registers (e.g.
469464
470465``` rust,compile_fail
471466# #[cfg(target_arch = "x86_64")] {
472- let x = 5;
473467// al overlaps with ax, so we can't name both of them.
474468unsafe { core::arch::asm!("", in("ax") 5, in("al") 4i8); }
475469// ERROR: register `al` conflicts with register `ax`
0 commit comments