rust/compiler/rustc_query_system/src/values.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
579 B
Rust
Raw Normal View History

2022-12-23 13:09:49 +00:00
use crate::dep_graph::{DepContext, DepKind};
2022-08-15 19:11:11 +00:00
use crate::query::QueryInfo;
2022-12-23 13:09:49 +00:00
pub trait Value<Tcx: DepContext, D: DepKind>: Sized {
fn from_cycle_error(tcx: Tcx, cycle: &[QueryInfo<D>]) -> Self;
}
2022-12-23 13:09:49 +00:00
impl<Tcx: DepContext, T, D: DepKind> Value<Tcx, D> for T {
default fn from_cycle_error(tcx: Tcx, _: &[QueryInfo<D>]) -> 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.
panic!("Value::from_cycle_error called without errors");
}
}