diff options
| author | Michael Goulet <michael@errs.io> | 2023-10-26 17:30:53 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-10-26 17:58:02 +0000 |
| commit | 1836c1fbbdf0d6902da9a2d2473dbc72f371eb2e (patch) | |
| tree | 65993066515084f35f49bf7c5349687a1f46f0cb /compiler/rustc_query_system/src | |
| parent | cf226e93dcb0e21e2daa7c26aca0c5b46ff1b646 (diff) | |
| download | rust-1836c1fbbdf0d6902da9a2d2473dbc72f371eb2e.tar.gz rust-1836c1fbbdf0d6902da9a2d2473dbc72f371eb2e.zip | |
Stash and cancel cycle errors for auto trait leakage in opaques
Diffstat (limited to 'compiler/rustc_query_system/src')
| -rw-r--r-- | compiler/rustc_query_system/src/error.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_query_system/src/query/plumbing.rs | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/compiler/rustc_query_system/src/error.rs b/compiler/rustc_query_system/src/error.rs index e49e78cc7c4..5829e17ec16 100644 --- a/compiler/rustc_query_system/src/error.rs +++ b/compiler/rustc_query_system/src/error.rs @@ -15,6 +15,7 @@ pub enum HandleCycleError { Error, Fatal, DelayBug, + Stash, } #[derive(Subdiagnostic)] diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index 69a9c0eb95a..1f3403d09be 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -19,7 +19,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::sync::Lock; #[cfg(parallel_compiler)] use rustc_data_structures::{outline, sync}; -use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed, FatalError}; +use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed, FatalError, StashKey}; use rustc_span::{Span, DUMMY_SP}; use std::cell::Cell; use std::collections::hash_map::Entry; @@ -133,6 +133,17 @@ where let guar = error.delay_as_bug(); query.value_from_cycle_error(*qcx.dep_context(), &cycle_error.cycle, guar) } + Stash => { + let guar = if let Some(root) = cycle_error.cycle.first() + && let Some(span) = root.query.span + { + error.stash(span, StashKey::Cycle); + qcx.dep_context().sess().delay_span_bug(span, "delayed cycle error") + } else { + error.emit() + }; + query.value_from_cycle_error(*qcx.dep_context(), &cycle_error.cycle, guar) + } } } |
