Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make rustix::io::stdout a safe function, in std mode. #519

Merged
merged 4 commits into from
Jan 30, 2023

Conversation

sunfishcode
Copy link
Member

Revisit the safety considerations of rustix::io::stdout and friends. The Rust standard library assumes that the stdin, stdout, and stderr file descriptors are always open, to the point where it's even willing to hand out a 'static borrow for them. Consequently, rustix doesn't need to treat these as unsafe when std is in use.

Revisit the safety considerations of `rustix::io::stdout` and friends.
The Rust standard library assumes that the stdin, stdout, and stderr
file descriptors are always open, to the point where it's even willing
to hand out a [`'static` borrow for them]. Consequently, rustix doesn't
need to treat these as unsafe when std is in use.

[`'static` borrow for them]: https://doc.rust-lang.org/stable/std/io/struct.Stdin.html#method.lock
@sunfishcode sunfishcode merged commit 2a721e2 into main Jan 30, 2023
@sunfishcode sunfishcode deleted the sunfishcode/safe-stdio branch January 30, 2023 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant