Skip to content

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

Closed
@lcnr

Description

@lcnr
Contributor
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,
  |

Activity

added
A-diagnosticsArea: Messages for errors, warnings, and lints
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Nov 29, 2022
chenyukang

chenyukang commented on Dec 23, 2022

@chenyukang
Member

@rustbot claim

added a commit that references this issue on Dec 26, 2022

fix rust-lang#105061, Fix unused_parens issue for higher ranked funct…

52c902f
added a commit that references this issue on Jan 17, 2023

Rollup merge of rust-lang#106148 - chenyukang:yukang/fix-105061-unuse…

f91f369
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

    Participants

    @chenyukang@lcnr

    Issue actions

      unused_parens: doesn't trigger for higher ranked function pointers · Issue #105061 · rust-lang/rust