From 32e0ef34b470d47fcd99c310ab399c0599e1c680 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 4 Jul 2022 10:50:49 -0700 Subject: [PATCH] Add some additional double-adjustment regression tests --- .../ui/argument-suggestions/issue-98894.rs | 4 ++++ .../argument-suggestions/issue-98894.stderr | 19 +++++++++++++++++++ .../ui/argument-suggestions/issue-98897.rs | 4 ++++ .../argument-suggestions/issue-98897.stderr | 19 +++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 src/test/ui/argument-suggestions/issue-98894.rs create mode 100644 src/test/ui/argument-suggestions/issue-98894.stderr create mode 100644 src/test/ui/argument-suggestions/issue-98897.rs create mode 100644 src/test/ui/argument-suggestions/issue-98897.stderr diff --git a/src/test/ui/argument-suggestions/issue-98894.rs b/src/test/ui/argument-suggestions/issue-98894.rs new file mode 100644 index 0000000000000..c2618a96716a5 --- /dev/null +++ b/src/test/ui/argument-suggestions/issue-98894.rs @@ -0,0 +1,4 @@ +fn main() { + (|_, ()| ())(if true {} else {return;}); + //~^ ERROR this function takes 2 arguments but 1 argument was supplied +} diff --git a/src/test/ui/argument-suggestions/issue-98894.stderr b/src/test/ui/argument-suggestions/issue-98894.stderr new file mode 100644 index 0000000000000..0c8b94901e16f --- /dev/null +++ b/src/test/ui/argument-suggestions/issue-98894.stderr @@ -0,0 +1,19 @@ +error[E0057]: this function takes 2 arguments but 1 argument was supplied + --> $DIR/issue-98894.rs:2:5 + | +LL | (|_, ()| ())(if true {} else {return;}); + | ^^^^^^^^^^^^--------------------------- an argument of type `()` is missing + | +note: closure defined here + --> $DIR/issue-98894.rs:2:6 + | +LL | (|_, ()| ())(if true {} else {return;}); + | ^^^^^^^ +help: provide the argument + | +LL | (|_, ()| ())(if true {} else {return;}, ()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0057`. diff --git a/src/test/ui/argument-suggestions/issue-98897.rs b/src/test/ui/argument-suggestions/issue-98897.rs new file mode 100644 index 0000000000000..c55f495d69862 --- /dev/null +++ b/src/test/ui/argument-suggestions/issue-98897.rs @@ -0,0 +1,4 @@ +fn main() { + (|_, ()| ())([return, ()]); + //~^ ERROR this function takes 2 arguments but 1 argument was supplied +} diff --git a/src/test/ui/argument-suggestions/issue-98897.stderr b/src/test/ui/argument-suggestions/issue-98897.stderr new file mode 100644 index 0000000000000..8f0d98d09e89e --- /dev/null +++ b/src/test/ui/argument-suggestions/issue-98897.stderr @@ -0,0 +1,19 @@ +error[E0057]: this function takes 2 arguments but 1 argument was supplied + --> $DIR/issue-98897.rs:2:5 + | +LL | (|_, ()| ())([return, ()]); + | ^^^^^^^^^^^^-------------- an argument of type `()` is missing + | +note: closure defined here + --> $DIR/issue-98897.rs:2:6 + | +LL | (|_, ()| ())([return, ()]); + | ^^^^^^^ +help: provide the argument + | +LL | (|_, ()| ())([return, ()], ()); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0057`.