about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-08-05 11:40:07 +0900
committerGitHub <noreply@github.com>2020-08-05 11:40:07 +0900
commit008228a708302d4dd8359dccee6a8a85fff3865e (patch)
tree97609183179020d2991880e96e0f86fe5459c92a /src/librustc_error_codes/error_codes
parent7b39f75187f14a7d8b3735967499b457d85b17cb (diff)
parent0275cd74096b71f6c641b06e73e6cb359303d6cc (diff)
downloadrust-008228a708302d4dd8359dccee6a8a85fff3865e.tar.gz
rust-008228a708302d4dd8359dccee6a8a85fff3865e.zip
Rollup merge of #75140 - GuillaumeGomez:cleanup-e0745, r=pickfire
Clean up E0745

r? @Dylan-DPC
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0745.md11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/librustc_error_codes/error_codes/E0745.md b/src/librustc_error_codes/error_codes/E0745.md
index 6595691ce78..23ee7af30f4 100644
--- a/src/librustc_error_codes/error_codes/E0745.md
+++ b/src/librustc_error_codes/error_codes/E0745.md
@@ -1,20 +1,23 @@
-Cannot take address of temporary value.
+The address of temporary value was taken.
 
 Erroneous code example:
 
 ```compile_fail,E0745
 # #![feature(raw_ref_op)]
 fn temp_address() {
-    let ptr = &raw const 2;   // ERROR
+    let ptr = &raw const 2; // error!
 }
 ```
 
-To avoid the error, first bind the temporary to a named local variable.
+In this example, `2` is destroyed right after the assignment, which means that
+`ptr` now points to an unavailable location.
+
+To avoid this error, first bind the temporary to a named local variable:
 
 ```
 # #![feature(raw_ref_op)]
 fn temp_address() {
     let val = 2;
-    let ptr = &raw const val;
+    let ptr = &raw const val; // ok!
 }
 ```