From 1be8b2ff98f6eded73cecb1f5ad20ea49ba1309a Mon Sep 17 00:00:00 2001 From: Manas Date: Wed, 30 Mar 2022 19:02:27 +0530 Subject: [PATCH] Type mismatch when last expression is noreturn asm When last expression in a function body is noreturn asm, then analyzer complains about the type mismatch by highlighting entire body. This fixes it by introducing loop {} in the expanded code. --- crates/hir_expand/src/builtin_fn_macro.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/hir_expand/src/builtin_fn_macro.rs b/crates/hir_expand/src/builtin_fn_macro.rs index bad5f9aa2434..8d2352f06ede 100644 --- a/crates/hir_expand/src/builtin_fn_macro.rs +++ b/crates/hir_expand/src/builtin_fn_macro.rs @@ -295,7 +295,7 @@ fn asm_expand( let expanded = quote! {{ ##literals - () + loop {} }}; ExpandResult::ok(expanded) }