From: Matt Corallo Date: Sun, 26 Sep 2021 06:19:07 +0000 (+0000) Subject: Detect a type as clonable with an explicit `impl Clone` X-Git-Tag: v0.0.101.2^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=a89709db0fdd79f00e3a6c9bede01ec2089255fb;p=ldk-c-bindings Detect a type as clonable with an explicit `impl Clone` These stay `impl Clone` even after the pretty-print rustc pass so we cannot only match `core::clone::Clone` --- diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index f56f30f..9d6f9cf 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -1853,7 +1853,8 @@ fn walk_ast<'a>(ast_storage: &'a FullLibraryAST, crate_types: &mut CrateTypes<'a syn::Item::Impl(i) => { if let &syn::Type::Path(ref p) = &*i.self_ty { if let Some(trait_path) = i.trait_.as_ref() { - if path_matches_nongeneric(&trait_path.1, &["core", "clone", "Clone"]) { + if path_matches_nongeneric(&trait_path.1, &["core", "clone", "Clone"]) || + path_matches_nongeneric(&trait_path.1, &["Clone"]) { if let Some(full_path) = import_resolver.maybe_resolve_path(&p.path, None) { crate_types.set_clonable("crate::".to_owned() + &full_path); }