diff options
| author | Ralf Jung <post@ralfj.de> | 2021-07-13 08:58:59 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2021-07-14 18:17:49 +0200 |
| commit | 71c166a0dcd0389f943284ed358a3dbee6a0e4a8 (patch) | |
| tree | 55873a86d8c23e47e4a46ed38e68bf444f2ecfd9 /compiler/rustc_middle/src/mir | |
| parent | 626605cea02ee5f512f5efae0cd188ae1a7007c7 (diff) | |
| download | rust-71c166a0dcd0389f943284ed358a3dbee6a0e4a8.tar.gz rust-71c166a0dcd0389f943284ed358a3dbee6a0e4a8.zip | |
use NonZeroU64 for AllocId to restore old type sizes
Diffstat (limited to 'compiler/rustc_middle/src/mir')
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/mod.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/pointer.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/value.rs | 4 |
3 files changed, 6 insertions, 6 deletions
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)] |
