rustc_query_system/
values.rs

1use rustc_span::ErrorGuaranteed;
2
3use crate::dep_graph::DepContext;
4use crate::query::CycleError;
5
6pub trait Value<Tcx: DepContext>: Sized {
7    fn from_cycle_error(tcx: Tcx, cycle_error: &CycleError, guar: ErrorGuaranteed) -> Self;
8}
9
10impl<Tcx: DepContext, T> Value<Tcx> for T {
11    default fn from_cycle_error(tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed) -> T {
12        tcx.sess().dcx().abort_if_errors();
13        // Ideally we would use `bug!` here. But bug! is only defined in rustc_middle, and it's
14        // non-trivial to define it earlier.
15        panic!(
16            "<{} as Value>::from_cycle_error called without errors: {:#?}",
17            std::any::type_name::<T>(),
18            cycle_error.cycle,
19        );
20    }
21}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy