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
|
|
|
|
2018-01-29 01:48:56 -06:00
|
|
|
#![feature(generators)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
2020-07-27 19:00:00 -05:00
|
|
|
static move || { //~ WARN unused generator that must be used
|
2018-01-29 01:48:56 -06: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 02:09:40 -05:00
|
|
|
let _ = &a;
|
2018-01-29 01:48:56 -06:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|