-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
4.8 節的範例沒有文中出現的 borrow Error.
也找不到可以參考的原始檔. 因為書中原始檔 github 連結已經失效
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);
}
Metadata
Metadata
Assignees
Labels
No labels