summaryrefslogtreecommitdiffstats
path: root/tests/ui/did_you_mean/issue-42764.rs
blob: eb96c2480630eb140f8fe135cac027b34678056b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
enum DoubleOption<T> {
    FirstSome(T),
    AlternativeSome(T),
    Nothing,
}

fn this_function_expects_a_double_option<T>(d: DoubleOption<T>) {}

fn main() {
    let n: usize = 42;
    this_function_expects_a_double_option(n);
    //~^ ERROR mismatched types
    //~| HELP try wrapping the expression in a variant of `DoubleOption`
}


// But don't issue the "try using a variant" help if the one-"variant" ADT is
// actually a one-field struct.

struct Payload;

struct Wrapper { payload: Payload }

struct Context { wrapper: Wrapper }

fn overton() {
    let _c = Context { wrapper: Payload{} };
    //~^ ERROR mismatched types
    //~| try wrapping the expression in `Wrapper`
}