summary refs log tree commit diff
path: root/src/test/compile-fail/loop-does-not-diverge.rs
blob: eaaa4ecc9fb68778fb6b5f49ddd54e5ea4b121d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* Make sure a loop{} with a break in it can't be
   the tailexpr in the body of a diverging function */
fn forever() -> ! {
  loop {
    break;
  }
  ret 42; //! ERROR expected `_|_` but found `int` (types differ)
}

fn main() {
  if (1 == 2) { forever(); }
}