From 8f88cecab64504e9f8317e96bba41feb4ac10a29 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 20 Dec 2022 18:52:30 +0900 Subject: [PATCH] Add regression test for #57404 Signed-off-by: Yuki Okushi --- src/test/ui/typeck/issue-57404.rs | 7 +++++++ src/test/ui/typeck/issue-57404.stderr | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/test/ui/typeck/issue-57404.rs create mode 100644 src/test/ui/typeck/issue-57404.stderr diff --git a/src/test/ui/typeck/issue-57404.rs b/src/test/ui/typeck/issue-57404.rs new file mode 100644 index 00000000000..ecabca66a00 --- /dev/null +++ b/src/test/ui/typeck/issue-57404.rs @@ -0,0 +1,7 @@ +#![feature(unboxed_closures)] +#![feature(fn_traits)] + +fn main() { + let handlers: Option FnMut<&'a mut (), Output=()>>> = None; + handlers.unwrap().as_mut().call_mut(&mut ()); //~ ERROR: `&mut ()` is not a tuple +} diff --git a/src/test/ui/typeck/issue-57404.stderr b/src/test/ui/typeck/issue-57404.stderr new file mode 100644 index 00000000000..5065ac32ad2 --- /dev/null +++ b/src/test/ui/typeck/issue-57404.stderr @@ -0,0 +1,16 @@ +error[E0277]: `&mut ()` is not a tuple + --> $DIR/issue-57404.rs:6:41 + | +LL | handlers.unwrap().as_mut().call_mut(&mut ()); + | -------- -^^^^^^ + | | | + | | the trait `Tuple` is not implemented for `&mut ()` + | | help: consider removing the leading `&`-reference + | required by a bound introduced by this call + | +note: required by a bound in `call_mut` + --> $SRC_DIR/core/src/ops/function.rs:LL:COL + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`.