- Notifications
You must be signed in to change notification settings - Fork341
Implement I/O-safe traits on types#1036
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
runs-on:${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os:[ubuntu-latest, windows-latest] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Doesn’t support MacOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The changes I wrote only impactcfg(unix)
andcfg(windows)
, so I included a Unix platform (ubuntu-latest
) and a Windows platform (windows-latest
). If you would like me to also test on MacOS I can.
Uh oh!
There was an error while loading.Please reload this page.
} | ||
} | ||
impl From<File> for OwnedFd { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should this beTryFrom
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I was mirroring the previous implementation forIntoRawFd
for this type. If you would think that it would be better asTryFrom
I will oblige.
Uh oh!
There was an error while loading.Please reload this page.
impl From<TcpListener> for OwnedSocket { | ||
fn from(listener: TcpListener) -> OwnedSocket { | ||
listener.watcher.into_inner().unwrap().into() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should this beTryFrom
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I was mirroring theIntoRawSocket
implementation for this type. Should this beTryFrom
? If so, I can make it.
yoshuawuyts commentedAug 17, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Tagging in@sunfishcode who likely has thoughts on how we should approach this. edit: I believe file and stdio types may actually be unsound to implement these traits on on windows? |
Are you referring to the |
This change looks good to me. Overall, the intention for |
Also, it's currently the case that async-std doesn't currently call |
What is the current status of this PR? |
@yoshuawuyts Is there anything I can do to move this PR forwards? |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Commented on a couple of minor issues. Happy to merge this with those fixed. |
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
This is completely broken 😭 |
@Keruspe Argh. :( Would welcome PRs fixing this; that should happen before a new release. |
Should be fixed in master now, CI is green now |
Uh oh!
There was an error while loading.Please reload this page.
This PR adds a new feature,
io_safety
, which requires Rust 1.63 or higher. This trait implements theAsFd/AsHandle/AsSocket
family of functions onasync-std
's types. In addition, several types also implementFrom<OwnedFd/OwnedHandle/OwnedSocket>
andInto<OwnedFd/OwnedHandle/OwnedSocket>
.See also:sunfishcode/io-lifetimes#38