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 @@ -677,6 +677,33 @@ trait UnusedDelimLint {
677677 }
678678
679679 // Check if LHS needs parens to prevent false-positives in cases like `fn x() -> u8 { ({ 0 } + 1) }`.
680+ //
681+ // FIXME: https://github.com/rust-lang/rust/issues/119426
682+ // The syntax tree in this code is from after macro expansion, so the
683+ // current implementation has both false negatives and false positives
684+ // related to expressions containing macros.
685+ //
686+ // macro_rules! m1 {
687+ // () => {
688+ // 1
689+ // };
690+ // }
691+ //
692+ // fn f1() -> u8 {
693+ // // Lint says parens are not needed, but they are.
694+ // (m1! {} + 1)
695+ // }
696+ //
697+ // macro_rules! m2 {
698+ // () => {
699+ // loop { break 1; }
700+ // };
701+ // }
702+ //
703+ // fn f2() -> u8 {
704+ // // Lint says parens are needed, but they are not.
705+ // (m2!() + 1)
706+ // }
680707 {
681708 let mut innermost = inner;
682709 loop {
@@ -688,10 +715,7 @@ trait UnusedDelimLint {
688715 ExprKind :: Index ( base, _subscript, _) => base,
689716 _ => break ,
690717 } ;
691- if match innermost. kind {
692- ExprKind :: MacCall ( _) => false ,
693- _ => !classify:: expr_requires_semi_to_be_stmt ( innermost) ,
694- } {
718+ if !classify:: expr_requires_semi_to_be_stmt ( innermost) {
695719 return true ;
696720 }
697721 }
You can’t perform that action at this time.
0 commit comments