]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/issue-60709.rs
Rollup merge of #107061 - compiler-errors:new-solver-new-candidates-3, r=lcnr
[rust.git] / tests / ui / async-await / issue-60709.rs
1 // This used to compile the future down to ud2, due to uninhabited types being
2 // handled incorrectly in generators.
3 // compile-flags: -Copt-level=z -Cdebuginfo=2 --edition=2018
4
5 // run-pass
6 // ignore-asmjs wasm2js does not support source maps yet
7
8 use std::future::Future;
9 use std::task::Poll;
10 use std::task::Context;
11 use std::pin::Pin;
12 use std::rc::Rc;
13
14 struct Never();
15 impl Future for Never {
16     type Output = ();
17     fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
18         Poll::Pending
19     }
20 }
21
22 fn main() {
23     let fut = async {
24         let _rc = Rc::new(()); // Also crashes with Arc
25         Never().await;
26     };
27     let _bla = fut; // Moving the future is required.
28 }