summaryrefslogtreecommitdiffstats
path: root/src/test/ui/generator/type-mismatch-error.rs
blob: d39c788a84bd409eba24c4b4a2c3063f20caf195 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//! Test that we get the expected type mismatch error instead of "closure is expected to take 0
//! arguments" (which got introduced after implementing resume arguments).

#![feature(generators, generator_trait)]

use std::ops::Generator;

fn f<G: Generator>(_: G, _: G::Return) {}

fn main() {
    f(
        |a: u8| {
            if false {
                yield ();
            } else {
                a
                //~^ error: `if` and `else` have incompatible types
            }
        },
        0u8,
    );
}