1
Fork 0

Rollup merge of #112683 - asquared31415:asm_clobber_ice, r=compiler-errors

fix ICE on specific malformed asm clobber_abi

fixes #112635
This commit is contained in:
Matthias Krüger 2023-06-17 12:43:30 +02:00 committed by GitHub
commit 7051c84326
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 184 additions and 96 deletions

View file

@ -379,16 +379,12 @@ fn parse_clobber_abi<'a>(p: &mut Parser<'a>, args: &mut AsmArgs) -> PResult<'a,
}
let mut new_abis = Vec::new();
loop {
while !p.eat(&token::CloseDelim(Delimiter::Parenthesis)) {
match p.parse_str_lit() {
Ok(str_lit) => {
new_abis.push((str_lit.symbol_unescaped, str_lit.span));
}
Err(opt_lit) => {
// If the non-string literal is a closing paren then it's the end of the list and is fine
if p.eat(&token::CloseDelim(Delimiter::Parenthesis)) {
break;
}
let span = opt_lit.map_or(p.token.span, |lit| lit.span);
let mut err =
p.sess.span_diagnostic.struct_span_err(span, "expected string literal");