fzyzcjy / flutter_rust_bridge

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

[Bug] bump proc-macro2 #1301

Closed gutenfries closed 1 year ago

gutenfries commented 1 year ago

Describe the bug

I recently downloaded a project from git to start hacking away at it again and after some basic version upgrading, finding out what versions play well with each other, etc, this issue kept popping up.

FRB will build all the generated files without error, but when I attempt to run my code (via flutter run -d linux) it gives me the following error:

flutter run -d linux  
Launching lib/main.dart on Linux in debug mode...
error[E0635]: unknown feature `proc_macro_span_shrink`
  --> /home/gutenfries/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.52/src/lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0635`.
error: could not compile `proc-macro2` (lib) due to previous error
error: failed to compile `corrosion-generator v0.1.0 (/home/gutenfries/Desktop/playback/client/build/linux/x64/debug/_deps/corrosion-src/generator)`, intermediate artifacts can be found at `/home/gutenfries/Desktop/playback/client/build/linux/x64/debug/_deps/corrosion-src/generator/target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
CMake Error at /home/gutenfries/Desktop/playback/client/build/linux/x64/debug/_deps/corrosion-src/cmake/Corrosion.cmake:594 (message):
  Building CMake Generator for Corrosion - failed
Call Stack (most recent call first):
  /home/gutenfries/Desktop/playback/client/build/linux/x64/debug/_deps/corrosion-src/CMakeLists.txt:73 (include)

Building Linux application...                                           
Exception: Unable to generate build files

upon doing some more research (using google lol), I've found that this is an issue with proc-macro

Basically, the Rust team pushed some changes to prod, and the proc-macro2 folks haven't been able to make the necessary changes to their codebase at the time of the release. (see https://github.com/rust-lang/rust/issues/113152 for more details)

This presents a breaking bug for FRB, as anyone with >= nightly-2023-06-28 installed will run into the same (breaking) issue.

Proposed fix(es):

the issue has recently (quite literally since I started typing this up lol) been resolved within proc-macro2, and versions >=1.0.60 appropriately address this. (see https://github.com/dtolnay/proc-macro2/pull/391 for additional context.)

simply bumping this ASAP should be adequate to address this.

Codegen logs with RUST_LOG=debug environment variable

N/A

To Reproduce

run flutter run in a FRB project with rust version nightly-2023-06-28 or newer

Expected behavior

No response

Generated binding code

No response

OS

Zorin OS (highly modified XFCE Ubuntu LTS)

Version of flutter_rust_bridge_codegen

flutter_rust_bridge_codegen 1.79.0

Flutter info

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.6, on Zorin OS 16.3 5.15.0-78-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.80.2)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!

Version of clang++

clang version 10.0.0-4ubuntu1

Version of ffigen

8.0.2

Additional context

No response

fzyzcjy commented 1 year ago

Looks quite reasonable, feel free to PR to bump that version!

gutenfries commented 1 year ago

@fzyzcjy Apologies for the dead ping (we've been seeing each other quite a bit in issues/PRs recently, yes lol?)

This exact same bug popped up in https://github.com/corrosion-rs/corrosion.git.

No big deal, I have a PR open on corrosion (https://github.com/corrosion-rs/corrosion/pull/429).

Just wanted you to be aware of this, as it will still affect FRB.

fzyzcjy commented 1 year ago

No worries!

as it will still affect FRB

Not very sure, do you mean it affects FRB for the people who are using corrosion? Get it, I will be aware of that

gutenfries commented 1 year ago

To my latest knowledge, corrosion is a (CMake) requirement for users to use FRB with flutter.

github-actions[bot] commented 1 year 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.