diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-05-19 13:59:44 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-05-19 13:59:44 +0300 |
| commit | 88fa5c6a45a533a78c698a22f4b16002a3bc9fc3 (patch) | |
| tree | 7de7f6bc6d9aa974bbddbe37ab2641290eb3c12e /src/librustc/mir/interpret | |
| parent | e0d2f7462b07039c7327d8331272a804c025b047 (diff) | |
Improve type size assertions
Now they - Tell what the new size is, when it changes - Do not require passing an identifier
Diffstat (limited to 'src/librustc/mir/interpret')
| -rw-r--r-- | src/librustc/mir/interpret/pointer.rs | 2 | ||||
| -rw-r--r-- | src/librustc/mir/interpret/value.rs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc/mir/interpret/pointer.rs b/src/librustc/mir/interpret/pointer.rs index 75e0f704a58..59b7891b90f 100644 --- a/src/librustc/mir/interpret/pointer.rs +++ b/src/librustc/mir/interpret/pointer.rs @@ -78,7 +78,7 @@ pub struct Pointer<Tag=(),Id=AllocId> { pub tag: Tag, } -static_assert!(POINTER_SIZE: ::std::mem::size_of::<Pointer>() == 16); +static_assert_size!(Pointer, 16); /// Produces a `Pointer` which points to the beginning of the Allocation impl From<AllocId> for Pointer { diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs index 7e45568725f..551b86390db 100644 --- a/src/librustc/mir/interpret/value.rs +++ b/src/librustc/mir/interpret/value.rs @@ -54,7 +54,7 @@ pub enum ConstValue<'tcx> { } #[cfg(target_arch = "x86_64")] -static_assert!(CONST_SIZE: ::std::mem::size_of::<ConstValue<'static>>() == 40); +static_assert_size!(ConstValue<'_>, 40); impl<'tcx> ConstValue<'tcx> { #[inline] @@ -111,7 +111,7 @@ pub enum Scalar<Tag=(), Id=AllocId> { } #[cfg(target_arch = "x86_64")] -static_assert!(SCALAR_SIZE: ::std::mem::size_of::<Scalar>() == 24); +static_assert_size!(Scalar, 24); impl<Tag> fmt::Display for Scalar<Tag> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
