about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/errors.rs
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-04-11 01:56:24 +0200
committerGitHub <noreply@github.com>2024-04-11 01:56:24 +0200
commit82c6f187ad85cbac2b299a55f8951126ab2c0bfa (patch)
tree4592bdfb0811ba103ebd2afaa9ae48186a08ca1b /compiler/rustc_pattern_analysis/src/errors.rs
parentccab2b16d3989c3c27302a7c2d06b383c2008f9c (diff)
parentc8490a06085acf60bef4888d8af02c63fa0417d4 (diff)
downloadrust-82c6f187ad85cbac2b299a55f8951126ab2c0bfa.tar.gz
rust-82c6f187ad85cbac2b299a55f8951126ab2c0bfa.zip
Rollup merge of #123314 - surechen:fix_120642, r=Nadrieril
Skip `unused_parens` report for `Paren(Path(..))` in macro.

fixes #120642

In following code, `unused_parens` suggest change `<($($rest),*)>::bar()` to `<$rest>::bar()`  which will cause another err: `error: variable 'rest' is still repeating at this depth`:

```rust
trait Foo {
    fn bar();
}

macro_rules! problem {
    ($ty:ident) => {
        impl<$ty: Foo> Foo for ($ty,) {
            fn bar() { <$ty>::bar() }
        }
    };
    ($ty:ident $(, $rest:ident)*) => {
        impl<$ty: Foo, $($rest: Foo),*> Foo for ($ty, $($rest),*) {
            fn bar() {
                <$ty>::bar();
                <($($rest),*)>::bar()
            }
        }
        problem!($($rest),*);
    }
}
```

I think maybe we can handle this by avoid warning for `Paren(Path(..))` in the macro. Is this reasonable approach?
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/errors.rs')
0 files changed, 0 insertions, 0 deletions