File tree 2 files changed +11
-8
lines changed
2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -558,11 +558,12 @@ pub fn trans_place<'tcx>(
558
558
let base = match & place. base {
559
559
PlaceBase :: Local ( local) => fx. get_local_place ( * local) ,
560
560
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 )
563
563
}
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 )
566
567
}
567
568
}
568
569
} ;
Original file line number Diff line number Diff line change @@ -54,13 +54,14 @@ pub fn codegen_static_ref<'tcx>(
54
54
55
55
pub fn trans_promoted < ' tcx > (
56
56
fx : & mut FunctionCx < ' _ , ' tcx , impl Backend > ,
57
+ instance : Instance < ' tcx > ,
57
58
promoted : Promoted ,
58
59
dest_ty : Ty < ' tcx > ,
59
60
) -> CPlace < ' tcx > {
60
61
match fx
61
62
. tcx
62
63
. const_eval ( ParamEnv :: reveal_all ( ) . and ( GlobalId {
63
- instance : fx . instance ,
64
+ instance,
64
65
promoted : Some ( promoted) ,
65
66
} ) )
66
67
{
@@ -461,10 +462,11 @@ pub fn mir_operand_get_const_val<'tcx>(
461
462
} ;
462
463
463
464
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) ) ;
466
468
fx. tcx . const_eval ( ParamEnv :: reveal_all ( ) . and ( GlobalId {
467
- instance : fx . instance ,
469
+ instance,
468
470
promoted : Some ( * promoted) ,
469
471
} ) ) . unwrap ( )
470
472
}
You can’t perform that action at this time.
0 commit comments