]> git.proxmox.com Git - rustc.git/blob - tests/ui/coroutine/issue-57084.rs
New upstream version 1.75.0+dfsg1
[rustc.git] / tests / ui / coroutine / issue-57084.rs
1 // This issue reproduces an ICE on compile (E.g. fails on 2018-12-19 nightly).
2 // "cannot relate bound region: ReLateBound(DebruijnIndex(1), BrAnon(1)) <= '?1"
3 // run-pass
4 // edition:2018
5 #![feature(coroutines,coroutine_trait)]
6 use std::ops::Coroutine;
7
8 fn with<F>(f: F) -> impl Coroutine<Yield=(), Return=()>
9 where F: Fn() -> ()
10 {
11 move || {
12 loop {
13 match f() {
14 _ => yield,
15 }
16 }
17 }
18 }
19
20 fn main() {
21 let data = &vec![1];
22 || { //~ WARN unused coroutine that must be used
23 let _to_pin = with(move || println!("{:p}", data));
24 loop {
25 yield
26 }
27 };
28 }