Skip to content

unused_parens: doesn't trigger for higher ranked function pointers #105061

Closed
@lcnr

Description

@lcnr
struct Inv<'a>(&'a mut &'a ());

trait Trait {}
impl Trait for (for<'a> fn(Inv<'a>),) {}


fn with_bound()
where
    ((for<'a> fn(Inv<'a>)),): Trait,
{}

fn main() {
    with_bound();
}

This should lint as the parens around the function pointer are unnecessary, but stopped doing so due to #104796.

Expected output:

warning: unnecessary parentheses around type
 --> src/main.rs:9:5
  |
9 |     (for<'a> fn(Inv<'a>)): Trait,
  |     ^                   ^
  |
  = note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
  |
9 -     (for<'a> fn(Inv<'a>)): Trait,
9 +     for<'a> fn(Inv<'a>): Trait,
  |

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions