Skip to content

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

Merged
bors merged 2 commits into
rust-lang:masterfrom
cuviper:unix-uninit
Jun 29, 2019
Merged

Avoid mem::uninitialized() in std::sys::unix#62163
bors merged 2 commits into
rust-lang:masterfrom
cuviper:unix-uninit

Conversation

@cuviper

@cuviper cuviper commented Jun 26, 2019

Copy link
Copy Markdown
Member

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
Comment thread src/libstd/sys/unix/process/process_unix.rs Outdated
@RalfJung

Copy link
Copy Markdown
Member

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

Comment thread src/libstd/sys/unix/process/process_unix.rs
@RalfJung

Copy link
Copy Markdown
Member

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

I like this!

@cuviper

cuviper commented Jun 27, 2019

Copy link
Copy Markdown
Member Author

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

I think we're good now?

@bors r=RalfJung

@bors

bors commented Jun 27, 2019

Copy link
Copy Markdown
Collaborator

📌 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