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
pubstructA{pubeax:u32}pubunsafefnbar() -> A{let r:A;asm!("cpuid\n":"={eax}"(r.eax):"{eax}"(0),"{ecx}"(0):"rbx":);
r
}
with
error[E0594]: cannot assign to field `r.eax` of immutable binding
--> src/lib.rs:7:25
|
5 | let r: A;
| - help: make this binding mutable: `mut r`
6 | asm!("cpuid\n"
7 | : "={eax}"(r.eax)
| ^^^^^ cannot mutably borrow field of immutable binding
error[E0381]: use of possibly uninitialized variable: `r`
--> src/lib.rs:10:5
|
10 | r
| ^ use of possibly uninitialized `r`
This works (Playground):
but this fails (Playground):
with
In particular, making
r
mut
(Playground):still errors with:
even though
r
is fully initialized. However this works (Playground):I expected that all of these would either work, or not work. They all look the same to me.
The text was updated successfully, but these errors were encountered: