stall on on constants that contain infer vars in const_eval_resolve
This commit is contained in:
parent
47f78a2487
commit
ac0458a597
1 changed files with 8 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
use super::{ErrorHandled, EvalToConstValueResult, GlobalId};
|
||||
|
||||
use crate::mir;
|
||||
use crate::ty::fold::TypeFoldable;
|
||||
use crate::ty::subst::InternalSubsts;
|
||||
use crate::ty::{self, TyCtxt};
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
@ -38,6 +39,13 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
ct: ty::Unevaluated<'tcx>,
|
||||
span: Option<Span>,
|
||||
) -> EvalToConstValueResult<'tcx> {
|
||||
// Cannot resolve `Unevaluated` constants that contain inference
|
||||
// variables. We reject those here since `resolve_opt_const_arg`
|
||||
// would fail otherwise
|
||||
if ct.substs.has_infer_types_or_consts() {
|
||||
return Err(ErrorHandled::TooGeneric);
|
||||
}
|
||||
|
||||
match ty::Instance::resolve_opt_const_arg(self, param_env, ct.def, ct.substs) {
|
||||
Ok(Some(instance)) => {
|
||||
let cid = GlobalId { instance, promoted: ct.promoted };
|
||||
|
|
Loading…
Add table
Reference in a new issue