summaryrefslogtreecommitdiffstats
path: root/src/test/ui/for-loop-while/for-loop-has-unit-body.rs
blob: eba385461b951e192ed400d39745c969a3f90d1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// run-pass
fn main() {
    // Check that the tail statement in the body unifies with something
    for _ in 0..3 {
        // `()` is fine to zero-initialize as it is zero sized and inhabited.
        unsafe { std::mem::zeroed() }
    }

    // Check that the tail statement in the body can be unit
    for _ in 0..3 {
        ()
    }
}