2023-10-19 21:46:28 +00:00
|
|
|
#![feature(coroutines)]
|
2018-01-28 18:49:48 +00:00
|
|
|
|
|
|
|
enum Test { A(i32), B, }
|
|
|
|
|
2018-05-25 10:36:58 +00:00
|
|
|
fn main() { }
|
2018-01-28 18:49:48 +00:00
|
|
|
|
|
|
|
fn fun(test: Test) {
|
2024-04-11 13:15:34 +00:00
|
|
|
#[coroutine] move || {
|
2023-10-19 21:46:28 +00:00
|
|
|
if let Test::A(ref _a) = test { //~ ERROR borrow may still be in use when coroutine yields
|
2018-01-28 18:49:48 +00:00
|
|
|
yield ();
|
2018-05-25 10:36:58 +00:00
|
|
|
_a.use_ref();
|
2018-01-28 18:49:48 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2018-05-25 10:36:58 +00:00
|
|
|
|
|
|
|
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
|
|
|
|
impl<T> Fake for T { }
|