-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
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) |
Rollup of 5 pull requests Successful merges: - #143191 (Stabilize `rwlock_downgrade` library feature) - #147000 (std: Add Motor OS std library port) - #147670 (some `ErrorGuaranteed` cleanups) - #147716 (Fix some comments) - #147718 (miri: use allocator_shim_contents codegen helper) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 5 pull requests Successful merges: - #143191 (Stabilize `rwlock_downgrade` library feature) - #147000 (std: Add Motor OS std library port) - #147670 (some `ErrorGuaranteed` cleanups) - #147716 (Fix some comments) - #147718 (miri: use allocator_shim_contents codegen helper) r? `@ghost` `@rustbot` modify labels: rollup
…ss35 std: Add Motor OS std library port Motor OS was added as a no-std Tier-3 target in [PR 146848](rust-lang#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](https://crates.io/crates/moto-rt). Where there is some non-trivial code (e.g. thread::spawn), it is quite similar, often identical, to what other platforms do.
Rollup of 7 pull requests Successful merges: - #144936 (CFI: Fix types that implement Fn, FnMut, or FnOnce) - #147000 (std: Add Motor OS std library port) - #147732 (remove duplicate inline macro) - #147738 (Don't highlight `let` expressions as having type `bool` in let-chain error messages) - #147744 (miri subtree update) - #147751 (Use `bit_set::Word` in a couple more places.) - #147752 (style-guide: fix typo for empty struct advice) r? `@ghost` `@rustbot` modify labels: rollup
…ss35 std: Add Motor OS std library port Motor OS was added as a no-std Tier-3 target in [PR 146848](rust-lang#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](https://crates.io/crates/moto-rt). Where there is some non-trivial code (e.g. thread::spawn), it is quite similar, often identical, to what other platforms do.
…ss35 std: Add Motor OS std library port Motor OS was added as a no-std Tier-3 target in [PR 146848](rust-lang#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](https://crates.io/crates/moto-rt). Where there is some non-trivial code (e.g. thread::spawn), it is quite similar, often identical, to what other platforms do.
…ss35 std: Add Motor OS std library port Motor OS was added as a no-std Tier-3 target in [PR 146848](rust-lang#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](https://crates.io/crates/moto-rt). Where there is some non-trivial code (e.g. thread::spawn), it is quite similar, often identical, to what other platforms do.
…ss35 std: Add Motor OS std library port Motor OS was added as a no-std Tier-3 target in [PR 146848](rust-lang#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](https://crates.io/crates/moto-rt). Where there is some non-trivial code (e.g. thread::spawn), it is quite similar, often identical, to what other platforms do.
Rollup of 7 pull requests Successful merges: - #147000 (std: Add Motor OS std library port) - #147732 (remove duplicate inline macro) - #147738 (Don't highlight `let` expressions as having type `bool` in let-chain error messages) - #147739 (Fix whitespace in rustfmt-excluded clippy file) - #147744 (miri subtree update) - #147751 (Use `bit_set::Word` in a couple more places.) - #147752 (style-guide: fix typo for empty struct advice) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 7 pull requests Successful merges: - #147000 (std: Add Motor OS std library port) - #147732 (remove duplicate inline macro) - #147738 (Don't highlight `let` expressions as having type `bool` in let-chain error messages) - #147739 (Fix whitespace in rustfmt-excluded clippy file) - #147744 (miri subtree update) - #147751 (Use `bit_set::Word` in a couple more places.) - #147752 (style-guide: fix typo for empty struct advice) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - #144438 (Guard HIR lowered contracts with `contract_checks`) - #147000 (std: Add Motor OS std library port) - #147576 (Fix ICE on offsetted ZST pointer) - #147732 (remove duplicate inline macro) - #147738 (Don't highlight `let` expressions as having type `bool` in let-chain error messages) - #147744 (miri subtree update) - #147751 (Use `bit_set::Word` in a couple more places.) - #147752 (style-guide: fix typo for empty struct advice) - #147773 (`is_ascii` on an empty string or slice returns true) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #147000 - moturus:motor-os_stdlib_pr, r=tgross35 std: Add Motor OS std library port Motor OS was added as a no-std Tier-3 target in [PR 146848](#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](https://crates.io/crates/moto-rt). Where there is some non-trivial code (e.g. thread::spawn), it is quite similar, often identical, to what other platforms do.
impl OsStringExt for OsString { | ||
#[inline] | ||
fn as_str(&self) -> &str { | ||
self.to_str().unwrap() |
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.
If Motor OS strings are guaranteed UTF-8, why not do str::from_utf8_unchecked(self.as_encoded_bytes())
?
Shouldn't this be into_string
; otherwise it's redundant to OsStrExt
?
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.
But I suppose we can't rely on OS strings remaining UTF-8, since there's no UTF-8-guaranteed variant of OsString. (The user could push arbitrary bytes)
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.
Maybe this is an argument for a UTF-8 OsString, but I'd also never heard of Motor OS, so maybe it's not worth the extra implementation cost.
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.
Maybe this is an argument for a UTF-8 OsString, but [...] maybe it's not worth the extra implementation cost.
Yes, OsString currently is not platform specific in Rust, but just bytes. So while Motor OS is very much Rust-first, and Rust strings are UTF-8, there is no guarantee that bytes in OsString are actually UTF-8, so unwrap()
seems appropriate here.
I'd also never heard of Motor OS [...]
Feel free to play around and post your impressions on Motor OS github (I'll need to update the building instructions doc, now that this PR is in).
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 wrote more about my thoughts on this in #147797
Update the docs to reflect that [Motor OS std library PR](rust-lang#147000) has been merged.
Update the docs to reflect that [Motor OS std library PR](rust-lang#147000) has been merged.
Update the docs to reflect that [Motor OS std library PR](rust-lang#147000) has been merged.
docs: update Motor OS target docs Update the docs to reflect that [Motor OS std library PR](rust-lang#147000) has been merged.
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.