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>2020-07-14 17:11:02 +0000
committerbors <bors@rust-lang.org>2020-07-14 17:11:02 +0000
commit2002ebacfbca288830a3c308ddc8189705c608fe (patch)
treed02268730c1ae866eb4a1ec31e144592b868be3d /src/librustc_error_codes/error_codes
parentc724b67e1b474262917a5154d74e7072267593fe (diff)
parent5414eae4521d0b6141b9db4c44be144757e5d5fb (diff)
Auto merge of #74330 - Manishearth:rollup-mrc09pb, r=Manishearth
Rollup of 15 pull requests

Successful merges:

 - #71237 (Add Ayu theme to rustdoc)
 - #73720 (Clean up E0704 error explanation)
 - #73866 (Obviate #[allow(improper_ctypes_definitions)])
 - #73965 (typeck: check for infer before type impls trait)
 - #73986 (add (unchecked) indexing methods to raw (and NonNull) slices)
 - #74173 (Detect tuple struct incorrectly used as struct pat)
 - #74220 (Refactor Windows `parse_prefix`)
 - #74227 (Remove an unwrap in layout computation)
 - #74239 (Update llvm-project to latest origin/rustc/10.0-2020-05-05 commit )
 - #74257 (don't mark linux kernel module targets as a unix environment)
 - #74270 (typeck: report placeholder type error w/out span)
 - #74296 (Clarify the description for rfind)
 - #74310 (Use `ArrayVec` in `SparseBitSet`.)
 - #74316 (Remove unnecessary type hints from Wake internals)
 - #74324 (Update Clippy)

Failed merges:

r? @ghost
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0704.md5
-rw-r--r--src/librustc_error_codes/error_codes/E0769.md39
2 files changed, 42 insertions, 2 deletions
diff --git a/src/librustc_error_codes/error_codes/E0704.md b/src/librustc_error_codes/error_codes/E0704.md
index cde46f52c27..c22b274fb22 100644
--- a/src/librustc_error_codes/error_codes/E0704.md
+++ b/src/librustc_error_codes/error_codes/E0704.md
@@ -1,6 +1,6 @@
-This error indicates that a incorrect visibility restriction was specified.
+An incorrect visibility restriction was specified.
 
-Example of erroneous code:
+Erroneous code example:
 
 ```compile_fail,E0704
 mod foo {
@@ -12,6 +12,7 @@ mod foo {
 
 To make struct `Bar` only visible in module `foo` the `in` keyword should be
 used:
+
 ```
 mod foo {
     pub(in crate::foo) struct Bar {
diff --git a/src/librustc_error_codes/error_codes/E0769.md b/src/librustc_error_codes/error_codes/E0769.md
new file mode 100644
index 00000000000..d1995be9899
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0769.md
@@ -0,0 +1,39 @@
+A tuple struct or tuple variant was used in a pattern as if it were a
+struct or struct variant.
+
+Erroneous code example:
+
+```compile_fail,E0769
+enum E {
+    A(i32),
+}
+let e = E::A(42);
+match e {
+    E::A { number } => println!("{}", x),
+}
+```
+
+To fix this error, you can use the tuple pattern:
+
+```
+# enum E {
+#     A(i32),
+# }
+# let e = E::A(42);
+match e {
+    E::A(number) => println!("{}", number),
+}
+```
+
+Alternatively, you can also use the struct pattern by using the correct
+field names and binding them to new identifiers:
+
+```
+# enum E {
+#     A(i32),
+# }
+# let e = E::A(42);
+match e {
+    E::A { 0: number } => println!("{}", number),
+}
+```