bytecodealliance / bytecodealliance/wasm-tools

wasmparser: `for_each_operator!` assumes specific name of the lifetime

Open
#814 0 comments 0 reactions 0 assignees View on GitHub
wasmparser
Dominant language
Rust
Stars
1.8k
Forks
351
Avg merge
16h 57m
Merged PRs (30d)
38

Description

`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:

1. Generate `BrTable<'_>` instead – rustc wants to see `'a` there;
2. Add `type BrTable = wasmparser::BrTable<'a>` to the trait declaration and pass `::BrTable` – associated type defaults are unstable.

Didn’t spend any time thinking if there are other approaches we could take here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.