Skip to content

Commit a069957

Browse files
committed
Directly use core and alloc instead of going through mystd where possible
This makes the api surface we require from std clearer. It is also more consistent with existing direct usage of core and alloc.
1 parent 230570f commit a069957

12 files changed

+34
-25
lines changed

src/symbolize/gimli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ use super::BytesOrWideString;
1010
use super::ResolveWhat;
1111
use super::SymbolName;
1212
use addr2line::gimli;
13+
use alloc::vec::Vec;
1314
use core::convert::TryInto;
1415
use core::mem;
1516
use core::u32;
1617
use libc::c_void;
1718
use mystd::ffi::OsString;
1819
use mystd::fs::File;
1920
use mystd::path::Path;
20-
use mystd::prelude::v1::*;
2121

2222
#[cfg(backtrace_in_libstd)]
2323
mod mystd {

src/symbolize/gimli/libs_aix.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use super::mystd::borrow::ToOwned;
21
use super::mystd::env;
3-
use super::mystd::ffi::{CStr, OsStr};
2+
use super::mystd::ffi::OsStr;
43
use super::mystd::io::Error;
5-
use super::mystd::os::unix::prelude::*;
4+
use super::mystd::os::unix::ffi::OsStrExt;
65
use super::xcoff;
76
use super::{Library, LibrarySegment, Vec};
7+
use alloc::borrow::ToOwned;
88
use alloc::vec;
9+
use core::ffi::CStr;
910
use core::mem;
1011

1112
const EXE_IMAGE_BASE: u64 = 0x100000000;

src/symbolize/gimli/libs_dl_iterate_phdr.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
// and typically implement an API called `dl_iterate_phdr` to load
33
// native libraries.
44

5-
use super::mystd::borrow::ToOwned;
65
use super::mystd::env;
7-
use super::mystd::ffi::{CStr, OsStr};
8-
use super::mystd::os::unix::prelude::*;
6+
use super::mystd::ffi::OsStr;
7+
use super::mystd::os::unix::ffi::OsStrExt;
98
use super::{Library, LibrarySegment, OsString, Vec};
9+
use alloc::borrow::ToOwned;
10+
use core::ffi::CStr;
1011
use core::slice;
1112

1213
pub(super) fn native_libraries() -> Vec<Library> {

src/symbolize/gimli/libs_haiku.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
// that section. All the read-only segments of the ELF-binary are in
66
// that part of the address space.
77

8-
use super::mystd::borrow::ToOwned;
9-
use super::mystd::ffi::{CStr, OsStr};
10-
use super::mystd::mem::MaybeUninit;
11-
use super::mystd::os::unix::prelude::*;
8+
use super::mystd::ffi::OsStr;
9+
use super::mystd::os::unix::ffi::OsStrExt;
1210
use super::{Library, LibrarySegment, Vec};
11+
use alloc::borrow::ToOwned;
12+
use core::ffi::CStr;
13+
use core::mem::MaybeUninit;
1314

1415
pub(super) fn native_libraries() -> Vec<Library> {
1516
let mut libraries: Vec<Library> = Vec::new();

src/symbolize/gimli/libs_illumos.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use super::mystd::borrow::ToOwned;
2-
use super::mystd::ffi::{CStr, OsStr};
3-
use super::mystd::os::unix::prelude::*;
1+
use super::mystd::ffi::OsStr;
2+
use super::mystd::os::unix::ffi::OsStrExt;
43
use super::{Library, LibrarySegment, Vec};
4+
use alloc::borrow::ToOwned;
5+
use core::ffi::CStr;
56
use core::mem;
67
use object::NativeEndian;
78

src/symbolize/gimli/libs_macos.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#![allow(deprecated)]
22

3-
use super::mystd::ffi::{CStr, OsStr};
4-
use super::mystd::os::unix::prelude::*;
5-
use super::mystd::prelude::v1::*;
3+
use super::mystd::ffi::OsStr;
4+
use super::mystd::os::unix::ffi::OsStrExt;
65
use super::{Library, LibrarySegment};
6+
use alloc::borrow::ToOwned;
7+
use alloc::vec::Vec;
78
use core::convert::TryInto;
9+
use core::ffi::CStr;
810
use core::mem;
911

1012
// FIXME: replace with ptr::from_ref once MSRV is high enough

src/symbolize/gimli/libs_windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::super::super::windows_sys::*;
2-
use super::mystd::os::windows::prelude::*;
2+
use super::mystd::os::windows::ffi::OsStringExt;
33
use super::{coff, mmap, Library, LibrarySegment, OsString};
44
use alloc::vec;
55
use alloc::vec::Vec;

src/symbolize/gimli/macho.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use super::{gimli, Box, Context, Endian, EndianSlice, Mapping, Path, Stash, Vec};
1+
use super::{gimli, Context, Endian, EndianSlice, Mapping, Path, Stash, Vec};
2+
use alloc::boxed::Box;
23
use alloc::sync::Arc;
34
use core::convert::TryInto;
45
use object::macho;
@@ -283,7 +284,7 @@ impl<'a> Object<'a> {
283284

284285
fn object_mapping(file: &object::read::ObjectMapFile<'_>) -> Option<Mapping> {
285286
use super::mystd::ffi::OsStr;
286-
use super::mystd::os::unix::prelude::*;
287+
use super::mystd::os::unix::ffi::OsStrExt;
287288

288289
let map = super::mmap(Path::new(OsStr::from_bytes(file.path())))?;
289290
let member_name = file.member();

src/symbolize/gimli/mmap_unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::mystd::fs::File;
2-
use super::mystd::os::unix::prelude::*;
2+
use super::mystd::os::fd::AsRawFd;
33
use core::ops::Deref;
44
use core::ptr;
55
use core::slice;

src/symbolize/gimli/mmap_windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::super::super::windows_sys::*;
22

33
use super::mystd::fs::File;
4-
use super::mystd::os::windows::prelude::*;
4+
use super::mystd::os::windows::io::AsRawHandle;
55
use core::ffi::c_void;
66
use core::ops::Deref;
77
use core::ptr;

src/symbolize/gimli/parse_running_mmaps_unix.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
// in `mod libs_dl_iterate_phdr` (e.g. linux, freebsd, ...); it may be more
33
// general purpose, but it hasn't been tested elsewhere.
44

5+
use super::mystd::ffi::OsString;
56
use super::mystd::fs::File;
67
use super::mystd::io::Read;
7-
use super::mystd::str::FromStr;
8-
use super::{OsString, String, Vec};
8+
use alloc::string::String;
9+
use alloc::vec::Vec;
10+
use core::str::FromStr;
911

1012
#[derive(PartialEq, Eq, Debug)]
1113
pub(super) struct MapsEntry {

src/symbolize/gimli/xcoff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use super::mystd::ffi::{OsStr, OsString};
22
use super::mystd::os::unix::ffi::OsStrExt;
3-
use super::mystd::str;
43
use super::{gimli, Context, Endian, EndianSlice, Mapping, Path, Stash, Vec};
54
use alloc::sync::Arc;
5+
use core::str;
66
use core::ops::Deref;
77
use object::read::archive::ArchiveFile;
88
use object::read::xcoff::{FileHeader, SectionHeader, XcoffFile, XcoffSymbol};

0 commit comments

Comments
 (0)