Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build breaks with v0.24.6 #841

Closed
tronical opened this issue May 31, 2023 · 5 comments
Closed

Build breaks with v0.24.6 #841

tronical opened this issue May 31, 2023 · 5 comments

Comments

@tronical
Copy link

PR #820 changed the config struct in a way that breaks existing code:

@@ -1003,6 +1003,8 @@ pub struct Config {
     pub only_target_dependencies: bool,
     /// Configuration options specific to Cython.
     pub cython: CythonConfig,
+    #[serde(skip)]
+    pub(crate) config_path: Option<StdPathBuf>,
 }

 impl Default for Config {

Our code initialises Config not via ::default() but like this:

cbindgen::Config {
        pragma_once: true,
        include_version: true,
        // some more fields here
        ..Default::default()
    }

and that causes

error[E0451]: field `config_path` of struct `Config` is private
  --> api/cpp/cbindgen.rs:83:11
   |
83 |         ..Default::default()
   |           ^^^^^^^^^^^^^^^^^^ field `config_path` is private

I can work around this of course by using Config::default(), but unfortunately the crate release with this change breaks our existing crate on crates.io that relies on this :-(

tronical added a commit to slint-ui/slint that referenced this issue May 31, 2023
Unfortunately the latest cbindgen release added private field to a
public struct, breaking our build. Work around this until
mozilla/cbindgen#841 is fixed.
@konsti219
Copy link

konsti219 commented May 31, 2023

Same issue here trying to build https://github.com/fzyzcjy/flutter_rust_bridge .
The change in that PR is actually a breaking change but was shipped in a patch version.

https://github.com/rust-lang/rfcs/blob/master/text/1105-api-evolution.md

Major change: adding a private field when all current fields are public.

@konsti219
Copy link

@emilio This seems quite urgent.

@emilio
Copy link
Collaborator

emilio commented Jun 1, 2023

Yep, thanks. Yanked 0.24.6. Sorry for not catching that during review. Will publish 0.25 later this week. Let me know if a 0.24.7 with that change reverted would make someone's life easier.

@emilio emilio closed this as completed Jun 1, 2023
@tronical
Copy link
Author

tronical commented Jun 1, 2023

Thanks for the quick reaction and fix!

jschwe added a commit to jschwe/cbindgen that referenced this issue Jun 5, 2023
This will fail creating a new github release, if the semver
action fails.
This would have caught mozilla#841.
jschwe added a commit to jschwe/cbindgen that referenced this issue Jun 5, 2023
This will fail creating a new github release, if the semver
action fails.
This would have caught mozilla#841.
emilio pushed a commit that referenced this issue Aug 25, 2023
This will fail creating a new github release, if the semver
action fails.
This would have caught #841.
fornwall added a commit to fornwall/advent-of-code that referenced this issue Aug 30, 2023
@sporksmith
Copy link

I'm confused - it looks like this is still broken (or maybe broken again)? I guess based on the CHANGELOG it was decided to keep this breaking change?

80526e7

  • Breaking changes: The Config struct now has a private member.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants