Skip to content

Commit 44bef25

Browse files
committed
allocating memory for floats can fail, too
1 parent 9669acc commit 44bef25

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/interpreter/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,12 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
183183
}
184184
match *const_val {
185185
Float(ConstFloat::F32(f)) => {
186-
let ptr = self.memory.allocate(4);
186+
let ptr = self.memory.allocate(4)?;
187187
self.memory.write_f32(ptr, f)?;
188188
Ok(ptr)
189189
},
190190
Float(ConstFloat::F64(f)) => {
191-
let ptr = self.memory.allocate(8);
191+
let ptr = self.memory.allocate(8)?;
192192
self.memory.write_f64(ptr, f)?;
193193
Ok(ptr)
194194
},

0 commit comments

Comments
 (0)