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

frb macro causing compilation error #2493

Open
GregoryConrad opened this issue Jan 11, 2025 · 2 comments
Open

frb macro causing compilation error #2493

GregoryConrad opened this issue Jan 11, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@GregoryConrad
Copy link
Contributor

GregoryConrad commented Jan 11, 2025

Describe the bug

Had a new compilation error pop up in my CI yesterday. Guessing it's due to the new stable Rust release.

Steps to reproduce

Use the frb macro.

Logs

error: unexpected `cfg` condition name: `frb_expand`
  --> packages/mimir/native/src/api.rs:62:1
   |
62 | #[frb(dart_metadata=("freezed"))]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = 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: `-D unexpected-cfgs` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]`
   = note: this error originates in the attribute macro `frb` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unexpected `cfg` condition name: `frb_expand`
  --> packages/mimir/native/src/api.rs:70:1
   |
70 | #[frb(dart_metadata=("freezed"))]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = 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: this error originates in the attribute macro `frb` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unexpected `cfg` condition name: `frb_expand`
   --> packages/mimir/native/src/api.rs:207:5
    |
207 |     #[frb(ignore)]
    |     ^^^^^^^^^^^^^^
    |
    = 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: this error originates in the attribute macro `frb` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unexpected `cfg` condition name: `frb_expand`
   --> packages/mimir/native/src/api.rs:218:5
    |
218 |     #[frb(ignore)]
    |     ^^^^^^^^^^^^^^
    |
    = 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: this error originates in the attribute macro `frb` (in Nightly builds, run with -Z macro-backtrace for more info)
@GregoryConrad GregoryConrad added the bug Something isn't working label Jan 11, 2025
@GregoryConrad
Copy link
Contributor Author

Can be silenced with (in Cargo.toml):

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

But is there any fix that can be done on FRB side?

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jan 11, 2025

I quickly glanced it before and it seemed not trivial: #2425 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants