use NonZeroU64 for AllocId to restore old type sizes
This commit is contained in:
parent
626605cea0
commit
71c166a0dc
6 changed files with 14 additions and 13 deletions
|
@ -49,6 +49,7 @@
|
|||
#![feature(iter_zip)]
|
||||
#![feature(thread_local_const_init)]
|
||||
#![feature(try_reserve)]
|
||||
#![feature(nonzero_ops)]
|
||||
#![recursion_limit = "512"]
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -99,7 +99,7 @@ use std::convert::TryFrom;
|
|||
use std::fmt;
|
||||
use std::io;
|
||||
use std::io::{Read, Write};
|
||||
use std::num::NonZeroU32;
|
||||
use std::num::{NonZeroU32, NonZeroU64};
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
|
||||
use rustc_ast::LitKind;
|
||||
|
@ -177,7 +177,7 @@ pub enum LitToConstError {
|
|||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
pub struct AllocId(pub u64);
|
||||
pub struct AllocId(pub NonZeroU64);
|
||||
|
||||
// We want the `Debug` output to be readable as it is used by `derive(Debug)` for
|
||||
// all the Miri types.
|
||||
|
@ -428,7 +428,7 @@ crate struct AllocMap<'tcx> {
|
|||
|
||||
impl<'tcx> AllocMap<'tcx> {
|
||||
crate fn new() -> Self {
|
||||
AllocMap { alloc_map: Default::default(), dedup: Default::default(), next_id: AllocId(0) }
|
||||
AllocMap { alloc_map: Default::default(), dedup: Default::default(), next_id: AllocId(NonZeroU64::new(1).unwrap()) }
|
||||
}
|
||||
fn reserve(&mut self) -> AllocId {
|
||||
let next = self.next_id;
|
||||
|
|
|
@ -135,7 +135,7 @@ pub struct Pointer<Tag = AllocId> {
|
|||
pub provenance: Tag,
|
||||
}
|
||||
|
||||
//FIXME static_assert_size!(Pointer, 16);
|
||||
static_assert_size!(Pointer, 16);
|
||||
|
||||
// We want the `Debug` output to be readable as it is used by `derive(Debug)` for
|
||||
// all the Miri types.
|
||||
|
|
|
@ -136,7 +136,7 @@ pub enum Scalar<Tag = AllocId> {
|
|||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
//FIXME static_assert_size!(Scalar, 24);
|
||||
static_assert_size!(Scalar, 24);
|
||||
|
||||
// We want the `Debug` output to be readable as it is used by `derive(Debug)` for
|
||||
// all the Miri types.
|
||||
|
@ -522,7 +522,7 @@ pub enum ScalarMaybeUninit<Tag = AllocId> {
|
|||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
//FIXME static_assert_size!(ScalarMaybeUninit, 24);
|
||||
static_assert_size!(ScalarMaybeUninit, 24);
|
||||
|
||||
impl<Tag> From<Scalar<Tag>> for ScalarMaybeUninit<Tag> {
|
||||
#[inline(always)]
|
||||
|
|
|
@ -34,7 +34,7 @@ pub enum Immediate<Tag = AllocId> {
|
|||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
//FIXME rustc_data_structures::static_assert_size!(Immediate, 56);
|
||||
rustc_data_structures::static_assert_size!(Immediate, 56);
|
||||
|
||||
impl<Tag: Provenance> std::fmt::Debug for Immediate<Tag> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
|
@ -100,7 +100,7 @@ pub struct ImmTy<'tcx, Tag = AllocId> {
|
|||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
//FIXME rustc_data_structures::static_assert_size!(ImmTy<'_>, 72);
|
||||
rustc_data_structures::static_assert_size!(ImmTy<'_>, 72);
|
||||
|
||||
impl<'tcx, Tag: Provenance> std::fmt::Debug for ImmTy<'tcx, Tag> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
|
|
|
@ -34,7 +34,7 @@ pub enum MemPlaceMeta<Tag = AllocId> {
|
|||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
//FIXME rustc_data_structures::static_assert_size!(MemPlaceMeta, 24);
|
||||
rustc_data_structures::static_assert_size!(MemPlaceMeta, 24);
|
||||
|
||||
impl<Tag: Provenance> std::fmt::Debug for MemPlaceMeta<Tag> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
|
@ -87,7 +87,7 @@ pub struct MemPlace<Tag = AllocId> {
|
|||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
//FIXME rustc_data_structures::static_assert_size!(MemPlace, 56);
|
||||
rustc_data_structures::static_assert_size!(MemPlace, 48);
|
||||
|
||||
impl<Tag: Provenance> std::fmt::Debug for MemPlace<Tag> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
|
@ -111,7 +111,7 @@ pub enum Place<Tag = AllocId> {
|
|||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
//FIXME rustc_data_structures::static_assert_size!(Place, 64);
|
||||
rustc_data_structures::static_assert_size!(Place, 56);
|
||||
|
||||
impl<Tag: Provenance> std::fmt::Debug for Place<Tag> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
|
@ -132,7 +132,7 @@ pub struct PlaceTy<'tcx, Tag = AllocId> {
|
|||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
//FIXME rustc_data_structures::static_assert_size!(PlaceTy<'_>, 80);
|
||||
rustc_data_structures::static_assert_size!(PlaceTy<'_>, 72);
|
||||
|
||||
impl<'tcx, Tag: Provenance> std::fmt::Debug for PlaceTy<'tcx, Tag> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
|
@ -157,7 +157,7 @@ pub struct MPlaceTy<'tcx, Tag = AllocId> {
|
|||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
//FIXME rustc_data_structures::static_assert_size!(MPlaceTy<'_>, 72);
|
||||
rustc_data_structures::static_assert_size!(MPlaceTy<'_>, 64);
|
||||
|
||||
impl<'tcx, Tag: Provenance> std::fmt::Debug for MPlaceTy<'tcx, Tag> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
|
|
Loading…
Add table
Reference in a new issue