@@ -29,22 +29,21 @@ Rust book) to the `nested_borrow_mut` and `borrow_mut` functions. In both cases
29
29
the input is a reference to ` self ` , so the compiler attempts to assign the
30
30
the same lifetime to the input and output.
31
31
32
- Looking specifically at ` nested_borrow_mut ` ,
33
- we see that there are three object references to keep track of,
34
- along with their associated lifetimes:
32
+ Looking specifically at ` nested_borrow_mut ` , we see that there are three object
33
+ references to keep track of, along with their associated lifetimes:
35
34
- ` self ` (which is a ` &mut T ` )
36
35
- ` u_ref ` (which is a ` &mut U ` )
37
36
- ` v_ref ` (which is a ` &mut V ` )
38
37
39
38
The ` borrow_mut() ` method implicitly requires that that the input and output
40
- have the same lifetime bounds. Thus:
39
+ have the same lifetime bounds. Thus the lines :
41
40
42
41
``` rust
43
42
let u_ref = self . borrow_mut ();
44
43
let v_ref = u_ref . borrow_mut ();
45
44
```
46
45
47
- Imply that ` u_ref ` and ` self ` must share a lifetime bound, and also that
46
+ imply that ` u_ref ` and ` self ` must share a lifetime bound, and also that
48
47
` v_ref ` and ` u_ref ` share a lifetime bound. The problem is that the function
49
48
signature for ` nested_borrow_mut ` only gives the compiler information about the
50
49
lifetimes of ` self ` and ` v_ref ` -- nothing about ` u_ref ` .
0 commit comments