]>
Commit | Line | Data |
---|---|---|
5099ac24 FG |
1 | // Test suggesting tuples where bare arguments may have been passed |
2 | // See issue #86481 for details. | |
3 | ||
4 | // run-rustfix | |
5 | ||
6 | fn main() { | |
7 | let _: Result<(i32, i8), ()> = Ok((1, 2)); | |
8 | //~^ ERROR this enum variant takes 1 argument but 2 arguments were supplied | |
9 | let _: Option<(i32, i8, &'static str)> = Some((1, 2, "hi")); | |
10 | //~^ ERROR this enum variant takes 1 argument but 3 arguments were supplied | |
11 | let _: Option<()> = Some(()); | |
12 | //~^ ERROR this enum variant takes 1 argument but 0 arguments were supplied | |
13 | ||
14 | let _: Option<(i32,)> = Some((3,)); | |
15 | //~^ ERROR mismatched types | |
16 | ||
17 | let _: Option<(i32,)> = Some((3,)); | |
18 | //~^ ERROR mismatched types | |
19 | ||
20 | two_ints((1, 2)); //~ ERROR this function takes 1 argument | |
21 | ||
22 | with_generic((3, 4)); //~ ERROR this function takes 1 argument | |
23 | } | |
24 | ||
25 | fn two_ints(_: (i32, i32)) { | |
26 | } | |
27 | ||
28 | fn with_generic<T: Copy + Send>((a, b): (i32, T)) { | |
29 | if false { | |
30 | // test generics/bound handling | |
31 | with_generic((a, b)); //~ ERROR this function takes 1 argument | |
32 | } | |
33 | } |