Add Ty
to ConstKind::Value
This commit is contained in:
parent
58feec9b85
commit
a9702a6668
30 changed files with 180 additions and 186 deletions
|
@ -1040,8 +1040,13 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
|
|||
) -> Option<ty::Const<'tcx>> {
|
||||
use rustc_middle::mir::interpret::ErrorHandled;
|
||||
match self.infcx.const_eval_resolve(param_env, unevaluated, DUMMY_SP) {
|
||||
// THISPR
|
||||
Ok(Some(val)) => Some(ty::Const::new_value(self.interner(), val, todo!())),
|
||||
Ok(Some(val)) => Some(ty::Const::new_value(
|
||||
self.interner(),
|
||||
val,
|
||||
self.interner()
|
||||
.type_of(unevaluated.def)
|
||||
.instantiate(self.interner(), unevaluated.args),
|
||||
)),
|
||||
Ok(None) | Err(ErrorHandled::TooGeneric(_)) => None,
|
||||
Err(ErrorHandled::Reported(e, _)) => {
|
||||
Some(ty::Const::new_error(self.interner(), e.into()))
|
||||
|
|
|
@ -178,7 +178,9 @@ impl<'a, 'tcx> EvalCtxt<'a, InferCtxt<'tcx>> {
|
|||
ty::ConstKind::Infer(_) => {
|
||||
self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
|
||||
}
|
||||
ty::ConstKind::Placeholder(_) | ty::ConstKind::Value(_) | ty::ConstKind::Error(_) => {
|
||||
ty::ConstKind::Placeholder(_)
|
||||
| ty::ConstKind::Value(_, _)
|
||||
| ty::ConstKind::Error(_) => {
|
||||
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
|
||||
}
|
||||
// We can freely ICE here as:
|
||||
|
|
|
@ -765,8 +765,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
unevaluated,
|
||||
obligation.cause.span,
|
||||
) {
|
||||
// THISPR
|
||||
Ok(Some(valtree)) => Ok(ty::Const::new_value(selcx.tcx(),valtree, todo!())),
|
||||
Ok(Some(valtree)) => Ok(ty::Const::new_value(selcx.tcx(),valtree, self.tcx.type_of(unevaluated.def).instantiate(self.tcx, unevaluated.args))),
|
||||
Ok(None) => {
|
||||
let tcx = self.tcx;
|
||||
let reported =
|
||||
|
|
|
@ -34,7 +34,7 @@ pub fn is_const_evaluatable<'tcx>(
|
|||
ty::ConstKind::Param(_)
|
||||
| ty::ConstKind::Bound(_, _)
|
||||
| ty::ConstKind::Placeholder(_)
|
||||
| ty::ConstKind::Value(_)
|
||||
| ty::ConstKind::Value(_, _)
|
||||
| ty::ConstKind::Error(_) => return Ok(()),
|
||||
ty::ConstKind::Infer(_) => return Err(NotConstEvaluatable::MentionsInfer),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue