Skip to content

Commit

Permalink
Rollup merge of rust-lang#104796 - notriddle:notriddle/unused-issue-1…
Browse files Browse the repository at this point in the history
…04397, r=oli-obk

lint: do not warn unused parens around higher-ranked function pointers

Fixes rust-lang#104397
  • Loading branch information
matthiaskrgr authored Nov 24, 2022
2 parents 0a2b8a9 + 97d95d4 commit 7cb4a21
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_lint/src/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ impl EarlyLintPass for UnusedParens {
if let ast::TyKind::Paren(r) = &ty.kind {
match &r.kind {
ast::TyKind::TraitObject(..) => {}
ast::TyKind::BareFn(b) if b.generic_params.len() > 0 => {}
ast::TyKind::ImplTrait(_, bounds) if bounds.len() > 1 => {}
ast::TyKind::Array(_, len) => {
self.check_unused_delims_expr(
Expand Down
18 changes: 18 additions & 0 deletions src/test/ui/lint/unused/issue-104397.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// check-pass

#![warn(unused)]
#![deny(warnings)]

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();
}

0 comments on commit 7cb4a21

Please sign in to comment.