From a76222b90f680e9fcc0e6fae293167d24356ff8f Mon Sep 17 00:00:00 2001 From: Ashley Ruglys Date: Mon, 18 Oct 2021 09:42:44 -0700 Subject: [PATCH] Test type checking --- crates/spirv-std/macros/src/lib.rs | 2 +- crates/spirv-std/src/lib.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/spirv-std/macros/src/lib.rs b/crates/spirv-std/macros/src/lib.rs index 97a2ff365a..25c44d5baa 100644 --- a/crates/spirv-std/macros/src/lib.rs +++ b/crates/spirv-std/macros/src/lib.rs @@ -440,7 +440,7 @@ fn debug_printf_inner(input: DebugPrintfInput) -> TokenStream { variable_idents.push_str(&format!("%{} ", ident)); input_registers.push(quote::quote! { - #ident = in(reg) &{#variable}, + #ident = in(reg) &spirv_std::debug_printf_assert_is_type::(#variable), }); let op_load = format!("%{ident} = OpLoad _ {{{ident}}}", ident = ident); diff --git a/crates/spirv-std/src/lib.rs b/crates/spirv-std/src/lib.rs index fb65ba3656..5c61ed9a3c 100644 --- a/crates/spirv-std/src/lib.rs +++ b/crates/spirv-std/src/lib.rs @@ -130,3 +130,8 @@ extern "C" fn rust_eh_personality() {} #[doc(hidden)] /// [spirv_types] pub fn workaround_rustdoc_ice_84738() {} + +#[doc(hidden)] +pub fn debug_printf_assert_is_type(ty: T) -> T { + ty +}