Closed
Description
https://doc.rust-lang.org/rust-by-example/scope/borrow.html shows an example that supposedly does not work, but actually does work with Rust 2018:
{
// Take a reference to the data contained inside the box
let _ref_to_i32: &i32 = &boxed_i32;
// Error!
// Can't destroy `boxed_i32` while the inner value is borrowed.
eat_box_i32(boxed_i32);
// FIXME ^ Comment out this line
// `_ref_to_i32` goes out of scope and is no longer borrowed.
}
Metadata
Metadata
Assignees
Labels
No labels