Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/simple.rs')
-rw-r--r--crates/hir-ty/src/tests/simple.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/crates/hir-ty/src/tests/simple.rs b/crates/hir-ty/src/tests/simple.rs
index 08127eeb46..cf51671afb 100644
--- a/crates/hir-ty/src/tests/simple.rs
+++ b/crates/hir-ty/src/tests/simple.rs
@@ -3926,3 +3926,42 @@ fn foo<T: Bar>() {
"#]],
);
}
+
+#[test]
+fn asm_const_label() {
+ check_infer(
+ r#"
+//- minicore: asm
+const fn bar() -> i32 { 123 }
+fn baz(s: &str) {}
+
+fn foo() {
+ unsafe {
+ core::arch::asm!(
+ "mov eax, {}",
+ "jmp {}",
+ const bar(),
+ label {
+ baz("hello");
+ },
+ );
+ }
+}
+ "#,
+ expect![[r#"
+ 22..29 '{ 123 }': i32
+ 24..27 '123': i32
+ 37..38 's': &'? str
+ 46..48 '{}': ()
+ !0..68 'builti...");},)': ()
+ !40..43 'bar': fn bar() -> i32
+ !40..45 'bar()': i32
+ !51..66 '{baz("hello");}': ()
+ !52..55 'baz': fn baz(&'? str)
+ !52..64 'baz("hello")': ()
+ !56..63 '"hello"': &'static str
+ 59..257 '{ ... } }': ()
+ 65..255 'unsafe... }': ()
+ "#]],
+ );
+}