Skip to content

Commit 5b79d92

Browse files
committed
fix: Fix parser panicking on invalid asm options
1 parent f74a0c8 commit 5b79d92

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

crates/hir-ty/src/tests/macros.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,11 @@ fn main() {
14981498
43..44 '1': i32
14991499
58..63 'mut o': i32
15001500
66..67 '0': i32
1501+
!95..104 'thread_id': usize
1502+
!103..107 '&foo': &'? i32
1503+
!104..107 'foo': i32
1504+
!115..120 '&muto': &'? mut i32
1505+
!119..120 'o': i32
15011506
293..294 'o': i32
15021507
308..317 'thread_id': usize
15031508
"#]],

crates/parser/src/grammar/expressions/atom.rs

+1
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ fn parse_options(p: &mut Parser<'_>) {
434434
let m = p.start();
435435
if !OPTIONS.iter().any(|&syntax| p.eat_contextual_kw(syntax)) {
436436
p.err_and_bump("expected asm option");
437+
m.abandon(p);
437438
continue;
438439
}
439440
m.complete(p, ASM_OPTION);

0 commit comments

Comments
 (0)