+fn mplace_to_const<'tcx>(
+ ecx: &CompileTimeEvalContext<'_, '_, 'tcx>,
+ mplace: MPlaceTy<'tcx>,
+) -> EvalResult<'tcx, ty::Const<'tcx>> {
+ let MemPlace { ptr, align, meta } = *mplace;
+ // extract alloc-offset pair
+ assert!(meta.is_none());
+ let ptr = ptr.to_ptr()?;
+ let alloc = ecx.memory.get(ptr.alloc_id)?;
+ assert!(alloc.align >= align);
+ assert!(alloc.bytes.len() as u64 - ptr.offset.bytes() >= mplace.layout.size.bytes());
+ let mut alloc = alloc.clone();
+ alloc.align = align;
+ // FIXME shouldn't it be the case that `mark_static_initialized` has already
+ // interned this? I thought that is the entire point of that `FinishStatic` stuff?
+ let alloc = ecx.tcx.intern_const_alloc(alloc);
+ let val = ConstValue::ByRef(ptr, alloc);
+ Ok(ty::Const { val, ty: mplace.layout.ty })
+}
+
+fn op_to_const<'tcx>(