Skip to content
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

Avoid mem::uninitialized() in std::sys::unix #62163

Merged
merged 2 commits into from
Jun 29, 2019
Merged

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Jun 26, 2019

For libc types that will be initialized in FFI calls, we can just use
MaybeUninit and then pass around raw pointers.

For sun_path_offset(), which really wants offset_of, all callers
have a real sockaddr_un available, so we can use that reference.

r? @RalfJung

For `libc` types that will be initialized in FFI calls, we can just use
`MaybeUninit` and then pass around raw pointers.

For `sun_path_offset()`, which really wants `offset_of`, all callers
have a real `sockaddr_un` available, so we can use that reference.
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 26, 2019
@RalfJung
Copy link
Member

LGTM! r=me with that type annotation added and when Travis is happy.

@RalfJung
Copy link
Member

Actually, I guess we can just use ptr::write_bytes.

I like this!

@cuviper
Copy link
Member Author

cuviper commented Jun 27, 2019

LGTM! r=me with that type annotation added and when Travis is happy.

I think we're good now?

@bors r=RalfJung

@bors
Copy link
Contributor

bors commented Jun 27, 2019

📌 Commit b533aff has been approved by RalfJung

@bors bors 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 Jun 27, 2019
Centril added a commit to Centril/rust that referenced this pull request Jun 28, 2019
Avoid mem::uninitialized() in std::sys::unix

For `libc` types that will be initialized in FFI calls, we can just use
`MaybeUninit` and then pass around raw pointers.

For `sun_path_offset()`, which really wants `offset_of`, all callers
have a real `sockaddr_un` available, so we can use that reference.

r? @RalfJung
Centril added a commit to Centril/rust that referenced this pull request Jun 28, 2019
Avoid mem::uninitialized() in std::sys::unix

For `libc` types that will be initialized in FFI calls, we can just use
`MaybeUninit` and then pass around raw pointers.

For `sun_path_offset()`, which really wants `offset_of`, all callers
have a real `sockaddr_un` available, so we can use that reference.

r? @RalfJung
Centril added a commit to Centril/rust that referenced this pull request Jun 28, 2019
Avoid mem::uninitialized() in std::sys::unix

For `libc` types that will be initialized in FFI calls, we can just use
`MaybeUninit` and then pass around raw pointers.

For `sun_path_offset()`, which really wants `offset_of`, all callers
have a real `sockaddr_un` available, so we can use that reference.

r? @RalfJung
Centril added a commit to Centril/rust that referenced this pull request Jun 29, 2019
Avoid mem::uninitialized() in std::sys::unix

For `libc` types that will be initialized in FFI calls, we can just use
`MaybeUninit` and then pass around raw pointers.

For `sun_path_offset()`, which really wants `offset_of`, all callers
have a real `sockaddr_un` available, so we can use that reference.

r? @RalfJung
bors added a commit that referenced this pull request Jun 29, 2019
Rollup of 7 pull requests

Successful merges:

 - #61199 (Revert "Set test flag when rustdoc is running with --test option" )
 - #61755 (Add `--pass $mode` to compiletest through `./x.py`)
 - #61818 (Issue #60709 test)
 - #62023 (publish_toolstate: don't use 'new' from inside the loop)
 - #62104 (Inform the query system about properties of queries at compile time)
 - #62163 (Avoid mem::uninitialized() in std::sys::unix)
 - #62204 (doc(libcore) Fix CS)

Failed merges:

r? @ghost
@bors bors merged commit b533aff into rust-lang:master Jun 29, 2019
@cuviper cuviper deleted the unix-uninit branch April 3, 2020 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

4 participants