futursolo / stylist-rs

A CSS-in-Rust styling solution for WebAssembly Applications
https://crates.io/crates/stylist
MIT License
366 stars 22 forks source link

Importing `JsValue` in a `proc_macro` causes a compilation error on recent nightly's #120

Closed finnbear closed 1 year ago

finnbear commented 1 year ago

Thanks for the crate! I noticed a regression on recent Rust nightly's that causes a linker error when using stylist.

I'll work on a PR to see if JsValue can be removed for proc_macro purposes.

futursolo commented 1 year ago

Is this a duplicate of #114?

finnbear commented 1 year ago

Is this a duplicate of #114?

Almost certainly yes!

futursolo commented 1 year ago

I have submitted a pull request awaiting code review from @WorldSEnder.

Until this is mitigated from stylist, there is a comment in the compiler regression issue about how to mitigate the impact by switching the linker to lld until Rust compiler is fixed.

vaassi commented 1 year ago

solution with lld doesn't work for me but adding this in Cargo.toml with rust 1.70 helps me to solve this issue

[profile.dev.package.wasm-bindgen] debug-assertions = false

rambip commented 1 year ago

Same error here, I can't compile stylist. Im on rust 1.70

rambip commented 1 year ago

After going back to rust 1.69, I can confirm that it is a version issue (it worked with 1.69)

futursolo commented 1 year ago

Stylist v0.12.1 has been released, which should also mitigate this issue from within stylist. Affected users can run cargo update in their projects and it should pick up the new version automatically.

futursolo commented 9 months ago

This current workaround has a couple requirements:

  1. For single crate applications, you need to use edition 2021.
  2. For applications inside a workspace, you need to enable cargo resolver 2. (See #129)

In addition, since Rust 1.72 has fixed this regression and this workaround is no longer needed, I do plan to remove the workaround.

The current plan is once 1.72 has been released for 6 months, we bump the MSRV requirement to 1.72 to avoid this regression and remove the workaround.