Skip to content

Commit

Permalink
Fix borrow so it fails in 2018 edition Fixes rust-lang#1141
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgalex committed Feb 5, 2019
1 parent a5ed6aa commit 9c9695c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/scope/borrow.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ fn main() {
borrow_i32(&stacked_i32);
{
// 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.
// Can't destroy `boxed_i32` if the inner value is borrowed later in scope.
eat_box_i32(boxed_i32);
// FIXME ^ Comment out this line
// Take a reference to the data contained inside the box
let _ref_to_i32: &i32 = &boxed_i32;
// `_ref_to_i32` goes out of scope and is no longer borrowed.
}
Expand Down

0 comments on commit 9c9695c

Please sign in to comment.