From 8d2db1b75d445263d63b002dd1df502e18cd3d65 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Wed, 18 Dec 2019 20:41:07 +0100 Subject: [PATCH] Monomorphize type of promoted --- src/base.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/base.rs b/src/base.rs index 00e5d965d94..68f9bc342b0 100644 --- a/src/base.rs +++ b/src/base.rs @@ -616,11 +616,13 @@ pub fn trans_place<'tcx>( PlaceBase::Local(local) => fx.get_local_place(*local), PlaceBase::Static(static_) => match static_.kind { StaticKind::Static => { + // Statics can't be generic, so `static_.ty` doesn't need to be monomorphized. crate::constant::codegen_static_ref(fx, static_.def_id, 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) + let ty = fx.monomorphize(&static_.ty); + crate::constant::trans_promoted(fx, instance, promoted, ty) } }, };