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 | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/ide_diagnostics/src/handlers/missing_match_arms.rs b/crates/ide_diagnostics/src/handlers/missing_match_arms.rs index 5a35704697..5ef4d2a226 100644 --- a/crates/ide_diagnostics/src/handlers/missing_match_arms.rs +++ b/crates/ide_diagnostics/src/handlers/missing_match_arms.rs @@ -863,6 +863,30 @@ 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) => {} } +};", + + ); + } + 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 |