rust/compiler/rustc_lint/src
León Orell Valerian Liehr 82c6f187ad
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?
2024-04-11 01:56:24 +02:00
..
context Rollup merge of #122954 - fmease:defined-by-extern-prelude, r=petrochenkov 2024-04-11 01:56:24 +02:00
nonstandard_style mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
array_into_iter.rs Mark some once-again-unreachable paths as unreachable. 2024-02-29 11:08:29 +11:00
async_fn_in_trait.rs Rename TyCtxt::emit_spanned_lint as TyCtxt::emit_node_span_lint. 2024-01-23 08:09:05 +11:00
builtin.rs Rollup merge of #120144 - petrochenkov:unty, r=davidtwco 2024-04-08 14:31:10 +02:00
context.rs Rename hir::Node::Local into hir::Node::LetStmt 2024-03-22 20:48:36 +01:00
deref_into_dyn_supertrait.rs Auto merge of #120017 - nnethercote:lint-api, r=oli-obk 2024-01-23 00:06:57 +00:00
drop_forget_useless.rs hir: Remove hir::Map::{opt_parent_id,parent_id,get_parent,find_parent} 2024-02-10 12:24:46 +03:00
early.rs Rename {enter,exit}_lint_attrs to check_attributes{,_post} 2024-03-24 14:57:57 +00:00
enum_intrinsics_non_enums.rs Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
errors.rs Rename AddToDiagnostic as Subdiagnostic. 2024-03-11 10:04:49 +11:00
expect.rs Rename TyCtxt::emit_spanned_lint as TyCtxt::emit_node_span_lint. 2024-01-23 08:09:05 +11:00
for_loops_over_fallibles.rs Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
foreign_modules.rs Make RawPtr take Ty and Mutbl separately 2024-03-22 11:13:29 -04:00
hidden_unicode_codepoints.rs Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
internal.rs Allow multiple impl Into<{D,Subd}iagMessage> parameters in a function. 2024-03-11 16:42:10 +11:00
invalid_from_utf8.rs Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
late.rs Rename {enter,exit}_lint_attrs to check_attributes{,_post} 2024-03-24 14:57:57 +00:00
let_underscore.rs Rename hir::Local into hir::LetStmt 2024-03-22 20:36:21 +01:00
levels.rs Rename hir::Local into hir::LetStmt 2024-03-22 20:36:21 +01:00
lib.rs Split refining_impl_trait lint into _reachable, _internal variants 2024-03-05 16:19:16 -08:00
lints.rs Add support for NonNull in ambiguous_wide_ptr_comparisions 2024-03-29 22:02:07 +01:00
map_unit_fn.rs Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
methods.rs Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
multiple_supertrait_upcastable.rs Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
non_ascii_idents.rs Rename all ParseSess variables/fields/lifetimes as psess. 2024-03-05 08:11:45 +11:00
non_fmt_panic.rs Rename all ParseSess variables/fields/lifetimes as psess. 2024-03-05 08:11:45 +11:00
non_local_def.rs Thread pattern types through the HIR 2024-04-08 12:00:07 +00:00
nonstandard_style.rs Hoist only-executables check above producing crate ident 2024-03-01 19:16:02 +00:00
noop_method_call.rs When encountering <&T as Clone>::clone(x) because T: Clone, suggest #[derive(Clone)] 2024-02-22 18:01:20 +00:00
opaque_hidden_inferred_bound.rs update messages 2024-04-03 19:03:12 -04:00
pass_by_value.rs Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
passes.rs Rename {enter,exit}_lint_attrs to check_attributes{,_post} 2024-03-24 14:57:57 +00:00
ptr_nulls.rs Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
redundant_semicolon.rs Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
reference_casting.rs Make RawPtr take Ty and Mutbl separately 2024-03-22 11:13:29 -04:00
tests.rs refactor(rustc_lint): inline check_lint_name_cmdline 2023-08-30 17:35:07 +01:00
traits.rs Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint. 2024-01-23 08:08:25 +11:00
types.rs Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
unit_bindings.rs Rename hir::Local into hir::LetStmt 2024-03-22 20:36:21 +01:00
unused.rs skip unused_parens's suggestion for Paren in macro. 2024-04-10 17:56:43 +08:00