Skip to content

rustc_codegen_ssa should write temporary files to the output directory #139963

Open
@ChrisDenton

Description

@ChrisDenton

In most places in the compiler temporary files are written to the output directory (using tempdir_in). E.g.:

let metadata_tmpdir = TempFileBuilder::new()
.prefix("rmeta")
.tempdir_in(out_filename.parent().unwrap_or_else(|| Path::new("")))

let archive_tmpdir = TempFileBuilder::new()
.suffix(".temp-archive")
.tempdir_in(output.parent().unwrap_or_else(|| Path::new("")))

The one exception is compiler/rustc_codegen_ssa/src/back/link.rs which writes to the OS temp directory (note the use of tempdir instead of tempdir_in):

let tmpdir = TempFileBuilder::new()
.prefix("rustc")
.tempdir()

I don't think there is a good reason to maintain this inconsistency?

Note that this affects -C save-temps where you have to go hunting for the relevant temp file (or redirect the platform-specific temp directory environment variable).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions