11852: Type mismatch when last expression is noreturn asm r=lnicola a=weirdsmiley

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.

Fixes: [#11820](https://github.com/rust-analyzer/rust-analyzer/issues/11820)

Co-authored-by: Manas <manas18244@iiitd.ac.in>
This commit is contained in:
bors[bot] 2022-03-30 13:48:50 +00:00 committed by GitHub
commit 259182b50b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -295,7 +295,7 @@ fn asm_expand(
let expanded = quote! {{
##literals
()
loop {}
}};
ExpandResult::ok(expanded)
}