diff options
| author | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2022-09-27 20:56:05 +0200 |
|---|---|---|
| committer | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2022-09-27 20:56:05 +0200 |
| commit | 8a96884981c97c4c35e304004290271308a67637 (patch) | |
| tree | d65ed037add268a9ce4204ae8f1ae5a10f1db4f4 /compiler/rustc_errors | |
| parent | 57ee5cf5a93923dae9c98bffb11545fc3a31368d (diff) | |
| download | rust-8a96884981c97c4c35e304004290271308a67637.tar.gz rust-8a96884981c97c4c35e304004290271308a67637.zip | |
Flush delayed bugs before codegen
Sometimes it can happen that invalid code like a TyKind::Error makes its way through the compiler without triggering any errors (this is always a bug in rustc but bugs do happen sometimes :)). These ICEs will manifest in the backend like as cg_llvm not being able to get the layout of `[type error]`, which makes it hard to debug. By flushing before codegen, we display all the delayed bugs, making it easier to trace it to the root of the problem.
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 4d262ae0f5e..b4e99225f81 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1133,6 +1133,12 @@ impl Handler { ); std::mem::take(&mut self.inner.borrow_mut().fulfilled_expectations) } + + pub fn flush_delayed(&self) { + let mut inner = self.inner.lock(); + let bugs = std::mem::replace(&mut inner.delayed_span_bugs, Vec::new()); + inner.flush_delayed(bugs, "no errors encountered even though `delay_span_bug` issued"); + } } impl HandlerInner { |
