Skip to content

Commit

Permalink
Merge pull request #1152 from gurgalex/make_borrow_example_fail_for_2018
Browse files Browse the repository at this point in the history
Fix borrow so it fails in 2018 edition Fixes #1141
  • Loading branch information
marioidival authored Apr 15, 2019
2 parents 8236c2e + 4e85201 commit 1ff0f8e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/scope/borrow.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ fn main() {
let _ref_to_i32: &i32 = &boxed_i32;
// Error!
// Can't destroy `boxed_i32` while the inner value is borrowed.
// Can't destroy `boxed_i32` while the inner value is borrowed later in scope.
eat_box_i32(boxed_i32);
// FIXME ^ Comment out this line
// Attempt to borrow `_ref_to_i32` after inner value is destroyed
borrow_i32(_ref_to_i32);
// `_ref_to_i32` goes out of scope and is no longer borrowed.
}
Expand Down

0 comments on commit 1ff0f8e

Please sign in to comment.