mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-03 13:23:25 +00:00
Improve asm support
Including:
- Infer `label {}` and `const` operands.
- Correctly handle unsafe check inside `label {}`.
- Fix an embarrassing parser typo that cause labels to never be part of the AST
This commit is contained in:
parent
f8e784353b
commit
5ed11234cc
10 changed files with 186 additions and 40 deletions
|
|
@ -894,4 +894,25 @@ fn main() {
|
|||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn asm_label() {
|
||||
check_diagnostics(
|
||||
r#"
|
||||
//- minicore: asm
|
||||
fn foo() {
|
||||
unsafe {
|
||||
core::arch::asm!(
|
||||
"jmp {}",
|
||||
label {
|
||||
let p = 0xDEADBEAF as *mut u8;
|
||||
*p = 3;
|
||||
// ^^ error: dereference of raw pointer is unsafe and requires an unsafe function or block
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue