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

warnings when compiling against the latest nightly 1.85.0 #2425

Open
uditrugman opened this issue Nov 25, 2024 · 5 comments
Open

warnings when compiling against the latest nightly 1.85.0 #2425

uditrugman opened this issue Nov 25, 2024 · 5 comments
Labels
awaiting Waiting for responses, PR, further discussions, upstream release, etc bug Something isn't working

Comments

@uditrugman
Copy link

Describe the bug

there are warnings when compiling with the latest rust nightly version 1.85.0:

warning: unexpected `cfg` condition name: `frb_expand`
 --> rust_lib/src/api/commons/commons_di.rs:4:1
  |
4 | #[frb(opaque)]
  | ^^^^^^^^^^^^^^
  |
  = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
  = help: consider using a Cargo feature instead
  = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
           [lints.rust]
           unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }
  = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(frb_expand)");` to the top of the `build.rs`
  = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
  = note: `#[warn(unexpected_cfgs)]` on by default
  = note: this warning originates in the attribute macro `frb` (in Nightly builds, run with -Z macro-backtrace for more info)

Steps to reproduce

Hint: A simple way to reproduce is to clone and modify the https://github.com/fzyzcjy/flutter_rust_bridge/tree/master/frb_example/dart_minimal example package according to your needs.

  1. ...
  2. ...
  3. ...

Logs

warning: unexpected `cfg` condition name: `frb_expand`
 --> rust_lib/src/api/commons/commons_di.rs:4:1
  |
4 | #[frb(opaque)]
  | ^^^^^^^^^^^^^^
  |
  = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
  = help: consider using a Cargo feature instead
  = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
           [lints.rust]
           unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }
  = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(frb_expand)");` to the top of the `build.rs`
  = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
  = note: `#[warn(unexpected_cfgs)]` on by default
  = note: this warning originates in the attribute macro `frb` (in Nightly builds, run with -Z macro-backtrace for more info)


### Expected behavior

_No response_

### Generated binding code

_No response_

### OS

_No response_

### Version of `flutter_rust_bridge_codegen`

_No response_

### Flutter info

_No response_

### Version of `clang++`

_No response_

### Additional context

_No response_
@uditrugman uditrugman added the bug Something isn't working label Nov 25, 2024
@fzyzcjy
Copy link
Owner

fzyzcjy commented Nov 25, 2024

Hi, could you please show rust_lib/src/api/commons/commons_di.rs (especially code around that warning line)?

@fzyzcjy fzyzcjy added the awaiting Waiting for responses, PR, further discussions, upstream release, etc label Nov 25, 2024
@uditrugman
Copy link
Author

just normal frb structure :

#[frb(opaque)]
pub struct FrbCommonsDI(Arc<crate::commons::commons_di::CommonsDI>);

my workaround was to add the below to my Cargo.toml

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }

but the correct solution, i think, is to add "frb_expand" to the list of features of frb_rust.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Nov 25, 2024

but the correct solution, i think, is to add "frb_expand" to the list of features of frb_rust.

Looks reasonable and feel free to PR for this! (since this does not look to be super hard)

@uditrugman
Copy link
Author

but the correct solution, i think, is to add "frb_expand" to the list of features of frb_rust.

Looks reasonable and feel free to PR for this! (since this does not look to be super hard)

I tried, but it appears to be more complicated than this

@fzyzcjy
Copy link
Owner

fzyzcjy commented Nov 26, 2024

No worries, then I will take a look at the next batch (may not be very fast since this is a linter warning instead of a real bug or error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting Waiting for responses, PR, further discussions, upstream release, etc bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants