2018-09-06 07:41:12 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(unused_unsafe)]
|
2018-09-06 07:41:12 -05:00
|
|
|
|
2023-10-19 16:46:28 -05:00
|
|
|
#![feature(coroutines)]
|
2018-01-29 01:48:56 -06:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
2023-10-19 16:46:28 -05:00
|
|
|
static move || { //~ WARN unused coroutine that must be used
|
|
|
|
// Tests that the coroutine transformation finds out that `a` is not live
|
2018-01-29 01:48:56 -06:00
|
|
|
// during the yield expression. Type checking will also compute liveness
|
|
|
|
// and it should also find out that `a` is not live.
|
2023-10-19 16:46:28 -05:00
|
|
|
// The compiler will panic if the coroutine transformation finds that
|
2018-01-29 01:48:56 -06:00
|
|
|
// `a` is live and type checking finds it dead.
|
|
|
|
let a = {
|
|
|
|
yield ();
|
|
|
|
4i32
|
|
|
|
};
|
2021-06-18 02:09:40 -05:00
|
|
|
let _ = &a;
|
2018-01-29 01:48:56 -06:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|