Skip to content

Commit b9dc950

Browse files
committed
Rustup to rustc 1.39.0-nightly (9b91b9c10 2019-08-26)
1 parent e704eb5 commit b9dc950

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/base.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,12 @@ pub fn trans_place<'tcx>(
558558
let base = match &place.base {
559559
PlaceBase::Local(local) => fx.get_local_place(*local),
560560
PlaceBase::Static(static_) => match static_.kind {
561-
StaticKind::Static(def_id) => {
562-
crate::constant::codegen_static_ref(fx, def_id, static_.ty)
561+
StaticKind::Static => {
562+
crate::constant::codegen_static_ref(fx, static_.def_id, static_.ty)
563563
}
564-
StaticKind::Promoted(promoted) => {
565-
crate::constant::trans_promoted(fx, promoted, static_.ty)
564+
StaticKind::Promoted(promoted, substs) => {
565+
let instance = Instance::new(static_.def_id, fx.monomorphize(&substs));
566+
crate::constant::trans_promoted(fx, instance, promoted, static_.ty)
566567
}
567568
}
568569
};

src/constant.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ pub fn codegen_static_ref<'tcx>(
5454

5555
pub fn trans_promoted<'tcx>(
5656
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
57+
instance: Instance<'tcx>,
5758
promoted: Promoted,
5859
dest_ty: Ty<'tcx>,
5960
) -> CPlace<'tcx> {
6061
match fx
6162
.tcx
6263
.const_eval(ParamEnv::reveal_all().and(GlobalId {
63-
instance: fx.instance,
64+
instance,
6465
promoted: Some(promoted),
6566
}))
6667
{
@@ -461,10 +462,11 @@ pub fn mir_operand_get_const_val<'tcx>(
461462
};
462463

463464
Some(match &static_.kind {
464-
StaticKind::Static(_) => unimplemented!(),
465-
StaticKind::Promoted(promoted) => {
465+
StaticKind::Static => unimplemented!(),
466+
StaticKind::Promoted(promoted, substs) => {
467+
let instance = Instance::new(static_.def_id, fx.monomorphize(substs));
466468
fx.tcx.const_eval(ParamEnv::reveal_all().and(GlobalId {
467-
instance: fx.instance,
469+
instance,
468470
promoted: Some(*promoted),
469471
})).unwrap()
470472
}

0 commit comments

Comments
 (0)