summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/non-trivial-drop.rs
blob: 1004303d5c137851193aee7c217b02436312cb16 (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
31
32
33
34
35
// build-pass
// edition:2018

#![feature(coroutines)]

fn main() {
    foo();
}

fn foo() {
    || {
        yield drop(Config {
            nickname: NonCopy,
            b: NonCopy2,
        }.nickname);
    };
}

#[derive(Default)]
struct NonCopy;
impl Drop for NonCopy {
    fn drop(&mut self) {}
}

#[derive(Default)]
struct NonCopy2;
impl Drop for NonCopy2 {
    fn drop(&mut self) {}
}

#[derive(Default)]
struct Config {
    nickname: NonCopy,
    b: NonCopy2,
}