Add DiagCtxt::delayed_bug.
We have `span_delayed_bug` and often pass it a `DUMMY_SP`. This commit adds `delayed_bug`, which matches pairs like `err`/`span_err` and `warn`/`span_warn`.
This commit is contained in:
@@ -14,7 +14,6 @@ use rustc_infer::traits::Normalized;
|
||||
use rustc_middle::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeSuperFoldable};
|
||||
use rustc_middle::ty::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitor};
|
||||
use rustc_span::DUMMY_SP;
|
||||
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
@@ -286,10 +285,8 @@ impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx>
|
||||
// Rustdoc normalizes possibly not well-formed types, so only
|
||||
// treat this as a bug if we're not in rustdoc.
|
||||
if !tcx.sess.opts.actually_rustdoc {
|
||||
tcx.dcx().span_delayed_bug(
|
||||
DUMMY_SP,
|
||||
format!("unexpected ambiguity: {c_data:?} {result:?}"),
|
||||
);
|
||||
tcx.dcx()
|
||||
.delayed_bug(format!("unexpected ambiguity: {c_data:?} {result:?}"));
|
||||
}
|
||||
return Err(NoSolution);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_infer::infer::region_constraints::RegionConstraintData;
|
||||
use rustc_middle::traits::query::NoSolution;
|
||||
use rustc_middle::ty::{TyCtxt, TypeFoldable};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
@@ -88,10 +88,9 @@ where
|
||||
if errors.is_empty() {
|
||||
Ok(value)
|
||||
} else {
|
||||
Err(infcx.dcx().span_delayed_bug(
|
||||
DUMMY_SP,
|
||||
format!("errors selecting obligation during MIR typeck: {errors:?}"),
|
||||
))
|
||||
Err(infcx
|
||||
.dcx()
|
||||
.delayed_bug(format!("errors selecting obligation during MIR typeck: {errors:?}")))
|
||||
}
|
||||
})?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user