Skip to content

Commit 1031ad8

Browse files
committed
Test fixes from the rollup
Closes #15807 (Deprecate some unsafe functions in `str::raw` and remove `OwnedStr` trait) Closes #15859 (Implement `Show` for `CString` and fix warning compiling tests for libcollections) Closes #15911 (Updated LLVM for iOS) Closes #15925 (libsyntax: Remove `~self` and `mut ~self` from the language.) Closes #15930 (Add examples for Checked[Add|Sub|Mul|Div]) Closes #15933 (rustdoc: make table of contents optional) Closes #15937 (librustc: Make bare functions implement the `FnMut` trait.) Closes #15938 (librustc: Check structure constructors against their types.) Closes #15939 (rustdoc: Add a --crate-name option) Closes #15942 (Document trie collections) Closes #15943 (Document SmallIntMap)
1 parent dff1406 commit 1031ad8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libnative/io/addrinfo.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ impl GetAddrInfoRequest {
2727
assert!(host.is_some() || servname.is_some());
2828

2929
let c_host = host.map(|x| x.to_c_str());
30+
let c_host = c_host.as_ref().map(|x| x.as_ptr()).unwrap_or(null());
3031
let c_serv = servname.map(|x| x.to_c_str());
32+
let c_serv = c_serv.as_ref().map(|x| x.as_ptr()).unwrap_or(null());
3133

3234
let hint = hint.map(|hint| {
3335
libc::addrinfo {
@@ -49,9 +51,7 @@ impl GetAddrInfoRequest {
4951

5052
// Make the call
5153
let s = unsafe {
52-
let ch = if c_host.is_none() { null() } else { c_host.unwrap().as_ptr() };
53-
let cs = if c_serv.is_none() { null() } else { c_serv.unwrap().as_ptr() };
54-
getaddrinfo(ch, cs, hint_ptr, &mut res)
54+
getaddrinfo(c_host, c_serv, hint_ptr, &mut res)
5555
};
5656

5757
// Error?

0 commit comments

Comments
 (0)