You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #90358 - DevinR528:omitted-field-fix, r=jackh726
Fix exposing fields marked unstable or doc hidden
Closes#89837
Work towards #89554
Filter fields that are marked `doc(hidden)` or are unstable with that feature turned off. This brings structs and enums into alignment behavior-wise when emitting warning/errors about pattern exhaustiveness/reachability.
cc `@Nadrieril`
error[E0004]: non-exhaustive patterns: `_` not covered
2
-
--> $DIR/doc-hidden-non-exhaustive.rs:8:11
2
+
--> $DIR/doc-hidden-non-exhaustive.rs:15:11
3
3
|
4
-
LL | match Foo::A {
5
-
| ^^^^^^ pattern `_` not covered
4
+
LL | match HiddenEnum::A {
5
+
| ^^^^^^^^^^^^^ pattern `_` not covered
6
6
|
7
-
note: `Foo` defined here
7
+
note: `HiddenEnum` defined here
8
8
--> $DIR/auxiliary/hidden.rs:1:1
9
9
|
10
-
LL | / pub enum Foo {
10
+
LL | / pub enum HiddenEnum {
11
11
LL | | A,
12
12
LL | | B,
13
13
LL | | #[doc(hidden)]
14
14
LL | | C,
15
15
LL | | }
16
16
| |_^
17
-
= note: the matched value is of type `Foo`
17
+
= note: the matched value is of type `HiddenEnum`
18
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
19
|
20
-
LL ~ Foo::B => {}
20
+
LL ~ HiddenEnum::B => {}
21
21
LL + _ => todo!()
22
22
|
23
23
24
24
error[E0004]: non-exhaustive patterns: `B` not covered
25
-
--> $DIR/doc-hidden-non-exhaustive.rs:14:11
25
+
--> $DIR/doc-hidden-non-exhaustive.rs:21:11
26
26
|
27
-
LL | match Foo::A {
28
-
| ^^^^^^ pattern `B` not covered
27
+
LL | match HiddenEnum::A {
28
+
| ^^^^^^^^^^^^^ pattern `B` not covered
29
29
|
30
-
note: `Foo` defined here
30
+
note: `HiddenEnum` defined here
31
31
--> $DIR/auxiliary/hidden.rs:3:5
32
32
|
33
-
LL | / pub enum Foo {
33
+
LL | / pub enum HiddenEnum {
34
34
LL | | A,
35
35
LL | | B,
36
36
| | ^ not covered
37
37
LL | | #[doc(hidden)]
38
38
LL | | C,
39
39
LL | | }
40
40
| |_-
41
-
= note: the matched value is of type `Foo`
41
+
= note: the matched value is of type `HiddenEnum`
42
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
43
|
44
-
LL ~ Foo::C => {}
44
+
LL ~ HiddenEnum::C => {}
45
45
LL + B => todo!()
46
46
|
47
47
48
48
error[E0004]: non-exhaustive patterns: `B` and `_` not covered
49
-
--> $DIR/doc-hidden-non-exhaustive.rs:20:11
49
+
--> $DIR/doc-hidden-non-exhaustive.rs:27:11
50
50
|
51
-
LL | match Foo::A {
52
-
| ^^^^^^ patterns `B` and `_` not covered
51
+
LL | match HiddenEnum::A {
52
+
| ^^^^^^^^^^^^^ patterns `B` and `_` not covered
53
53
|
54
-
note: `Foo` defined here
54
+
note: `HiddenEnum` defined here
55
55
--> $DIR/auxiliary/hidden.rs:3:5
56
56
|
57
-
LL | / pub enum Foo {
57
+
LL | / pub enum HiddenEnum {
58
58
LL | | A,
59
59
LL | | B,
60
60
| | ^ not covered
61
61
LL | | #[doc(hidden)]
62
62
LL | | C,
63
63
LL | | }
64
64
| |_-
65
-
= note: the matched value is of type `Foo`
65
+
= note: the matched value is of type `HiddenEnum`
66
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
67
|
68
-
LL ~ Foo::A => {}
68
+
LL ~ HiddenEnum::A => {}
69
69
LL + B | _ => todo!()
70
70
|
71
71
72
72
error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
73
-
--> $DIR/doc-hidden-non-exhaustive.rs:25:11
73
+
--> $DIR/doc-hidden-non-exhaustive.rs:32:11
74
74
|
75
75
LL | match None {
76
76
| ^^^^ patterns `Some(B)` and `Some(_)` not covered
= note: the matched value is of type `Option<Foo>`
90
+
= note: the matched value is of type `Option<HiddenEnum>`
91
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
92
|
93
-
LL ~ Some(Foo::A) => {}
93
+
LL ~ Some(HiddenEnum::A) => {}
94
94
LL + Some(B) | Some(_) => todo!()
95
95
|
96
96
97
-
error: aborting due to 4 previous errors
97
+
error[E0004]: non-exhaustive patterns: `C` not covered
98
+
--> $DIR/doc-hidden-non-exhaustive.rs:38:11
99
+
|
100
+
LL | match InCrate::A {
101
+
| ^^^^^^^^^^ pattern `C` not covered
102
+
|
103
+
note: `InCrate` defined here
104
+
--> $DIR/doc-hidden-non-exhaustive.rs:11:5
105
+
|
106
+
LL | enum InCrate {
107
+
| -------
108
+
...
109
+
LL | C,
110
+
| ^ not covered
111
+
= note: the matched value is of type `InCrate`
112
+
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
113
+
|
114
+
LL ~ InCrate::B => {}
115
+
LL + C => todo!()
116
+
|
117
+
118
+
error: aborting due to 5 previous errors
98
119
99
120
For more information about this error, try `rustc --explain E0004`.
0 commit comments