You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A-diagnosticsArea: Messages for errors, warnings, and lintsA-inline-assemblyArea: Inline assembly (`asm!(…)`)C-enhancementCategory: An issue proposing an enhancement or a PR with one.
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!
@nagisa - I was wondering. It does open up questions about how to make macros give better errors but perhaps there is a better forum for that design question.
A-diagnosticsArea: Messages for errors, warnings, and lintsA-inline-assemblyArea: Inline assembly (`asm!(…)`)C-enhancementCategory: An issue proposing an enhancement or a PR with one.
Activity
nagisa commentedon Jul 20, 2016
In the compiler inline assembly is one big opaque blob. I doubt its worth much spending effort on such unstable feature yet.
sophiajt commentedon Jul 20, 2016
@nagisa - I was wondering. It does open up questions about how to make macros give better errors but perhaps there is a better forum for that design question.
Rollup merge of rust-lang#54945 - estebank:asm-span, r=petrochenkov
Auto merge of #54945 - estebank:asm-span, r=petrochenkov