mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Fix rebase conflicts with stderr files
This commit is contained in:
parent
c0e76d6999
commit
492d8d7293
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -4,8 +4,22 @@ 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
|
||||
@ -13,14 +27,23 @@ error[E0004]: non-exhaustive patterns: `B` not covered
|
||||
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
|
||||
@ -28,14 +51,23 @@ error[E0004]: non-exhaustive patterns: `B` and `_` not covered
|
||||
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
|
||||
@ -43,32 +75,45 @@ error[E0004]: non-exhaustive patterns: `Some(B)` and `Some(_)` not covered
|
||||
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
|
||||
|
||||
|
29
src/test/ui/pattern/usefulness/stable-gated-fields.stderr
Normal file
29
src/test/ui/pattern/usefulness/stable-gated-fields.stderr
Normal file
@ -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`.
|
@ -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")]
|
||||
@ -17,23 +17,23 @@ 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")]
|
||||
@ -41,10 +41,10 @@ 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!()
|
||||
|
|
||||
|
||||
|
33
src/test/ui/pattern/usefulness/unstable-gated-fields.stderr
Normal file
33
src/test/ui/pattern/usefulness/unstable-gated-fields.stderr
Normal file
@ -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`.
|
@ -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")]
|
||||
@ -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!()
|
||||
|
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user