Drop `#[no_mangle]`/`extern` flag for internal-only method
authorMatt Corallo <git@bluematt.me>
Tue, 3 Oct 2023 05:59:41 +0000 (05:59 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 4 Oct 2023 20:02:23 +0000 (20:02 +0000)
This prevents new `cbindgen` from generating bindings for things we
don't actually want to export.

c-bindings-gen/src/main.rs

index 8876583315246524ffb938df804234b9a2784d86..956420be780a938e817d856392f928b443695257 100644 (file)
@@ -554,8 +554,7 @@ fn writeln_trait<'a, 'b, W: std::io::Write>(w: &mut W, t: &'a syn::ItemTrait, ty
        writeln!(w, "unsafe impl Send for {} {{}}", trait_name).unwrap();
        writeln!(w, "unsafe impl Sync for {} {{}}", trait_name).unwrap();
 
-       writeln!(w, "#[no_mangle]").unwrap();
-       writeln!(w, "pub(crate) extern \"C\" fn {}_clone_fields(orig: &{}) -> {} {{", trait_name, trait_name, trait_name).unwrap();
+       writeln!(w, "pub(crate) fn {}_clone_fields(orig: &{}) -> {} {{", trait_name, trait_name, trait_name).unwrap();
        writeln!(w, "\t{} {{", trait_name).unwrap();
        writeln!(w, "\t\tthis_arg: orig.this_arg,").unwrap();
        for (field, clone_fn, _) in generated_fields.iter() {