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 {
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)
}
}
};

View File

@ -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()
}