Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
- remove useless commands from test Makefile
- do not unnecessarily remove metadata temporary files because they'll be managed by MaybeTempDir
- remove unused FailedRemove error introduced by this PR
  • Loading branch information
pjhades committed Jun 6, 2023
1 parent 9b1a1e1 commit ade6c36
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 19 deletions.
3 changes: 0 additions & 3 deletions compiler/rustc_metadata/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ metadata_failed_create_file =
metadata_failed_create_tempdir =
couldn't create a temp dir: {$err}
metadata_failed_remove =
failed to remove {$filename}: {$err}
metadata_failed_write_error =
failed to write {$filename}: {$err}
Expand Down
7 changes: 0 additions & 7 deletions compiler/rustc_metadata/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,6 @@ pub struct FailedCopyToStdout {
pub err: Error,
}

#[derive(Diagnostic)]
#[diag(metadata_failed_remove)]
pub struct FailedRemove {
pub filename: PathBuf,
pub err: Error,
}

#[derive(Diagnostic)]
#[diag(metadata_binary_output_to_tty)]
pub struct BinaryOutputToTty;
Expand Down
9 changes: 1 addition & 8 deletions compiler/rustc_metadata/src/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::errors::{
BinaryOutputToTty, FailedCopyToStdout, FailedCreateEncodedMetadata, FailedCreateFile,
FailedCreateTempdir, FailedRemove, FailedWriteError,
FailedCreateTempdir, FailedWriteError,
};
use crate::{encode_metadata, EncodedMetadata};

Expand Down Expand Up @@ -109,13 +109,6 @@ pub fn encode_and_write_metadata(tcx: TyCtxt<'_>) -> (EncodedMetadata, bool) {
tcx.sess.emit_fatal(FailedCreateEncodedMetadata { err });
});

// Delete the temporary metadata file if output is stdout
if need_metadata_file && out_filename.is_stdout() {
if let Err(err) = fs::remove_file(&metadata_filename) {
tcx.sess.emit_err(FailedRemove { filename: metadata_filename, err });
}
}

let need_metadata_module = metadata_kind == MetadataKind::Compressed;

(metadata, need_metadata_module)
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/emit-to-stdout/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ obj: $(OUT)
# it there.
metadata: $(OUT)
cp $(SRC) $(OUT)
(cd $(OUT); pwd; ls -d; $(RUSTC) --emit metadata=- $(SRC) 1>/dev/ptmx 2>$(OUT)/$@ || true)
(cd $(OUT); $(RUSTC) --emit metadata=- $(SRC) 1>/dev/ptmx 2>$(OUT)/$@ || true)
diff $(OUT)/$@ emit-metadata.stderr

link: $(OUT)
Expand Down

0 comments on commit ade6c36

Please sign in to comment.