]> git.lizzy.rs Git - rust.git/blob - src/test/ui/for-loop-while/for-loop-has-unit-body.rs
Merge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyup
[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 }