1 use crate::dep_graph::DepContext;
2 use crate::query::QueryInfo;
4 pub trait Value<CTX: DepContext>: Sized {
5 fn from_cycle_error(tcx: CTX, cycle: &[QueryInfo]) -> Self;
8 impl<CTX: DepContext, T> Value<CTX> for T {
9 default fn from_cycle_error(tcx: CTX, _: &[QueryInfo]) -> T {
10 tcx.sess().abort_if_errors();
11 // Ideally we would use `bug!` here. But bug! is only defined in rustc_middle, and it's
12 // non-trivial to define it earlier.
13 panic!("Value::from_cycle_error called without errors");