@@ -171,7 +171,6 @@ As with format strings, positional arguments must appear before named arguments
171
171
172
172
``` rust,compile_fail
173
173
# #[cfg(target_arch = "x86_64")] {
174
- let x = 5;
175
174
// Named operands need to come after positional ones
176
175
unsafe { core::arch::asm!("/* {x} {} */", x = const 5, in(reg) 5); }
177
176
// 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); }
181
180
182
181
``` rust,compile_fail
183
182
# #[cfg(target_arch = "x86_64")] {
184
- let x = 5;
185
183
// We also can't put explicit registers before positional operands
186
184
unsafe { core::arch::asm!("/* {} */", in("eax") 0, in(reg) 5); }
187
185
// 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
194
192
195
193
``` rust,compile_fail
196
194
# #[cfg(target_arch = "x86_64")] {
197
- let x = 5;
198
195
// Explicit register operands don't get substituted, use `eax` explicitly in the string
199
196
unsafe { core::arch::asm!("/* {} */", in("eax") 5); }
200
197
// 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
207
204
208
205
``` rust,compile_fail
209
206
# #[cfg(target_arch = "x86_64")] {
210
- let x = 5;
211
207
// We have to name all of the operands in the format string
212
208
unsafe { core::arch::asm!("", in(reg) 5, x = const 5); }
213
209
// ERROR: multiple unused asm arguments
@@ -407,7 +403,6 @@ Because `global_asm!` exists outside a function, it can only use `sym` and `cons
407
403
408
404
``` rust,compile_fail
409
405
# fn main() {}
410
- let x = 5;
411
406
// register operands aren't allowed, since we aren't in a function
412
407
# #[cfg(target_arch = "x86_64")]
413
408
core::arch::global_asm!("", in(reg) 5);
@@ -469,7 +464,6 @@ Additionally, it is also a compile-time error to use overlapping registers (e.g.
469
464
470
465
``` rust,compile_fail
471
466
# #[cfg(target_arch = "x86_64")] {
472
- let x = 5;
473
467
// al overlaps with ax, so we can't name both of them.
474
468
unsafe { core::arch::asm!("", in("ax") 5, in("al") 4i8); }
475
469
// ERROR: register `al` conflicts with register `ax`
0 commit comments