use rustc::mir::interpret::{ConstEvalErr, ErrorHandled};
use rustc::mir;
use rustc::ty::{self, TyCtxt, query::TyCtxtAt};
-use rustc::ty::layout::{self, LayoutOf, VariantIdx, Size};
+use rustc::ty::layout::{self, LayoutOf, VariantIdx};
use rustc::ty::subst::Subst;
use rustc::traits::Reveal;
use rustc::util::common::ErrorReported;
ptr.offset.bytes(),
),
Scalar::Raw { .. } => (
- ecx.tcx.intern_const_alloc(Allocation::from_byte_aligned_bytes(b"", ())),
+ ecx.tcx.intern_const_alloc(Allocation::from_byte_aligned_bytes(
+ b"" as &[u8],
+ )),
0,
),
};
fn find_foreign_static(
_def_id: DefId,
_tcx: TyCtxtAt<'a, 'tcx, 'tcx>,
- _memory_extra: &(),
) -> EvalResult<'tcx, Cow<'tcx, Allocation<Self::PointerTag>>> {
err!(ReadForeignStatic)
}
#[inline(always)]
- fn adjust_static_allocation<'b>(
- alloc: &'b Allocation,
+ fn tag_allocation<'b>(
+ _id: AllocId,
+ alloc: Cow<'b, Allocation>,
+ _kind: Option<MemoryKind<!>>,
_memory_extra: &(),
- ) -> Cow<'b, Allocation<Self::PointerTag>> {
- // We do not use a tag so we can just cheaply forward the reference
- Cow::Borrowed(alloc)
+ ) -> (Cow<'b, Allocation<Self::PointerTag>>, Self::PointerTag) {
+ // We do not use a tag so we can just cheaply forward the allocation
+ (alloc, ())
}
#[inline(always)]
- fn new_allocation(
- _size: Size,
- _extra: &Self::MemoryExtra,
- _kind: MemoryKind<!>,
- ) -> (Self::AllocExtra, Self::PointerTag) {
- ((), ())
+ fn tag_static_base_pointer(
+ _id: AllocId,
+ _memory_extra: &(),
+ ) -> Self::PointerTag {
+ ()
}
fn box_alloc(
}
}
-/// Projects to a field of a (variant of a) const.
+/// Extracts a field of a (variant of a) const.
// this function uses `unwrap` copiously, because an already validated constant must have valid
// fields and can thus never fail outside of compiler bugs
pub fn const_field<'a, 'tcx>(