Closed
Description
Looking around the compile-fail test suite, I noticed this example:
jturner-23759:rust jturner$ ./build/x86_64-apple-darwin/stage1/bin/rustc src/test/compile-fail/asm-out-assign-imm.rs
error[E0384]: re-assignment of immutable variable `x`
--> src/test/compile-fail/asm-out-assign-imm.rs:24:9
|
21 | x = 1; //~ NOTE first assignment
| ----- first assignment to `x`
...
24 | asm!("mov $1, $0" : "=r"(x) : "r"(5));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ re-assignment of immutable variable
src/test/compile-fail/asm-out-assign-imm.rs:24:9: 24:47 note: in this expansion of asm!
The span on the asm line seems a bit much. Ideally, I think we'd show them where the assignment is happening so they don't have to look for it. Something like:
24 | asm!("mov $1, $0" : "=r"(x) : "r"(5));
| ^^^^^^^ re-assignment of immutable variable
src/test/compile-fail/asm-out-assign-imm.rs:24:9: 24:47 note: in this expansion of asm!
Or even:
24 | asm!("mov $1, $0" : "=r"(x) : "r"(5));
| ^ re-assignment of immutable variable
src/test/compile-fail/asm-out-assign-imm.rs:24:9: 24:47 note: in this expansion of asm!