]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_query_system/src/values.rs
Auto merge of #103591 - lqd:win-lto, r=Mark-Simulacrum
[rust.git] / compiler / rustc_query_system / src / values.rs
1 use crate::dep_graph::DepContext;
2 use crate::query::QueryInfo;
3
4 pub trait Value<Tcx: DepContext>: Sized {
5     fn from_cycle_error(tcx: Tcx, cycle: &[QueryInfo]) -> Self;
6 }
7
8 impl<Tcx: DepContext, T> Value<Tcx> for T {
9     default fn from_cycle_error(tcx: Tcx, _: &[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");
14     }
15 }