-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use Rust union types #2056
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
Use Rust union types #2056
Conversation
r? @Amanieu (rust-highfive has picked a reviewer for you, use r? to override) |
Also I had to ignore |
Unfortunately I believe this is a breaking change, which means we can't actually do this until we bump the crate version to 1.0. cc @JohnTitor |
I'm aware that it is a breaking change and that's not a problem for me to wait until a new major version for this to be merged. |
☔ The latest upstream changes (presumably #1975) made this pull request unmergeable. Please resolve the merge conflicts. |
I'm unsure how to find out what's wrong with sigval on emscripten... |
Btw, I noted (when I originally opened this PR) that the following fields may also be wroth considering turning into unions:
|
I also don't know. I'll mark this as review as a reminder that I need to take a look at this. @rustbot review
Feel free to submit another PR! |
This needs another rebase, feel free to just leave Regarding traits: don't add For @rustbot author |
It is, I need to disable the FreeBSD jobs so I can land #4254. |
@rustbot ready ping me when the CI works again |
@kellda CI should be set! |
@rustbot author, this needs a rebase |
Yet another inter-semester break, yet another attempt to merge this ! |
d79341b
to
7afa26e
Compare
// sigval is a struct in Rust, but a union in C: | ||
"sigval" => "union sigval".to_string(), | ||
|
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.
This change seems to make freebsd fail, but I'm not sure why or what would be the correct thing to do
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.
The FreeBSD jobs are unfortunately flakey with ctest
; I've tried but I can't fix the "spooky action at a distance" response to changes that seem to happen on those.
If you can get the rests of the tests passing (looks like s390x and Solaris are failing) we can hand-review the FreeBSD changes or figure something else out there.
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.
The Solaris tests seems to fail for similar reasons than FreeBSD, or at least similar symptoms.
I'll investigate s390x and emscripten
c5e2e67
to
c10e99f
Compare
@rustbot ready |
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.
Sorry this took so long, but it looks great! I have one last request for names then please rebase one last time and I'm happy to merge.
src/fuchsia/mod.rs
Outdated
@@ -467,7 +462,7 @@ s! { | |||
pub ifa_flags: c_uint, | |||
pub ifa_addr: *mut crate::sockaddr, | |||
pub ifa_netmask: *mut crate::sockaddr, | |||
pub ifa_ifu: *mut crate::sockaddr, // FIXME(union) This should be a union | |||
pub ifa_ifu: __c_anonymous_ifa_ifu, |
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.
This should be __c_anonymous_ifaddrs_ifa_ifu
(struct name + field name)
pub union epoll_data { | ||
pub ptr: *mut c_void, | ||
pub fd: c_int, | ||
pub u32: u32, | ||
pub u64: u64, | ||
} |
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.
src/unix/linux_like/mod.rs
Outdated
@@ -168,7 +168,7 @@ s! { | |||
pub ifa_flags: c_uint, | |||
pub ifa_addr: *mut crate::sockaddr, | |||
pub ifa_netmask: *mut crate::sockaddr, | |||
pub ifa_ifu: *mut crate::sockaddr, // FIXME(union) This should be a union | |||
pub ifa_ifu: __c_anonymous_ifa_ifu, |
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.
Same here, could you include the struct name plus the field name?
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.
LGTM, thank you for the persistence across the four years since this PR opened!
CI is a bit borked right now but I'll merge this soon
For #1020
Replace some types with unions now that rustc supports them.
I also found
sigevent.sigev_notify_thread_id
,siginfo_t.__data
andsigaction.sa_sigaction
that I think should be unions, but I wasn't sure.