From b9dc950a11509deadf2fa7bf6936184fe6113f4c Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Tue, 27 Aug 2019 11:01:36 +0200 Subject: [PATCH] Rustup to rustc 1.39.0-nightly (9b91b9c10 2019-08-26) --- src/base.rs | 9 +++++---- src/constant.rs | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/base.rs b/src/base.rs index 54db738031fe..3f0892a315ec 100644 --- a/src/base.rs +++ b/src/base.rs @@ -558,11 +558,12 @@ pub fn trans_place<'tcx>( let base = match &place.base { PlaceBase::Local(local) => fx.get_local_place(*local), PlaceBase::Static(static_) => match static_.kind { - StaticKind::Static(def_id) => { - crate::constant::codegen_static_ref(fx, def_id, static_.ty) + StaticKind::Static => { + crate::constant::codegen_static_ref(fx, static_.def_id, static_.ty) } - StaticKind::Promoted(promoted) => { - crate::constant::trans_promoted(fx, promoted, static_.ty) + StaticKind::Promoted(promoted, substs) => { + let instance = Instance::new(static_.def_id, fx.monomorphize(&substs)); + crate::constant::trans_promoted(fx, instance, promoted, static_.ty) } } }; diff --git a/src/constant.rs b/src/constant.rs index d1e09cb52399..daec74344657 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -54,13 +54,14 @@ pub fn codegen_static_ref<'tcx>( pub fn trans_promoted<'tcx>( fx: &mut FunctionCx<'_, 'tcx, impl Backend>, + instance: Instance<'tcx>, promoted: Promoted, dest_ty: Ty<'tcx>, ) -> CPlace<'tcx> { match fx .tcx .const_eval(ParamEnv::reveal_all().and(GlobalId { - instance: fx.instance, + instance, promoted: Some(promoted), })) { @@ -461,10 +462,11 @@ pub fn mir_operand_get_const_val<'tcx>( }; Some(match &static_.kind { - StaticKind::Static(_) => unimplemented!(), - StaticKind::Promoted(promoted) => { + StaticKind::Static => unimplemented!(), + StaticKind::Promoted(promoted, substs) => { + let instance = Instance::new(static_.def_id, fx.monomorphize(substs)); fx.tcx.const_eval(ParamEnv::reveal_all().and(GlobalId { - instance: fx.instance, + instance, promoted: Some(*promoted), })).unwrap() }