Skip to content

Commit 6d3e89e

Browse files
author
Jakub Wieczorek
committed
Mark the exit of infinite loops as unreachable
1 parent d130acc commit 6d3e89e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustc/middle/trans/controlflow.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ pub fn trans_loop<'a>(bcx:&'a Block<'a>,
264264

265265
fcx.pop_loop_cleanup_scope(loop_id);
266266

267+
if ty::type_is_bot(node_id_type(bcx, loop_id)) {
268+
Unreachable(next_bcx_in);
269+
}
270+
267271
return next_bcx_in;
268272
}
269273

0 commit comments

Comments
 (0)