Skip to content

Commit

Permalink
Rollup merge of rust-lang#120684 - carschandler:patch-1, r=nnethercote
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matthiaskrgr authored Mar 2, 2024
2 parents 56ba5af + 50ff362 commit 4e8af6c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_error_codes/src/error_codes/E0716.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let q = p;

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

To fix this problem, you need to create a local variable to store the value in
Expand Down

0 comments on commit 4e8af6c

Please sign in to comment.