summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/issue-60709.rs
blob: c206f01b98f780d0c7f3c1fa5e6752cffcae5b4a (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
// This used to compile the future down to ud2, due to uninhabited types being
// handled incorrectly in coroutines.
// compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018

// run-pass

use std::future::Future;
use std::task::Poll;
use std::task::Context;
use std::pin::Pin;
use std::rc::Rc;

struct Never();
impl Future for Never {
    type Output = ();
    fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
        Poll::Pending
    }
}

fn main() {
    let fut = async {
        let _rc = Rc::new(()); // Also crashes with Arc
        Never().await;
    };
    let _bla = fut; // Moving the future is required.
}