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

Fix compile when install the newest version #1232

Closed
wants to merge 1 commit into from

Conversation

PonyPC
Copy link

@PonyPC PonyPC commented May 31, 2023

cargo install flutter_rust_bridge_codegen v1.77.1

   Compiling flutter_rust_bridge_codegen v1.77.1
error[E0451]: field `config_path` of struct `Config` is private
   |
99 |         ..Default::default()
   |           ^^^^^^^^^^^^^^^^^^ field `config_path` is private

For more information about this error, try `rustc --explain E0451`.
error: could not compile `flutter_rust_bridge_codegen` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `flutter_rust_bridge_codegen v1.77.1`, intermediate artifacts can be found at

cargo install flutter_rust_bridge_codegen v1.77.1
```
   Compiling flutter_rust_bridge_codegen v1.77.1
error[E0451]: field `config_path` of struct `Config` is private
   |
99 |         ..Default::default()
   |           ^^^^^^^^^^^^^^^^^^ field `config_path` is private

For more information about this error, try `rustc --explain E0451`.
error: could not compile `flutter_rust_bridge_codegen` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `flutter_rust_bridge_codegen v1.77.1`, intermediate artifacts can be found at
```
@welcome
Copy link

welcome bot commented May 31, 2023

Hi! Thanks for opening this pull request! 😄

@fzyzcjy
Copy link
Owner

fzyzcjy commented May 31, 2023

Seem related: mozilla/cbindgen#841

@fzyzcjy
Copy link
Owner

fzyzcjy commented May 31, 2023

LGTM after CI is green! More specifically, only need to worry about Rust linter, as the other two are flaky and known problems.

@fzyzcjy
Copy link
Owner

fzyzcjy commented May 31, 2023

Hmm, for this linter error, I guess we can suppress it there, since it is a false positive.

error: field assignment outside of initializer for an instance created with Default::default()
  --> frb_codegen/src/commands.rs:81:5
   |
81 |     config.language = cbindgen::Language::C;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: consider initializing the variable with `cbindgen::Config { language: cbindgen::Language::C, sys_includes: vec![
              "stdbool.h".to_string(),
              "stdint.h".to_string(),
              "stdlib.h".to_string(),
          ], no_includes: true, after_includes: Some("typedef struct _Dart_Handle* Dart_Handle;".to_owned()), export: cbindgen::ExportConfig {
              include: c_struct_names
                  .iter()
                  .map(|name| format!("\"{name}\""))
                  .collect(),
              exclude: exclude_symbols,
              ..Default::default()
          }, ..Default::default() }` and removing relevant reassignments
  --> frb_codegen/src/commands.rs:80:5
   |
80 |     let mut config = cbindgen::Config::default();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
   = note: `-D clippy::field-reassign-with-default` implied by `-D warnings`

@konsti219
Copy link

I think the better solution to this problem would be locking cbindgen at 0.24.5 while they work on fixing the broken crate version.

@w-ensink
Copy link
Contributor

w-ensink commented Jun 1, 2023

Mozilla fixed it. Build is working again.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jun 1, 2023

Mozilla fixed it. Build is working again.

So... shall I close the PR?

@w-ensink
Copy link
Contributor

w-ensink commented Jun 1, 2023

So... shall I close the PR?

I don't think you should merge this one, as it only adds a couple extra useless assignments and it doesn't really add any functionality. But it's totally up to you :-)
The problem is solved either way.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jun 1, 2023

I checked a bit about the mozilla issue. Seems that I should keep it open and see what happens to the next breaking version of cbindgen. If that version still contains this breaking change, then we will need to eventually do this change I guess.

@stale
Copy link

stale bot commented Jul 31, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jul 31, 2023
@stale stale bot closed this Aug 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants