diff options
| author | carschandler <92899389+carschandler@users.noreply.github.com> | 2024-02-05 15:23:05 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-05 15:23:05 -0600 |
| commit | 71a697327bd64bdebcdf81b10c3dd03dfe33cb68 (patch) | |
| tree | 5353bc546646fecca772f6bee8c0fa799497ff73 /compiler/rustc_error_codes/src | |
| parent | ea37e8091fe87ae0a7e204c034e7d55061e56790 (diff) | |
| download | rust-71a697327bd64bdebcdf81b10c3dd03dfe33cb68.tar.gz rust-71a697327bd64bdebcdf81b10c3dd03dfe33cb68.zip | |
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.
Diffstat (limited to 'compiler/rustc_error_codes/src')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0716.md | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0716.md b/compiler/rustc_error_codes/src/error_codes/E0716.md index c3546cd744f..b50c8b8e7ca 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0716.md +++ b/compiler/rustc_error_codes/src/error_codes/E0716.md @@ -30,8 +30,9 @@ 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 -above by showing that `tmp` would be freed as we exit the block. +statement -- in this case, after the outer `let` that assigns to `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 rather than relying on a temporary. For example, you might change the original |
