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` defined here --> $SRC_DIR/core/src/option.rs:LL:COL | -LL | / pub enum Option { -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` -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` error: aborting due to 4 previous errors