|
|
@ -66,11 +66,7 @@ let y = &x;
|
|
|
|
z = y;
|
|
|
|
z = y;
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
The borrow checker always tries to minimize the extent of a lifetime, so it will
|
|
|
|
|
|
|
|
likely desugar to something like the following:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```rust,ignore
|
|
|
|
```rust,ignore
|
|
|
|
// NOTE: `'a: {` and `foo = &'b x` is not valid syntax!
|
|
|
|
|
|
|
|
'a: {
|
|
|
|
'a: {
|
|
|
|
let x: i32 = 0;
|
|
|
|
let x: i32 = 0;
|
|
|
|
'b: {
|
|
|
|
'b: {
|
|
|
@ -191,8 +187,6 @@ println!("{}", x);
|
|
|
|
'c: {
|
|
|
|
'c: {
|
|
|
|
// Temporary scope because we don't need the
|
|
|
|
// Temporary scope because we don't need the
|
|
|
|
// &mut to last any longer.
|
|
|
|
// &mut to last any longer.
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: Vec::push is not valid syntax
|
|
|
|
|
|
|
|
Vec::push(&'c mut data, 4);
|
|
|
|
Vec::push(&'c mut data, 4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
println!("{}", x);
|
|
|
|
println!("{}", x);
|
|
|
|