fix ICE on type error in promoted

This commit is contained in:
Ralf Jung 2024-12-07 17:22:09 +01:00
parent 9c707a8b76
commit ed8ee39930
25 changed files with 78 additions and 213 deletions

View file

@ -11,7 +11,7 @@ use rustc_hir::{
BodyId, Expr, ExprKind, HirId, Impl, ImplItem, ImplItemKind, Item, ItemKind, Node, TraitItem, TraitItemKind, UnOp,
};
use rustc_lint::{LateContext, LateLintPass, Lint};
use rustc_middle::mir::interpret::{ErrorHandled, EvalToValTreeResult, GlobalId};
use rustc_middle::mir::interpret::{ErrorHandled, EvalToValTreeResult, GlobalId, ReportedErrorInfo};
use rustc_middle::ty::adjustment::Adjust;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_session::impl_lint_pass;
@ -302,7 +302,10 @@ impl<'tcx> NonCopyConst<'tcx> {
tcx.const_eval_global_id_for_typeck(typing_env, cid, span)
},
Ok(None) => Err(ErrorHandled::TooGeneric(span)),
Err(err) => Err(ErrorHandled::Reported(err.into(), span)),
Err(err) => Err(ErrorHandled::Reported(
ReportedErrorInfo::non_const_eval_error(err),
span,
)),
}
}
}