diff --git a/src/Cargo.lock b/src/Cargo.lock index d4544ffa3244f..615d36b8ee558 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -1800,7 +1800,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]] @@ -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]] @@ -2427,7 +2427,7 @@ version = "0.0.0" dependencies = [ "minifier 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "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]] @@ -2831,15 +2831,6 @@ dependencies = [ "xattr 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tempdir" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "tempfile" version = "3.0.2" @@ -3380,7 +3371,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum syntex_pos 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "955ef4b16af4c468e4680d1497f873ff288f557d338180649e18f915af5e15ac" "checksum syntex_syntax 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "76a302e717e348aa372ff577791c3832395650073b8d8432f8b3cb170b34afde" "checksum tar 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "6af6b94659f9a571bf769a5b71f54079393585ee0bfdd71b691be22d7d6b1d18" -"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "47776f63b85777d984a50ce49d6b9e58826b6a3766a449fc95bc66cd5663c15b" "checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index 0ff4dc2eace81..457a9f2f625ec 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -61,6 +61,4 @@ chalk-engine = { version = "0.6.0", default-features=false } # later crate stop compiling. If you can remove this and everything # compiles, then please feel free to do so! flate2 = "1.0" -tempdir = "0.3" - - +tempfile = "3.0" diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index 7cf0a1c1becaa..6ddae57e336ed 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 4e9910e58f391..7e24e1114a0c2 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,10 @@ 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 +335,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 8732e115fd2fd..b11b0c7abe875 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; diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml index 96a2194eeeefd..126fa7fb32034 100644 --- a/src/librustdoc/Cargo.toml +++ b/src/librustdoc/Cargo.toml @@ -9,5 +9,5 @@ path = "lib.rs" [dependencies] pulldown-cmark = { version = "0.1.2", default-features = false } -tempdir = "0.3" minifier = "0.0.11" +tempfile = "3" diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 97c84d8348f7c..3a38a8c29d788 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -46,7 +46,7 @@ extern crate test as testing; #[macro_use] extern crate log; extern crate rustc_errors as errors; extern crate pulldown_cmark; -extern crate tempdir; +extern crate tempfile; extern crate minifier; extern crate serialize as rustc_serialize; // used by deriving diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 6086c5a47c78c..fe992169ca934 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -27,7 +27,7 @@ use rustc::session::{self, CompileIncomplete, config}; use rustc::session::config::{OutputType, OutputTypes, Externs, CodegenOptions}; use rustc::session::search_paths::{SearchPaths, PathKind}; use rustc_metadata::dynamic_lib::DynamicLibrary; -use tempdir::TempDir; +use tempfile::Builder as TempFileBuilder; use rustc_driver::{self, driver, target_features, Compilation}; use rustc_driver::driver::phase_2_configure_and_expand; use rustc_metadata::cstore::CStore; @@ -277,7 +277,9 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, let cstore = CStore::new(codegen_backend.metadata_loader()); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); - let outdir = Mutex::new(TempDir::new("rustdoctest").ok().expect("rustdoc needs a tempdir")); + let outdir = Mutex::new( + TempFileBuilder::new().prefix("rustdoctest").tempdir().expect("rustdoc needs a tempdir") + ); let libdir = sess.target_filesearch(PathKind::All).get_lib_path(); let mut control = driver::CompileController::basic(); diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index cef548b0d94da..6f03d09268b91 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -114,7 +114,7 @@ static WHITELIST: &'static [Crate] = &[ Crate("scopeguard"), Crate("smallvec"), Crate("stable_deref_trait"), - Crate("tempdir"), + Crate("tempfile"), Crate("termcolor"), Crate("terminon"), Crate("termion"),