// mappings from a trai defined in a different file, we may mis-resolve or
// fail to resolve the mapped types. Thus, we have to construct a new
// resolver for the module that the trait was defined in here first.
- let trait_resolver = get_module_type_resolver!(full_trait_path, types.crate_libs, types.crate_types);
+ let mut trait_resolver = get_module_type_resolver!(full_trait_path, types.crate_libs, types.crate_types);
gen_types.learn_associated_types(trait_obj, &trait_resolver);
let mut impl_associated_types = HashMap::new();
for item in i.items.iter() {
_ => {}
}
}
- if uncallable_function {
- let mut trait_resolver = get_module_type_resolver!(full_trait_path, $types.crate_libs, $types.crate_types);
- write_method_params(w, &$trait_meth.sig, "c_void", &mut trait_resolver, Some(&meth_gen_types), true, true);
- } else {
- write_method_params(w, &$m.sig, "c_void", $types, Some(&meth_gen_types), true, true);
- }
+ write_method_params(w, &$trait_meth.sig, "c_void", &mut trait_resolver, Some(&meth_gen_types), true, true);
write!(w, " {{\n\t").unwrap();
if uncallable_function {
write!(w, "unreachable!();").unwrap();
} else {
- write_method_var_decl_body(w, &$m.sig, "", $types, Some(&meth_gen_types), false);
+ write_method_var_decl_body(w, &$trait_meth.sig, "", &mut trait_resolver, Some(&meth_gen_types), false);
let mut takes_self = false;
for inp in $m.sig.inputs.iter() {
if let syn::FnArg::Receiver(_) = inp {
},
_ => {},
}
- write_method_call_params(w, &$m.sig, "", $types, Some(&meth_gen_types), &real_type, false);
+ write_method_call_params(w, &$trait_meth.sig, "", &mut trait_resolver, Some(&meth_gen_types), &real_type, false);
}
write!(w, "\n}}\n").unwrap();
if let syn::ReturnType::Type(_, rtype) = &$m.sig.output {
assert!(meth.default.is_some());
let old_gen_types = gen_types;
gen_types = GenericTypes::new(Some(resolved_path.clone()));
- let mut trait_resolver = get_module_type_resolver!(full_trait_path, types.crate_libs, types.crate_types);
impl_meth!(meth, meth, full_trait_path, trait_obj, "", &mut trait_resolver);
gen_types = old_gen_types;
},