about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-11-19 12:11:09 +0000
committerbors <bors@rust-lang.org>2019-11-19 12:11:09 +0000
commit9d6ff1553b7debbe5c99c102ce0978b6130592f8 (patch)
treeecd66e45b8f75d0ad7b407c61e9570a9b5e9646d /src/librustc_error_codes/error_codes
parent2cad8bb659066b42fc518c95def384956126bd3f (diff)
parente1a32faf880360c836a350dbfe9a02d2cd45bcf9 (diff)
downloadrust-9d6ff1553b7debbe5c99c102ce0978b6130592f8.tar.gz
rust-9d6ff1553b7debbe5c99c102ce0978b6130592f8.zip
Auto merge of #66545 - Centril:rollup-xv2rx7v, r=Centril
Rollup of 11 pull requests

Successful merges:

 - #66090 (Misc CI improvements)
 - #66155 (Add long error explanation for E0594)
 - #66239 (Suggest calling async closure when needed)
 - #66430 ([doc] Fix the source code highlighting on source comments)
 - #66431 (Fix 'type annotations needed' error with opaque types)
 - #66461 (Add explanation message for E0641)
 - #66493 (Add JohnTitor to rustc-guide toolstate notification list)
 - #66511 (std::error::Chain: remove Copy)
 - #66529 (resolve: Give derive helpers highest priority during resolution)
 - #66536 (Move the definition of `QueryResult` into `plumbing.rs`.)
 - #66538 (Remove compiler_builtins_lib feature from libstd)

Failed merges:

r? @ghost
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0594.md23
-rw-r--r--src/librustc_error_codes/error_codes/E0641.md19
2 files changed, 42 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes/E0594.md b/src/librustc_error_codes/error_codes/E0594.md
new file mode 100644
index 00000000000..ad8eb631e63
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0594.md
@@ -0,0 +1,23 @@
+A non-mutable value was assigned a value.
+
+Erroneous code example:
+
+```compile_fail,E0594
+struct SolarSystem {
+    earth: i32,
+}
+
+let ss = SolarSystem { earth: 3 };
+ss.earth = 2; // error!
+```
+
+To fix this error, declare `ss` as mutable by using the `mut` keyword:
+
+```
+struct SolarSystem {
+    earth: i32,
+}
+
+let mut ss = SolarSystem { earth: 3 }; // declaring `ss` as mutable
+ss.earth = 2; // ok!
+```
diff --git a/src/librustc_error_codes/error_codes/E0641.md b/src/librustc_error_codes/error_codes/E0641.md
new file mode 100644
index 00000000000..e39bebce1fe
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0641.md
@@ -0,0 +1,19 @@
+Attempted to cast to/from a pointer with an unknown kind.
+
+Erroneous code examples:
+
+```compile_fail,E0641
+let b = 0 as *const _; // error
+```
+
+Must give information for type of pointer that is being cast from/to if the
+type cannot be inferred.
+
+```
+// Creating a pointer from reference: type can be inferred
+let a = &(String::from("Hello world!")) as *const _; // Ok
+
+let b = 0 as *const i32; // Ok
+
+let c: *const i32 = 0 as *const _; // Ok
+```
\ No newline at end of file