Skip to content

Commit 6f5f27e

Browse files
committed
[bindings] Handle impl Clone like impl ::core::clone::Clone
1 parent cdbe833 commit 6f5f27e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

c-bindings-gen/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,8 @@ fn writeln_impl<W: std::io::Write>(w: &mut W, i: &syn::ItemImpl, types: &mut Typ
903903
write!(w, "\t{} {{ inner: Box::into_raw(Box::new(Default::default())), is_owned: true }}\n", ident).unwrap();
904904
write!(w, "}}\n").unwrap();
905905
} else if path_matches_nongeneric(&trait_path.1, &["core", "cmp", "PartialEq"]) {
906-
} else if path_matches_nongeneric(&trait_path.1, &["core", "clone", "Clone"]) && types.c_type_has_inner_from_path(&resolved_path) {
906+
} else if (path_matches_nongeneric(&trait_path.1, &["core", "clone", "Clone"]) || path_matches_nongeneric(&trait_path.1, &["Clone"])) &&
907+
types.c_type_has_inner_from_path(&resolved_path) {
907908
writeln!(w, "impl Clone for {} {{", ident).unwrap();
908909
writeln!(w, "\tfn clone(&self) -> Self {{").unwrap();
909910
writeln!(w, "\t\tSelf {{").unwrap();

0 commit comments

Comments
 (0)