Skip to content

Commit

Permalink
Fix ..Default::default() for struct Config
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jschwe authored and emilio committed Feb 6, 2024
1 parent 6bfc217 commit c9c90bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# unreleased

* Revert: The `Config` struct now has a private member.

# 0.26.0

* Fix swapping of `>>=` and `<<=` in constants.
Expand Down
9 changes: 8 additions & 1 deletion src/bindgen/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<StdPathBuf>,
/// 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<StdPathBuf>,
}

impl Default for Config {
Expand Down

0 comments on commit c9c90bf

Please sign in to comment.