make ConstEvaluatable
more strict
This commit is contained in:
parent
7bc0bf7254
commit
c81935e6df
11 changed files with 133 additions and 26 deletions
|
@ -10,6 +10,7 @@ use rustc_middle::ty::ToPredicate;
|
|||
use rustc_middle::ty::{self, Binder, Const, Ty, TypeFoldable};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use super::const_evaluatable;
|
||||
use super::project;
|
||||
use super::select::SelectionContext;
|
||||
use super::wf;
|
||||
|
@ -458,16 +459,17 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
|
|||
}
|
||||
|
||||
ty::PredicateAtom::ConstEvaluatable(def_id, substs) => {
|
||||
match self.selcx.infcx().const_eval_resolve(
|
||||
obligation.param_env,
|
||||
const_evaluatable::is_const_evaluatable(
|
||||
self.selcx.infcx(),
|
||||
def_id,
|
||||
substs,
|
||||
None,
|
||||
Some(obligation.cause.span),
|
||||
) {
|
||||
Ok(_) => ProcessResult::Changed(vec![]),
|
||||
Err(err) => ProcessResult::Error(CodeSelectionError(ConstEvalFailure(err))),
|
||||
}
|
||||
obligation.param_env,
|
||||
obligation.cause.span,
|
||||
)
|
||||
.map_or_else(
|
||||
|e| ProcessResult::Error(CodeSelectionError(ConstEvalFailure(e))),
|
||||
|()| ProcessResult::Changed(vec![]),
|
||||
)
|
||||
}
|
||||
|
||||
ty::PredicateAtom::ConstEquate(c1, c2) => {
|
||||
|
|
|
@ -7,6 +7,7 @@ pub mod auto_trait;
|
|||
mod chalk_fulfill;
|
||||
pub mod codegen;
|
||||
mod coherence;
|
||||
mod const_evaluatable;
|
||||
mod engine;
|
||||
pub mod error_reporting;
|
||||
mod fulfill;
|
||||
|
|
|
@ -6,6 +6,7 @@ use self::EvaluationResult::*;
|
|||
use self::SelectionCandidate::*;
|
||||
|
||||
use super::coherence::{self, Conflict};
|
||||
use super::const_evaluatable;
|
||||
use super::project;
|
||||
use super::project::normalize_with_depth_to;
|
||||
use super::util;
|
||||
|
@ -542,17 +543,18 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
}
|
||||
|
||||
ty::PredicateAtom::ConstEvaluatable(def_id, substs) => {
|
||||
match self.tcx().const_eval_resolve(
|
||||
obligation.param_env,
|
||||
const_evaluatable::is_const_evaluatable(
|
||||
self.infcx,
|
||||
def_id,
|
||||
substs,
|
||||
None,
|
||||
None,
|
||||
) {
|
||||
Ok(_) => Ok(EvaluatedToOk),
|
||||
Err(ErrorHandled::TooGeneric) => Ok(EvaluatedToAmbig),
|
||||
Err(_) => Ok(EvaluatedToErr),
|
||||
}
|
||||
obligation.param_env,
|
||||
obligation.cause.span,
|
||||
)
|
||||
.map(|()| EvaluatedToOk)
|
||||
.or_else(|e| match e {
|
||||
ErrorHandled::TooGeneric => Ok(EvaluatedToAmbig),
|
||||
_ => Ok(EvaluatedToErr),
|
||||
})
|
||||
}
|
||||
|
||||
ty::PredicateAtom::ConstEquate(c1, c2) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue