rustc_middle/util/bug.rs
1use crate::ty::TyCtxt;
2
3/// A query to trigger a delayed bug. Clearly, if one has a `tcx` one can already trigger a
4/// delayed bug, so what is the point of this? It exists to help us test the interaction of delayed
5/// bugs with the query system and incremental.
6pub fn trigger_delayed_bug(tcx: TyCtxt<'_>, key: rustc_hir::def_id::DefId) {
7 tcx.dcx().span_delayed_bug(
8 tcx.def_span(key),
9 "delayed bug triggered by #[rustc_delayed_bug_from_inside_query]",
10 );
11}
12
13pub fn provide(providers: &mut crate::query::Providers) {
14 *providers = crate::query::Providers { trigger_delayed_bug, ..*providers };
15}