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