From 677eeaaa6174722738aec7658b408dbb1a8a5c52 Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Tue, 8 May 2018 22:11:58 +0200 Subject: [PATCH] Replace tempdir by tempfile in librustc_trans --- src/Cargo.lock | 2 +- src/librustc_codegen_llvm/Cargo.toml | 2 +- src/librustc_codegen_llvm/back/link.rs | 6 +++--- src/librustc_codegen_llvm/lib.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index 672c447727d..4bf704cd409 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -2103,7 +2103,7 @@ dependencies = [ "serialize 0.0.0", "syntax 0.0.0", "syntax_pos 0.0.0", - "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index 7cf0a1c1bec..6ddae57e336 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -32,7 +32,7 @@ rustc_mir = { path = "../librustc_mir" } serialize = { path = "../libserialize" } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } -tempdir = "0.3" +tempfile = "3.0" # not actually used but needed to make sure we enable the same feature set as # winapi used in librustc diff --git a/src/librustc_codegen_llvm/back/link.rs b/src/librustc_codegen_llvm/back/link.rs index 4e9910e58f3..be336e93112 100644 --- a/src/librustc_codegen_llvm/back/link.rs +++ b/src/librustc_codegen_llvm/back/link.rs @@ -28,7 +28,7 @@ use {CodegenResults, CrateInfo}; use rustc::util::common::time; use rustc::util::fs::fix_windows_verbatim_for_gcc; use rustc::hir::def_id::CrateNum; -use tempdir::TempDir; +use tempfile::{Builder as TempFileBuilder, TempDir}; use rustc_target::spec::{PanicStrategy, RelroLevel, LinkerFlavor, TargetTriple}; use rustc_data_structures::fx::FxHashSet; use context::get_reloc_model; @@ -321,7 +321,7 @@ fn link_binary_output(sess: &Session, // final destination, with a `fs::rename` call. In order for the rename to // always succeed, the temporary file needs to be on the same filesystem, // which is why we create it inside the output directory specifically. - let metadata_tmpdir = match TempDir::new_in(out_filename.parent().unwrap(), "rmeta") { + let metadata_tmpdir = match TempFileBuilder::new().prefix("rmeta").tempdir_in(out_filename.parent().unwrap()) { Ok(tmpdir) => tmpdir, Err(err) => sess.fatal(&format!("couldn't create a temp dir: {}", err)), }; @@ -332,7 +332,7 @@ fn link_binary_output(sess: &Session, out_filenames.push(out_filename); } - let tmpdir = match TempDir::new("rustc") { + let tmpdir = match TempFileBuilder::new().prefix("rustc").tempdir() { Ok(tmpdir) => tmpdir, Err(err) => sess.fatal(&format!("couldn't create a temp dir: {}", err)), }; diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 8732e115fd2..b11b0c7abe8 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -56,7 +56,7 @@ extern crate syntax_pos; extern crate rustc_errors as errors; extern crate serialize; extern crate cc; // Used to locate MSVC -extern crate tempdir; +extern crate tempfile; use back::bytecode::RLIB_BYTECODE_EXTENSION;