Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide_diagnostics/src/handlers/missing_match_arms.rs')
| -rw-r--r-- | crates/ide_diagnostics/src/handlers/missing_match_arms.rs | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/crates/ide_diagnostics/src/handlers/missing_match_arms.rs b/crates/ide_diagnostics/src/handlers/missing_match_arms.rs index 947b0f2e2e..6e2764e59f 100644 --- a/crates/ide_diagnostics/src/handlers/missing_match_arms.rs +++ b/crates/ide_diagnostics/src/handlers/missing_match_arms.rs @@ -821,7 +821,6 @@ fn main() { #[test] fn pattern_type_is_of_substitution() { - cov_mark::check!(match_check_wildcard_expanded_to_substitutions); check_diagnostics_no_bails( r#" struct Foo<T>(T); @@ -864,6 +863,43 @@ fn main() { ); } + #[test] + fn normalize_field_ty() { + check_diagnostics_no_bails( + r" +trait Trait { type Projection; } +enum E {Foo, Bar} +struct A; +impl Trait for A { type Projection = E; } +struct Next<T: Trait>(T::Projection); +static __: () = { + let n: Next<A> = Next(E::Foo); + match n { Next(E::Foo) => {} } + // ^ error: missing match arm + match n { Next(E::Foo | E::Bar) => {} } + match n { Next(E::Foo | _ ) => {} } + match n { Next(_ | E::Bar) => {} } + match n { _ | Next(E::Bar) => {} } + match &n { Next(E::Foo | E::Bar) => {} } + match &n { _ | Next(E::Bar) => {} } +};", + ); + } + + #[test] + fn binding_mode_by_ref() { + check_diagnostics_no_bails( + r" +enum E{ A, B } +fn foo() { + match &E::A { + E::A => {} + x => {} + } +}", + ); + } + mod false_negatives { //! The implementation of match checking here is a work in progress. As we roll this out, we //! prefer false negatives to false positives (ideally there would be no false positives). This |