summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/opaque-type-error.rs
blob: 5e1147403143e55bd436d9b707a6031adcd3e200 (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
// edition:2018
use core::future::Future;

async fn base_thing() -> Result<(), ()> {
    Ok(())
}

fn thing_one() -> impl Future<Output = Result<(), ()>> {
    base_thing()
}

fn thing_two() -> impl Future<Output = Result<(), ()>> {
    base_thing()
}

async fn thing() -> Result<(), ()> {
    if true {
        thing_one()
    } else {
        thing_two() //~ ERROR `if` and `else` have incompatible types
    }.await
}

fn main() {}