Rollup merge of #105966 - compiler-errors:issue-105936, r=eholk
Re-enable `Fn` trait call notation error for non-tuple argument I have no idea why I delayed this bug... but also there doesn't seem to be a UI test that actually shows a change, so maybe that's why. Fixes #105936
This commit is contained in:
commit
6a215ab989
3 changed files with 27 additions and 1 deletions
|
@ -214,7 +214,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
"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)
|
||||
}
|
||||
}
|
||||
|
|
17
src/test/ui/unboxed-closures/non-tupled-call.rs
Normal file
17
src/test/ui/unboxed-closures/non-tupled-call.rs
Normal 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);
|
||||
}
|
9
src/test/ui/unboxed-closures/non-tupled-call.stderr
Normal file
9
src/test/ui/unboxed-closures/non-tupled-call.stderr
Normal 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`.
|
Loading…
Add table
Reference in a new issue