Skip to content

Commit

Permalink
Delete feature(alloc)
Browse files Browse the repository at this point in the history
The feature `alloc` has been stable since 1.36.0.
  • Loading branch information
philipc authored and m4b committed Dec 12, 2019
1 parent e5ff551 commit 85507a0
Show file tree
Hide file tree
Showing 26 changed files with 42 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: rust
rust:
- 1.31.1
- 1.36.0
- stable
- beta
- nightly
Expand Down
20 changes: 9 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,28 @@ example:
cargo run --example=rdr -- /bin/ls

api:
cargo build
cargo build --no-default-features
cargo build --no-default-features --features="alloc"
cargo build --no-default-features --features="std"
cargo build --no-default-features --features="endian_fd"
cargo build --no-default-features --features="endian_fd std"
cargo build --no-default-features --features="elf32"
cargo build --no-default-features --features="elf32 elf64"
cargo build --no-default-features --features="elf32 elf64 std"
cargo build --no-default-features --features="elf32 elf64 endian_fd"
cargo build --no-default-features --features="elf32 elf64 endian_fd std"
cargo build --no-default-features --features="archive std"
cargo build --no-default-features --features="mach64"
cargo build --no-default-features --features="mach64 std"
cargo build --no-default-features --features="mach32"
cargo build --no-default-features --features="mach32 std"
cargo build --no-default-features --features="mach64 mach32"
cargo build --no-default-features --features="mach64 mach32 std"
cargo build --no-default-features --features="pe32"
cargo build --no-default-features --features="pe32 std"
cargo build --no-default-features --features="pe32 pe64"
cargo build --no-default-features --features="pe32 pe64 std"
cargo build

nightly_api:
cargo build --no-default-features --features="alloc"
cargo build --no-default-features --features="endian_fd"
cargo build --no-default-features --features="elf32 elf64 endian_fd"
cargo build --no-default-features --features="archive"
cargo build --no-default-features --features="mach64"
cargo build --no-default-features --features="mach32"
cargo build --no-default-features --features="mach64 mach32"
cargo build --no-default-features --features="pe32"
cargo build --no-default-features --features="pe32 pe64"

.PHONY: clean test example doc
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ https://docs.rs/goblin/

### Usage

Goblin requires `rustc` 1.31.1.
Goblin requires `rustc` 1.36.0.

Add to your `Cargo.toml`

Expand Down
4 changes: 2 additions & 2 deletions src/archive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use crate::strtab;
use crate::error::{Result, Error};

use core::usize;
use crate::alloc::collections::btree_map::BTreeMap;
use crate::alloc::vec::Vec;
use alloc::collections::btree_map::BTreeMap;
use alloc::vec::Vec;

