summaryrefslogtreecommitdiffstats
path: root/src/test/ui/tuple
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/tuple')
-rw-r--r--src/test/ui/tuple/add-tuple-within-arguments.rs10
-rw-r--r--src/test/ui/tuple/add-tuple-within-arguments.stderr40
-rw-r--r--src/test/ui/tuple/array-diagnostics.rs7
-rw-r--r--src/test/ui/tuple/array-diagnostics.stderr9
-rw-r--r--src/test/ui/tuple/index-float.rs10
-rw-r--r--src/test/ui/tuple/index-invalid.rs7
-rw-r--r--src/test/ui/tuple/index-invalid.stderr21
-rw-r--r--src/test/ui/tuple/indexing-in-macro.rs9
-rw-r--r--src/test/ui/tuple/nested-index.rs12
-rw-r--r--src/test/ui/tuple/one-tuple.rs15
-rw-r--r--src/test/ui/tuple/tup.rs21
-rw-r--r--src/test/ui/tuple/tuple-arity-mismatch.rs17
-rw-r--r--src/test/ui/tuple/tuple-arity-mismatch.stderr35
-rw-r--r--src/test/ui/tuple/tuple-index-fat-types.rs13
-rw-r--r--src/test/ui/tuple/tuple-index-not-tuple.rs10
-rw-r--r--src/test/ui/tuple/tuple-index-not-tuple.stderr15
-rw-r--r--src/test/ui/tuple/tuple-index-out-of-bounds.rs14
-rw-r--r--src/test/ui/tuple/tuple-index-out-of-bounds.stderr15
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test.rs9
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test.stderr17
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test2.rs15
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test2.stderr28
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test3.rs15
-rw-r--r--src/test/ui/tuple/tuple-struct-fields/test3.stderr28
-rw-r--r--src/test/ui/tuple/wrong_argument_ice-2.rs17
-rw-r--r--src/test/ui/tuple/wrong_argument_ice-2.stderr19
-rw-r--r--src/test/ui/tuple/wrong_argument_ice-3.rs17
-rw-r--r--src/test/ui/tuple/wrong_argument_ice-3.stderr23
-rw-r--r--src/test/ui/tuple/wrong_argument_ice-4.rs6
-rw-r--r--src/test/ui/tuple/wrong_argument_ice-4.stderr23
-rw-r--r--src/test/ui/tuple/wrong_argument_ice.rs17
-rw-r--r--src/test/ui/tuple/wrong_argument_ice.stderr19
32 files changed, 533 insertions, 0 deletions
diff --git a/src/test/ui/tuple/add-tuple-within-arguments.rs b/src/test/ui/tuple/add-tuple-within-arguments.rs
new file mode 100644
index 000000000..089c703fd
--- /dev/null
+++ b/src/test/ui/tuple/add-tuple-within-arguments.rs
@@ -0,0 +1,10 @@
+fn foo(s: &str, a: (i32, i32), s2: &str) {}
+
+fn bar(s: &str, a: (&str,), s2: &str) {}
+
+fn main() {
+ foo("hi", 1, 2, "hi");
+ //~^ ERROR this function takes 3 arguments but 4 arguments were supplied
+ bar("hi", "hi", "hi");
+ //~^ ERROR mismatched types
+}
diff --git a/src/test/ui/tuple/add-tuple-within-arguments.stderr b/src/test/ui/tuple/add-tuple-within-arguments.stderr
new file mode 100644
index 000000000..95df96ca0
--- /dev/null
+++ b/src/test/ui/tuple/add-tuple-within-arguments.stderr
@@ -0,0 +1,40 @@
+error[E0061]: this function takes 3 arguments but 4 arguments were supplied
+ --> $DIR/add-tuple-within-arguments.rs:6:5
+ |
+LL | foo("hi", 1, 2, "hi");
+ | ^^^
+ |
+note: function defined here
+ --> $DIR/add-tuple-within-arguments.rs:1:4
+ |
+LL | fn foo(s: &str, a: (i32, i32), s2: &str) {}
+ | ^^^ ------- ------------- --------
+help: wrap these arguments in parentheses to construct a tuple
+ |
+LL | foo("hi", (1, 2), "hi");
+ | + +
+
+error[E0308]: mismatched types
+ --> $DIR/add-tuple-within-arguments.rs:8:15
+ |
+LL | bar("hi", "hi", "hi");
+ | --- ^^^^ expected tuple, found `&str`
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected tuple `(&str,)`
+ found reference `&'static str`
+note: function defined here
+ --> $DIR/add-tuple-within-arguments.rs:3:4
+ |
+LL | fn bar(s: &str, a: (&str,), s2: &str) {}
+ | ^^^ ------- ---------- --------
+help: use a trailing comma to create a tuple with one element
+ |
+LL | bar("hi", ("hi",), "hi");
+ | + ++
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0061, E0308.
+For more information about an error, try `rustc --explain E0061`.
diff --git a/src/test/ui/tuple/array-diagnostics.rs b/src/test/ui/tuple/array-diagnostics.rs
new file mode 100644
index 000000000..1929dab07
--- /dev/null
+++ b/src/test/ui/tuple/array-diagnostics.rs
@@ -0,0 +1,7 @@
+fn main() {
+ let _tmp = [
+ ("C200B40A82", 3),
+ ("C200B40A83", 4) //~ ERROR: expected function, found `(&'static str, {integer})` [E0618]
+ ("C200B40A8537", 5),
+ ];
+}
diff --git a/src/test/ui/tuple/array-diagnostics.stderr b/src/test/ui/tuple/array-diagnostics.stderr
new file mode 100644
index 000000000..a10d7af47
--- /dev/null
+++ b/src/test/ui/tuple/array-diagnostics.stderr
@@ -0,0 +1,9 @@
+error[E0618]: expected function, found `(&'static str, {integer})`
+ --> $DIR/array-diagnostics.rs:4:9
+ |
+LL | ("C200B40A83", 4)
+ | ^^^^^^^^^^^^^^^^^- help: consider separating array elements with a comma: `,`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0618`.
diff --git a/src/test/ui/tuple/index-float.rs b/src/test/ui/tuple/index-float.rs
new file mode 100644
index 000000000..eda2bf485
--- /dev/null
+++ b/src/test/ui/tuple/index-float.rs
@@ -0,0 +1,10 @@
+// check-pass
+
+fn main() {
+ let tuple = (((),),);
+
+ let _ = tuple. 0.0; // OK, whitespace
+ let _ = tuple.0. 0; // OK, whitespace
+
+ let _ = tuple./*special cases*/0.0; // OK, comment
+}
diff --git a/src/test/ui/tuple/index-invalid.rs b/src/test/ui/tuple/index-invalid.rs
new file mode 100644
index 000000000..d36f6cfe3
--- /dev/null
+++ b/src/test/ui/tuple/index-invalid.rs
@@ -0,0 +1,7 @@
+fn main() {
+ let _ = (((),),).1.0; //~ ERROR no field `1` on type `(((),),)`
+
+ let _ = (((),),).0.1; //~ ERROR no field `1` on type `((),)`
+
+ let _ = (((),),).000.000; //~ ERROR no field `000` on type `(((),),)`
+}
diff --git a/src/test/ui/tuple/index-invalid.stderr b/src/test/ui/tuple/index-invalid.stderr
new file mode 100644
index 000000000..8d22f458a
--- /dev/null
+++ b/src/test/ui/tuple/index-invalid.stderr
@@ -0,0 +1,21 @@
+error[E0609]: no field `1` on type `(((),),)`
+ --> $DIR/index-invalid.rs:2:22
+ |
+LL | let _ = (((),),).1.0;
+ | ^
+
+error[E0609]: no field `1` on type `((),)`
+ --> $DIR/index-invalid.rs:4:24
+ |
+LL | let _ = (((),),).0.1;
+ | ^
+
+error[E0609]: no field `000` on type `(((),),)`
+ --> $DIR/index-invalid.rs:6:22
+ |
+LL | let _ = (((),),).000.000;
+ | ^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/ui/tuple/indexing-in-macro.rs b/src/test/ui/tuple/indexing-in-macro.rs
new file mode 100644
index 000000000..bef4a69ab
--- /dev/null
+++ b/src/test/ui/tuple/indexing-in-macro.rs
@@ -0,0 +1,9 @@
+// check-pass
+
+macro_rules! m {
+ (.$l:literal) => {};
+}
+
+m!(.0.0); // OK, `0.0` after a dot is still a float token.
+
+fn main() {}
diff --git a/src/test/ui/tuple/nested-index.rs b/src/test/ui/tuple/nested-index.rs
new file mode 100644
index 000000000..a3232d6fc
--- /dev/null
+++ b/src/test/ui/tuple/nested-index.rs
@@ -0,0 +1,12 @@
+// run-pass
+
+fn main () {
+ let n = (1, (2, 3)).1.1;
+ assert_eq!(n, 3);
+
+ let n = (1, (2, (3, 4))).1.1.1;
+ assert_eq!(n, 4);
+
+ // This is a range expression, not nested indexing.
+ let _ = 0.0..1.1;
+}
diff --git a/src/test/ui/tuple/one-tuple.rs b/src/test/ui/tuple/one-tuple.rs
new file mode 100644
index 000000000..00fbadce1
--- /dev/null
+++ b/src/test/ui/tuple/one-tuple.rs
@@ -0,0 +1,15 @@
+// run-pass
+// Why one-tuples? Because macros.
+
+
+pub fn main() {
+ match ('c',) {
+ (x,) => {
+ assert_eq!(x, 'c');
+ }
+ }
+ // test the 1-tuple type too
+ let x: (char,) = ('d',);
+ let (y,) = x;
+ assert_eq!(y, 'd');
+}
diff --git a/src/test/ui/tuple/tup.rs b/src/test/ui/tuple/tup.rs
new file mode 100644
index 000000000..160477b0b
--- /dev/null
+++ b/src/test/ui/tuple/tup.rs
@@ -0,0 +1,21 @@
+// run-pass
+
+#![allow(non_camel_case_types)]
+
+type point = (isize, isize);
+
+fn f(p: point, x: isize, y: isize) {
+ let (a, b) = p;
+ assert_eq!(a, x);
+ assert_eq!(b, y);
+}
+
+pub fn main() {
+ let p: point = (10, 20);
+ let (a, b) = p;
+ assert_eq!(a, 10);
+ assert_eq!(b, 20);
+ let p2: point = p;
+ f(p, 10, 20);
+ f(p2, 10, 20);
+}
diff --git a/src/test/ui/tuple/tuple-arity-mismatch.rs b/src/test/ui/tuple/tuple-arity-mismatch.rs
new file mode 100644
index 000000000..f1e525c93
--- /dev/null
+++ b/src/test/ui/tuple/tuple-arity-mismatch.rs
@@ -0,0 +1,17 @@
+// Issue #6155
+
+fn first((value, _): (isize, f64)) -> isize { value }
+
+fn main() {
+ let y = first ((1,2.0,3));
+ //~^ ERROR mismatched types
+ //~| expected tuple `(isize, f64)`
+ //~| found tuple `(isize, f64, {integer})`
+ //~| expected a tuple with 2 elements, found one with 3 elements
+
+ let y = first ((1,));
+ //~^ ERROR mismatched types
+ //~| expected tuple `(isize, f64)`
+ //~| found tuple `(isize,)`
+ //~| expected a tuple with 2 elements, found one with 1 element
+}
diff --git a/src/test/ui/tuple/tuple-arity-mismatch.stderr b/src/test/ui/tuple/tuple-arity-mismatch.stderr
new file mode 100644
index 000000000..fff7be987
--- /dev/null
+++ b/src/test/ui/tuple/tuple-arity-mismatch.stderr
@@ -0,0 +1,35 @@
+error[E0308]: mismatched types
+ --> $DIR/tuple-arity-mismatch.rs:6:20
+ |
+LL | let y = first ((1,2.0,3));
+ | ----- ^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected tuple `(isize, f64)`
+ found tuple `(isize, f64, {integer})`
+note: function defined here
+ --> $DIR/tuple-arity-mismatch.rs:3:4
+ |
+LL | fn first((value, _): (isize, f64)) -> isize { value }
+ | ^^^^^ ------------------------
+
+error[E0308]: mismatched types
+ --> $DIR/tuple-arity-mismatch.rs:12:20
+ |
+LL | let y = first ((1,));
+ | ----- ^^^^ expected a tuple with 2 elements, found one with 1 element
+ | |
+ | arguments to this function are incorrect
+ |
+ = note: expected tuple `(isize, f64)`
+ found tuple `(isize,)`
+note: function defined here
+ --> $DIR/tuple-arity-mismatch.rs:3:4
+ |
+LL | fn first((value, _): (isize, f64)) -> isize { value }
+ | ^^^^^ ------------------------
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/tuple/tuple-index-fat-types.rs b/src/test/ui/tuple/tuple-index-fat-types.rs
new file mode 100644
index 000000000..5dda1ed97
--- /dev/null
+++ b/src/test/ui/tuple/tuple-index-fat-types.rs
@@ -0,0 +1,13 @@
+// run-pass
+
+struct Foo<'a>(&'a [isize]);
+
+fn main() {
+ let x: &[isize] = &[1, 2, 3];
+ let y = (x,);
+ assert_eq!(y.0, x);
+
+ let x: &[isize] = &[1, 2, 3];
+ let y = Foo(x);
+ assert_eq!(y.0, x);
+}
diff --git a/src/test/ui/tuple/tuple-index-not-tuple.rs b/src/test/ui/tuple/tuple-index-not-tuple.rs
new file mode 100644
index 000000000..c478e1c67
--- /dev/null
+++ b/src/test/ui/tuple/tuple-index-not-tuple.rs
@@ -0,0 +1,10 @@
+struct Point { x: isize, y: isize }
+struct Empty;
+
+fn main() {
+ let origin = Point { x: 0, y: 0 };
+ origin.0;
+ //~^ ERROR no field `0` on type `Point`
+ Empty.0;
+ //~^ ERROR no field `0` on type `Empty`
+}
diff --git a/src/test/ui/tuple/tuple-index-not-tuple.stderr b/src/test/ui/tuple/tuple-index-not-tuple.stderr
new file mode 100644
index 000000000..a1bcdfaed
--- /dev/null
+++ b/src/test/ui/tuple/tuple-index-not-tuple.stderr
@@ -0,0 +1,15 @@
+error[E0609]: no field `0` on type `Point`
+ --> $DIR/tuple-index-not-tuple.rs:6:12
+ |
+LL | origin.0;
+ | ^ help: a field with a similar name exists: `x`
+
+error[E0609]: no field `0` on type `Empty`
+ --> $DIR/tuple-index-not-tuple.rs:8:11
+ |
+LL | Empty.0;
+ | ^ unknown field
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/ui/tuple/tuple-index-out-of-bounds.rs b/src/test/ui/tuple/tuple-index-out-of-bounds.rs
new file mode 100644
index 000000000..c772c0daa
--- /dev/null
+++ b/src/test/ui/tuple/tuple-index-out-of-bounds.rs
@@ -0,0 +1,14 @@
+struct Point(i32, i32);
+
+fn main() {
+ let origin = Point(0, 0);
+ origin.0;
+ origin.1;
+ origin.2;
+ //~^ ERROR no field `2` on type `Point`
+ let tuple = (0, 0);
+ tuple.0;
+ tuple.1;
+ tuple.2;
+ //~^ ERROR no field `2` on type `({integer}, {integer})`
+}
diff --git a/src/test/ui/tuple/tuple-index-out-of-bounds.stderr b/src/test/ui/tuple/tuple-index-out-of-bounds.stderr
new file mode 100644
index 000000000..7d7c5cd78
--- /dev/null
+++ b/src/test/ui/tuple/tuple-index-out-of-bounds.stderr
@@ -0,0 +1,15 @@
+error[E0609]: no field `2` on type `Point`
+ --> $DIR/tuple-index-out-of-bounds.rs:7:12
+ |
+LL | origin.2;
+ | ^ help: a field with a similar name exists: `0`
+
+error[E0609]: no field `2` on type `({integer}, {integer})`
+ --> $DIR/tuple-index-out-of-bounds.rs:12:11
+ |
+LL | tuple.2;
+ | ^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/ui/tuple/tuple-struct-fields/test.rs b/src/test/ui/tuple/tuple-struct-fields/test.rs
new file mode 100644
index 000000000..00677090d
--- /dev/null
+++ b/src/test/ui/tuple/tuple-struct-fields/test.rs
@@ -0,0 +1,9 @@
+mod foo {
+ type T = ();
+ struct S1(pub(in foo) (), pub(T), pub(crate) (), pub(((), T)));
+ struct S2(pub((foo)) ());
+ //~^ ERROR expected one of `)` or `,`, found `(`
+ //~| ERROR cannot find type `foo` in this scope
+}
+
+fn main() {}
diff --git a/src/test/ui/tuple/tuple-struct-fields/test.stderr b/src/test/ui/tuple/tuple-struct-fields/test.stderr
new file mode 100644
index 000000000..bfa0b32fd
--- /dev/null
+++ b/src/test/ui/tuple/tuple-struct-fields/test.stderr
@@ -0,0 +1,17 @@
+error: expected one of `)` or `,`, found `(`
+ --> $DIR/test.rs:4:26
+ |
+LL | struct S2(pub((foo)) ());
+ | -^ expected one of `)` or `,`
+ | |
+ | help: missing `,`
+
+error[E0412]: cannot find type `foo` in this scope
+ --> $DIR/test.rs:4:20
+ |
+LL | struct S2(pub((foo)) ());
+ | ^^^ not found in this scope
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/tuple/tuple-struct-fields/test2.rs b/src/test/ui/tuple/tuple-struct-fields/test2.rs
new file mode 100644
index 000000000..2b2a2c127
--- /dev/null
+++ b/src/test/ui/tuple/tuple-struct-fields/test2.rs
@@ -0,0 +1,15 @@
+macro_rules! define_struct {
+ ($t:ty) => {
+ struct S1(pub $t);
+ struct S2(pub (in foo) ());
+ struct S3(pub $t ());
+ //~^ ERROR expected one of `)` or `,`, found `(`
+ }
+}
+
+mod foo {
+ define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope
+ //~| ERROR cannot find type `foo` in this scope
+}
+
+fn main() {}
diff --git a/src/test/ui/tuple/tuple-struct-fields/test2.stderr b/src/test/ui/tuple/tuple-struct-fields/test2.stderr
new file mode 100644
index 000000000..64a9ac135
--- /dev/null
+++ b/src/test/ui/tuple/tuple-struct-fields/test2.stderr
@@ -0,0 +1,28 @@
+error: expected one of `)` or `,`, found `(`
+ --> $DIR/test2.rs:5:26
+ |
+LL | struct S3(pub $t ());
+ | -^ expected one of `)` or `,`
+ | |
+ | help: missing `,`
+...
+LL | define_struct! { (foo) }
+ | ------------------------ in this macro invocation
+ |
+ = note: this error originates in the macro `define_struct` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0412]: cannot find type `foo` in this scope
+ --> $DIR/test2.rs:11:23
+ |
+LL | define_struct! { (foo) }
+ | ^^^ not found in this scope
+
+error[E0412]: cannot find type `foo` in this scope
+ --> $DIR/test2.rs:11:23
+ |
+LL | define_struct! { (foo) }
+ | ^^^ not found in this scope
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/tuple/tuple-struct-fields/test3.rs b/src/test/ui/tuple/tuple-struct-fields/test3.rs
new file mode 100644
index 000000000..98d19426e
--- /dev/null
+++ b/src/test/ui/tuple/tuple-struct-fields/test3.rs
@@ -0,0 +1,15 @@
+macro_rules! define_struct {
+ ($t:ty) => {
+ struct S1(pub($t));
+ struct S2(pub (in foo) ());
+ struct S3(pub($t) ());
+ //~^ ERROR expected one of `)` or `,`, found `(`
+ }
+}
+
+mod foo {
+ define_struct! { foo } //~ ERROR cannot find type `foo` in this scope
+ //~| ERROR cannot find type `foo` in this scope
+}
+
+fn main() {}
diff --git a/src/test/ui/tuple/tuple-struct-fields/test3.stderr b/src/test/ui/tuple/tuple-struct-fields/test3.stderr
new file mode 100644
index 000000000..75262ed57
--- /dev/null
+++ b/src/test/ui/tuple/tuple-struct-fields/test3.stderr
@@ -0,0 +1,28 @@
+error: expected one of `)` or `,`, found `(`
+ --> $DIR/test3.rs:5:27
+ |
+LL | struct S3(pub($t) ());
+ | -^ expected one of `)` or `,`
+ | |
+ | help: missing `,`
+...
+LL | define_struct! { foo }
+ | ---------------------- in this macro invocation
+ |
+ = note: this error originates in the macro `define_struct` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0412]: cannot find type `foo` in this scope
+ --> $DIR/test3.rs:11:22
+ |
+LL | define_struct! { foo }
+ | ^^^ not found in this scope
+
+error[E0412]: cannot find type `foo` in this scope
+ --> $DIR/test3.rs:11:22
+ |
+LL | define_struct! { foo }
+ | ^^^ not found in this scope
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/tuple/wrong_argument_ice-2.rs b/src/test/ui/tuple/wrong_argument_ice-2.rs
new file mode 100644
index 000000000..b0f814616
--- /dev/null
+++ b/src/test/ui/tuple/wrong_argument_ice-2.rs
@@ -0,0 +1,17 @@
+fn test(t: (i32, i32)) {}
+
+struct Foo;
+
+impl Foo {
+ fn qux(&self) -> i32 {
+ 0
+ }
+}
+
+fn bar() {
+ let x = Foo;
+ test(x.qux(), x.qux());
+ //~^ ERROR this function takes 1 argument but 2 arguments were supplied
+}
+
+fn main() {}
diff --git a/src/test/ui/tuple/wrong_argument_ice-2.stderr b/src/test/ui/tuple/wrong_argument_ice-2.stderr
new file mode 100644
index 000000000..0c2a4c414
--- /dev/null
+++ b/src/test/ui/tuple/wrong_argument_ice-2.stderr
@@ -0,0 +1,19 @@
+error[E0061]: this function takes 1 argument but 2 arguments were supplied
+ --> $DIR/wrong_argument_ice-2.rs:13:5
+ |
+LL | test(x.qux(), x.qux());
+ | ^^^^
+ |
+note: function defined here
+ --> $DIR/wrong_argument_ice-2.rs:1:4
+ |
+LL | fn test(t: (i32, i32)) {}
+ | ^^^^ -------------
+help: wrap these arguments in parentheses to construct a tuple
+ |
+LL | test((x.qux(), x.qux()));
+ | + +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0061`.
diff --git a/src/test/ui/tuple/wrong_argument_ice-3.rs b/src/test/ui/tuple/wrong_argument_ice-3.rs
new file mode 100644
index 000000000..951687c37
--- /dev/null
+++ b/src/test/ui/tuple/wrong_argument_ice-3.rs
@@ -0,0 +1,17 @@
+struct Process;
+
+pub type Group = (Vec<String>, Vec<Process>);
+
+fn test(process: &Process, groups: Vec<Group>) -> Vec<Group> {
+ let new_group = vec![String::new()];
+
+ if groups.capacity() == 0 {
+ groups.push(new_group, vec![process]);
+ //~^ ERROR this function takes 1 argument but 2 arguments were supplied
+ return groups;
+ }
+
+ todo!()
+}
+
+fn main() {}
diff --git a/src/test/ui/tuple/wrong_argument_ice-3.stderr b/src/test/ui/tuple/wrong_argument_ice-3.stderr
new file mode 100644
index 000000000..2733fb314
--- /dev/null
+++ b/src/test/ui/tuple/wrong_argument_ice-3.stderr
@@ -0,0 +1,23 @@
+error[E0061]: this function takes 1 argument but 2 arguments were supplied
+ --> $DIR/wrong_argument_ice-3.rs:9:16
+ |
+LL | groups.push(new_group, vec![process]);
+ | ^^^^ --------- ------------- argument of type `Vec<&Process>` unexpected
+ | |
+ | expected tuple, found struct `Vec`
+ |
+ = note: expected tuple `(Vec<String>, Vec<Process>)`
+ found struct `Vec<String>`
+note: associated function defined here
+ --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
+ |
+LL | pub fn push(&mut self, value: T) {
+ | ^^^^
+help: remove the extra argument
+ |
+LL | groups.push(/* (Vec<String>, Vec<Process>) */);
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0061`.
diff --git a/src/test/ui/tuple/wrong_argument_ice-4.rs b/src/test/ui/tuple/wrong_argument_ice-4.rs
new file mode 100644
index 000000000..479bd0d81
--- /dev/null
+++ b/src/test/ui/tuple/wrong_argument_ice-4.rs
@@ -0,0 +1,6 @@
+fn main() {
+ (|| {})(|| {
+ //~^ ERROR this function takes 0 arguments but 1 argument was supplied
+ let b = 1;
+ });
+}
diff --git a/src/test/ui/tuple/wrong_argument_ice-4.stderr b/src/test/ui/tuple/wrong_argument_ice-4.stderr
new file mode 100644
index 000000000..828ae21b4
--- /dev/null
+++ b/src/test/ui/tuple/wrong_argument_ice-4.stderr
@@ -0,0 +1,23 @@
+error[E0057]: this function takes 0 arguments but 1 argument was supplied
+ --> $DIR/wrong_argument_ice-4.rs:2:5
+ |
+LL | (|| {})(|| {
+ | _____^^^^^^^_-
+LL | |
+LL | | let b = 1;
+LL | | });
+ | |_____- argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15]` unexpected
+ |
+note: closure defined here
+ --> $DIR/wrong_argument_ice-4.rs:2:6
+ |
+LL | (|| {})(|| {
+ | ^^
+help: remove the extra argument
+ |
+LL | (|| {})();
+ | ~~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0057`.
diff --git a/src/test/ui/tuple/wrong_argument_ice.rs b/src/test/ui/tuple/wrong_argument_ice.rs
new file mode 100644
index 000000000..da967d8c1
--- /dev/null
+++ b/src/test/ui/tuple/wrong_argument_ice.rs
@@ -0,0 +1,17 @@
+use std::collections::VecDeque;
+
+pub struct BuildPlanBuilder {
+ acc: VecDeque<(String, String)>,
+ current_provides: String,
+ current_requires: String,
+}
+
+impl BuildPlanBuilder {
+ pub fn or(&mut self) -> &mut Self {
+ self.acc.push_back(self.current_provides, self.current_requires);
+ //~^ ERROR this function takes 1 argument but 2 arguments were supplied
+ self
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/tuple/wrong_argument_ice.stderr b/src/test/ui/tuple/wrong_argument_ice.stderr
new file mode 100644
index 000000000..ec07f1e70
--- /dev/null
+++ b/src/test/ui/tuple/wrong_argument_ice.stderr
@@ -0,0 +1,19 @@
+error[E0061]: this function takes 1 argument but 2 arguments were supplied
+ --> $DIR/wrong_argument_ice.rs:11:18
+ |
+LL | self.acc.push_back(self.current_provides, self.current_requires);
+ | ^^^^^^^^^
+ |
+note: associated function defined here
+ --> $SRC_DIR/alloc/src/collections/vec_deque/mod.rs:LL:COL
+ |
+LL | pub fn push_back(&mut self, value: T) {
+ | ^^^^^^^^^
+help: wrap these arguments in parentheses to construct a tuple
+ |
+LL | self.acc.push_back((self.current_provides, self.current_requires));
+ | + +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0061`.