File tree Expand file tree Collapse file tree 1 file changed +28
-4
lines changed Expand file tree Collapse file tree 1 file changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -675,6 +675,33 @@ trait UnusedDelimLint {
675675 }
676676
677677 // Check if LHS needs parens to prevent false-positives in cases like `fn x() -> u8 { ({ 0 } + 1) }`.
678+ //
679+ // FIXME: https://github.com/rust-lang/rust/issues/119426
680+ // The syntax tree in this code is from after macro expansion, so the
681+ // current implementation has both false negatives and false positives
682+ // related to expressions containing macros.
683+ //
684+ // macro_rules! m1 {
685+ // () => {
686+ // 1
687+ // };
688+ // }
689+ //
690+ // fn f1() -> u8 {
691+ // // Lint says parens are not needed, but they are.
692+ // (m1! {} + 1)
693+ // }
694+ //
695+ // macro_rules! m2 {
696+ // () => {
697+ // loop { break 1; }
698+ // };
699+ // }
700+ //
701+ // fn f2() -> u8 {
702+ // // Lint says parens are needed, but they are not.
703+ // (m2!() + 1)
704+ // }
678705 {
679706 let mut innermost = inner;
680707 loop {
@@ -686,10 +713,7 @@ trait UnusedDelimLint {
686713 ExprKind :: Index ( base, _subscript, _) => base,
687714 _ => break ,
688715 } ;
689- if match innermost. kind {
690- ExprKind :: MacCall ( _) => false ,
691- _ => !classify:: expr_requires_semi_to_be_stmt ( innermost) ,
692- } {
716+ if !classify:: expr_requires_semi_to_be_stmt ( innermost) {
693717 return true ;
694718 }
695719 }
You can’t perform that action at this time.
0 commit comments