Skip to content

Commit 3c58b2a

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

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
@@ -1002,6 +1002,7 @@ impl EarlyLintPass for UnusedParens {
10021002
if let ast::TyKind::Paren(r) = &ty.kind {
10031003
match &r.kind {
10041004
ast::TyKind::TraitObject(..) => {}
1005+
ast::TyKind::BareFn(b) if b.generic_params.len() > 0 => {}
10051006
ast::TyKind::ImplTrait(_, bounds) if bounds.len() > 1 => {}
10061007
ast::TyKind::Array(_, len) => {
10071008
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)