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
|
|
|
|
2018-01-29 07:48:56 +00:00
|
|
|
#![feature(generators)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
2020-07-28 00:00:00 +00:00
|
|
|
static move || { //~ WARN unused generator that must be used
|
2018-01-29 07:48:56 +00:00
|
|
|
// Tests that the generator transformation finds out that `a` is not live
|
|
|
|
// during the yield expression. Type checking will also compute liveness
|
|
|
|
// and it should also find out that `a` is not live.
|
|
|
|
// The compiler will panic if the generator transformation finds that
|
|
|
|
// `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
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|