Change:
Ok, so rustc outputting to /dev/null is a bit pathelogical but it used to not ICE the compiler. If you checkout and from dir tests/suite/futurescore run: rustc --crate-type lib -o /dev/null Then rustc is vexed: (ICEs on stable and nightly) The irony is that this is in the test suite of a rust code minimisation project.... Let me minimise the reproduction of the problem...
Thanks to rust-reduce I managed to get the repro down to: Interestingly it doesn't ICE on playground - I'm guessing playground is on linux?
Indeed
triage: P-medium, removing nomination tag, assigning self.
hmm. I nonetheless see an ICE on my own Linux machine. (There is probably some other reason the ICE does not replicate on the playpen.)

Discussion:
worker_id: usize, }, Done { <del> result: Result<CompiledModule, ()>, </del> <ins> result: Result<CompiledModule, Option<WorkerFatalError>>, </ins> worker_id: usize, }, CodegenDone {

main_thread_worker_state = MainThreadWorkerState::Idle; } // If the thread failed that means it panicked, so we abort immediately. <del> Message::Done { result: Err(()), worker_id: _ } => { </del> <ins> Message::Done { result: Err(None), worker_id: _ } => { </ins> bug!("worker thread panicked"); } <ins> Message::Done { result: Err(Some(WorkerFatalError)), worker_id: _ } => { return Err(()); } </ins> Message::CodegenItem => bug!("the coordinator should not receive codegen requests"), } }

pub const CODEGEN_WORKER_ID: usize = ::std::usize::MAX; <ins> /// `FatalError` is explicitly not `Send`. #[must_use] pub struct WorkerFatalError; </ins> fn spawn_work<B: ExtraBackendMethods>(cgcx: CodegenContext<B>, work: WorkItem<B>) { let depth = time_depth();

// we exit. struct Bomb<B: ExtraBackendMethods> { coordinator_send: Sender<Box<dyn Any + Send>>, <del> result: Option<WorkItemResult<B>>, </del> <ins> result: Option<Result<WorkItemResult<B>, FatalError>>, </ins> worker_id: usize, } impl<B: ExtraBackendMethods> Drop for Bomb<B> { fn drop(&mut self) { let worker_id = self.worker_id; let msg = match self.result.take() { <del> Some(WorkItemResult::Compiled(m)) => { </del> <ins> Some(Ok(WorkItemResult::Compiled(m))) => { </ins> Message::Done::<B> { result: Ok(m), worker_id } } <del> Some(WorkItemResult::NeedsFatLTO(m)) => { </del> <ins> Some(Ok(WorkItemResult::NeedsFatLTO(m))) => { </ins> Message::NeedsFatLTO::<B> { result: m, worker_id } } <del> Some(WorkItemResult::NeedsThinLTO(name, thin_buffer)) => { </del> <ins> Some(Ok(WorkItemResult::NeedsThinLTO(name, thin_buffer))) => { </ins> Message::NeedsThinLTO::<B> { name, thin_buffer, worker_id } } <del> None => Message::Done::<B> { result: Err(()), worker_id }, </del> <ins> Some(Err(FatalError)) => { Message::Done::<B> { result: Err(Some(WorkerFatalError)), worker_id } } None => Message::Done::<B> { result: Err(None), worker_id }, </ins> }; drop(self.coordinator_send.send(Box::new(msg))); }

// surface that there was an error in this worker. bomb.result = { let _prof_timer = cgcx.prof.generic_activity(work.profiling_event_id()); <del> execute_work_item(&cgcx, work).ok() </del> <ins> Some(execute_work_item(&cgcx, work)) </ins> }; }); }

<ins> // Issue #66530: We would ICE if someone compiled with `-o /dev/null`, // because we would try to generate auxiliary files in `/dev/` (which // at least the OS X file system rejects). // // An attempt to `-o` into a directory we cannot write into should indeed // be an error; but not an ICE. // compile-flags: -o /dev/null // The error-pattern check occurs *before* normalization, and the error patterns // are wildly different between build environments. So this is a cop-out (and we // rely on the checking of the normalized stderr output as our actual // "verification" of the diagnostic). // error-pattern: error // On Mac OS X, we get an error like the below // normalize-stderr-test "failed to write bytecode to /dev/null.non_ice_error_on_worker_io_fail.*" -> "io error modifying /dev/" // On Linux, we get an error like the below // normalize-stderr-test "couldn't create a temp dir.*" -> "io error modifying /dev/" // ignore-tidy-linelength // ignore-windows - this is a unix-specific test // ignore-emscripten - the file-system issues do not replicate here // ignore-wasm - the file-system issues do not replicate here // ignore-arm - the file-system issues do not replicate here, at least on armhf-gnu #![crate_type="lib"] #![cfg_attr(not(feature = "std"), no_std)] pub mod task { pub mod __internal { use crate::task::Waker; } pub use core::task::Waker; } </ins>

<ins> warning: ignoring --out-dir flag due to -o flag error: io error modifying /dev/ error: aborting due to previous error </ins>