Skip to content

Commit 1ff0f8e

Browse files
authored
Merge pull request #1152 from gurgalex/make_borrow_example_fail_for_2018
Fix borrow so it fails in 2018 edition Fixes #1141
2 parents 8236c2e + 4e85201 commit 1ff0f8e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/scope/borrow.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ fn main() {
3434
let _ref_to_i32: &i32 = &boxed_i32;
3535
3636
// Error!
37-
// Can't destroy `boxed_i32` while the inner value is borrowed.
37+
// Can't destroy `boxed_i32` while the inner value is borrowed later in scope.
3838
eat_box_i32(boxed_i32);
3939
// FIXME ^ Comment out this line
4040
41+
// Attempt to borrow `_ref_to_i32` after inner value is destroyed
42+
borrow_i32(_ref_to_i32);
4143
// `_ref_to_i32` goes out of scope and is no longer borrowed.
4244
}
4345

0 commit comments

Comments
 (0)