about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDevin Ragotzy <devin.ragotzy@gmail.com>2022-03-12 15:38:44 -0500
committerDevin Ragotzy <devin.ragotzy@gmail.com>2022-03-12 15:38:44 -0500
commit492d8d72936685726066ef0f0f0a9d935f537eee (patch)
tree213a15657b6a6e3fa8e7daf847d4d0f25186beeb
parentc0e76d6999983959af871060d98f72f2067a51a2 (diff)
downloadrust-492d8d72936685726066ef0f0f0a9d935f537eee.tar.gz
rust-492d8d72936685726066ef0f0f0a9d935f537eee.zip
Fix rebase conflicts with stderr files
-rw-r--r--compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs2
-rw-r--r--src/test/ui/pattern/usefulness/doc-hidden-fields.rs4
-rw-r--r--src/test/ui/pattern/usefulness/doc-hidden-fields.stderr10
-rw-r--r--src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr101
-rw-r--r--src/test/ui/pattern/usefulness/stable-gated-fields.stderr29
-rw-r--r--src/test/ui/pattern/usefulness/stable-gated-patterns.stderr24
-rw-r--r--src/test/ui/pattern/usefulness/unstable-gated-fields.stderr33
-rw-r--r--src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr12
8 files changed, 161 insertions, 54 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
index 72b12759315..612bed639bf 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
@@ -695,7 +695,7 @@ impl<'tcx> Constructor<'tcx> {
     /// attribute from a type not local to the current crate.
     pub(super) fn is_doc_hidden_variant(&self, pcx: PatCtxt<'_, '_, 'tcx>) -> bool {
         if let Constructor::Variant(idx) = self && let ty::Adt(adt, _) = pcx.ty.kind() {
-            let variant_def_id = adt.variants[*idx].def_id;
+            let variant_def_id = adt.variants()[*idx].def_id;
             return pcx.cx.tcx.is_doc_hidden(variant_def_id) && !variant_def_id.is_local();
         }
         false
diff --git a/src/test/ui/pattern/usefulness/doc-hidden-fields.rs b/src/test/ui/pattern/usefulness/doc-hidden-fields.rs
index aad3809a410..4163b87dc85 100644
--- a/src/test/ui/pattern/usefulness/doc-hidden-fields.rs
+++ b/src/test/ui/pattern/usefulness/doc-hidden-fields.rs
@@ -12,10 +12,10 @@ struct InCrate {
 }
 
 fn main() {
-    let HiddenStruct { one, two, } = HiddenStruct::default();
+    let HiddenStruct { one, two } = HiddenStruct::default();
     //~^ pattern requires `..` due to inaccessible fields
 
-    let HiddenStruct { one, } = HiddenStruct::default();
+    let HiddenStruct { one } = HiddenStruct::default();
     //~^ pattern does not mention field `two` and inaccessible fields
 
     let HiddenStruct { one, hide } = HiddenStruct::default();
diff --git a/src/test/ui/pattern/usefulness/doc-hidden-fields.stderr b/src/test/ui/pattern/usefulness/doc-hidden-fields.stderr
index 2f1575bfa41..f277bfbc884 100644
--- a/src/test/ui/pattern/usefulness/doc-hidden-fields.stderr
+++ b/src/test/ui/pattern/usefulness/doc-hidden-fields.stderr
@@ -1,19 +1,19 @@
 error: pattern requires `..` due to inaccessible fields
   --> $DIR/doc-hidden-fields.rs:15:9
    |
-LL |     let HiddenStruct { one, two, } = HiddenStruct::default();
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     let HiddenStruct { one, two } = HiddenStruct::default();
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 help: ignore the inaccessible and unused fields
    |
-LL |     let HiddenStruct { one, two, .., } = HiddenStruct::default();
+LL |     let HiddenStruct { one, two, .. } = HiddenStruct::default();
    |                                ++++
 
 error[E0027]: pattern does not mention field `two` and inaccessible fields
   --> $DIR/doc-hidden-fields.rs:18:9
    |
-LL |     let HiddenStruct { one, } = HiddenStruct::default();
-   |         ^^^^^^^^^^^^^^^^^^^^^ missing field `two` and inaccessible fields
+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
    |
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 729716cb723..296465eb818 100644
--- a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
+++ b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
@@ -4,8 +4,22 @@ error[E0004]: non-exhaustive patterns: `_` not covered
 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: `HiddenEnum` defined here
+  --> $DIR/auxiliary/hidden.rs:1:1
+   |
+LL | / pub enum HiddenEnum {
+LL | |     A,
+LL | |     B,
+LL | |     #[doc(hidden)]
+LL | |     C,
+LL | | }
+   | |_^
    = note: the matched value is of type `HiddenEnum`
+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 ~         HiddenEnum::B => {}
+LL +         _ => todo!()
+   |
 
 error[E0004]: non-exhaustive patterns: `B` not covered
   --> $DIR/doc-hidden-non-exhaustive.rs:21:11
@@ -13,14 +27,23 @@ error[E0004]: non-exhaustive patterns: `B` not covered
 LL |     match HiddenEnum::A {
    |           ^^^^^^^^^^^^^ pattern `B` not covered
    |
-note: `Foo` defined here
+note: `HiddenEnum` defined here
   --> $DIR/auxiliary/hidden.rs:3:5
    |
-LL |     B,
-   |     - not covered
-   |
-   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+LL | / pub enum HiddenEnum {
+LL | |     A,
+LL | |     B,
+   | |     ^ not covered
+LL | |     #[doc(hidden)]
+LL | |     C,
+LL | | }
+   | |_-
    = note: the matched value is of type `HiddenEnum`
+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 ~         HiddenEnum::C => {}
+LL +         B => todo!()
+   |
 
 error[E0004]: non-exhaustive patterns: `B` and `_` not covered
   --> $DIR/doc-hidden-non-exhaustive.rs:27:11
@@ -28,14 +51,23 @@ error[E0004]: non-exhaustive patterns: `B` and `_` not covered
 LL |     match HiddenEnum::A {
    |           ^^^^^^^^^^^^^ patterns `B` and `_` not covered
    |
-note: `Foo` defined here
+note: `HiddenEnum` defined here
   --> $DIR/auxiliary/hidden.rs:3:5
    |
-LL |     B,
-   |     - not covered
-   |
-   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+LL | / pub enum HiddenEnum {
+LL | |     A,
+LL | |     B,
+   | |     ^ not covered
+LL | |     #[doc(hidden)]
+LL | |     C,
+LL | | }
+   | |_-
    = note: the matched value is of type `HiddenEnum`
+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 ~         HiddenEnum::A => {}
+LL +         B | _ => todo!()
+   |
 
 error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
   --> $DIR/doc-hidden-non-exhaustive.rs:32:11
@@ -43,32 +75,45 @@ error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
 LL |     match None {
    |           ^^^^ patterns `Some(B)` and `Some(_)` not covered
    |
-note: `Option<Foo>` defined here
+note: `Option<HiddenEnum>` defined here
   --> $SRC_DIR/core/src/option.rs:LL:COL
    |
-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
+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<HiddenEnum>`
+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(HiddenEnum::A) => {}
+LL +         Some(B) | Some(_) => todo!()
+   |
 
 error[E0004]: non-exhaustive patterns: `C` not covered
   --> $DIR/doc-hidden-non-exhaustive.rs:38:11
    |
-LL | / enum InCrate {
-LL | |     A,
-LL | |     B,
-LL | |     #[doc(hidden)]
-LL | |     C,
-   | |     - not covered
-LL | | }
-   | |_- `InCrate` defined here
-...
-LL |       match InCrate::A {
-   |             ^^^^^^^^^^ pattern `C` not covered
+LL |     match InCrate::A {
+   |           ^^^^^^^^^^ pattern `C` not covered
    |
-   = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
+note: `InCrate` defined here
+  --> $DIR/doc-hidden-non-exhaustive.rs:11:5
+   |
+LL | enum InCrate {
+   |      -------
+...
+LL |     C,
+   |     ^ not covered
    = note: the matched value is of type `InCrate`
+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 ~         InCrate::B => {}
+LL +         C => todo!()
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/pattern/usefulness/stable-gated-fields.stderr b/src/test/ui/pattern/usefulness/stable-gated-fields.stderr
new file mode 100644
index 00000000000..cf98c51a2b4
--- /dev/null
+++ b/src/test/ui/pattern/usefulness/stable-gated-fields.stderr
@@ -0,0 +1,29 @@
+error[E0027]: pattern does not mention field `stable2` and inaccessible fields
+  --> $DIR/stable-gated-fields.rs:8:9
+   |
+LL |     let UnstableStruct { stable } = UnstableStruct::default();
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `stable2` and inaccessible fields
+   |
+help: include the missing field in the pattern and ignore the inaccessible fields
+   |
+LL |     let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
+   |                                ~~~~~~~~~~~~~~~
+help: if you don't care about this missing field, you can explicitly ignore it
+   |
+LL |     let UnstableStruct { stable, .. } = UnstableStruct::default();
+   |                                ~~~~~~
+
+error: pattern requires `..` due to inaccessible fields
+  --> $DIR/stable-gated-fields.rs:11:9
+   |
+LL |     let UnstableStruct { stable, stable2 } = UnstableStruct::default();
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: ignore the inaccessible and unused fields
+   |
+LL |     let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
+   |                                         ++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0027`.
diff --git a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr
index 696ef9d8de9..559539178cb 100644
--- a/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr
+++ b/src/test/ui/pattern/usefulness/stable-gated-patterns.stderr
@@ -1,13 +1,13 @@
 error[E0004]: non-exhaustive patterns: `Stable2` and `_` not covered
   --> $DIR/stable-gated-patterns.rs:8:11
    |
-LL |     match Foo::Stable {
-   |           ^^^^^^^^^^^ patterns `Stable2` and `_` not covered
+LL |     match UnstableEnum::Stable {
+   |           ^^^^^^^^^^^^^^^^^^^^ patterns `Stable2` and `_` not covered
    |
-note: `Foo` defined here
+note: `UnstableEnum` defined here
   --> $DIR/auxiliary/unstable.rs:9:5
    |
-LL | / pub enum Foo {
+LL | / pub enum UnstableEnum {
 LL | |     #[stable(feature = "stable_test_feature", since = "1.0.0")]
 LL | |     Stable,
 LL | |     #[stable(feature = "stable_test_feature", since = "1.0.0")]
@@ -17,23 +17,23 @@ LL | |     #[unstable(feature = "unstable_test_feature", issue = "none")]
 LL | |     Unstable,
 LL | | }
    | |_-
-   = note: the matched value is of type `Foo`
+   = note: the matched value is of type `UnstableEnum`
 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::Stable => {}
+LL ~         UnstableEnum::Stable => {}
 LL +         Stable2 | _ => todo!()
    |
 
 error[E0004]: non-exhaustive patterns: `_` not covered
   --> $DIR/stable-gated-patterns.rs:13:11
    |
-LL |     match Foo::Stable {
-   |           ^^^^^^^^^^^ pattern `_` not covered
+LL |     match UnstableEnum::Stable {
+   |           ^^^^^^^^^^^^^^^^^^^^ pattern `_` not covered
    |
-note: `Foo` defined here
+note: `UnstableEnum` defined here
   --> $DIR/auxiliary/unstable.rs:5:1
    |
-LL | / pub enum Foo {
+LL | / pub enum UnstableEnum {
 LL | |     #[stable(feature = "stable_test_feature", since = "1.0.0")]
 LL | |     Stable,
 LL | |     #[stable(feature = "stable_test_feature", since = "1.0.0")]
@@ -41,10 +41,10 @@ LL | |     #[stable(feature = "stable_test_feature", since = "1.0.0")]
 LL | |     Unstable,
 LL | | }
    | |_^
-   = note: the matched value is of type `Foo`
+   = note: the matched value is of type `UnstableEnum`
 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::Stable2 => {}
+LL ~         UnstableEnum::Stable2 => {}
 LL +         _ => todo!()
    |
 
diff --git a/src/test/ui/pattern/usefulness/unstable-gated-fields.stderr b/src/test/ui/pattern/usefulness/unstable-gated-fields.stderr
new file mode 100644
index 00000000000..e4f5fa06b3f
--- /dev/null
+++ b/src/test/ui/pattern/usefulness/unstable-gated-fields.stderr
@@ -0,0 +1,33 @@
+error[E0027]: pattern does not mention field `unstable`
+  --> $DIR/unstable-gated-fields.rs:10:9
+   |
+LL |     let UnstableStruct { stable, stable2, } = UnstableStruct::default();
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `unstable`
+   |
+help: include the missing field in the pattern
+   |
+LL |     let UnstableStruct { stable, stable2, unstable } = UnstableStruct::default();
+   |                                         ~~~~~~~~~~~~
+help: if you don't care about this missing field, you can explicitly ignore it
+   |
+LL |     let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
+   |                                         ~~~~~~
+
+error[E0027]: pattern does not mention field `stable2`
+  --> $DIR/unstable-gated-fields.rs:13:9
+   |
+LL |     let UnstableStruct { stable, unstable, } = UnstableStruct::default();
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `stable2`
+   |
+help: include the missing field in the pattern
+   |
+LL |     let UnstableStruct { stable, unstable, stable2 } = UnstableStruct::default();
+   |                                          ~~~~~~~~~~~
+help: if you don't care about this missing field, you can explicitly ignore it
+   |
+LL |     let UnstableStruct { stable, unstable, .. } = UnstableStruct::default();
+   |                                          ~~~~~~
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0027`.
diff --git a/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr b/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr
index 8487c9725da..b5f1805deef 100644
--- a/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr
+++ b/src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr
@@ -1,13 +1,13 @@
 error[E0004]: non-exhaustive patterns: `Unstable` not covered
   --> $DIR/unstable-gated-patterns.rs:10:11
    |
-LL |     match Foo::Stable {
-   |           ^^^^^^^^^^^ pattern `Unstable` not covered
+LL |     match UnstableEnum::Stable {
+   |           ^^^^^^^^^^^^^^^^^^^^ pattern `Unstable` not covered
    |
-note: `Foo` defined here
+note: `UnstableEnum` defined here
   --> $DIR/auxiliary/unstable.rs:11:5
    |
-LL | / pub enum Foo {
+LL | / pub enum UnstableEnum {
 LL | |     #[stable(feature = "stable_test_feature", since = "1.0.0")]
 LL | |     Stable,
 LL | |     #[stable(feature = "stable_test_feature", since = "1.0.0")]
@@ -16,10 +16,10 @@ LL | |     Unstable,
    | |     ^^^^^^^^ not covered
 LL | | }
    | |_-
-   = note: the matched value is of type `Foo`
+   = note: the matched value is of type `UnstableEnum`
 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::Stable2 => {}
+LL ~         UnstableEnum::Stable2 => {}
 LL +         Unstable => todo!()
    |