mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
fix: Fix parser panicking on invalid asm options
This commit is contained in:
parent
f74a0c8801
commit
5b79d922b2
2 changed files with 6 additions and 0 deletions
|
@ -1498,6 +1498,11 @@ fn main() {
|
||||||
43..44 '1': i32
|
43..44 '1': i32
|
||||||
58..63 'mut o': i32
|
58..63 'mut o': i32
|
||||||
66..67 '0': i32
|
66..67 '0': i32
|
||||||
|
!95..104 'thread_id': usize
|
||||||
|
!103..107 '&foo': &'? i32
|
||||||
|
!104..107 'foo': i32
|
||||||
|
!115..120 '&muto': &'? mut i32
|
||||||
|
!119..120 'o': i32
|
||||||
293..294 'o': i32
|
293..294 'o': i32
|
||||||
308..317 'thread_id': usize
|
308..317 'thread_id': usize
|
||||||
"#]],
|
"#]],
|
||||||
|
|
|
@ -434,6 +434,7 @@ fn parse_options(p: &mut Parser<'_>) {
|
||||||
let m = p.start();
|
let m = p.start();
|
||||||
if !OPTIONS.iter().any(|&syntax| p.eat_contextual_kw(syntax)) {
|
if !OPTIONS.iter().any(|&syntax| p.eat_contextual_kw(syntax)) {
|
||||||
p.err_and_bump("expected asm option");
|
p.err_and_bump("expected asm option");
|
||||||
|
m.abandon(p);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
m.complete(p, ASM_OPTION);
|
m.complete(p, ASM_OPTION);
|
||||||
|
|
Loading…
Reference in a new issue