Skip to content

Commit 738b0c0

Browse files
Re-enable fn trait call notation error
1 parent 65bd2a6 commit 738b0c0

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
214214
"cannot use call notation; the first type parameter \
215215
for the function trait is neither a tuple nor unit"
216216
)
217-
.delay_as_bug();
217+
.emit();
218218
(self.err_args(provided_args.len()), None)
219219
}
220220
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![feature(fn_traits, unboxed_closures, tuple_trait)]
2+
3+
use std::default::Default;
4+
use std::marker::Tuple;
5+
6+
fn wrap<P: Tuple + Default, T>(func: impl Fn<P, Output = T>) {
7+
let x: P = Default::default();
8+
// Should be: `func.call(x);`
9+
func(x);
10+
//~^ ERROR cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
11+
}
12+
13+
fn foo() {}
14+
15+
fn main() {
16+
wrap(foo);
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
2+
--> $DIR/non-tupled-call.rs:9:5
3+
|
4+
LL | func(x);
5+
| ^^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0059`.

0 commit comments

Comments
 (0)