File tree Expand file tree Collapse file tree 4 files changed +33
-7
lines changed
ide_diagnostics/src/handlers Expand file tree Collapse file tree 4 files changed +33
-7
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,6 @@ pub struct MissingOkOrSomeInTailExpr {
164
164
pub struct MissingMatchArms {
165
165
pub file : HirFileId ,
166
166
pub match_expr : AstPtr < ast:: Expr > ,
167
- pub arms : AstPtr < ast:: MatchArmList > ,
168
167
}
169
168
170
169
#[ derive( Debug ) ]
Original file line number Diff line number Diff line change @@ -1266,17 +1266,14 @@ impl DefWithBody {
1266
1266
if let ast:: Expr :: MatchExpr ( match_expr) =
1267
1267
& source_ptr. value . to_node ( & root)
1268
1268
{
1269
- if let ( Some ( match_expr) , Some ( arms) ) =
1270
- ( match_expr. expr ( ) , match_expr. match_arm_list ( ) )
1271
- {
1269
+ if let Some ( match_expr) = match_expr. expr ( ) {
1272
1270
acc. push (
1273
1271
MissingMatchArms {
1274
1272
file : source_ptr. file_id ,
1275
1273
match_expr : AstPtr :: new ( & match_expr) ,
1276
- arms : AstPtr :: new ( & arms) ,
1277
1274
}
1278
1275
. into ( ) ,
1279
- )
1276
+ ) ;
1280
1277
}
1281
1278
}
1282
1279
}
Original file line number Diff line number Diff line change @@ -900,6 +900,36 @@ fn foo() {
900
900
) ;
901
901
}
902
902
903
+ #[ test]
904
+ fn macro_or_pat ( ) {
905
+ check_diagnostics_no_bails (
906
+ r#"
907
+ macro_rules! m {
908
+ () => {
909
+ Enum::Type1 | Enum::Type2
910
+ };
911
+ }
912
+
913
+ enum Enum {
914
+ Type1,
915
+ Type2,
916
+ Type3,
917
+ }
918
+
919
+ fn f(ty: Enum) {
920
+ match ty {
921
+ //^^ error: missing match arm
922
+ m!() => (),
923
+ }
924
+
925
+ match ty {
926
+ m!() | Enum::Type3 => ()
927
+ }
928
+ }
929
+ "# ,
930
+ ) ;
931
+ }
932
+
903
933
mod false_negatives {
904
934
//! The implementation of match checking here is a work in progress. As we roll this out, we
905
935
//! prefer false negatives to false positives (ideally there would be no false positives). This
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ pub(crate) mod entry {
112
112
113
113
pub ( crate ) fn pattern ( p : & mut Parser ) {
114
114
let m = p. start ( ) ;
115
- patterns:: pattern_single ( p) ;
115
+ patterns:: pattern_top ( p) ;
116
116
if p. at ( EOF ) {
117
117
m. abandon ( p) ;
118
118
return ;
You can’t perform that action at this time.
0 commit comments