bytecodealliance / bytecodealliance/wit-bindgen
[Rust] See through type aliases for borrowing optimizations
- Lingua principale
- Rust
- Stelle
- 1.5k
- Fork
- 288
- Merge medio
- 6h 32m
- PR unite (30g)
- 19
Descrizione
As noted in https://github.com/bytecodealliance/wit-bindgen/issues/769 and https://github.com/bytecodealliance/wit-bindgen/pull/675, type aliases cause certain optimizations around borrowing to not longer be applied.
For example take the following semantically equivalent functions in wit:
```wit
borrow: func(param: list);
type param = list;
no-borrow: func(param: param);
```
Those functions will be generated as the following:
```rust
fn borrow(param: &[u8]);
type Param = Vec;
fn no_borrow(param: Param);
```
Unfortunately, we want to preserve the structure of the wit files in the generated code meaning that generating the `no_borrow` function with a `&[u8]` param instead of the `Param` alias would violate that tenant. It is unclear which should take precedent, the borrowing optimization or the desire to maintain wit structure.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Start by reviewing the linked issue 769 and pull request 675, then trace where type aliases and borrowing optimizations are handled in the binding generator. The issue does not name files or tests; completion requires an agreed choice between preserving WIT structure and applying borrowing optimization, followed by corresponding coverage.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100