Skip to content

Commit c9e4816

Browse files
Add convenience function for detecting cyclic CFGs
1 parent 4fd9b99 commit c9e4816

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustc/mir/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,12 @@ impl<'tcx> Body<'tcx> {
262262
dominators(self)
263263
}
264264

265+
/// Returns `true` if a cycle exists in the control-flow graph that is reachable from the
266+
/// `START_BLOCK`.
267+
pub fn is_cfg_cyclic(&self) -> bool {
268+
graph::is_cyclic(self)
269+
}
270+
265271
#[inline]
266272
pub fn local_kind(&self, local: Local) -> LocalKind {
267273
let index = local.as_usize();

0 commit comments

Comments
 (0)