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 | 30 |
1 files changed, 30 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 6e2764e59f..6bdcd41a79 100644 --- a/crates/ide_diagnostics/src/handlers/missing_match_arms.rs +++ b/crates/ide_diagnostics/src/handlers/missing_match_arms.rs @@ -900,6 +900,36 @@ fn foo() { ); } + #[test] + fn macro_or_pat() { + check_diagnostics_no_bails( + r#" +macro_rules! m { + () => { + Enum::Type1 | Enum::Type2 + }; +} + +enum Enum { + Type1, + Type2, + Type3, +} + +fn f(ty: Enum) { + match ty { + //^^ error: missing match arm + m!() => (), + } + + match ty { + m!() | Enum::Type3 => () + } +} +"#, + ); + } + 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 |