Migrate rustc_ty_utils to use SessionDiagnostic
This commit is contained in:
parent
8a13871b69
commit
01c1616b25
8 changed files with 209 additions and 95 deletions
|
@ -9,6 +9,8 @@ use rustc_middle::ty::{self, EarlyBinder, Ty, TyCtxt};
|
|||
use rustc_session::Limit;
|
||||
use rustc_span::{sym, DUMMY_SP};
|
||||
|
||||
use crate::errors::NeedsDropOverflow;
|
||||
|
||||
type NeedsDropResult<T> = Result<T, AlwaysRequiresDrop>;
|
||||
|
||||
fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
|
||||
|
@ -90,10 +92,7 @@ where
|
|||
if !self.recursion_limit.value_within_limit(level) {
|
||||
// Not having a `Span` isn't great. But there's hopefully some other
|
||||
// recursion limit error as well.
|
||||
tcx.sess.span_err(
|
||||
DUMMY_SP,
|
||||
&format!("overflow while checking whether `{}` requires drop", self.query_ty),
|
||||
);
|
||||
tcx.sess.emit_err(NeedsDropOverflow { query_ty: self.query_ty });
|
||||
return Some(Err(AlwaysRequiresDrop));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue