don't convert valtree to constvalue during normalization
This commit is contained in:
parent
b79b7d8b4e
commit
a9e657dbfc
1 changed files with 1 additions and 19 deletions
|
@ -351,25 +351,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
|
||||||
&mut self,
|
&mut self,
|
||||||
constant: mir::ConstantKind<'tcx>,
|
constant: mir::ConstantKind<'tcx>,
|
||||||
) -> Result<mir::ConstantKind<'tcx>, Self::Error> {
|
) -> Result<mir::ConstantKind<'tcx>, Self::Error> {
|
||||||
Ok(match constant {
|
constant.try_super_fold_with(self)
|
||||||
mir::ConstantKind::Ty(c) => {
|
|
||||||
let const_folded = c.try_super_fold_with(self)?;
|
|
||||||
match const_folded.kind() {
|
|
||||||
ty::ConstKind::Value(valtree) => {
|
|
||||||
let tcx = self.infcx.tcx;
|
|
||||||
let ty = const_folded.ty();
|
|
||||||
let const_val = tcx.valtree_to_const_val((ty, valtree));
|
|
||||||
debug!(?ty, ?valtree, ?const_val);
|
|
||||||
|
|
||||||
mir::ConstantKind::Val(const_val, ty)
|
|
||||||
}
|
|
||||||
_ => mir::ConstantKind::Ty(const_folded),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mir::ConstantKind::Val(_, _) | mir::ConstantKind::Unevaluated(..) => {
|
|
||||||
constant.try_super_fold_with(self)?
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue