fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.
https://fzyzcjy.github.io/flutter_rust_bridge/
MIT License
3.64k stars 256 forks source link

update version 2.0.0-dev.19 to 2.0.0-dev.28, this error has occurred when I run my rust unit test:flutter_rust_bridge::frb_generated_boilerplate!(); missing tokens in macro arguments #1823

Closed sdegongzuo closed 2 weeks ago

sdegongzuo commented 2 months ago

Describe the bug update version 2.0.0-dev.19 to 2.0.0-dev.28, run command _flutter_rust_bridgecodegen generate this error has occurred when I run my rust unit test:

error: unexpected end of macro invocation
  --> src/frb_generated.rs:27:1
   |
27 | flutter_rust_bridge::frb_generated_boilerplate!();
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments
   |
note: while trying to match `default_stream_sink_codec`
  --> /Users/y/.cargo/registry/src/rsproxy.cn-0dccff568467c15b/flutter_rust_bridge-2.0.0-dev.28/src/for_generated/boilerplate.rs:7:9
   |
7  |         default_stream_sink_codec = $default_stream_sink_codec:ident,
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0425]: cannot find value `FLUTTER_RUST_BRIDGE_CODEGEN_VERSION` in this scope
  --> src/frb_generated.rs:31:1
   |
31 | flutter_rust_bridge::frb_generated_default_handler!();
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
   |
   = note: this error originates in the macro `flutter_rust_bridge::frb_generated_default_handler` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0405]: cannot find trait `CstDecode` in this scope
  --> src/frb_generated.rs:37:16
   |
37 |     path: impl CstDecode<String> + core::panic::UnwindSafe,
   |                ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `CstDecode` in this scope
  --> src/frb_generated.rs:57:18
   |
57 |     number: impl CstDecode<i32> + core::panic::UnwindSafe,
   |                  ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `CstDecode` in this scope
  --> src/frb_generated.rs:77:16
   |
77 |     name: impl CstDecode<String> + core::panic::UnwindSafe,
   |                ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `CstDecode` in this scope
  --> src/frb_generated.rs:98:6
   |
98 | impl CstDecode<bool> for bool {
   |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `CstDecode` in this scope
   --> src/frb_generated.rs:103:6
    |
103 | impl CstDecode<i32> for i32 {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `CstDecode` in this scope
   --> src/frb_generated.rs:108:6
    |
108 | impl CstDecode<u8> for u8 {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseDecode` in this scope
   --> src/frb_generated.rs:113:6
    |
113 | impl SseDecode for String {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseDecode` in this scope
   --> src/frb_generated.rs:120:6
    |
120 | impl SseDecode for bool {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseDecode` in this scope
   --> src/frb_generated.rs:126:6
    |
126 | impl SseDecode for i32 {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseDecode` in this scope
   --> src/frb_generated.rs:132:6
    |
132 | impl SseDecode for Vec<u8> {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseDecode` in this scope
   --> src/frb_generated.rs:143:6
    |
143 | impl SseDecode for u8 {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseDecode` in this scope
   --> src/frb_generated.rs:149:6
    |
149 | impl SseDecode for () {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseEncode` in this scope
   --> src/frb_generated.rs:155:6
    |
155 | impl SseEncode for String {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseEncode` in this scope
   --> src/frb_generated.rs:161:6
    |
161 | impl SseEncode for bool {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseEncode` in this scope
   --> src/frb_generated.rs:167:6
    |
167 | impl SseEncode for i32 {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseEncode` in this scope
   --> src/frb_generated.rs:173:6
    |
173 | impl SseEncode for Vec<u8> {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseEncode` in this scope
   --> src/frb_generated.rs:182:6
    |
182 | impl SseEncode for u8 {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `SseEncode` in this scope
   --> src/frb_generated.rs:188:6
    |
188 | impl SseEncode for () {
    |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `CstDecode` in this scope
  --> src/frb_generated.io.rs:13:6
   |
13 | impl CstDecode<String> for *mut wire_cst_list_prim_u_8 {
   |      ^^^^^^^^^ not found in this scope

error[E0405]: cannot find trait `CstDecode` in this scope
  --> src/frb_generated.io.rs:19:6
   |
19 | impl CstDecode<Vec<u8>> for *mut wire_cst_list_prim_u_8 {
   |      ^^^^^^^^^ not found in this scope

To Reproduce Steps to reproduce the behavior: update version 2.0.0-dev.19 to 2.0.0-dev.28, this error has occurred when I run my rust unit test

Expected behavior A clear and concise description of what you expected to happen. Run normally after upgrading the version

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

welcome[bot] commented 2 months ago

Hi! Thanks for opening your first issue here! :smile:

fzyzcjy commented 2 months ago

Hi, do you mean fzyzcjy/flutter_rust_bridge instead of fzyzcjy/flutter_smooth?

sdegongzuo commented 2 months ago

sorry, i mean flutter_rust_bridge

Hi, do you mean fzyzcjy/flutter_rust_bridge instead of fzyzcjy/flutter_smooth?

welcome[bot] commented 2 months ago

Hi! Thanks for opening your first issue here! :smile:

fzyzcjy commented 2 months ago

Hi, could you please check whether your Cargo.toml shows correct flutter_rust_bridge version (or paste it here)?

sdegongzuo commented 2 months ago
[package]
name = "rust_lib"
version = "0.1.0"
edition = "2018"

[lib]
crate-type = ["cdylib", "staticlib"]

[dependencies]
flutter_rust_bridge = "=2.0.0-dev.28"

flutter_rust_bridge

sdegongzuo commented 2 months ago

this version is normal [package] name = "rust_lib" version = "0.1.0" edition = "2018"

[lib] crate-type = ["cdylib", "staticlib"]

[dependencies] flutter_rust_bridge = "=2.0.0-dev.19"

fzyzcjy commented 2 months ago

[dependencies] flutter_rust_bridge = "=2.0.0-dev.19"

Looks like this is old. Could you please modify it to be .28 and see whether it works?

lazykern commented 2 months ago

I faced the same issue after running my project in Windows, but after I updated flutter_rust_bridge_codegen to the latest version or the same version as in Cargo.toml, my project seems to be running perfectly.

cargo install 'flutter_rust_bridge_codegen@^2.0.0-dev.28'
sdegongzuo commented 2 months ago

I faced the same issue after running my project in Windows, but after I updated flutter_rust_bridge_codegen to the latest version or the same version as in Cargo.toml, my project seems to be running perfectly.

cargo install 'flutter_rust_bridge_codegen@^2.0.0-dev.28'

your flutter version?

lazykern commented 2 months ago

your flutter version?

3.19.3

sdegongzuo commented 1 month ago

I have upgraded the versions of Flutter and _flutter_rust_bridgecodegen to the latest version and they are running normally

fzyzcjy commented 2 weeks ago

Close since this seems to work. Feel free to reopen if having any issues!

github-actions[bot] commented 3 days ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.