wasm-tools
wasm-tools copied to clipboard
wasmparser: `for_each_operator!` assumes specific name of the lifetime
for_each_operator!
generates BrTable<'a>
as an argument for one of the visitors. This in essence depends on the trait definition to specify 'a
as the lifetime generic and implement specifically VisitOperator<'a>
. Ideally macro could figure out and implicitly use the right lifetime without requiring the user to specify 'a
specifically.
I tried a couple of things to remove this not-super-hygienic ambient-authority kinda thing:
- Generate
BrTable<'_>
instead – rustc wants to see'a
there; - Add
type BrTable = wasmparser::BrTable<'a>
to the trait declaration and pass<Self as VisitOperand>::BrTable
– associated type defaults are unstable.
Didn’t spend any time thinking if there are other approaches we could take here.