bytecodealliance / wasi-rs

Experimental WASI API bindings for Rust
Apache License 2.0
271 stars 48 forks source link

Generate lifetime parameter explicitly for aliased PointerLengthPair #51

Closed kawamuray closed 4 years ago

kawamuray commented 4 years ago

This PR makes tiny improvement for the generated src/lib_generated.rs from witx. Currently generated code lacks explicit lifetime parameter when an aliased type is referred as an argument, which is encouraged to put explicitly in Rust 2018.

In fact these optional warnings prevents me from compiling rust-lang/rust with pointing wasi dependency to my local copy by following errors.

error: hidden lifetime parameters in types are deprecated
   --> /Users/masked/wasi/src/lib_generated.rs:958:38
    |
958 | pub unsafe fn fd_pread(fd: Fd, iovs: IovecArray, offset: Filesize) -> Result<Size> {
    |                                      ^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>`
    |
    = note: `-D elided-lifetimes-in-paths` implied by `-D warnings`

error: hidden lifetime parameters in types are deprecated
    --> /Users/masked/wasi/src/lib_generated.rs:1009:39
     |
1009 | pub unsafe fn fd_pwrite(fd: Fd, iovs: CiovecArray, offset: Filesize) -> Result<Size> {
     |                                       ^^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>`

error: hidden lifetime parameters in types are deprecated
    --> /Users/masked/wasi/src/lib_generated.rs:1035:37
     |
1035 | pub unsafe fn fd_read(fd: Fd, iovs: IovecArray) -> Result<Size> {
     |                                     ^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>`
...