-
Notifications
You must be signed in to change notification settings - Fork 13.8k
std: Add Motor OS std library port #147000
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
base: master
Are you sure you want to change the base?
Conversation
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging. |
Is there any notable std functionality that isn't supported on this platform? Just skimming it, it seems like things are pretty complete (threads, systemtime, process, etc) Nominating for libs as this adds a new std target. @rustbot label +I-libs-nominated |
I believe all major pieces are supported/implemented, including networking. Some specific things are not (yet) fully implemented, like FS links, or DNS lookup (at the moment, only "localhost" resolves to an IP address). On the other hand, tokio is ported via a mio port, which was not completely trivial... |
☔ The latest upstream changes (presumably #147019) made this pull request unmergeable. Please resolve the merge conflicts. |
e2e23a1
to
f3884e2
Compare
This comment has been minimized.
This comment has been minimized.
f3884e2
to
d8da6c0
Compare
We discussed this in the @rust-lang/libs meeting and are happy to add std support for this target because it supports all major functionality of std. |
Thanks, Amanieu! @tgross35 Trevor, how can I improve this PR to make it mergeable? |
It's on my list, I just haven't had a chance to do a thorough review yet (probably later this week) |
d8da6c0
to
f2731ec
Compare
This comment has been minimized.
This comment has been minimized.
f2731ec
to
41b36cd
Compare
This comment has been minimized.
This comment has been minimized.
I believe I have addressed all comments now. Thanks for the detailed review, the PR is definitely better now than what it was two weeks ago! |
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.
Looks pretty good for me! Just a few small requests then I think this should be set.
unsafe { | ||
match addr.v4.sin_family { | ||
netc::AF_INET => SocketAddr::V4(crate::net::SocketAddrV4::from(addr.v4)), | ||
netc::AF_INET6 => SocketAddr::V6(crate::net::SocketAddrV6::from(addr.v6)), | ||
_ => panic!("bad sin_family {}", addr.v4.sin_family), | ||
} | ||
} |
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.
It would be good to format this as
// SAFETY: All variants have `sin_family` at the same offset
let family = unsafe { addr.v4.sin_family };
match family { ... }
As part of work to add stdlib support for Motor OS.
Motor OS was added as a no-std Tier-3 target in rust-lang#146848 as x86_64-unknown-motor. This patch/PR adds the std library for Motor OS. While the patch may seem large, all it does is proxy std pal calls to moto-rt. When there is some non-trivial code (e.g. thread::spawn), it is quite similar, and often identical, to what other platforms do.
41b36cd
to
f2731ec
Compare
This comment has been minimized.
This comment has been minimized.
unsafe {
match addr.v4.sin_family {
netc::AF_INET => SocketAddr::V4(crate::net::SocketAddrV4::from(addr.v4)),
netc::AF_INET6 => SocketAddr::V6(crate::net::SocketAddrV6::from(addr.v6)),
_ => panic!("bad sin_family {}", addr.v4.sin_family),
}
} Contributor
// SAFETY: All variants have `sin_family` at the same offset
let family = unsafe { addr.v4.sin_family };
match family { ... } This is done/fixed. For some reason I can't add comments to or resolve the comment above (a github bug?). |
f2731ec
to
a828ffc
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Motor OS was added as a no-std Tier-3 target in
PR 146848 as x86_64-unknown-motor.
This PR adds the std library for Motor OS.
While the PR may seem large, all it does is proxy
std pal calls to moto-rt. Where there is some non-trivial
code (e.g. thread::spawn), it is quite similar, often
identical, to what other platforms do.