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-12-24 03:40:33 +0000
committerbors <bors@rust-lang.org>2019-12-24 03:40:33 +0000
commit625375400cdd172877e81c3ce44ce68f2011af2d (patch)
tree2c80e84603e8cc5e868fe94406e6661baca703c0 /src/librustc_error_codes/error_codes
parenta4cd03dee2b57216b5c95084a0b46de130946ad7 (diff)
parenta76d67f22f08abf355a1b6abd22b8e2b7db700eb (diff)
downloadrust-625375400cdd172877e81c3ce44ce68f2011af2d.tar.gz
rust-625375400cdd172877e81c3ce44ce68f2011af2d.zip
Auto merge of #67575 - Centril:rollup-feikoir, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #67337 (Ensure that evaluating or validating a constant never reads from a static)
 - #67543 (Add regression tests for fixed ICEs)
 - #67547 (Cleanup err codes)
 - #67551 (Add long error code explanation message for E0627)
 - #67561 (remove `description` from `Error` impls in docs)
 - #67569 (Clean up unsafety in char::encode_utf8)
 - #67572 (Use the chocolatey CDN directly to avoid the flaky API)

Failed merges:

r? @ghost
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0124.md5
-rw-r--r--src/librustc_error_codes/error_codes/E0128.md9
-rw-r--r--src/librustc_error_codes/error_codes/E0627.md30
3 files changed, 38 insertions, 6 deletions
diff --git a/src/librustc_error_codes/error_codes/E0124.md b/src/librustc_error_codes/error_codes/E0124.md
index a7836526a7d..8af7cb819cf 100644
--- a/src/librustc_error_codes/error_codes/E0124.md
+++ b/src/librustc_error_codes/error_codes/E0124.md
@@ -1,5 +1,6 @@
-You declared two fields of a struct with the same name. Erroneous code
-example:
+A struct was declared with two fields having the same name.
+
+Erroneous code example:
 
 ```compile_fail,E0124
 struct Foo {
diff --git a/src/librustc_error_codes/error_codes/E0128.md b/src/librustc_error_codes/error_codes/E0128.md
index d0a4b32f968..6f8dfe3a73b 100644
--- a/src/librustc_error_codes/error_codes/E0128.md
+++ b/src/librustc_error_codes/error_codes/E0128.md
@@ -1,4 +1,5 @@
-Type parameter defaults can only use parameters that occur before them.
+A type parameter with default value is using forward declared identifier.
+
 Erroneous code example:
 
 ```compile_fail,E0128
@@ -7,11 +8,11 @@ struct Foo<T = U, U = ()> {
     field2: U,
 }
 // error: type parameters with a default cannot use forward declared
-// identifiers
+//        identifiers
 ```
 
-Since type parameters are evaluated in-order, you may be able to fix this issue
-by doing:
+Type parameter defaults can only use parameters that occur before them. Since
+type parameters are evaluated in-order, this issue could be fixed by doing:
 
 ```
 struct Foo<U = (), T = U> {
diff --git a/src/librustc_error_codes/error_codes/E0627.md b/src/librustc_error_codes/error_codes/E0627.md
new file mode 100644
index 00000000000..21358e1e567
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0627.md
@@ -0,0 +1,30 @@
+A yield expression was used outside of the generator literal.
+
+Erroneous code example:
+
+```compile_fail,E0627
+#![feature(generators, generator_trait)]
+
+fn fake_generator() -> &'static str {
+    yield 1;
+    return "foo"
+}
+
+fn main() {
+    let mut generator = fake_generator;
+}
+```
+
+The error occurs because keyword `yield` can only be used inside the generator
+literal. This can be fixed by constructing the generator correctly.
+
+```
+#![feature(generators, generator_trait)]
+
+fn main() {
+    let mut generator = || {
+        yield 1;
+        return "foo"
+    };
+}
+```