Skip to content

Commit

Permalink
Merge pull request #528 from dtolnay/samemethod
Browse files Browse the repository at this point in the history
Allow instance methods with same name on different types in same bridge
  • Loading branch information
dtolnay authored Nov 29, 2020
2 parents ded2962 + 1dcd53e commit 65be3eb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions macro/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,14 @@ fn expand_rust_type_assert_sized(ety: &ExternType) -> TokenStream {

fn expand_rust_function_shim(efn: &ExternFn, types: &Types) -> TokenStream {
let link_name = mangle::extern_fn(efn, types);
let local_name = format_ident!("__{}", efn.name.rust);
let catch_unwind_label = format!("::{}", efn.name.rust);
let local_name = match &efn.receiver {
None => format_ident!("__{}", efn.name.rust),
Some(receiver) => format_ident!("__{}__{}", receiver.ty.rust, efn.name.rust),
};
let catch_unwind_label = match &efn.receiver {
None => format!("::{}", efn.name.rust),
Some(receiver) => format!("::{}::{}", receiver.ty.rust, efn.name.rust),
};
let invoke = Some(&efn.name.rust);
expand_rust_function_shim_impl(
efn,
Expand Down

0 comments on commit 65be3eb

Please sign in to comment.