diff options
| author | Michael Goulet <michael@errs.io> | 2022-12-20 18:30:12 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-12-20 18:31:13 +0000 |
| commit | 738b0c06730e4e2c74901d554dcb7d1b40b5cd0a (patch) | |
| tree | 184b9b87c377856898c5efae25b2c5a8d72eeab3 | |
| parent | 65bd2a6a73d6a74fb1266a1d96b23de8810a5fb2 (diff) | |
| download | rust-738b0c06730e4e2c74901d554dcb7d1b40b5cd0a.tar.gz rust-738b0c06730e4e2c74901d554dcb7d1b40b5cd0a.zip | |
Re-enable fn trait call notation error
| -rw-r--r-- | compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/unboxed-closures/non-tupled-call.rs | 17 | ||||
| -rw-r--r-- | src/test/ui/unboxed-closures/non-tupled-call.stderr | 9 |
3 files changed, 27 insertions, 1 deletions
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index d1e0964112b..877680053f0 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -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) } } diff --git a/src/test/ui/unboxed-closures/non-tupled-call.rs b/src/test/ui/unboxed-closures/non-tupled-call.rs new file mode 100644 index 00000000000..08bea4f1678 --- /dev/null +++ b/src/test/ui/unboxed-closures/non-tupled-call.rs @@ -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); +} diff --git a/src/test/ui/unboxed-closures/non-tupled-call.stderr b/src/test/ui/unboxed-closures/non-tupled-call.stderr new file mode 100644 index 00000000000..35ac9ebe291 --- /dev/null +++ b/src/test/ui/unboxed-closures/non-tupled-call.stderr @@ -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`. |
