Skip to content

Commit 04210ae

Browse files
committed
Update output for doc hidden usefulness ui test output
1 parent ef0d99d commit 04210ae

File tree

2 files changed

+64
-62
lines changed

2 files changed

+64
-62
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
error: pattern requires `..` due to inaccessible fields
2+
--> $DIR/doc-hidden-fields.rs:8:9
3+
|
4+
LL | let HiddenStruct { one, two, } = HiddenStruct::default();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
help: ignore the inaccessible and unused fields
8+
|
9+
LL | let HiddenStruct { one, two, .., } = HiddenStruct::default();
10+
| ++++
11+
12+
error[E0027]: pattern does not mention field `two` and inaccessible fields
13+
--> $DIR/doc-hidden-fields.rs:11:9
14+
|
15+
LL | let HiddenStruct { one, } = HiddenStruct::default();
16+
| ^^^^^^^^^^^^^^^^^^^^^ missing field `two` and inaccessible fields
17+
|
18+
help: include the missing field in the pattern and ignore the inaccessible fields
19+
|
20+
LL | let HiddenStruct { one, two, .. } = HiddenStruct::default();
21+
| ~~~~~~~~~~~
22+
help: if you don't care about this missing field, you can explicitly ignore it
23+
|
24+
LL | let HiddenStruct { one, .. } = HiddenStruct::default();
25+
| ~~~~~~
26+
27+
error[E0027]: pattern does not mention field `two`
28+
--> $DIR/doc-hidden-fields.rs:14:9
29+
|
30+
LL | let HiddenStruct { one, hide } = HiddenStruct::default();
31+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `two`
32+
|
33+
help: include the missing field in the pattern
34+
|
35+
LL | let HiddenStruct { one, hide, two } = HiddenStruct::default();
36+
| ~~~~~~~
37+
help: if you don't care about this missing field, you can explicitly ignore it
38+
|
39+
LL | let HiddenStruct { one, hide, .. } = HiddenStruct::default();
40+
| ~~~~~~
41+
42+
error: aborting due to 3 previous errors
43+
44+
For more information about this error, try `rustc --explain E0027`.

src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr

+20-62
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,41 @@
11
error[E0004]: non-exhaustive patterns: `_` not covered
22
--> $DIR/doc-hidden-non-exhaustive.rs:8:11
33
|
4-
LL | match Foo::A {
5-
| ^^^^^^ pattern `_` not covered
6-
|
7-
note: `Foo` defined here
8-
--> $DIR/auxiliary/hidden.rs:1:1
9-
|
10-
LL | / pub enum Foo {
11-
LL | | A,
12-
LL | | B,
13-
LL | | #[doc(hidden)]
14-
LL | | C,
15-
LL | | }
16-
| |_^
17-
= note: the matched value is of type `Foo`
18-
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
19-
|
20-
LL ~ Foo::B => {}
21-
LL + _ => todo!()
4+
LL | match HiddenEnum::A {
5+
| ^^^^^^^^^^^^^ pattern `_` not covered
226
|
7+
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
8+
= note: the matched value is of type `HiddenEnum`
239

2410
error[E0004]: non-exhaustive patterns: `B` not covered
2511
--> $DIR/doc-hidden-non-exhaustive.rs:14:11
2612
|
27-
LL | match Foo::A {
28-
| ^^^^^^ pattern `B` not covered
13+
LL | match HiddenEnum::A {
14+
| ^^^^^^^^^^^^^ pattern `B` not covered
2915
|
3016
note: `Foo` defined here
3117
--> $DIR/auxiliary/hidden.rs:3:5
3218
|
33-
LL | / pub enum Foo {
34-
LL | | A,
35-
LL | | B,
36-
| | ^ not covered
37-
LL | | #[doc(hidden)]
38-
LL | | C,
39-
LL | | }
40-
| |_-
41-
= note: the matched value is of type `Foo`
42-
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
43-
|
44-
LL ~ Foo::C => {}
45-
LL + B => todo!()
19+
LL | B,
20+
| - not covered
4621
|
22+
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
23+
= note: the matched value is of type `HiddenEnum`
4724

4825
error[E0004]: non-exhaustive patterns: `B` and `_` not covered
4926
--> $DIR/doc-hidden-non-exhaustive.rs:20:11
5027
|
51-
LL | match Foo::A {
52-
| ^^^^^^ patterns `B` and `_` not covered
28+
LL | match HiddenEnum::A {
29+
| ^^^^^^^^^^^^^ patterns `B` and `_` not covered
5330
|
5431
note: `Foo` defined here
5532
--> $DIR/auxiliary/hidden.rs:3:5
5633
|
57-
LL | / pub enum Foo {
58-
LL | | A,
59-
LL | | B,
60-
| | ^ not covered
61-
LL | | #[doc(hidden)]
62-
LL | | C,
63-
LL | | }
64-
| |_-
65-
= note: the matched value is of type `Foo`
66-
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
67-
|
68-
LL ~ Foo::A => {}
69-
LL + B | _ => todo!()
34+
LL | B,
35+
| - not covered
7036
|
37+
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
38+
= note: the matched value is of type `HiddenEnum`
7139

7240
error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
7341
--> $DIR/doc-hidden-non-exhaustive.rs:25:11
@@ -78,21 +46,11 @@ LL | match None {
7846
note: `Option<Foo>` defined here
7947
--> $SRC_DIR/core/src/option.rs:LL:COL
8048
|
81-
LL | / pub enum Option<T> {
82-
LL | | /// No value.
83-
LL | | #[lang = "None"]
84-
LL | | #[stable(feature = "rust1", since = "1.0.0")]
85-
... |
86-
LL | | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
87-
| | ^^^^ not covered
88-
LL | | }
89-
| |_-
90-
= note: the matched value is of type `Option<Foo>`
91-
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
92-
|
93-
LL ~ Some(Foo::A) => {}
94-
LL + Some(B) | Some(_) => todo!()
49+
LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
50+
| ---- not covered
9551
|
52+
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
53+
= note: the matched value is of type `Option<HiddenEnum>`
9654

9755
error: aborting due to 4 previous errors
9856

0 commit comments

Comments
 (0)