Skip to content

Commit 492d8d7

Browse files
committed
Fix rebase conflicts with stderr files
1 parent c0e76d6 commit 492d8d7

8 files changed

+161
-54
lines changed

compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ impl<'tcx> Constructor<'tcx> {
695695
/// attribute from a type not local to the current crate.
696696
pub(super) fn is_doc_hidden_variant(&self, pcx: PatCtxt<'_, '_, 'tcx>) -> bool {
697697
if let Constructor::Variant(idx) = self && let ty::Adt(adt, _) = pcx.ty.kind() {
698-
let variant_def_id = adt.variants[*idx].def_id;
698+
let variant_def_id = adt.variants()[*idx].def_id;
699699
return pcx.cx.tcx.is_doc_hidden(variant_def_id) && !variant_def_id.is_local();
700700
}
701701
false

src/test/ui/pattern/usefulness/doc-hidden-fields.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ struct InCrate {
1212
}
1313

1414
fn main() {
15-
let HiddenStruct { one, two, } = HiddenStruct::default();
15+
let HiddenStruct { one, two } = HiddenStruct::default();
1616
//~^ pattern requires `..` due to inaccessible fields
1717

18-
let HiddenStruct { one, } = HiddenStruct::default();
18+
let HiddenStruct { one } = HiddenStruct::default();
1919
//~^ pattern does not mention field `two` and inaccessible fields
2020

2121
let HiddenStruct { one, hide } = HiddenStruct::default();

src/test/ui/pattern/usefulness/doc-hidden-fields.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error: pattern requires `..` due to inaccessible fields
22
--> $DIR/doc-hidden-fields.rs:15:9
33
|
4-
LL | let HiddenStruct { one, two, } = HiddenStruct::default();
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | let HiddenStruct { one, two } = HiddenStruct::default();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
help: ignore the inaccessible and unused fields
88
|
9-
LL | let HiddenStruct { one, two, .., } = HiddenStruct::default();
9+
LL | let HiddenStruct { one, two, .. } = HiddenStruct::default();
1010
| ++++
1111

1212
error[E0027]: pattern does not mention field `two` and inaccessible fields
1313
--> $DIR/doc-hidden-fields.rs:18:9
1414
|
15-
LL | let HiddenStruct { one, } = HiddenStruct::default();
16-
| ^^^^^^^^^^^^^^^^^^^^^ missing field `two` and inaccessible fields
15+
LL | let HiddenStruct { one } = HiddenStruct::default();
16+
| ^^^^^^^^^^^^^^^^^^^^ missing field `two` and inaccessible fields
1717
|
1818
help: include the missing field in the pattern and ignore the inaccessible fields
1919
|

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

+73-28
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,116 @@ error[E0004]: non-exhaustive patterns: `_` not covered
44
LL | match HiddenEnum::A {
55
| ^^^^^^^^^^^^^ pattern `_` not covered
66
|
7-
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
7+
note: `HiddenEnum` defined here
8+
--> $DIR/auxiliary/hidden.rs:1:1
9+
|
10+
LL | / pub enum HiddenEnum {
11+
LL | | A,
12+
LL | | B,
13+
LL | | #[doc(hidden)]
14+
LL | | C,
15+
LL | | }
16+
| |_^
817
= note: the matched value is of type `HiddenEnum`
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 ~ HiddenEnum::B => {}
21+
LL + _ => todo!()
22+
|
923

1024
error[E0004]: non-exhaustive patterns: `B` not covered
1125
--> $DIR/doc-hidden-non-exhaustive.rs:21:11
1226
|
1327
LL | match HiddenEnum::A {
1428
| ^^^^^^^^^^^^^ pattern `B` not covered
1529
|
16-
note: `Foo` defined here
30+
note: `HiddenEnum` defined here
1731
--> $DIR/auxiliary/hidden.rs:3:5
1832
|
19-
LL | B,
20-
| - not covered
21-
|
22-
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
33+
LL | / pub enum HiddenEnum {
34+
LL | | A,
35+
LL | | B,
36+
| | ^ not covered
37+
LL | | #[doc(hidden)]
38+
LL | | C,
39+
LL | | }
40+
| |_-
2341
= note: the matched value is of type `HiddenEnum`
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 ~ HiddenEnum::C => {}
45+
LL + B => todo!()
46+
|
2447

2548
error[E0004]: non-exhaustive patterns: `B` and `_` not covered
2649
--> $DIR/doc-hidden-non-exhaustive.rs:27:11
2750
|
2851
LL | match HiddenEnum::A {
2952
| ^^^^^^^^^^^^^ patterns `B` and `_` not covered
3053
|
31-
note: `Foo` defined here
54+
note: `HiddenEnum` defined here
3255
--> $DIR/auxiliary/hidden.rs:3:5
3356
|
34-
LL | B,
35-
| - not covered
36-
|
37-
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
57+
LL | / pub enum HiddenEnum {
58+
LL | | A,
59+
LL | | B,
60+
| | ^ not covered
61+
LL | | #[doc(hidden)]
62+
LL | | C,
63+
LL | | }
64+
| |_-
3865
= note: the matched value is of type `HiddenEnum`
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 ~ HiddenEnum::A => {}
69+
LL + B | _ => todo!()
70+
|
3971

4072
error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
4173
--> $DIR/doc-hidden-non-exhaustive.rs:32:11
4274
|
4375
LL | match None {
4476
| ^^^^ patterns `Some(B)` and `Some(_)` not covered
4577
|
46-
note: `Option<Foo>` defined here
78+
note: `Option<HiddenEnum>` defined here
4779
--> $SRC_DIR/core/src/option.rs:LL:COL
4880
|
49-
LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
50-
| ---- not covered
51-
|
52-
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
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+
| |_-
5390
= note: the matched value is of type `Option<HiddenEnum>`
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(HiddenEnum::A) => {}
94+
LL + Some(B) | Some(_) => todo!()
95+
|
5496

5597
error[E0004]: non-exhaustive patterns: `C` not covered
5698
--> $DIR/doc-hidden-non-exhaustive.rs:38:11
5799
|
58-
LL | / enum InCrate {
59-
LL | | A,
60-
LL | | B,
61-
LL | | #[doc(hidden)]
62-
LL | | C,
63-
| | - not covered
64-
LL | | }
65-
| |_- `InCrate` defined here
66-
...
67-
LL | match InCrate::A {
68-
| ^^^^^^^^^^ pattern `C` not covered
100+
LL | match InCrate::A {
101+
| ^^^^^^^^^^ pattern `C` not covered
69102
|
70-
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
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
71111
= 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+
|
72117

73118
error: aborting due to 5 previous errors
74119

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
error[E0027]: pattern does not mention field `stable2` and inaccessible fields
2+
--> $DIR/stable-gated-fields.rs:8:9
3+
|
4+
LL | let UnstableStruct { stable } = UnstableStruct::default();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `stable2` and inaccessible fields
6+
|
7+
help: include the missing field in the pattern and ignore the inaccessible fields
8+
|
9+
LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
10+
| ~~~~~~~~~~~~~~~
11+
help: if you don't care about this missing field, you can explicitly ignore it
12+
|
13+
LL | let UnstableStruct { stable, .. } = UnstableStruct::default();
14+
| ~~~~~~
15+
16+
error: pattern requires `..` due to inaccessible fields
17+
--> $DIR/stable-gated-fields.rs:11:9
18+
|
19+
LL | let UnstableStruct { stable, stable2 } = UnstableStruct::default();
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21+
|
22+
help: ignore the inaccessible and unused fields
23+
|
24+
LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
25+
| ++++
26+
27+
error: aborting due to 2 previous errors
28+
29+
For more information about this error, try `rustc --explain E0027`.

src/test/ui/pattern/usefulness/stable-gated-patterns.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0004]: non-exhaustive patterns: `Stable2` and `_` not covered
22
--> $DIR/stable-gated-patterns.rs:8:11
33
|
4-
LL | match Foo::Stable {
5-
| ^^^^^^^^^^^ patterns `Stable2` and `_` not covered
4+
LL | match UnstableEnum::Stable {
5+
| ^^^^^^^^^^^^^^^^^^^^ patterns `Stable2` and `_` not covered
66
|
7-
note: `Foo` defined here
7+
note: `UnstableEnum` defined here
88
--> $DIR/auxiliary/unstable.rs:9:5
99
|
10-
LL | / pub enum Foo {
10+
LL | / pub enum UnstableEnum {
1111
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
1212
LL | | Stable,
1313
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
@@ -17,34 +17,34 @@ LL | | #[unstable(feature = "unstable_test_feature", issue = "none")]
1717
LL | | Unstable,
1818
LL | | }
1919
| |_-
20-
= note: the matched value is of type `Foo`
20+
= note: the matched value is of type `UnstableEnum`
2121
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
2222
|
23-
LL ~ Foo::Stable => {}
23+
LL ~ UnstableEnum::Stable => {}
2424
LL + Stable2 | _ => todo!()
2525
|
2626

2727
error[E0004]: non-exhaustive patterns: `_` not covered
2828
--> $DIR/stable-gated-patterns.rs:13:11
2929
|
30-
LL | match Foo::Stable {
31-
| ^^^^^^^^^^^ pattern `_` not covered
30+
LL | match UnstableEnum::Stable {
31+
| ^^^^^^^^^^^^^^^^^^^^ pattern `_` not covered
3232
|
33-
note: `Foo` defined here
33+
note: `UnstableEnum` defined here
3434
--> $DIR/auxiliary/unstable.rs:5:1
3535
|
36-
LL | / pub enum Foo {
36+
LL | / pub enum UnstableEnum {
3737
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
3838
LL | | Stable,
3939
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
4040
... |
4141
LL | | Unstable,
4242
LL | | }
4343
| |_^
44-
= note: the matched value is of type `Foo`
44+
= note: the matched value is of type `UnstableEnum`
4545
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
4646
|
47-
LL ~ Foo::Stable2 => {}
47+
LL ~ UnstableEnum::Stable2 => {}
4848
LL + _ => todo!()
4949
|
5050

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
error[E0027]: pattern does not mention field `unstable`
2+
--> $DIR/unstable-gated-fields.rs:10:9
3+
|
4+
LL | let UnstableStruct { stable, stable2, } = UnstableStruct::default();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `unstable`
6+
|
7+
help: include the missing field in the pattern
8+
|
9+
LL | let UnstableStruct { stable, stable2, unstable } = UnstableStruct::default();
10+
| ~~~~~~~~~~~~
11+
help: if you don't care about this missing field, you can explicitly ignore it
12+
|
13+
LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default();
14+
| ~~~~~~
15+
16+
error[E0027]: pattern does not mention field `stable2`
17+
--> $DIR/unstable-gated-fields.rs:13:9
18+
|
19+
LL | let UnstableStruct { stable, unstable, } = UnstableStruct::default();
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `stable2`
21+
|
22+
help: include the missing field in the pattern
23+
|
24+
LL | let UnstableStruct { stable, unstable, stable2 } = UnstableStruct::default();
25+
| ~~~~~~~~~~~
26+
help: if you don't care about this missing field, you can explicitly ignore it
27+
|
28+
LL | let UnstableStruct { stable, unstable, .. } = UnstableStruct::default();
29+
| ~~~~~~
30+
31+
error: aborting due to 2 previous errors
32+
33+
For more information about this error, try `rustc --explain E0027`.

src/test/ui/pattern/usefulness/unstable-gated-patterns.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0004]: non-exhaustive patterns: `Unstable` not covered
22
--> $DIR/unstable-gated-patterns.rs:10:11
33
|
4-
LL | match Foo::Stable {
5-
| ^^^^^^^^^^^ pattern `Unstable` not covered
4+
LL | match UnstableEnum::Stable {
5+
| ^^^^^^^^^^^^^^^^^^^^ pattern `Unstable` not covered
66
|
7-
note: `Foo` defined here
7+
note: `UnstableEnum` defined here
88
--> $DIR/auxiliary/unstable.rs:11:5
99
|
10-
LL | / pub enum Foo {
10+
LL | / pub enum UnstableEnum {
1111
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
1212
LL | | Stable,
1313
LL | | #[stable(feature = "stable_test_feature", since = "1.0.0")]
@@ -16,10 +16,10 @@ LL | | Unstable,
1616
| | ^^^^^^^^ not covered
1717
LL | | }
1818
| |_-
19-
= note: the matched value is of type `Foo`
19+
= note: the matched value is of type `UnstableEnum`
2020
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
2121
|
22-
LL ~ Foo::Stable2 => {}
22+
LL ~ UnstableEnum::Stable2 => {}
2323
LL + Unstable => todo!()
2424
|
2525

0 commit comments

Comments
 (0)