A new proposal has been announced: A --temps-dir option for specifying where the intermediate files are written #423. It will be announced at the next meeting to try and draw attention to it, but usually MCPs are not discussed during triage meetings. If you think this would benefit from discussion amongst the team, consider proposing a design meeting.
Rustc uses the tempfile crate elsewhere in the linking code. It could be used for temp artifacts that end up in the target dir right now to put them inside a temp dir relative to the target dir.
The mentioned alternative of hashing the commandline arguments would be nicer though as it works better with split debuginfo by keeping all object files close together while still preventing collisions. It also doesn't require changes to cargo.
By the way other things do also collide when using different
--crate-type but the same name like the incremental cache. You can use multiple
--crate-type at the same time to build the crate in multiple formats at the same time.
@T-compiler: Proposal #423 has been seconded, and will be approved in 10 days if no objections are raised.