X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Fmiddle%2Fcfg%2Fmod.rs;h=e1c5906f0fb83f5d49f33959a89b806697f5e60b;hb=2af8155bee8614a4e3bd1831f8927652c7475cc5;hp=a74fff5630bfd0d48301c8bd3037731a2f5a4f88;hpb=25f8051f2ebdc9444e0f75e91dc0cbb45d194181;p=rust.git diff --git a/src/librustc/middle/cfg/mod.rs b/src/librustc/middle/cfg/mod.rs index a74fff5630b..e1c5906f0fb 100644 --- a/src/librustc/middle/cfg/mod.rs +++ b/src/librustc/middle/cfg/mod.rs @@ -48,4 +48,8 @@ pub fn new(tcx: &ty::ctxt, blk: &ast::Block) -> CFG { construct::construct(tcx, blk) } + + pub fn node_is_reachable(&self, id: ast::NodeId) -> bool { + self.graph.depth_traverse(self.entry).any(|node| node.id == id) + } }