Skip to content

Commit 71a6973

Browse files
authored
Update E0716.md for clarity
When reading through this, I got slightly hung up thinking the `let` it was referring to was the `let tmp` on line 25, which was confusing considering the comment states that the temporary is freed at the end of the block. I think adding this clarification could potentially help some beginners like myself without being overly verbose.
1 parent ea37e80 commit 71a6973

File tree

1 file changed

+3
-2
lines changed
  • compiler/rustc_error_codes/src/error_codes

1 file changed

+3
-2
lines changed

compiler/rustc_error_codes/src/error_codes/E0716.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ let q = p;
3030

3131
Whenever a temporary is created, it is automatically dropped (freed) according
3232
to fixed rules. Ordinarily, the temporary is dropped at the end of the enclosing
33-
statement -- in this case, after the `let`. This is illustrated in the example
34-
above by showing that `tmp` would be freed as we exit the block.
33+
statement -- in this case, after the outer `let` that assigns to `p`. This is
34+
illustrated in the example above by showing that `tmp` would be freed as we exit
35+
the block.
3536

3637
To fix this problem, you need to create a local variable to store the value in
3738
rather than relying on a temporary. For example, you might change the original

0 commit comments

Comments
 (0)