Take ConstValue::Placeholder into account in new locations

This commit is contained in:
varkor 2019-03-18 21:00:52 +00:00
parent fc16b0a147
commit d8b9387ace
2 changed files with 5 additions and 3 deletions

View File

@ -1355,6 +1355,7 @@ fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
// FIXME(const_generics): implement TypeFoldable for InferConst
ConstValue::Infer(ic) => ConstValue::Infer(ic),
ConstValue::Param(p) => ConstValue::Param(p.fold_with(folder)),
ConstValue::Placeholder(p) => ConstValue::Placeholder(p),
ConstValue::Scalar(a) => ConstValue::Scalar(a),
ConstValue::Slice(a, b) => ConstValue::Slice(a, b),
ConstValue::Unevaluated(did, substs)
@ -1366,8 +1367,9 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
match *self {
ConstValue::ByRef(..) => false,
// FIXME(const_generics): implement TypeFoldable for InferConst
ConstValue::Infer(_ic) => false,
ConstValue::Infer(_) => false,
ConstValue::Param(p) => p.visit_with(visitor),
ConstValue::Placeholder(_) => false,
ConstValue::Scalar(_) => false,
ConstValue::Slice(..) => false,
ConstValue::Unevaluated(_, substs) => substs.visit_with(visitor),

View File

@ -11,7 +11,7 @@
use rustc::ty::adjustment::{Adjust, Adjustment, PointerCast};
use rustc::ty::fold::{BottomUpFolder, TypeFoldable, TypeFolder};
use rustc::ty::subst::UnpackedKind;
use rustc::ty::{self, Ty, TyCtxt, Const};
use rustc::ty::{self, Ty, TyCtxt};
use rustc::mir::interpret::ConstValue;
use rustc::util::nodemap::DefIdSet;
use rustc_data_structures::sync::Lrc;
@ -579,7 +579,7 @@ fn visit_opaque_types(&mut self, span: Span) {
// parameter from the existential type
return self.tcx()
.global_tcx()
.mk_const_param(param.index, param.name, ty);
.mk_const_param(param.index, param.name, ct.ty);
}
}
}