Skip to content

Commit 01172a7

Browse files
committed
Auto merge of #50698 - Eijebong:tempfile, r=oli-obk
Replace tempdir by tempfile
2 parents 637fd2e + c863049 commit 01172a7

File tree

9 files changed

+19
-26
lines changed

9 files changed

+19
-26
lines changed

src/Cargo.lock

+3-13
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ dependencies = [
18001800
"serialize 0.0.0",
18011801
"syntax 0.0.0",
18021802
"syntax_pos 0.0.0",
1803-
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
1803+
"tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
18041804
]
18051805

18061806
[[package]]
@@ -2103,7 +2103,7 @@ dependencies = [
21032103
"serialize 0.0.0",
21042104
"syntax 0.0.0",
21052105
"syntax_pos 0.0.0",
2106-
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
2106+
"tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
21072107
]
21082108

21092109
[[package]]
@@ -2427,7 +2427,7 @@ version = "0.0.0"
24272427
dependencies = [
24282428
"minifier 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
24292429
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
2430-
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
2430+
"tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
24312431
]
24322432

24332433
[[package]]
@@ -2831,15 +2831,6 @@ dependencies = [
28312831
"xattr 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
28322832
]
28332833

2834-
[[package]]
2835-
name = "tempdir"
2836-
version = "0.3.7"
2837-
source = "registry+https://github.com/rust-lang/crates.io-index"
2838-
dependencies = [
2839-
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
2840-
"remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
2841-
]
2842-
28432834
[[package]]
28442835
name = "tempfile"
28452836
version = "3.0.2"
@@ -3380,7 +3371,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
33803371
"checksum syntex_pos 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "955ef4b16af4c468e4680d1497f873ff288f557d338180649e18f915af5e15ac"
33813372
"checksum syntex_syntax 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "76a302e717e348aa372ff577791c3832395650073b8d8432f8b3cb170b34afde"
33823373
"checksum tar 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "6af6b94659f9a571bf769a5b71f54079393585ee0bfdd71b691be22d7d6b1d18"
3383-
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
33843374
"checksum tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "47776f63b85777d984a50ce49d6b9e58826b6a3766a449fc95bc66cd5663c15b"
33853375
"checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508"
33863376
"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1"

src/librustc/Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,4 @@ chalk-engine = { version = "0.6.0", default-features=false }
6161
# later crate stop compiling. If you can remove this and everything
6262
# compiles, then please feel free to do so!
6363
flate2 = "1.0"
64-
tempdir = "0.3"
65-
66-
64+
tempfile = "3.0"

src/librustc_codegen_llvm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ rustc_mir = { path = "../librustc_mir" }
3232
serialize = { path = "../libserialize" }
3333
syntax = { path = "../libsyntax" }
3434
syntax_pos = { path = "../libsyntax_pos" }
35-
tempdir = "0.3"
35+
tempfile = "3.0"
3636

3737
# not actually used but needed to make sure we enable the same feature set as
3838
# winapi used in librustc

src/librustc_codegen_llvm/back/link.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use {CodegenResults, CrateInfo};
2828
use rustc::util::common::time;
2929
use rustc::util::fs::fix_windows_verbatim_for_gcc;
3030
use rustc::hir::def_id::CrateNum;
31-
use tempdir::TempDir;
31+
use tempfile::{Builder as TempFileBuilder, TempDir};
3232
use rustc_target::spec::{PanicStrategy, RelroLevel, LinkerFlavor, TargetTriple};
3333
use rustc_data_structures::fx::FxHashSet;
3434
use context::get_reloc_model;
@@ -321,7 +321,10 @@ fn link_binary_output(sess: &Session,
321321
// final destination, with a `fs::rename` call. In order for the rename to
322322
// always succeed, the temporary file needs to be on the same filesystem,
323323
// which is why we create it inside the output directory specifically.
324-
let metadata_tmpdir = match TempDir::new_in(out_filename.parent().unwrap(), "rmeta") {
324+
let metadata_tmpdir = match TempFileBuilder::new()
325+
.prefix("rmeta")
326+
.tempdir_in(out_filename.parent().unwrap())
327+
{
325328
Ok(tmpdir) => tmpdir,
326329
Err(err) => sess.fatal(&format!("couldn't create a temp dir: {}", err)),
327330
};
@@ -332,7 +335,7 @@ fn link_binary_output(sess: &Session,
332335
out_filenames.push(out_filename);
333336
}
334337

335-
let tmpdir = match TempDir::new("rustc") {
338+
let tmpdir = match TempFileBuilder::new().prefix("rustc").tempdir() {
336339
Ok(tmpdir) => tmpdir,
337340
Err(err) => sess.fatal(&format!("couldn't create a temp dir: {}", err)),
338341
};

src/librustc_codegen_llvm/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ extern crate syntax_pos;
5656
extern crate rustc_errors as errors;
5757
extern crate serialize;
5858
extern crate cc; // Used to locate MSVC
59-
extern crate tempdir;
59+
extern crate tempfile;
6060

6161
use back::bytecode::RLIB_BYTECODE_EXTENSION;
6262

src/librustdoc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ path = "lib.rs"
99

1010
[dependencies]
1111
pulldown-cmark = { version = "0.1.2", default-features = false }
12-
tempdir = "0.3"
1312
minifier = "0.0.11"
13+
tempfile = "3"

src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extern crate test as testing;
4646
#[macro_use] extern crate log;
4747
extern crate rustc_errors as errors;
4848
extern crate pulldown_cmark;
49-
extern crate tempdir;
49+
extern crate tempfile;
5050
extern crate minifier;
5151

5252
extern crate serialize as rustc_serialize; // used by deriving

src/librustdoc/test.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rustc::session::{self, CompileIncomplete, config};
2727
use rustc::session::config::{OutputType, OutputTypes, Externs, CodegenOptions};
2828
use rustc::session::search_paths::{SearchPaths, PathKind};
2929
use rustc_metadata::dynamic_lib::DynamicLibrary;
30-
use tempdir::TempDir;
30+
use tempfile::Builder as TempFileBuilder;
3131
use rustc_driver::{self, driver, target_features, Compilation};
3232
use rustc_driver::driver::phase_2_configure_and_expand;
3333
use rustc_metadata::cstore::CStore;
@@ -277,7 +277,9 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
277277
let cstore = CStore::new(codegen_backend.metadata_loader());
278278
rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
279279

280-
let outdir = Mutex::new(TempDir::new("rustdoctest").ok().expect("rustdoc needs a tempdir"));
280+
let outdir = Mutex::new(
281+
TempFileBuilder::new().prefix("rustdoctest").tempdir().expect("rustdoc needs a tempdir")
282+
);
281283
let libdir = sess.target_filesearch(PathKind::All).get_lib_path();
282284
let mut control = driver::CompileController::basic();
283285

src/tools/tidy/src/deps.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static WHITELIST: &'static [Crate] = &[
114114
Crate("scopeguard"),
115115
Crate("smallvec"),
116116
Crate("stable_deref_trait"),
117-
Crate("tempdir"),
117+
Crate("tempfile"),
118118
Crate("termcolor"),
119119
Crate("terminon"),
120120
Crate("termion"),

0 commit comments

Comments
 (0)