Skip to content

Commit

Permalink
Fix rebase conflicts with stderr files
Browse files Browse the repository at this point in the history
  • Loading branch information
DevinR528 committed Mar 12, 2022
1 parent c0e76d6 commit 492d8d7
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/pattern/usefulness/doc-hidden-fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions src/test/ui/pattern/usefulness/doc-hidden-fields.stderr
Original file line number Diff line number Diff line change
@@ -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
|
Expand Down
101 changes: 73 additions & 28 deletions src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,71 +4,116 @@ 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
|
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
|
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
|
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

Expand Down
29 changes: 29 additions & 0 deletions src/test/ui/pattern/usefulness/stable-gated-fields.stderr
Original file line number Diff line number Diff line change
@@ -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`.
24 changes: 12 additions & 12 deletions src/test/ui/pattern/usefulness/stable-gated-patterns.stderr
Original file line number Diff line number Diff line change
@@ -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")]
Expand All @@ -17,34 +17,34 @@ 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")]
... |
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!()
|

Expand Down
33 changes: 33 additions & 0 deletions src/test/ui/pattern/usefulness/unstable-gated-fields.stderr
Original file line number Diff line number Diff line change
@@ -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`.
12 changes: 6 additions & 6 deletions src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr
Original file line number Diff line number Diff line change
@@ -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")]
Expand All @@ -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!()
|

Expand Down

0 comments on commit 492d8d7

Please sign in to comment.