about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-08-18 19:54:56 +0200
committerGitHub <noreply@github.com>2021-08-18 19:54:56 +0200
commit627bc60702395b0527c4c89888ad2eabfa3e3fd4 (patch)
treef1a4d6d0180d59f4d8376059f8e8a4c47bbbe39c /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent7449c6edf93d8d68cdaf48252e219c015e42c97e (diff)
parent35de5c9b35be9feef992c3d03ed95a7176a15726 (diff)
downloadrust-627bc60702395b0527c4c89888ad2eabfa3e3fd4.tar.gz
rust-627bc60702395b0527c4c89888ad2eabfa3e3fd4.zip
Rollup merge of #88012 - sunfishcode:sunfishcode/wasi-raw-fd-c-int, r=alexcrichton
Change WASI's `RawFd` from `u32` to `c_int` (`i32`).

WASI previously used `u32` as its `RawFd` type, since its "file descriptors"
are unsigned table indices, and there's no fundamental reason why WASI can't
have more than 2^31 handles.

However, this creates myriad little incompability problems with code
that also supports Unix platforms, where `RawFd` is `c_int`. While WASI
isn't a Unix, it often shares code with Unix, and this difference made
such shared code inconvenient. #87329 is the most recent example of such
code.

So, switch WASI to use `c_int`, which is `i32`. This will mean that code
intending to support WASI should ideally avoid assuming that negative file
descriptors are invalid, even though POSIX itself says that file descriptors
are never negative.

This is a breaking change, but `RawFd` is considerd an experimental
feature in [the documentation].

[the documentation]: https://doc.rust-lang.org/stable/std/os/wasi/io/type.RawFd.html

r? `@alexcrichton`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions