Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kill borrows from assignments after generating new borrows
- Loading branch information
1 parent
b314654
commit c621919
Showing
2 changed files
with
24 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Check that `*y` isn't borrowed after `y = y`. | ||
|
||
// check-pass | ||
|
||
fn main() { | ||
let mut x = 1; | ||
{ | ||
let mut y = &mut x; | ||
y = y; | ||
y; | ||
} | ||
x; | ||
{ | ||
let mut y = &mut x; | ||
y = y; | ||
y = y; | ||
y; | ||
} | ||
x; | ||
} |