summaryrefslogtreecommitdiffstats
path: root/src/test/ui/suggestions/args-instead-of-tuple-errors.rs
blob: 5403b8d6d2871ae65a8f548ff6e39e2e2b9a1659 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Ensure we don't suggest tuple-wrapping when we'd end up with a type error

fn main() {
    // we shouldn't suggest to fix these - `2` isn't a `bool`

    let _: Option<(i32, bool)> = Some(1, 2);
    //~^ ERROR this enum variant takes 1 argument but 2 arguments were supplied
    int_bool(1, 2);
    //~^ ERROR this function takes 1 argument but 2 arguments were supplied

    let _: Option<(i8,)> = Some();
    //~^ ERROR this enum variant takes 1 argument but 0 arguments were supplied

    let _: Option<(i32,)> = Some(5_usize);
    //~^ ERROR mismatched types

    let _: Option<(i32,)> = Some((5_usize));
    //~^ ERROR mismatched types
}

fn int_bool(_: (i32, bool)) {
}