pub const SIZEOF_MAGIC: usize = 8;
/// The magic number of a Unix Archive
Expand Down
4 changes: 2 additions & 2 deletions src/elf/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ if_alloc! {
use core::result;
use crate::container::{Ctx, Container};
use crate::strtab::Strtab;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

#[derive(Default, PartialEq, Clone)]
pub struct Dyn {
Expand Down Expand Up @@ -434,7 +434,7 @@ macro_rules! elf_dyn_std_impl {
if_alloc! {
use core::fmt;
use core::slice;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

use crate::elf::program_header::{PT_DYNAMIC};
use crate::strtab::Strtab;
Expand Down
4 changes: 2 additions & 2 deletions src/elf/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ if_alloc! {
use scroll::{ctx, Endian};
use core::fmt;
use crate::container::{Ctx, Container};
use crate::alloc::string::ToString;
use alloc::string::ToString;

#[derive(Copy, Clone, PartialEq)]
/// An ELF header
Expand Down Expand Up @@ -520,7 +520,7 @@ macro_rules! elf_header_test {
use crate::elf::header::Header as ElfHeader;
use super::*;
use crate::container::{Ctx, Container};
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
#[test]
fn size_of() {
assert_eq!(::std::mem::size_of::<Header>(), SIZEOF_EHDR);
Expand Down
2 changes: 1 addition & 1 deletion src/elf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if_sylvan! {
use crate::strtab::Strtab;
use crate::error;
use crate::container::{Container, Ctx};
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
use core::cmp;

pub type Header = header::Header;
Expand Down
2 changes: 1 addition & 1 deletion src/elf/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if_alloc! {
use crate::error;
use crate::container;
use scroll::ctx;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

/// An iterator over ELF binary notes in a note section or segment
pub struct NoteDataIterator<'a> {
Expand Down
2 changes: 1 addition & 1 deletion src/elf/program_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ if_alloc! {
use core::result;
use core::ops::Range;
use crate::container::{Ctx, Container};
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

#[derive(Default, PartialEq, Clone)]
/// A unified ProgramHeader - convertable to and from 32-bit and 64-bit variants
Expand Down
2 changes: 1 addition & 1 deletion src/elf/reloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ if_alloc! {
use core::result;
use crate::container::{Ctx, Container};
#[cfg(feature = "endian_fd")]
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

#[derive(Clone, Copy, PartialEq, Default)]
/// A unified ELF relocation structure
Expand Down
4 changes: 2 additions & 2 deletions src/elf/section_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ macro_rules! elf_section_header_std_impl { ($size:ty) => {
use crate::elf::section_header::SectionHeader as ElfSectionHeader;

use plain::Plain;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

if_std! {
use crate::error::Result;
Expand Down Expand Up @@ -377,7 +377,7 @@ if_alloc! {
use crate::container::{Container, Ctx};

#[cfg(feature = "endian_fd")]
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

#[derive(Default, PartialEq, Clone)]
/// A unified SectionHeader - convertable to and from 32-bit and 64-bit variants
Expand Down
2 changes: 1 addition & 1 deletion src/elf/sym.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ if_alloc! {
use core::result;
use crate::container::{Ctx, Container};
use crate::error::Result;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

#[derive(Default, PartialEq, Clone)]
/// A unified Sym definition - convertable to and from 32-bit and 64-bit variants
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use scroll;
use core::result;
use core::fmt;
use crate::alloc::string::String;
use alloc::string::String;
#[cfg(feature = "std")]
use std::{error, io};

Expand Down
14 changes: 2 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! * A PE32/PE32+ (64-bit) parser, and raw C structs
//! * A Unix archive parser and loader
//!
//! Goblin requires at least `rustc` 1.31.1, uses the 2018 rust edition, and is developed on stable.
//! Goblin requires at least `rustc` 1.36.0, uses the 2018 rust edition, and is developed on stable.
//!
//! Goblin primarily supports the following important use cases:
//!
Expand Down Expand Up @@ -79,24 +79,14 @@
//! via `endian_fd`
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(all(feature = "alloc", not(feature = "std")), feature(alloc))]

#[cfg(feature = "std")]
extern crate core;

#[cfg(all(feature = "alloc", not(feature = "std")))]
#[cfg(feature = "alloc")]
#[macro_use]
extern crate alloc;

#[cfg(feature = "std")]
mod alloc {
pub use std::borrow;
pub use std::boxed;
pub use std::string;
pub use std::vec;
pub use std::collections;
}

/////////////////////////
// Misc/Helper Modules
/////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions src/mach/exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use scroll::{Pread, Uleb128};
use crate::error;
use core::fmt::{self, Debug};
use crate::mach::load_command;
use crate::alloc::vec::Vec;
use crate::alloc::string::String;
use alloc::vec::Vec;
use alloc::string::String;

type Flag = u64;

Expand Down
2 changes: 1 addition & 1 deletion src/mach/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use core::ops::Range;
use core::fmt::{self, Debug};
use scroll::{Sleb128, Uleb128, Pread};
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

use crate::container;
use crate::error;
Expand Down
2 changes: 1 addition & 1 deletion src/mach/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! The Mach-o, mostly zero-copy, binary format parser and raw struct definitions
use core::fmt;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

use log::debug;

Expand Down
4 changes: 2 additions & 2 deletions src/mach/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use log::{debug, warn};

use core::fmt;
use core::ops::{Deref, DerefMut};
use crate::alloc::boxed::Box;
use crate::alloc::vec::Vec;
use alloc::boxed::Box;
use alloc::vec::Vec;

use crate::container;
use crate::error;
Expand Down
2 changes: 1 addition & 1 deletion src/pe/export.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use scroll::{Pread, Pwrite};
use crate::alloc::vec::Vec;
use alloc::vec::Vec;

use log::debug;

Expand Down
2 changes: 1 addition & 1 deletion src/pe/header.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
use crate::error;
use crate::pe::{optional_header, section_table, symbol};
use crate::strtab;
Expand Down
4 changes: 2 additions & 2 deletions src/pe/import.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::alloc::borrow::Cow;
use crate::alloc::vec::Vec;
use alloc::borrow::Cow;
use alloc::vec::Vec;
use core::fmt::{LowerHex, Debug};

use scroll::{Pread, Pwrite, SizeWith};
Expand Down
2 changes: 1 addition & 1 deletion src/pe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// TODO: panics with unwrap on None for apisetschema.dll, fhuxgraphics.dll and some others

use crate::alloc::vec::Vec;
use alloc::vec::Vec;

pub mod header;
pub mod optional_header;
Expand Down
2 changes: 1 addition & 1 deletion src/pe/section_table.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::alloc::string::{String, ToString};
use alloc::string::{String, ToString};
use scroll::{ctx, Pread, Pwrite};
use crate::error::{self, Error};
use crate::pe::relocation;
Expand Down
2 changes: 1 addition & 1 deletion src/pe/symbol.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
use crate::error;
use crate::strtab;
use core::fmt::{self, Debug};
Expand Down
2 changes: 1 addition & 1 deletion src/pe/utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use scroll::Pread;
use crate::alloc::string::ToString;
use alloc::string::ToString;
use crate::error;

use super::section_table;
Expand Down
2 changes: 1 addition & 1 deletion src/strtab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use core::fmt;
use scroll::{ctx, Pread};
if_alloc! {
use crate::error;
use crate::alloc::vec::Vec;
use alloc::vec::Vec;
}

/// A common string table format which is indexed by byte offsets (and not
Expand Down

0 comments on commit 85507a0

Please sign in to comment.