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
use std;
import std::unsafe;
fn f(addr: @mutable int) -> ~int {
let i = ~100;
let a: int = unsafe::reinterpret_cast(i);
log a;
*addr = a;
// Since i is not a temporary it gets copied, which is not what you expect
ret i;
}
fn main() {
let addr = @mutable 0;
let i <- f(addr);
let expected = *addr;
let actual: int = unsafe::reinterpret_cast(i);
log expected;
log actual;
assert expected == actual;
}