Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d154185
I/O safety.
sunfishcode Jul 1, 2021
3a38511
Update library/std/src/os/unix/io/fd.rs
sunfishcode Jul 21, 2021
a23ca7c
Update library/std/src/os/windows/io/handle.rs
sunfishcode Jul 21, 2021
1c6bf04
Update library/std/src/os/windows/io/socket.rs
sunfishcode Jul 28, 2021
1f8a450
Add a test to ensure that RawFd is the size we assume it is.
sunfishcode Jul 27, 2021
6b4dbdb
Be more precise about `mmap` and undefined behavior.
sunfishcode Jul 27, 2021
31f7bf8
Add a comment about `OptionFileHandle`.
sunfishcode Jul 27, 2021
926344a
Add a comment about how `OwnedHandle` should not be used with registr…
sunfishcode Jul 28, 2021
45b5de3
Delete a spurious empty comment line.
sunfishcode Jul 28, 2021
0cb69de
Rename `OwnedFd`'s private field to match it's debug output.
sunfishcode Jul 28, 2021
6486f89
Add Owned*, Borrowed*, and As* to the preludes.
sunfishcode Jul 28, 2021
6d72117
Add Safety comments to the `As*` for `Owned*` implementations.
sunfishcode Jul 28, 2021
1b35f74
Reword the description of dup2/dup3.
sunfishcode Jul 28, 2021
68964a7
Fix copypasta of "Unix" within the WASI directory.
sunfishcode Jul 28, 2021
ab08639
Add comments about impls for File, TcpStream, ChildStdin, etc.
sunfishcode Jul 28, 2021
907f00b
Add more comments about the `INVALID_HANDLE_VALUE` situation.
sunfishcode Jul 28, 2021
71dab73
Synchronize minor differences between Unix and WASI implementations.
sunfishcode Jul 28, 2021
1dbd6d6
Factor out Unix and WASI fd code into a common module.
sunfishcode Jul 28, 2021
18a9f46
Don't encourage migration until io_safety is stablized.
sunfishcode Jul 28, 2021
1ae1eee
Rename OptionFileHandle to HandleOrInvalid and make it just wrap an O…
sunfishcode Jul 29, 2021
cada5fb
Update PidFd for the new I/O safety APIs.
sunfishcode Aug 3, 2021
a7d9ab5
Fix an unused import warning.
sunfishcode Aug 4, 2021
9b99f8c
Remove the `#![feature(io_safety)]` from lib.rs.
sunfishcode Aug 6, 2021
6f87288
Use the correct `into_*` on Windows to avoid dropping a stdio handle.
sunfishcode Aug 13, 2021
187ee5c
Add I/O safety trait impls for process::Stdio and process::Child.
sunfishcode Aug 17, 2021
0377a63
Fix syntax for non-doc comments, and use `crate::` instead of `std::`.
sunfishcode Aug 19, 2021
e555003
Factor out a common `RawFd`/`AsRawFd`/etc for Unix and WASI.
sunfishcode Aug 19, 2021
b4dfa19
Fix doc test failures on Windows.
sunfishcode Aug 19, 2021
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a test to ensure that RawFd is the size we assume it is.
  • Loading branch information
sunfishcode committed Aug 19, 2021
commit 1f8a450cdd1b8324765f19c3edd8ca2242682fb8
4 changes: 4 additions & 0 deletions library/std/src/os/unix/io/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

#![unstable(feature = "io_safety", issue = "87074")]

// Tests for this module
#[cfg(test)]
mod tests;

use super::raw::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use crate::fmt;
use crate::fs;
Expand Down
11 changes: 11 additions & 0 deletions library/std/src/os/unix/io/fd/tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use crate::mem::size_of;
use crate::os::unix::io::RawFd;

#[test]
fn test_raw_fd_layout() {
// `OwnedFd` and `BorrowedFd` use `rustc_layout_scalar_valid_range_start`
// and `rustc_layout_scalar_valid_range_end`, with values that depend on
// the bit width of `RawFd`. If this ever changes, those values will need
// to be updated.
assert_eq!(size_of::<RawFd>(), 4);
}
4 changes: 4 additions & 0 deletions library/std/src/os/wasi/io/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

#![unstable(feature = "wasi_ext", issue = "71213")]

// Tests for this module
#[cfg(test)]
mod tests;

use super::raw::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use crate::fmt;
use crate::fs;
Expand Down
11 changes: 11 additions & 0 deletions library/std/src/os/wasi/io/fd/tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use std::mem::size_of;
use std::os::wasi::io::RawFd;

#[test]
fn test_raw_fd_layout() {
/// `OwnedFd` and `BorrowedFd` use `rustc_layout_scalar_valid_range_start`
/// and `rustc_layout_scalar_valid_range_end`, with values that depend on
/// the bit width of `RawFd`. If this ever changes, those values will need
/// to be updated.
assert_eq!(size_of::<RawFd>(), 4);
}