about summary refs log tree commit diff
path: root/src/test/ui/pattern
diff options
context:
space:
mode:
authorDevin Ragotzy <devin.ragotzy@gmail.com>2021-10-27 20:58:23 -0400
committerDevin Ragotzy <devin.ragotzy@gmail.com>2022-03-12 15:15:43 -0500
commit04210aec5ff8e369a8e8468652e02254b5ee2922 (patch)
treea36e2832a4535eb3a33bfd28e370ac50fd5b407f /src/test/ui/pattern
parentef0d99d8d43dccf5f20e49826fc0c0126012390f (diff)
downloadrust-04210aec5ff8e369a8e8468652e02254b5ee2922.tar.gz
rust-04210aec5ff8e369a8e8468652e02254b5ee2922.zip
Update output for doc hidden usefulness ui test output
Diffstat (limited to 'src/test/ui/pattern')
-rw-r--r--src/test/ui/pattern/usefulness/doc-hidden-fields.stderr44
-rw-r--r--src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr82
2 files changed, 64 insertions, 62 deletions
diff --git a/src/test/ui/pattern/usefulness/doc-hidden-fields.stderr b/src/test/ui/pattern/usefulness/doc-hidden-fields.stderr
new file mode 100644
index 00000000000..9e48925479b
--- /dev/null
+++ b/src/test/ui/pattern/usefulness/doc-hidden-fields.stderr
@@ -0,0 +1,44 @@
+error: pattern requires `..` due to inaccessible fields
+  --> $DIR/doc-hidden-fields.rs:8:9
+   |
+LL |     let HiddenStruct { one, two, } = HiddenStruct::default();
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: ignore the inaccessible and unused fields
+   |
+LL |     let HiddenStruct { one, two, .., } = HiddenStruct::default();
+   |                                ++++
+
+error[E0027]: pattern does not mention field `two` and inaccessible fields
+  --> $DIR/doc-hidden-fields.rs:11:9
+   |
+LL |     let HiddenStruct { one, } = HiddenStruct::default();
+   |         ^^^^^^^^^^^^^^^^^^^^^ missing field `two` and inaccessible fields
+   |
+help: include the missing field in the pattern and ignore the inaccessible fields
+   |
+LL |     let HiddenStruct { one, two, .. } = HiddenStruct::default();
+   |                           ~~~~~~~~~~~
+help: if you don't care about this missing field, you can explicitly ignore it
+   |
+LL |     let HiddenStruct { one, .. } = HiddenStruct::default();
+   |                           ~~~~~~
+
+error[E0027]: pattern does not mention field `two`
+  --> $DIR/doc-hidden-fields.rs:14:9
+   |
+LL |     let HiddenStruct { one, hide } = HiddenStruct::default();
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `two`
+   |
+help: include the missing field in the pattern
+   |
+LL |     let HiddenStruct { one, hide, two } = HiddenStruct::default();
+   |                                 ~~~~~~~
+help: if you don't care about this missing field, you can explicitly ignore it
+   |
+LL |     let HiddenStruct { one, hide, .. } = HiddenStruct::default();
+   |                                 ~~~~~~
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0027`.
diff --git a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
index 7d0b71a497e..41cdb8fdedb 100644
--- a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
+++ b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
@@ -1,73 +1,41 @@
 error[E0004]: non-exhaustive patterns: `_` not covered
   --> $DIR/doc-hidden-non-exhaustive.rs:8:11
    |
-LL |     match Foo::A {
-   |           ^^^^^^ pattern `_` not covered
-   |
-note: `Foo` defined here
-  --> $DIR/auxiliary/hidden.rs:1:1
-   |
-LL | / pub enum Foo {
-LL | |     A,
-LL | |     B,
-LL | |     #[doc(hidden)]
-LL | |     C,
-LL | | }
-   | |_^
-   = note: the matched value is of type `Foo`
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
-   |
-LL ~         Foo::B => {}
-LL +         _ => todo!()
+LL |     match HiddenEnum::A {
+   |           ^^^^^^^^^^^^^ pattern `_` not covered
    |
+   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+   = note: the matched value is of type `HiddenEnum`
 
 error[E0004]: non-exhaustive patterns: `B` not covered
   --> $DIR/doc-hidden-non-exhaustive.rs:14:11
    |
-LL |     match Foo::A {
-   |           ^^^^^^ pattern `B` not covered
+LL |     match HiddenEnum::A {
+   |           ^^^^^^^^^^^^^ pattern `B` not covered
    |
 note: `Foo` defined here
   --> $DIR/auxiliary/hidden.rs:3:5
    |
-LL | / pub enum Foo {
-LL | |     A,
-LL | |     B,
-   | |     ^ not covered
-LL | |     #[doc(hidden)]
-LL | |     C,
-LL | | }
-   | |_-
-   = note: the matched value is of type `Foo`
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
-   |
-LL ~         Foo::C => {}
-LL +         B => todo!()
+LL |     B,
+   |     - not covered
    |
+   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+   = note: the matched value is of type `HiddenEnum`
 
 error[E0004]: non-exhaustive patterns: `B` and `_` not covered
   --> $DIR/doc-hidden-non-exhaustive.rs:20:11
    |
-LL |     match Foo::A {
-   |           ^^^^^^ patterns `B` and `_` not covered
+LL |     match HiddenEnum::A {
+   |           ^^^^^^^^^^^^^ patterns `B` and `_` not covered
    |
 note: `Foo` defined here
   --> $DIR/auxiliary/hidden.rs:3:5
    |
-LL | / pub enum Foo {
-LL | |     A,
-LL | |     B,
-   | |     ^ not covered
-LL | |     #[doc(hidden)]
-LL | |     C,
-LL | | }
-   | |_-
-   = note: the matched value is of type `Foo`
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
-   |
-LL ~         Foo::A => {}
-LL +         B | _ => todo!()
+LL |     B,
+   |     - not covered
    |
+   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+   = note: the matched value is of type `HiddenEnum`
 
 error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
   --> $DIR/doc-hidden-non-exhaustive.rs:25:11
@@ -78,21 +46,11 @@ LL |     match None {
 note: `Option<Foo>` defined here
   --> $SRC_DIR/core/src/option.rs:LL:COL
    |
-LL | / pub enum Option<T> {
-LL | |     /// No value.
-LL | |     #[lang = "None"]
-LL | |     #[stable(feature = "rust1", since = "1.0.0")]
-...  |
-LL | |     Some(#[stable(feature = "rust1", since = "1.0.0")] T),
-   | |     ^^^^ not covered
-LL | | }
-   | |_-
-   = note: the matched value is of type `Option<Foo>`
-help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
-   |
-LL ~         Some(Foo::A) => {}
-LL +         Some(B) | Some(_) => todo!()
+LL |     Some(#[stable(feature = "rust1", since = "1.0.0")] T),
+   |     ---- not covered
    |
+   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+   = note: the matched value is of type `Option<HiddenEnum>`
 
 error: aborting due to 4 previous errors