watt icon indicating copy to clipboard operation
watt copied to clipboard

Demo build failing + Example module decode error

Open wbrickner opened this issue 1 year ago • 0 comments

Would love to write macros using watt, it's very exciting. Can't get anything to work unfortunately, following the demo or the example pattern in the readme.

Demo broken

watt/demo/impl on  master is 📦 v0.0.0 via 🦀 v1.75.0 
❯ cargo build --release --target wasm32-unknown-unknown
    Updating crates.io index
   Compiling proc-macro2 v1.0.75 (/Users/wbrickner/Downloads/watt/proc-macro)
   Compiling unicode-ident v1.0.12
   Compiling quote v1.0.35
   Compiling syn v2.0.48
error[E0277]: `proc_macro2::LexError` doesn't implement `std::fmt::Display`
   --> /Users/wbrickner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.48/src/error.rs:407:32
    |
407 |         Error::new(err.span(), err)
    |         ----------             ^^^ `proc_macro2::LexError` cannot be formatted with the default formatter
    |         |
    |         required by a bound introduced by this call
    |
    = help: the trait `std::fmt::Display` is not implemented for `proc_macro2::LexError`
    = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
note: required by a bound in `error::Error::new`
   --> /Users/wbrickner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.48/src/error.rs:158:19
    |
158 |     pub fn new<T: Display>(span: Span, message: T) -> Self {
    |                   ^^^^^^^ required by this bound in `Error::new`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `syn` (lib) due to previous error

Example Code

Following the guide in the readme exactly, I get the wasm to build, but then at the invocation site of the shim (my_macro!()) I get a panic with a module decode error. This originates in the shim, on WasmMacro::new.

ts_test on  master [?] is 📦 v0.1.0 via 🦀 v1.75.0 
❯ cargo check
   Compiling type_set v0.1.0 (/Users/wbrickner/Documents/Projects/type_set/new/type_set)
    Checking ts_test v0.1.0 (/Users/wbrickner/Documents/Projects/type_set/new/ts_test)
error: proc macro panicked
 --> src/main.rs:3:1
  |
3 | the_macro!();
  | ^^^^^^^^^^^^
  |
  = help: message: called `Result::unwrap()` on an `Err` value: DecodeModuleFailed

error: could not compile `ts_test` (bin "ts_test") due to previous error

Thank for all the work you guys are doing for the ecosystem, it's amazing!

wbrickner avatar Jan 15 '24 21:01 wbrickner