Skip to content

Commit 7868b8f

Browse files
committed
Fix borrow so it fails in 2018 edition Fixes #1141
1 parent a5ed6aa commit 7868b8f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/scope/borrow.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@ fn main() {
3030
borrow_i32(&stacked_i32);
3131
3232
{
33-
// Take a reference to the data contained inside the box
34-
let _ref_to_i32: &i32 = &boxed_i32;
35-
3633
// Error!
37-
// Can't destroy `boxed_i32` while the inner value is borrowed.
34+
// Can't destroy `boxed_i32` while the inner value is borrowed later in scope.
3835
eat_box_i32(boxed_i32);
3936
// FIXME ^ Comment out this line
4037
38+
// Take a reference to the data contained inside the box
39+
let _ref_to_i32: &i32 = &boxed_i32;
4140
// `_ref_to_i32` goes out of scope and is no longer borrowed.
4241
}
4342

0 commit comments

Comments
 (0)