fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.

Home Page:https://fzyzcjy.github.io/flutter_rust_bridge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generated code is breaking `cargo test` because of its doc-test contains a moved import

CaviarChen opened this issue · comments

Describe the bug

flutter_rust_bridge::frb_generated_boilerplate! contains a doc test which is breaking since > 2.0.0-dev.18.

Steps to reproduce

  1. See CaviarChen@5c94600 All I did is add "lib" to crate-type so one could run cargo test.
  2. run cargo test
  3. you get:
running 1 test
error[E0412]: cannot find type `RustOpaque` in this scope
  --> src/frb_generated.rs:47:29
   |
7  | pub struct DebugWrapper(pub RustOpaque<Box<dyn Debug>>);
   |                             ^^^^^^^^^^ help: a struct with a similar name exists: `DartOpaque`
   |
  ::: ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge-2.0.0-dev.21/src/dart_opaque/mod.rs:30:1
   |
30 | pub struct DartOpaque {
   | --------------------- similarly named struct `DartOpaque` defined here

error[E0412]: cannot find type `RustOpaque` in this scope
  --> src/frb_generated.rs:52:30
   |
12 | pub struct DebugWrapper2(pub RustOpaque<Box<dyn Debug + Send + Sync + UnwindSafe + RefUnwindSafe>>);
   |                              ^^^^^^^^^^ help: a struct with a similar name exists: `DartOpaque`
   |
  ::: ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge-2.0.0-dev.21/src/dart_opaque/mod.rs:30:1
   |
30 | pub struct DartOpaque {
   |

Logs

n/a

Expected behavior

No response

Generated binding code

No response

OS

No response

Version of flutter_rust_bridge_codegen

2.0.0-dev.21

Flutter info

No response

Version of clang++

No response

Additional context

No response

Looks like a bug, I will remove the doc test, but instead point to the doc, to be more consistent with all other parts of frb.

Amazing! Thank you for such a fast response. (You should consider turning on GitHub Sponsors)

You are welcome and thank you for the suggestions!