about summary refs log tree commit diff
path: root/src/librustc/cfg/construct.rs
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-10-19 15:40:07 +0100
committerDan Robertson <dan@dlrobertson.com>2019-08-17 15:05:36 +0000
commit1713ac4bf5c992f40d667c929c1e1ce9c3a51204 (patch)
tree098d9b4e320c88f985b2459ae9ded38081f46cb7 /src/librustc/cfg/construct.rs
parentac60ca0643feb3452688a9ca97c839c155742915 (diff)
downloadrust-1713ac4bf5c992f40d667c929c1e1ce9c3a51204.tar.gz
rust-1713ac4bf5c992f40d667c929c1e1ce9c3a51204.zip
Initial implementation of or patterns
Diffstat (limited to 'src/librustc/cfg/construct.rs')
-rw-r--r--src/librustc/cfg/construct.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs
index 7ada56cfa76..0dad2dda837 100644
--- a/src/librustc/cfg/construct.rs
+++ b/src/librustc/cfg/construct.rs
@@ -140,6 +140,11 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
                 self.add_ast_node(pat.hir_id.local_id, &[pats_exit])
             }
 
+            PatKind::Or(ref pats) => {
+                let branches: Vec<_> = pats.iter().map(|p| self.pat(p, pred)).collect();
+                self.add_ast_node(pat.hir_id.local_id, &branches)
+            }
+
             PatKind::Slice(ref pre, ref vec, ref post) => {
                 let pre_exit = self.pats_all(pre.iter(), pred);
                 let vec_exit = self.pats_all(vec.iter(), pre_exit);