about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2021-07-13 08:58:59 +0200
committerRalf Jung <post@ralfj.de>2021-07-14 18:17:49 +0200
commit71c166a0dcd0389f943284ed358a3dbee6a0e4a8 (patch)
tree55873a86d8c23e47e4a46ed38e68bf444f2ecfd9
parent626605cea02ee5f512f5efae0cd188ae1a7007c7 (diff)
downloadrust-71c166a0dcd0389f943284ed358a3dbee6a0e4a8.tar.gz
rust-71c166a0dcd0389f943284ed358a3dbee6a0e4a8.zip
use NonZeroU64 for AllocId to restore old type sizes
-rw-r--r--compiler/rustc_middle/src/lib.rs1
-rw-r--r--compiler/rustc_middle/src/mir/interpret/mod.rs6
-rw-r--r--compiler/rustc_middle/src/mir/interpret/pointer.rs2
-rw-r--r--compiler/rustc_middle/src/mir/interpret/value.rs4
-rw-r--r--compiler/rustc_mir/src/interpret/operand.rs4
-rw-r--r--compiler/rustc_mir/src/interpret/place.rs10
6 files changed, 14 insertions, 13 deletions
diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs
index 57f507290e8..f2acc601d4f 100644
--- a/compiler/rustc_middle/src/lib.rs
+++ b/compiler/rustc_middle/src/lib.rs
@@ -49,6 +49,7 @@
 #![feature(iter_zip)]
 #![feature(thread_local_const_init)]
 #![feature(try_reserve)]
+#![feature(nonzero_ops)]
 #![recursion_limit = "512"]
 
 #[macro_use]
diff --git a/compiler/rustc_middle/src/mir/interpret/mod.rs b/compiler/rustc_middle/src/mir/interpret/mod.rs
index 44fa94c89c5..86bd35003bb 100644
--- a/compiler/rustc_middle/src/mir/interpret/mod.rs
+++ b/compiler/rustc_middle/src/mir/interpret/mod.rs
@@ -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;
diff --git a/compiler/rustc_middle/src/mir/interpret/pointer.rs b/compiler/rustc_middle/src/mir/interpret/pointer.rs
index 3d6ee49a19e..a95e39e1811 100644
--- a/compiler/rustc_middle/src/mir/interpret/pointer.rs
+++ b/compiler/rustc_middle/src/mir/interpret/pointer.rs
@@ -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.
diff --git a/compiler/rustc_middle/src/mir/interpret/value.rs b/compiler/rustc_middle/src/mir/interpret/value.rs
index 831a4d33ca2..bb6f1bb21c6 100644
--- a/compiler/rustc_middle/src/mir/interpret/value.rs
+++ b/compiler/rustc_middle/src/mir/interpret/value.rs
@@ -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)]
diff --git a/compiler/rustc_mir/src/interpret/operand.rs b/compiler/rustc_mir/src/interpret/operand.rs
index e10f4fb7ff9..fefda32bfe6 100644
--- a/compiler/rustc_mir/src/interpret/operand.rs
+++ b/compiler/rustc_mir/src/interpret/operand.rs
@@ -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 {
diff --git a/compiler/rustc_mir/src/interpret/place.rs b/compiler/rustc_mir/src/interpret/place.rs
index 040262c5dc6..5e35a83a5b9 100644
--- a/compiler/rustc_mir/src/interpret/place.rs
+++ b/compiler/rustc_mir/src/interpret/place.rs
@@ -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 {