2018-09-06 12:41:12 +00:00
|
|
|
//@ run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(unused_unsafe)]
|
2018-09-06 12:41:12 +00:00
|
|
|
|
2023-10-19 21:46:28 +00:00
|
|
|
#![feature(coroutines)]
|
2018-01-29 07:48:56 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
2023-10-19 21:46:28 +00: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 07:48:56 +00: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 21:46:28 +00:00
|
|
|
// The compiler will panic if the coroutine transformation finds that
|
2018-01-29 07:48:56 +00:00
|
|
|
// `a` is live and type checking finds it dead.
|
|
|
|
let a = {
|
|
|
|
yield ();
|
|
|
|
4i32
|
|
|
|
};
|
2021-06-18 07:09:40 +00:00
|
|
|
let _ = &a;
|
2018-01-29 07:48:56 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|