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
let y: &i32;
let x = 5;
y = &x;
println!("{}", y);
以上在rustc 可以正確 compile, 但書中說應該出現
error: x does not live long enough
y = &x;
^
note: reference must be valid for the block suffix following statement 0 at
2:16...
let y: &i32;
let x = 5;
y = &x;
println!("{}", y);
}
note: ...but borrowed value is only valid for the block suffix following
statement 1 at 3:14
let x = 5;
y = &x;
println!("{}", y);
}
The text was updated successfully, but these errors were encountered:
4.8 節的範例沒有文中出現的 borrow Error.
也找不到可以參考的原始檔. 因為書中原始檔 github 連結已經失效
以上在rustc 可以正確 compile, 但書中說應該出現
error:
x
does not live long enoughy = &x;
^
note: reference must be valid for the block suffix following statement 0 at
2:16...
let y: &i32;
let x = 5;
y = &x;
}
note: ...but borrowed value is only valid for the block suffix following
statement 1 at 3:14
let x = 5;
y = &x;
}
The text was updated successfully, but these errors were encountered: