Skip to content

Commit 8368588

Browse files
authored
Rollup merge of #77748 - mati865:dead-code-cleanup, r=petrochenkov
Dead code cleanup in windows-gnu std Closes #77622 This is the only leftover I could find.
2 parents b6b6bc0 + 8818fda commit 8368588

File tree

3 files changed

+1
-65
lines changed

3 files changed

+1
-65
lines changed

library/std/src/sys/windows/c.rs

-11
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ pub type LPWCH = *mut WCHAR;
4747
pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
4848
pub type LPWSADATA = *mut WSADATA;
4949
pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
50-
pub type LPSTR = *mut CHAR;
5150
pub type LPWSTR = *mut WCHAR;
5251
pub type LPFILETIME = *mut FILETIME;
5352
pub type LPWSABUF = *mut WSABUF;
@@ -876,16 +875,6 @@ extern "system" {
876875
pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
877876
pub fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD;
878877
pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
879-
pub fn WideCharToMultiByte(
880-
CodePage: UINT,
881-
dwFlags: DWORD,
882-
lpWideCharStr: LPCWSTR,
883-
cchWideChar: c_int,
884-
lpMultiByteStr: LPSTR,
885-
cbMultiByte: c_int,
886-
lpDefaultChar: LPCSTR,
887-
lpUsedDefaultChar: LPBOOL,
888-
) -> c_int;
889878

890879
pub fn closesocket(socket: SOCKET) -> c_int;
891880
pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int, flags: c_int) -> c_int;

library/std/src/sys/windows/mod.rs

-53
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::ffi::{OsStr, OsString};
44
use crate::io::ErrorKind;
55
use crate::os::windows::ffi::{OsStrExt, OsStringExt};
66
use crate::path::PathBuf;
7-
use crate::ptr;
87
use crate::time::Duration;
98

109
pub use self::rand::hashmap_random_keys;
@@ -206,58 +205,6 @@ fn os2path(s: &[u16]) -> PathBuf {
206205
PathBuf::from(OsString::from_wide(s))
207206
}
208207

209-
#[allow(dead_code)] // Only used in backtrace::gnu::get_executable_filename()
210-
fn wide_char_to_multi_byte(
211-
code_page: u32,
212-
flags: u32,
213-
s: &[u16],
214-
no_default_char: bool,
215-
) -> crate::io::Result<Vec<i8>> {
216-
unsafe {
217-
let mut size = c::WideCharToMultiByte(
218-
code_page,
219-
flags,
220-
s.as_ptr(),
221-
s.len() as i32,
222-
ptr::null_mut(),
223-
0,
224-
ptr::null(),
225-
ptr::null_mut(),
226-
);
227-
if size == 0 {
228-
return Err(crate::io::Error::last_os_error());
229-
}
230-
231-
let mut buf = Vec::with_capacity(size as usize);
232-
buf.set_len(size as usize);
233-
234-
let mut used_default_char = c::FALSE;
235-
size = c::WideCharToMultiByte(
236-
code_page,
237-
flags,
238-
s.as_ptr(),
239-
s.len() as i32,
240-
buf.as_mut_ptr(),
241-
buf.len() as i32,
242-
ptr::null(),
243-
if no_default_char { &mut used_default_char } else { ptr::null_mut() },
244-
);
245-
if size == 0 {
246-
return Err(crate::io::Error::last_os_error());
247-
}
248-
if no_default_char && used_default_char == c::TRUE {
249-
return Err(crate::io::Error::new(
250-
crate::io::ErrorKind::InvalidData,
251-
"string cannot be converted to requested code page",
252-
));
253-
}
254-
255-
buf.set_len(size as usize);
256-
257-
Ok(buf)
258-
}
259-
}
260-
261208
pub fn truncate_utf16_at_nul(v: &[u16]) -> &[u16] {
262209
match unrolled_find_u16s(0, v) {
263210
// don't include the 0

library/unwind/src/libunwind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ extern "C" {
8989
}
9090

9191
cfg_if::cfg_if! {
92-
if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm"))))] {
92+
if #[cfg(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm")))] {
9393
// Not ARM EHABI
9494
#[repr(C)]
9595
#[derive(Copy, Clone, PartialEq)]

0 commit comments

Comments
 (0)