]> git.lizzy.rs Git - rust.git/blob - src/test/ui/for-loop-while/for-loop-has-unit-body.rs
Merge commit '9a0c32934ebe376128230aa8da3275697b2053e7' into sync_cg_clif-2021-03-05
[rust.git] / src / test / ui / for-loop-while / for-loop-has-unit-body.rs
1 // run-pass
2 fn main() {
3     // Check that the tail statement in the body unifies with something
4     for _ in 0..3 {
5         // `()` is fine to zero-initialize as it is zero sized and inhabited.
6         unsafe { std::mem::zeroed() }
7     }
8
9     // Check that the tail statement in the body can be unit
10     for _ in 0..3 {
11         ()
12     }
13 }