1
Fork 0

Rustup to rustc 1.39.0-nightly (9b91b9c10 2019-08-26)

This commit is contained in:
bjorn3 2019-08-27 11:01:36 +02:00
parent e704eb5259
commit b9dc950a11
2 changed files with 11 additions and 8 deletions

View file

@ -558,11 +558,12 @@ pub fn trans_place<'tcx>(
let base = match &place.base { let base = match &place.base {
PlaceBase::Local(local) => fx.get_local_place(*local), PlaceBase::Local(local) => fx.get_local_place(*local),
PlaceBase::Static(static_) => match static_.kind { PlaceBase::Static(static_) => match static_.kind {
StaticKind::Static(def_id) => { StaticKind::Static => {
crate::constant::codegen_static_ref(fx, def_id, static_.ty) crate::constant::codegen_static_ref(fx, static_.def_id, static_.ty)
} }
StaticKind::Promoted(promoted) => { StaticKind::Promoted(promoted, substs) => {
crate::constant::trans_promoted(fx, promoted, static_.ty) let instance = Instance::new(static_.def_id, fx.monomorphize(&substs));
crate::constant::trans_promoted(fx, instance, promoted, static_.ty)
} }
} }
}; };

View file

@ -54,13 +54,14 @@ pub fn codegen_static_ref<'tcx>(
pub fn trans_promoted<'tcx>( pub fn trans_promoted<'tcx>(
fx: &mut FunctionCx<'_, 'tcx, impl Backend>, fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
instance: Instance<'tcx>,
promoted: Promoted, promoted: Promoted,
dest_ty: Ty<'tcx>, dest_ty: Ty<'tcx>,
) -> CPlace<'tcx> { ) -> CPlace<'tcx> {
match fx match fx
.tcx .tcx
.const_eval(ParamEnv::reveal_all().and(GlobalId { .const_eval(ParamEnv::reveal_all().and(GlobalId {
instance: fx.instance, instance,
promoted: Some(promoted), promoted: Some(promoted),
})) }))
{ {
@ -461,10 +462,11 @@ pub fn mir_operand_get_const_val<'tcx>(
}; };
Some(match &static_.kind { Some(match &static_.kind {
StaticKind::Static(_) => unimplemented!(), StaticKind::Static => unimplemented!(),
StaticKind::Promoted(promoted) => { StaticKind::Promoted(promoted, substs) => {
let instance = Instance::new(static_.def_id, fx.monomorphize(substs));
fx.tcx.const_eval(ParamEnv::reveal_all().and(GlobalId { fx.tcx.const_eval(ParamEnv::reveal_all().and(GlobalId {
instance: fx.instance, instance,
promoted: Some(*promoted), promoted: Some(*promoted),
})).unwrap() })).unwrap()
} }