Rollup merge of #99192 - Amanieu:fix-asm-srcloc, r=petrochenkov
Fix spans for asm diagnostics Line spans were incorrect if the first line of an asm statement was an empty string.
This commit is contained in:
commit
d3a1aa0b43
@ -534,8 +534,8 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
|
||||
|
||||
let mut template_strs = Vec::with_capacity(args.templates.len());
|
||||
|
||||
for template_expr in args.templates.into_iter() {
|
||||
if !template.is_empty() {
|
||||
for (i, template_expr) in args.templates.into_iter().enumerate() {
|
||||
if i != 0 {
|
||||
template.push(ast::InlineAsmTemplatePiece::String("\n".to_string()));
|
||||
}
|
||||
|
||||
|
@ -118,5 +118,12 @@ fn main() {
|
||||
//~^^^^^^^^^^ ERROR: unrecognized instruction mnemonic
|
||||
//~^^^^^^^ ERROR: unrecognized instruction mnemonic
|
||||
//~^^^^^^^^ ERROR: unrecognized instruction mnemonic
|
||||
|
||||
asm!(
|
||||
"",
|
||||
"\n",
|
||||
"invalid_instruction"
|
||||
);
|
||||
//~^^ ERROR: unrecognized instruction mnemonic
|
||||
}
|
||||
}
|
||||
|
@ -274,5 +274,17 @@ note: instantiated into assembly here
|
||||
LL | invalid_instruction4
|
||||
| ^
|
||||
|
||||
error: aborting due to 23 previous errors
|
||||
error: unrecognized instruction mnemonic
|
||||
--> $DIR/srcloc.rs:125:14
|
||||
|
|
||||
LL | "invalid_instruction"
|
||||
| ^
|
||||
|
|
||||
note: instantiated into assembly here
|
||||
--> <inline asm>:4:1
|
||||
|
|
||||
LL | invalid_instruction
|
||||
| ^
|
||||
|
||||
error: aborting due to 24 previous errors
|
||||
|
||||
|
@ -120,5 +120,12 @@ fn main() {
|
||||
//~^^^^^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction2'
|
||||
//~^^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction3'
|
||||
//~^^^^^^^^ ERROR: invalid instruction mnemonic 'invalid_instruction4'
|
||||
|
||||
asm!(
|
||||
"",
|
||||
"\n",
|
||||
"invalid_instruction"
|
||||
);
|
||||
//~^^ ERROR: invalid instruction mnemonic 'invalid_instruction'
|
||||
}
|
||||
}
|
||||
|
@ -286,5 +286,17 @@ note: instantiated into assembly here
|
||||
LL | invalid_instruction4
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 23 previous errors; 1 warning emitted
|
||||
error: invalid instruction mnemonic 'invalid_instruction'
|
||||
--> $DIR/srcloc.rs:127:14
|
||||
|
|
||||
LL | "invalid_instruction"
|
||||
| ^
|
||||
|
|
||||
note: instantiated into assembly here
|
||||
--> <inline asm>:5:1
|
||||
|
|
||||
LL | invalid_instruction
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 24 previous errors; 1 warning emitted
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user