dtolnay / dtolnay/watt

Demo build failing + Example module decode error

Open
#54 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.5k
Forks
31
PR merge metrics
No merged PRs in 30d

Description

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(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!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the two failures: run `cargo build --release --target wasm32-unknown-unknown` in `watt/demo/impl`, then follow the README example through the shim's `WasmMacro::new`. Check the reported dependency compilation error and the module decode failure; done means the demo builds and the example macro invocation completes without `DecodeModuleFailed`.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.