Don't infinite loop on bad keys

This commit is contained in:
Alex Crichton 2015-01-19 13:16:42 -08:00
parent 34aaa5f384
commit 885db13d09

View file

@ -220,7 +220,7 @@ impl<'a> Parser<'a> {
_ => break, _ => break,
} }
} }
None => {} None => break
} }
} }
Some(ret) Some(ret)
@ -1135,4 +1135,9 @@ trimmed in raw strings.
assert!(table.lookup("f f").is_some()); assert!(table.lookup("f f").is_some());
assert!(table.lookup("\"").is_some()); assert!(table.lookup("\"").is_some());
} }
#[test]
fn invalid_bare_numeral() {
assert!(Parser::new("4").parse().is_none());
}
} }