Skip to content

Commit 83d1aab

Browse files
authored
Rollup merge of #104796 - notriddle:notriddle/unused-issue-104397, r=oli-obk
lint: do not warn unused parens around higher-ranked function pointers Fixes #104397
2 parents ed2d936 + 97d95d4 commit 83d1aab

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

compiler/rustc_lint/src/unused.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,7 @@ impl EarlyLintPass for UnusedParens {
10151015
if let ast::TyKind::Paren(r) = &ty.kind {
10161016
match &r.kind {
10171017
ast::TyKind::TraitObject(..) => {}
1018+
ast::TyKind::BareFn(b) if b.generic_params.len() > 0 => {}
10181019
ast::TyKind::ImplTrait(_, bounds) if bounds.len() > 1 => {}
10191020
ast::TyKind::Array(_, len) => {
10201021
self.check_unused_delims_expr(
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// check-pass
2+
3+
#![warn(unused)]
4+
#![deny(warnings)]
5+
6+
struct Inv<'a>(&'a mut &'a ());
7+
8+
trait Trait {}
9+
impl Trait for for<'a> fn(Inv<'a>) {}
10+
11+
fn with_bound()
12+
where
13+
(for<'a> fn(Inv<'a>)): Trait,
14+
{}
15+
16+
fn main() {
17+
with_bound();
18+
}

0 commit comments

Comments
 (0)