-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Refactor stdlib for pal #39325
Refactor stdlib for pal #39325
Conversation
This removes one exception in the tidy lint 'pal'.
This removes exceptions in the tidy lint 'pal'.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
r? @brson |
@bors r+ beautiful thanks @cassiersg ! |
📌 Commit 662fef6 has been approved by |
@bors r- |
@cassiersg the float commit looks incomplete to me - it adds the sys definitions but does not rewrite the float modules to use the sys/float modules. I'd expect std/f32 and std/f64 to change and for those files to be removed from the pal whitelist. Can you add another commit to do that? |
Also remove exceptions in tidy lint 'pal'.
@brson I actually forgot to commit some files. Everything should be there now. |
@bors r+ Thanks @cassiersg. As a follow up to this (or in this PR if you want), even the common C functions need to be moved into 'sys' - a platform-independent std is ultimately not allowed to call C directly. Duplication of the C declarations is fine. |
📌 Commit badd513 has been approved by |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit badd513 has been approved by |
I'm getting some failures on the rollup (#39353) on 64-bit MSVC:
I think those may be related to this PR? (haven't dug deeply though) |
⌛ Testing commit badd513 with merge 1881594... |
💔 Test failed - status-appveyor |
@cassiersg Can you peek at the errors here? |
@brson I don't have currently access to a windows system. I'll look at this next weekend. |
src/libstd/sys/windows/f32.rs
Outdated
#[cfg_attr(target_env = "msvc", link_name = "__lgamma_r")] | ||
pub fn lgammaf_r(n: c_float, sign: &mut c_int) -> c_float; | ||
|
||
#[cfg_attr(target_env = "msvc", link_name = "_hypot")] |
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 think the link_name
s here should be __lgammaf_r
and _hypotf
.
Since the test failed on f32::hypot_0
could this have caused the failure?
@brson I have not yet access to a windows environment. I just pushed a fix for the bug @whataloadofwhat found, since it is probably the cause of test failure. |
@bors: r=brson |
📌 Commit 7298535 has been approved by |
Refactor stdlib for pal This is a small step towards [pal](https://internals.rust-lang.org/t/refactoring-std-for-ultimate-portability/4301/40). I moved all platform-specific code from `libstd/{path,f32,f64}.rs` to `libstd/sys`. For the float implementation, I moved only the parts that are currently platform-specific, which leaves direct dependency on libc in `libstd/f32.rs` and `libstd/f64.rs`. I don't know if it is better to move all the dependency to libc in `sys`.
Refactor stdlib for pal This is a small step towards [pal](https://internals.rust-lang.org/t/refactoring-std-for-ultimate-portability/4301/40). I moved all platform-specific code from `libstd/{path,f32,f64}.rs` to `libstd/sys`. For the float implementation, I moved only the parts that are currently platform-specific, which leaves direct dependency on libc in `libstd/f32.rs` and `libstd/f64.rs`. I don't know if it is better to move all the dependency to libc in `sys`.
⌛ Testing commit 7298535 with merge ad597e7... |
💔 Test failed - status-travis |
Errors are legit @cassiersg. |
Closing due to inactivity, but feel free to resubmit with tests fixed! |
This is a small step towards pal. I moved all platform-specific code from
libstd/{path,f32,f64}.rs
tolibstd/sys
.For the float implementation, I moved only the parts that are currently platform-specific, which leaves direct dependency on libc in
libstd/f32.rs
andlibstd/f64.rs
. I don't know if it is better to move all the dependency to libc insys
.