Skip to content

Conversation

lasiotus
Copy link
Contributor

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.

@rustbot
Copy link
Collaborator

rustbot commented Sep 24, 2025

These commits modify the library/Cargo.lock file. Unintentional changes to library/Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging.

cc @davidtwco, @wesleywiser

@rustbot rustbot added A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 24, 2025

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@tgross35
Copy link
Contributor

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

@rustbot rustbot added the I-libs-nominated Nominated for discussion during a libs team meeting. label Sep 24, 2025
@lasiotus
Copy link
Contributor Author

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)

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...

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 25, 2025
@bors
Copy link
Collaborator

bors commented Sep 25, 2025

☔ The latest upstream changes (presumably #147019) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot

This comment has been minimized.

@lasiotus lasiotus requested a review from tgross35 September 26, 2025 21:38
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 26, 2025
@lasiotus lasiotus requested a review from bjorn3 September 26, 2025 21:38
@Amanieu
Copy link
Member

Amanieu commented Oct 1, 2025

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.

@Amanieu Amanieu removed the I-libs-nominated Nominated for discussion during a libs team meeting. label Oct 1, 2025
@lasiotus
Copy link
Contributor Author

lasiotus commented Oct 2, 2025

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?

@tgross35
Copy link
Contributor

tgross35 commented Oct 2, 2025

It's on my list, I just haven't had a chance to do a thorough review yet (probably later this week)

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 3, 2025
bors added a commit that referenced this pull request Oct 15, 2025
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
bors added a commit that referenced this pull request Oct 15, 2025
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
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 16, 2025
…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.
bors added a commit that referenced this pull request Oct 16, 2025
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
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 16, 2025
…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.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 16, 2025
…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.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 16, 2025
…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.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 16, 2025
…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.
bors added a commit that referenced this pull request Oct 16, 2025
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
bors added a commit that referenced this pull request Oct 16, 2025
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
bors added a commit that referenced this pull request Oct 16, 2025
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
@bors bors merged commit 91f48d8 into rust-lang:master Oct 16, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 16, 2025
rust-timer added a commit that referenced this pull request Oct 16, 2025
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()
Copy link
Contributor

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?

Copy link
Contributor

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)

Copy link
Contributor

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.

Copy link
Contributor Author

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).

Copy link
Contributor

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

@lasiotus lasiotus deleted the motor-os_stdlib_pr branch October 17, 2025 18:45
lasiotus added a commit to moturus/rust that referenced this pull request Oct 17, 2025
Update the docs to reflect that
[Motor OS std library PR](rust-lang#147000)
has been merged.
lasiotus added a commit to moturus/rust that referenced this pull request Oct 17, 2025
Update the docs to reflect that
[Motor OS std library PR](rust-lang#147000)
has been merged.
lasiotus added a commit to moturus/rust that referenced this pull request Oct 17, 2025
Update the docs to reflect that
[Motor OS std library PR](rust-lang#147000)
has been merged.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 18, 2025
docs: update Motor OS target docs

Update the docs to reflect that [Motor OS std library PR](rust-lang#147000) has been merged.
rust-timer added a commit that referenced this pull request Oct 18, 2025
Rollup merge of #147824 - moturus:motor-os-docs, r=Urgau

docs: update Motor OS target docs

Update the docs to reflect that [Motor OS std library PR](#147000) has been merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tidy Area: The tidy tool S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants