-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
I/O safety breaks existing code #89955
Comments
I think this is officially a "minor" change, and thus allowed -- it's like all the breakage that can happen when |
This is about to ship in 1.56 -- cc @rust-lang/release But AFAIK it didn't show problems in crater, so we'll probably let it go as a minor change... |
Certainly nothing significant, I think. Working with (raw) file descriptors is probably pretty rare, so I'm not expecting much breakage. |
1.56 has shipped now, and I haven't seen any other reports of breakage. So following the comments above, I'll close this issue now. If anyone does see any other instances of breakage, please report it! |
As reported here, the I/O safety feature introduces a breaking change.
Reduced standalone testcase (playground link):
It's possible to change the code to avoid the error, for example by changing the
let _f = ...
line to either of:or, once I/O safety is stabilized, by changing
create_fd
to returnOwnedFd
instead ofF: FromRawFd
. The reporter also reported that they've already fixed their own code. Nevertheless, it is breakage observed in real-world code.The problem is caused by I/O safety adding an
impl From<OwnedFd> for File
. We added theseFrom
impls as an alternative to adding a newFromFd
trait. However, this means thatFile
now has multipleFrom
impls for types that implementAsRawFd
, so one can no longer doFile::from(create_fd())
wherecreate_fd
is defined likefn create_fd<F: FromRawFd>() -> F
, because it's now ambiguous which type it should use forF
.So the questions here are:
FromFd
trait?The text was updated successfully, but these errors were encountered: