rust/tests/ui/nll/self-assign-ref-mut.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
260 B
Rust
Raw Normal View History

// 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;
}