Merge pull request #7225 from joshuawarner32/fuzzing-bugs

Fix some bugs found via fuzzing
This commit is contained in:
Anton-4 2024-11-16 19:46:12 +01:00 committed by GitHub
commit 19a716b8e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 152 additions and 6 deletions

View file

@ -2094,7 +2094,7 @@ pub fn merge_spaces<'a>(
fn expr_to_pattern_help<'a>(arena: &'a Bump, expr: &Expr<'a>) -> Result<Pattern<'a>, ()> {
let mut expr = expr.extract_spaces();
if let Expr::ParensAround(loc_expr) = &expr.item {
while let Expr::ParensAround(loc_expr) = &expr.item {
let expr_inner = loc_expr.extract_spaces();
expr.before = merge_spaces(arena, expr.before, expr_inner.before);

View file

@ -1056,7 +1056,11 @@ where
// the next character should not be an identifier character
// to prevent treating `whence` or `iffy` as keywords
match state.bytes().get(width) {
Some(next) if *next == b' ' || *next == b'#' || *next == b'\n' || *next == b'\r' => {
Some(
b' ' | b'#' | b'\n' | b'\r' | b'\t' | b',' | b'(' | b')' | b'[' | b']' | b'{'
| b'}' | b'"' | b'\'' | b'/' | b'\\' | b'+' | b'*' | b'%' | b'^' | b'&' | b'|'
| b'<' | b'>' | b'=' | b'!' | b'~' | b'`' | b';' | b':' | b'?' | b'.',
) => {
state = state.advance(width);
Ok((MadeProgress, (), state))
}