Re-enable fn trait call notation error

This commit is contained in:
Michael Goulet 2022-12-20 18:30:12 +00:00
parent 65bd2a6a73
commit 738b0c0673
3 changed files with 27 additions and 1 deletions

View File

@ -214,7 +214,7 @@ pub(in super::super) fn check_argument_types(
"cannot use call notation; the first type parameter \
for the function trait is neither a tuple nor unit"
)
.delay_as_bug();
.emit();
(self.err_args(provided_args.len()), None)
}
}

View File

@ -0,0 +1,17 @@
#![feature(fn_traits, unboxed_closures, tuple_trait)]
use std::default::Default;
use std::marker::Tuple;
fn wrap<P: Tuple + Default, T>(func: impl Fn<P, Output = T>) {
let x: P = Default::default();
// Should be: `func.call(x);`
func(x);
//~^ ERROR cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
}
fn foo() {}
fn main() {
wrap(foo);
}

View File

@ -0,0 +1,9 @@
error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
--> $DIR/non-tupled-call.rs:9:5
|
LL | func(x);
| ^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0059`.