From a89709db0fdd79f00e3a6c9bede01ec2089255fb Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 26 Sep 2021 06:19:07 +0000 Subject: [PATCH] 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` --- c-bindings-gen/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } -- 2.30.2