diff --git a/Cargo.toml b/Cargo.toml index 6031933bd2d2..2afa0c2a1665 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,6 +33,7 @@ gccjit = "2.8" [dev-dependencies] boml = "0.3.1" lang_tester = "0.8.0" +tempfile = "3.20.0" [profile.dev] # By compiling dependencies with optimizations, performing tests gets much faster. diff --git a/src/lib.rs b/src/lib.rs index ec3f5a919ab7..f30f3f1ed158 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -205,7 +205,7 @@ impl CodegenBackend for GccCodegenBackend { // NOTE: try the LTO frontend and check if it errors out. If so, do not embed the bitcode. { let temp_dir = TempDir::new().expect("cannot create temporary directory"); - let temp_file = temp_dir.into_path().join("result.asm"); + let temp_file = temp_dir.keep().join("result.asm"); let context = Context::default(); let object_file_path = temp_file.to_str().expect("path to str"); context.compile_to_file(gccjit::OutputKind::ObjectFile, object_file_path);