remove the semicolon for builtin macro call statements in statement_outside_block
The expansion of `asm!()` and `line!()` is not marked as from an expansion, in which case `SourceMap::stmt_span` returns the input span unchanged. So instead of using `stmt_span`, use `mac_call_stmt_semi_span` directly
This commit is contained in:
parent
4de65a113f
commit
65eb1ec0fb
4 changed files with 60 additions and 13 deletions
|
|
@ -80,5 +80,13 @@ fn main() {
|
|||
|
||||
{ unit_fn_block(); };
|
||||
|
||||
unsafe {
|
||||
std::arch::asm!("")
|
||||
};
|
||||
|
||||
{
|
||||
line!()
|
||||
};
|
||||
|
||||
unit_fn_block()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,5 +80,13 @@ fn main() {
|
|||
|
||||
{ unit_fn_block(); };
|
||||
|
||||
unsafe {
|
||||
std::arch::asm!("");
|
||||
}
|
||||
|
||||
{
|
||||
line!();
|
||||
}
|
||||
|
||||
unit_fn_block()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,5 +51,33 @@ LL - { m!(()); }
|
|||
LL + { m!(()) };
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: consider moving the `;` outside the block for consistent formatting
|
||||
--> tests/ui/semicolon_outside_block.rs:83:5
|
||||
|
|
||||
LL | / unsafe {
|
||||
LL | | std::arch::asm!("");
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
help: put the `;` here
|
||||
|
|
||||
LL ~ std::arch::asm!("")
|
||||
LL ~ };
|
||||
|
|
||||
|
||||
error: consider moving the `;` outside the block for consistent formatting
|
||||
--> tests/ui/semicolon_outside_block.rs:87:5
|
||||
|
|
||||
LL | / {
|
||||
LL | | line!();
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
help: put the `;` here
|
||||
|
|
||||
LL ~ line!()
|
||||
LL ~ };
|
||||
|
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue