diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2021-04-03 12:30:43 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2021-04-03 13:05:04 +0200 |
commit | b21086cc3ba5aaeea53082e0618733a1b354daab (patch) | |
tree | b110e0b04c1023032077003fc45c50a94d1a48bf /src | |
parent | 2605da86c8cd7930f0c0d5f1025e33855a582bc0 (diff) |
codegen: Don't use a `sym` temporary in dynamic library code.
Fixes #2014.
Diffstat (limited to 'src')
-rw-r--r-- | src/codegen/dyngen.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/codegen/dyngen.rs b/src/codegen/dyngen.rs index 5bb8747c..71c4dab1 100644 --- a/src/codegen/dyngen.rs +++ b/src/codegen/dyngen.rs @@ -140,15 +140,13 @@ impl DynamicItems { // N.B: If the signature was required, it won't be wrapped in a Result<...> // and we can simply call it directly. - let call_body = if is_required { - quote! { - self.#ident(#( #args_identifiers ),*) - } + let fn_ = if is_required { + quote! { self.#ident } } else { - quote! { - let sym = self.#ident.as_ref().expect("Expected function, got error."); - (sym)(#( #args_identifiers ),*) - } + quote! { self.#ident.as_ref().expect("Expected function, got error.") } + }; + let call_body = quote! { + (#fn_)(#( #args_identifiers ),*) }; // We can't implement variadic functions from C easily, so we allow to |