@@ -116,12 +116,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
116
116
size : Size ,
117
117
allow_ptr_and_undef : bool ,
118
118
) -> EvalResult < ' tcx > {
119
- // Empty accesses don't need to be valid pointers, but they should still be non-NULL
120
119
let align = Align :: from_bytes ( 1 ) . unwrap ( ) ;
121
- if size. bytes ( ) == 0 {
122
- self . check_align ( ptr, align) ?;
123
- return Ok ( ( ) ) ;
124
- }
125
120
// Check bounds, align and relocations on the edges
126
121
self . get_bytes_with_undef_and_ptr ( cx, ptr, size, align) ?;
127
122
// Check undef and ptr
@@ -138,12 +133,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
138
133
ptr : Pointer < Tag > ,
139
134
size : Size ,
140
135
) -> EvalResult < ' tcx , & [ u8 ] > {
141
- // Empty accesses don't need to be valid pointers, but they should still be non-NULL
142
136
let align = Align :: from_bytes ( 1 ) . unwrap ( ) ;
143
- if size. bytes ( ) == 0 {
144
- self . check_align ( ptr, align) ?;
145
- return Ok ( & [ ] ) ;
146
- }
147
137
self . get_bytes ( cx, ptr, size, align)
148
138
}
149
139
@@ -153,12 +143,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
153
143
ptr : Pointer < Tag > ,
154
144
src : & [ u8 ] ,
155
145
) -> EvalResult < ' tcx > {
156
- // Empty accesses don't need to be valid pointers, but they should still be non-NULL
157
146
let align = Align :: from_bytes ( 1 ) . unwrap ( ) ;
158
- if src. is_empty ( ) {
159
- self . check_align ( ptr, align) ?;
160
- return Ok ( ( ) ) ;
161
- }
162
147
let bytes = self . get_bytes_mut (
163
148
cx, ptr, Size :: from_bytes ( src. len ( ) as u64 ) , align,
164
149
) ?;
@@ -173,12 +158,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
173
158
val : u8 ,
174
159
count : Size
175
160
) -> EvalResult < ' tcx > {
176
- // Empty accesses don't need to be valid pointers, but they should still be non-NULL
177
161
let align = Align :: from_bytes ( 1 ) . unwrap ( ) ;
178
- if count. bytes ( ) == 0 {
179
- self . check_align ( ptr, align) ?;
180
- return Ok ( ( ) ) ;
181
- }
182
162
let bytes = self . get_bytes_mut ( cx, ptr, count, align) ?;
183
163
for b in bytes {
184
164
* b = val;
@@ -329,7 +309,6 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
329
309
align : Align ,
330
310
check_defined_and_ptr : bool ,
331
311
) -> EvalResult < ' tcx , & [ u8 ] > {
332
- assert_ne ! ( size. bytes( ) , 0 , "0-sized accesses should never even get a `Pointer`" ) ;
333
312
self . check_align ( ptr. into ( ) , align) ?;
334
313
self . check_bounds ( cx, ptr, size) ?;
335
314
0 commit comments