Repository: rust-lang/rust-bindgen
Pull request #2928 (2024-09-07 12:03:59)

Stabilize `--wrap-static-fns`
Fixes https://github.com/rust-lang/rust-bindgen/issues/2900



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 69e76399..cfecc5ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -216,6 +216,7 @@
 # Unreleased
 ## Added
 ## Changed
+- The `--wrap-static-fns` related options no longer require the experimental feature or flag.
 ## Removed
 ## Fixed
 - Use the right characters for newlines on windows.
diff --git a/bindgen-cli/options.rs b/bindgen-cli/options.rs
index 5311d87a..ad96664b 100644
--- a/bindgen-cli/options.rs
+++ b/bindgen-cli/options.rs
@@ -476,15 +476,15 @@ struct BindgenCommand {
     #[arg(long, value_name = "CUSTOM", value_parser = parse_custom_attribute)]
     with_attribute_custom_union: Vec<(Vec<String>, String)>,
     /// Generate wrappers for `static` and `static inline` functions.
-    #[arg(long, requires = "experimental")]
+    #[arg(long)]
     wrap_static_fns: bool,
     /// Sets the PATH for the source file that must be created due to the presence of `static` and
     /// `static inline` functions.
-    #[arg(long, requires = "experimental", value_name = "PATH")]
+    #[arg(long, value_name = "PATH")]
     wrap_static_fns_path: Option<PathBuf>,
     /// Sets the SUFFIX added to the extern wrapper functions generated for `static` and `static
     /// inline` functions.
-    #[arg(long, requires = "experimental", value_name = "SUFFIX")]
+    #[arg(long, value_name = "SUFFIX")]
     wrap_static_fns_suffix: Option<String>,
     /// Set the default VISIBILITY of fields, including bitfields and accessor methods for
     /// bitfields. This flag is ignored if the `--respect-cxx-access-specs` flag is used.
diff --git a/bindgen/options/mod.rs b/bindgen/options/mod.rs
index e4c03ecd..e9f4fb81 100644
--- a/bindgen/options/mod.rs
+++ b/bindgen/options/mod.rs
@@ -1419,10 +1419,8 @@ options! {
             /// Note that they will usually not work. However you can use `-fkeep-inline-functions`
             /// or `-fno-inline-functions` if you are responsible of compiling the library to make
             /// them callable.
-            #[cfg_attr(
-                feature = "experimental",
-                doc = "\nCheck the [`Builder::wrap_static_fns`] method for an alternative."
-            )]
+            ///
+            /// Check the [`Builder::wrap_static_fns`] method for an alternative.
             pub fn generate_inline_functions(mut self, doit: bool) -> Self {
                 self.options.generate_inline_functions = doit;
                 self
@@ -2021,7 +2019,6 @@ options! {
     /// Whether to generate wrappers for `static` functions.
     wrap_static_fns: bool {
         methods: {
-            #[cfg(feature = "experimental")]
             /// Set whether to generate wrappers for `static`` functions.
             ///
             /// Passing `true` to this method will generate a C source file with non-`static`
@@ -2040,7 +2037,6 @@ options! {
     /// The suffix to be added to the function wrappers for `static` functions.
     wrap_static_fns_suffix: Option<String> {
         methods: {
-            #[cfg(feature = "experimental")]
             /// Set the suffix added to the wrappers for `static` functions.
             ///
             /// This option only comes into effect if `true` is passed to the
@@ -2057,7 +2053,6 @@ options! {
     /// The path of the file where the wrappers for `static` functions will be emitted.
     wrap_static_fns_path: Option<PathBuf> {
         methods: {
-            #[cfg(feature = "experimental")]
             /// Set the path for the source code file that would be created if any wrapper
             /// functions must be generated due to the presence of `static` functions.
             ///


Test patch:
diff --git a/bindgen-tests/tests/headers/wrap-static-fns.h b/bindgen-tests/tests/headers/wrap-static-fns.h
index 2be7bd93..5cd3d41a 100644
--- a/bindgen-tests/tests/headers/wrap-static-fns.h
+++ b/bindgen-tests/tests/headers/wrap-static-fns.h
@@ -1,4 +1,4 @@
-// bindgen-flags: --experimental --wrap-static-fns
+// bindgen-flags: --wrap-static-fns
 // bindgen-parse-callbacks: wrap-as-variadic-fn
 
 // to avoid polluting the expectation tests we put the stdarg.h behind a conditional