From bd222ae93fa0cabe7d51ba8db40ece99579bdaed Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Wed, 10 Apr 2019 21:50:31 -0400 Subject: regex: fix HIR analysis bug An alternate can be empty at this point, so we must handle it. We didn't before because the regex engine actually disallows empty alternates, however, this code runs before the regex compiler rejects the regex. --- grep-regex/src/multi.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/grep-regex/src/multi.rs b/grep-regex/src/multi.rs index 501e5aca..6e43e975 100644 --- a/grep-regex/src/multi.rs +++ b/grep-regex/src/multi.rs @@ -109,6 +109,7 @@ pub fn alternation_literals(expr: &Hir) -> Option>> { for alt in alts { let mut lit = vec![]; match *alt.kind() { + HirKind::Empty => {} HirKind::Literal(ref x) => extendlit(x, &mut lit), HirKind::Concat(ref exprs) => { for e in exprs { -- cgit v1.2.3