Skip to content

Commit

Permalink
Add an optional feature for 1.34.2 compatibility (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroicKatora committed Aug 15, 2020
1 parent 1f95a16 commit d18e847
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions miniz_oxide/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ compiler_builtins = { version = '0.1.2', optional = true }
# Internal feature, only used when building as part of libstd, not part of the
# stable interface of this crate.
rustc-dep-of-std = ['core', 'alloc', 'compiler_builtins', 'adler/rustc-dep-of-std']
# Use std instead of alloc. This should only be used for backwards compatibility.
no_extern_crate_alloc = []
4 changes: 2 additions & 2 deletions miniz_oxide/src/deflate/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! This module contains functionality for compression.

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

mod buffer;
pub mod core;
Expand Down
6 changes: 3 additions & 3 deletions miniz_oxide/src/inflate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use ::core::cmp::min;
use ::core::usize;
use alloc::boxed::Box;
use alloc::vec;
use alloc::vec::Vec;
use crate::alloc::boxed::Box;
use crate::alloc::vec;
use crate::alloc::vec::Vec;

pub mod core;
mod output_buffer;
Expand Down
2 changes: 1 addition & 1 deletion miniz_oxide/src/inflate/stream.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Extra streaming decompression functionality.
//!
//! As of now this is mainly inteded for use to build a higher-level wrapper.
use alloc::boxed::Box;
use crate::alloc::boxed::Box;
use core::{cmp, mem};

use crate::inflate::core::{decompress, inflate_flags, DecompressorOxide, TINFL_LZ_DICT_SIZE};
Expand Down
5 changes: 4 additions & 1 deletion miniz_oxide/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@

#![allow(warnings)]
#![forbid(unsafe_code)]
#![no_std]
#![cfg_attr(not(feature = "no_extern_crate_alloc"), no_std)]

#[cfg(not(feature = "no_extern_crate_alloc"))]
extern crate alloc;
#[cfg(feature = "no_extern_crate_alloc")]
use std as alloc;

#[cfg(test)]
extern crate std;
Expand Down

0 comments on commit d18e847

Please sign in to comment.