From d8b9387ace8331ce1a61d496c8f3251ac1de6928 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 18 Mar 2019 21:00:52 +0000 Subject: [PATCH] Take ConstValue::Placeholder into account in new locations --- src/librustc/ty/structural_impls.rs | 4 +++- src/librustc_typeck/check/writeback.rs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 3057c529ddf..504b939c5f2 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -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>(&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), diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index f56ef1a0d0c..5d98cb568bd 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -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); } } }