]> git.lizzy.rs Git - rust.git/blob - src/test/ui/for-loop-while/for-loop-has-unit-body.rs
Auto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
[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 }