diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-11-15 14:48:34 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-11-24 11:36:32 +0100 |
| commit | 9d57adf2ba57420903b4c9b4dbb492c3fcf691b8 (patch) | |
| tree | b12b37c7ee83d0b8712c575e1191b4f0cc9d584d /src/librustc/mir | |
| parent | 8b04b098695951f561ef4eedf33c6fbc63728caa (diff) | |
| download | rust-9d57adf2ba57420903b4c9b4dbb492c3fcf691b8.tar.gz rust-9d57adf2ba57420903b4c9b4dbb492c3fcf691b8.zip | |
Explain {read,write}_scalar failure to cope with zsts
Diffstat (limited to 'src/librustc/mir')
| -rw-r--r-- | src/librustc/mir/interpret/allocation.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index b2c44548805..2ecd5eb5a62 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -231,6 +231,11 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> { } /// Read a *non-ZST* scalar + /// + /// zsts can't be read out of two reasons: + /// * byteorder cannot work with zero element buffers + /// * in oder to obtain a `Pointer` we need to check for ZSTness anyway due to integer pointers + /// being valid for ZSTs pub fn read_scalar( &self, cx: &impl HasDataLayout, @@ -274,6 +279,11 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> { } /// Write a *non-ZST* scalar + /// + /// zsts can't be read out of two reasons: + /// * byteorder cannot work with zero element buffers + /// * in oder to obtain a `Pointer` we need to check for ZSTness anyway due to integer pointers + /// being valid for ZSTs pub fn write_scalar( &mut self, cx: &impl HasDataLayout, |
