From 0f6b3e15f4d66407e2dd21e931818f39d25ad790 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Fri, 25 Jan 2019 13:06:04 +0100 Subject: [PATCH] Clean --- derive/src/codegen.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/derive/src/codegen.rs b/derive/src/codegen.rs index 6668b03..1a481d9 100644 --- a/derive/src/codegen.rs +++ b/derive/src/codegen.rs @@ -1,3 +1,8 @@ +//! This module generates a trait implementation for `Externals` on the target type. +//! It also generates a function called `resolve` that returns a `ModuleImportResolved`. +//! +//! The code generation is rather simple but it relies heavily on type inference. + use crate::parser::{FuncDef, ImplBlockDef}; use proc_macro2::{Ident, Span, TokenStream}; use quote::{quote, quote_spanned, ToTokens}; @@ -170,7 +175,9 @@ fn emit_resolve_func_arm(func: &FuncDef) -> TokenStream { }; // at this point types of all variables and return_val are inferred. - if signature.params() != &[#(#params_materialized_tys),*] || signature.return_type() != #materialized_return_ty { + if signature.params() != &[#(#params_materialized_tys),*] + || signature.return_type() != #materialized_return_ty + { return Err(Error::Instantiation( format!("Export {} has different signature {:?}", #string_ident, signature), ));