Skip to content

Working towards a libc-less (wasm32) libstd #45725

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Nov 9, 2017

Conversation

alexcrichton
Copy link
Member

This is a series of commits I was able to extract from prepare to comiple libstd on a "bare libc-less" target, notably wasm32. The actual wasm32 bits I intend to send in a PR later, this is just some internal refactorings required for libstd to work with a libc that's empty and a few other assorted refactorings.

No functional change should be included in this PR for users of libstd, this is intended to just be internal refactorings.

@rust-highfive
Copy link
Contributor

r? @dtolnay

(rust_highfive has picked a reviewer for you, use r? to override)

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 2, 2017
@dtolnay
Copy link
Member

dtolnay commented Nov 4, 2017

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 4, 2017

📌 Commit db3d3f0 has been approved by dtolnay

@kennytm kennytm added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 4, 2017
@LukasKalbertodt
Copy link
Member

screenshot from 2017-11-04 18-57-22

What a lovely PR! All of the commits have long, great descriptions too 😮

@bors
Copy link
Collaborator

bors commented Nov 5, 2017

⌛ Testing commit db3d3f00233eb4442c653549c7534ebcc676e106 with merge f080a4046c5e9bb23da1c0a1bc519c551408ec82...

@bors
Copy link
Collaborator

bors commented Nov 5, 2017

💔 Test failed - status-appveyor

@alexcrichton
Copy link
Member Author

@bors: r=dtolnay

@bors
Copy link
Collaborator

bors commented Nov 5, 2017

📌 Commit 5b673fe has been approved by dtolnay

@alexcrichton
Copy link
Member Author

@bors: r=dtolnay

@bors
Copy link
Collaborator

bors commented Nov 5, 2017

📌 Commit e82ce58 has been approved by dtolnay

@bors
Copy link
Collaborator

bors commented Nov 5, 2017

⌛ Testing commit e82ce589e7f13106d87317f186b275969e17117a with merge 5c430c47d8be405885401082eec445dfe7419d8d...

@bors
Copy link
Collaborator

bors commented Nov 5, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Nov 5, 2017

unused_import on macOS when building libstd.

[00:04:39] error: unused import: `self`
[00:04:39]   --> src/libstd/sys/unix/rand.rs:31:14
[00:04:39]    |
[00:04:39] 31 |     use io::{self, Read};
[00:04:39]    |              ^^^^
[00:04:39]    |
[00:04:39] note: lint level defined here
[00:04:39]   --> src/libstd/lib.rs:232:9
[00:04:39]    |
[00:04:39] 232| #![deny(warnings)]
[00:04:39]    |         ^^^^^^^^
[00:04:39]    = note: #[deny(unused_imports)] implied by #[deny(warnings)]
[00:04:39] 
[00:04:43] error: aborting due to previous error
[00:04:43] 
[00:04:43] error: Could not compile `std`.

@alexcrichton
Copy link
Member Author

@bors: r=dtolnay

@bors
Copy link
Collaborator

bors commented Nov 5, 2017

📌 Commit 847660c has been approved by dtolnay

@bors
Copy link
Collaborator

bors commented Nov 5, 2017

⌛ Testing commit 847660c3aeb2b81d3c836ee0cf0d93535c4cfdbc with merge de5fe8a8eca4f8bc459d7e48bd2497405b48fb37...

@bors
Copy link
Collaborator

bors commented Nov 5, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member Author

@bors: r=dtolnay

@bors
Copy link
Collaborator

bors commented Nov 9, 2017

💔 Test failed - status-travis

@bors
Copy link
Collaborator

bors commented Nov 9, 2017

⌛ Testing commit 9435c71 with merge e811220421ad005f75424b01e78d7e1f88dbc39e...

@bors
Copy link
Collaborator

bors commented Nov 9, 2017

💔 Test failed - status-travis

@bors
Copy link
Collaborator

bors commented Nov 9, 2017

⌛ Testing commit 9435c71 with merge 9e989bf...

bors added a commit that referenced this pull request Nov 9, 2017
Working towards a libc-less (wasm32) libstd

This is a series of commits I was able to extract from prepare to comiple libstd on a "bare libc-less" target, notably wasm32. The actual wasm32 bits I intend to send in a PR later, this is just some internal refactorings required for libstd to work with a `libc` that's empty and a few other assorted refactorings.

No functional change should be included in this PR for users of libstd, this is intended to just be internal refactorings.
@bors
Copy link
Collaborator

bors commented Nov 9, 2017

💔 Test failed - status-travis

@bors
Copy link
Collaborator

bors commented Nov 9, 2017

⌛ Testing commit 9435c71 with merge be37f638ce7a40244220df291e0b5652ffc005fa...

@bors
Copy link
Collaborator

bors commented Nov 9, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member Author

@bord: retry

@alexcrichton
Copy link
Member Author

Er sorry

@bors: retry

@kennytm
Copy link
Member

kennytm commented Nov 9, 2017

@bors treeclosed- p=0

@bors
Copy link
Collaborator

bors commented Nov 9, 2017

⌛ Testing commit 9435c71 with merge a5e95f7d2c5e1e2cee0b8b528e956a0ad992d1aa...

@bors
Copy link
Collaborator

bors commented Nov 9, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Nov 9, 2017

Building stage2 std artifacts (x86_64-apple-darwin -> armv7-apple-ios)
...
[01:06:55] warning: dropping unsupported crate type `dylib` for target `armv7-apple-ios`
[01:06:55] 
[01:06:58] error[E0308]: mismatched types
[01:06:58]   --> src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs:39:29
[01:06:58]    |
[01:06:58] 39 |             exact_position: *from,
[01:06:58]    |                             ^^^^^ expected u8, found enum `libc::c_void`
[01:06:58]    |
[01:06:58]    = note: expected type `*const u8`
[01:06:58]               found type `*mut libc::c_void`
[01:06:58] 
[01:06:58] error[E0308]: mismatched types
[01:06:58]   --> src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs:40:26
[01:06:58]    |
[01:06:58] 40 |             symbol_addr: *from,
[01:06:58]    |                          ^^^^^ expected u8, found enum `libc::c_void`
[01:06:58]    |
[01:06:58]    = note: expected type `*const u8`
[01:06:58]               found type `*mut libc::c_void`

This commit removes usage of the `libc` crate in "portable" modules like
those at the top level and `sys_common`. Instead common types like `*mut
u8` or `u32` are used instead of `*mut c_void` or `c_int` as well as
switching to platform-specific functions like `sys::strlen` instead of
`libc::strlen`.
@alexcrichton
Copy link
Member Author

@bors: r=dtolnay

@bors
Copy link
Collaborator

bors commented Nov 9, 2017

📌 Commit 5c3fe11 has been approved by dtolnay

@bors
Copy link
Collaborator

bors commented Nov 9, 2017

⌛ Testing commit 5c3fe11 with merge f1ea23e...

bors added a commit that referenced this pull request Nov 9, 2017
Working towards a libc-less (wasm32) libstd

This is a series of commits I was able to extract from prepare to comiple libstd on a "bare libc-less" target, notably wasm32. The actual wasm32 bits I intend to send in a PR later, this is just some internal refactorings required for libstd to work with a `libc` that's empty and a few other assorted refactorings.

No functional change should be included in this PR for users of libstd, this is intended to just be internal refactorings.
@bors
Copy link
Collaborator

bors commented Nov 9, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: dtolnay
Pushing f1ea23e to master...

use io;
use rand::Rng;

// FIXME: Use rand:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave this FIXME

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants