Skip to content

Commit fc02eee

Browse files
fix wrapping
1 parent dd7c48e commit fc02eee

File tree

1 file changed

+4
-5
lines changed
  • compiler/rustc_error_codes/src/error_codes

1 file changed

+4
-5
lines changed

compiler/rustc_error_codes/src/error_codes/E0311.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,21 @@ Rust book) to the `nested_borrow_mut` and `borrow_mut` functions. In both cases
2929
the input is a reference to `self`, so the compiler attempts to assign the
3030
the same lifetime to the input and output.
3131

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:
3534
- `self` (which is a `&mut T`)
3635
- `u_ref` (which is a `&mut U`)
3736
- `v_ref` (which is a `&mut V`)
3837

3938
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:
4140

4241
```rust
4342
let u_ref = self.borrow_mut();
4443
let v_ref = u_ref.borrow_mut();
4544
```
4645

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
4847
`v_ref` and `u_ref` share a lifetime bound. The problem is that the function
4948
signature for `nested_borrow_mut` only gives the compiler information about the
5049
lifetimes of `self` and `v_ref` -- nothing about `u_ref`.

0 commit comments

Comments
 (0)