@Jakub Konka Do you know if there's a way to figure out where errors inside of proc macros are coming from?
I'm experimenting with some changes, and I have an error like this:
error[E0308]: mismatched types --> crates/wasi-common/src/wasi.rs:6:1 | 6 | / wiggle::from_witx!({ 7 | | witx: ["wig/WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx"], 8 | | ctx: WasiCtx, 9 | | }); | | ^ | | | | |___expected `usize`, found `i32` | in this macro invocation | help: you can convert an `i32` to `usize` and panic if the converted value wouldn't fit | 6 | wiggle::from_witx!({ 7 | witx: ["wig/WASI/phases/snapshot/witx/wasi_snapshot_preview1.witx"], 8 | ctx: WasiCtx, 9 | });.try_into().unwrap()
I can use cargo expand, but then I get the whole from_witx expansion and no indication of where the error is
And rustc's help message isn't so helpful here :o}
Yeah, currently tracking errors is pretty hard and messages don't tell anything meaningful at all. I'm not an expert in this but I guess in the future we should probably invest into some error tracking like in wasm-bindgen
(if at all possible).
All I can recommend right now is to use cargo expand
which is less than ideal
debugging proc macros is unfortunately very difficult :(
there are a lot of smaller test cases in the crates/wiggle/tests
directory, i would try to reproduce your error there
so that the expansion is a little smaller
Last updated: Dec 23 2024 at 13:07 UTC