Skip to content

Commit 45c5c34

Browse files
committed
Use mystd instead of std
1 parent 37c08db commit 45c5c34

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/symbolize/gimli/libs_windows.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use super::super::super::windows_sys::*;
22
use super::mystd::ffi::OsString;
3-
#[cfg(windows)]
4-
use super::mystd::os::windows::prelude::*;
53
use super::{coff, mmap, Library, LibrarySegment};
64
use alloc::vec;
75
use alloc::vec::Vec;
@@ -47,7 +45,7 @@ unsafe fn add_loaded_images(ret: &mut Vec<Library>) {
4745
// Safety: long_path should be null-terminated
4846
#[cfg(target_os = "cygwin")]
4947
unsafe fn get_posix_path(long_path: &[u16]) -> Option<OsString> {
50-
use std::os::unix::ffi::OsStringExt;
48+
use super::mystd::os::unix::ffi::OsStringExt;
5149

5250
unsafe extern "C" {
5351
fn cygwin_conv_path(
@@ -91,17 +89,20 @@ unsafe fn get_posix_path(long_path: &[u16]) -> Option<OsString> {
9189
}
9290

9391
unsafe fn load_library(me: &MODULEENTRY32W) -> Option<Library> {
94-
let pos = me
95-
.szExePath
96-
.iter()
97-
.position(|i| *i == 0)
98-
.unwrap_or(me.szExePath.len());
9992
#[cfg(windows)]
100-
let name = OsString::from_wide(&me.szExePath[..pos]);
93+
let name = {
94+
use super::mystd::os::windows::prelude::*;
95+
let pos = me
96+
.szExePath
97+
.iter()
98+
.position(|i| *i == 0)
99+
.unwrap_or(me.szExePath.len());
100+
OsString::from_wide(&me.szExePath[..pos])
101+
};
101102
#[cfg(target_os = "cygwin")]
102103
// Safety: the path with max length MAX_PATH always contains a null
103-
// terminator
104-
let name = unsafe { get_posix_path(&me.szExePath[..pos])? };
104+
// terminator. Don't slice it.
105+
let name = unsafe { get_posix_path(&me.szExePath[..])? };
105106

106107
// MinGW libraries currently don't support ASLR
107108
// (rust-lang/rust#16514), but DLLs can still be relocated around in

0 commit comments

Comments
 (0)