From c9c90bf6610de037cf8e0114deff97d7f43e3ef5 Mon Sep 17 00:00:00 2001 From: Jonathan Schwender Date: Wed, 27 Dec 2023 11:04:01 +0100 Subject: [PATCH] Fix `..Default::default()` for struct `Config` Previously the `depfile` option added a new private member to the `Config` struct - a breaking change which many users complained about. Making the field public, but hiding it from the documentation and excluding it from `serde` reverts the breakage, while keeping the depfile functionality. --- CHANGES | 4 ++++ src/bindgen/config.rs | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index c81b81e09..cb56b372f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +# unreleased + + * Revert: The `Config` struct now has a private member. + # 0.26.0 * Fix swapping of `>>=` and `<<=` in constants. diff --git a/src/bindgen/config.rs b/src/bindgen/config.rs index 5012414b7..a976d1d26 100644 --- a/src/bindgen/config.rs +++ b/src/bindgen/config.rs @@ -1010,8 +1010,15 @@ pub struct Config { pub only_target_dependencies: bool, /// Configuration options specific to Cython. pub cython: CythonConfig, + #[doc(hidden)] #[serde(skip)] - pub(crate) config_path: Option, + /// Internal field for tracking from which file the config was loaded. + /// + /// Users should not set this field explicitly. Making the field private + /// prevents users from filling the struct with `..Default::default()`, + /// and creating a new InternalConfig struct would require more breaking + /// changes to our public API. + pub config_path: Option, } impl Default for Config {