Pass ErrorGuaranteed to cycle error
This commit is contained in:
parent
668bf8c593
commit
e7b3c94b0e
7 changed files with 59 additions and 24 deletions
|
@ -8,6 +8,7 @@ use crate::query::DepNodeIndex;
|
|||
use crate::query::{QueryContext, QueryInfo, QueryState};
|
||||
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_span::ErrorGuaranteed;
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
|
||||
|
@ -57,6 +58,7 @@ pub trait QueryConfig<Qcx: QueryContext>: Copy {
|
|||
self,
|
||||
tcx: Qcx::DepContext,
|
||||
cycle: &[QueryInfo<Qcx::DepKind>],
|
||||
guar: ErrorGuaranteed,
|
||||
) -> Self::Value;
|
||||
|
||||
fn anon(self) -> bool;
|
||||
|
|
|
@ -148,8 +148,8 @@ where
|
|||
use HandleCycleError::*;
|
||||
match query.handle_cycle_error() {
|
||||
Error => {
|
||||
error.emit();
|
||||
query.value_from_cycle_error(*qcx.dep_context(), &cycle_error.cycle)
|
||||
let guar = error.emit();
|
||||
query.value_from_cycle_error(*qcx.dep_context(), &cycle_error.cycle, guar)
|
||||
}
|
||||
Fatal => {
|
||||
error.emit();
|
||||
|
@ -157,8 +157,8 @@ where
|
|||
unreachable!()
|
||||
}
|
||||
DelayBug => {
|
||||
error.delay_as_bug();
|
||||
query.value_from_cycle_error(*qcx.dep_context(), &cycle_error.cycle)
|
||||
let guar = error.delay_as_bug();
|
||||
query.value_from_cycle_error(*qcx.dep_context(), &cycle_error.cycle, guar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
use rustc_span::ErrorGuaranteed;
|
||||
|
||||
use crate::dep_graph::{DepContext, DepKind};
|
||||
use crate::query::QueryInfo;
|
||||
|
||||
pub trait Value<Tcx: DepContext, D: DepKind>: Sized {
|
||||
fn from_cycle_error(tcx: Tcx, cycle: &[QueryInfo<D>]) -> Self;
|
||||
fn from_cycle_error(tcx: Tcx, cycle: &[QueryInfo<D>], guar: ErrorGuaranteed) -> Self;
|
||||
}
|
||||
|
||||
impl<Tcx: DepContext, T, D: DepKind> Value<Tcx, D> for T {
|
||||
default fn from_cycle_error(tcx: Tcx, cycle: &[QueryInfo<D>]) -> T {
|
||||
default fn from_cycle_error(tcx: Tcx, cycle: &[QueryInfo<D>], _guar: ErrorGuaranteed) -> T {
|
||||
tcx.sess().abort_if_errors();
|
||||
// Ideally we would use `bug!` here. But bug! is only defined in rustc_middle, and it's
|
||||
// non-trivial to define it earlier.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue