]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_metadata/locator.rs
Remove the in-tree `flate` crate
[rust.git] / src / librustc_metadata / locator.rs
index 34b07af9f01f439cf84e551c5ff5cd629b6bcf98..7a3575cb50bd72ebfc2e3b8c5dbf7073010969d4 100644 (file)
 use std::path::{Path, PathBuf};
 use std::time::Instant;
 
-use flate;
+use flate2::read::ZlibDecoder;
 use owning_ref::{ErasedBoxRef, OwningRef};
 
 pub struct CrateMismatch {
@@ -861,8 +861,9 @@ fn get_metadata_section_imp(target: &Target,
             // Header is okay -> inflate the actual metadata
             let compressed_bytes = &buf[header_len..];
             debug!("inflating {} bytes of compressed metadata", compressed_bytes.len());
-            match flate::inflate_bytes(compressed_bytes) {
-                Ok(inflated) => {
+            let mut inflated = Vec::new();
+            match ZlibDecoder::new(compressed_bytes).read_to_end(&mut inflated) {
+                Ok(_) => {
                     let buf = unsafe { OwningRef::new_assert_stable_address(inflated) };
                     buf.map_owner_box().erase_owner()
                 }