implement valtrees as the type-system representation for constant values
This commit is contained in:
parent
edab34ab2a
commit
705d818bd5
116 changed files with 1606 additions and 1032 deletions
|
@ -636,13 +636,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
let evaluate = |c: ty::Const<'tcx>| {
|
||||
if let ty::ConstKind::Unevaluated(unevaluated) = c.kind() {
|
||||
self.infcx
|
||||
.const_eval_resolve(
|
||||
obligation.param_env,
|
||||
unevaluated,
|
||||
Some(obligation.cause.span),
|
||||
)
|
||||
.map(|val| ty::Const::from_value(self.tcx(), val, c.ty()))
|
||||
match self.infcx.try_const_eval_resolve(
|
||||
obligation.param_env,
|
||||
unevaluated,
|
||||
c.ty(),
|
||||
Some(obligation.cause.span),
|
||||
) {
|
||||
Ok(val) => Ok(val),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
} else {
|
||||
Ok(c)
|
||||
}
|
||||
|
@ -2576,7 +2578,11 @@ impl<'o, 'tcx> TraitObligationStackList<'o, 'tcx> {
|
|||
}
|
||||
|
||||
fn depth(&self) -> usize {
|
||||
if let Some(head) = self.head { head.depth } else { 0 }
|
||||
if let Some(head) = self.head {
|
||||
head.depth
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue