Skip to content

Commit 7b2b0dd

Browse files
committed
test HashMap creation in libstd-MIR, and make it work again
1 parent 894306e commit 7b2b0dd

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/terminator/intrinsic.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,10 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
424424
let ty_align = self.type_align(ty)?;
425425
let val_byte = self.value_to_primval(arg_vals[1], u8)?.to_u128()? as u8;
426426
let size = self.type_size(ty)?.expect("write_bytes() type must be sized");
427-
let ptr = arg_vals[0].read_ptr(&self.memory)?.to_ptr()?;
427+
let ptr = arg_vals[0].read_ptr(&self.memory)?;
428428
let count = self.value_to_primval(arg_vals[2], usize)?.to_u64()?;
429429
if count > 0 {
430+
let ptr = ptr.to_ptr()?;
430431
self.memory.check_align(ptr, ty_align, size * count)?;
431432
self.memory.write_repeat(ptr, val_byte, size * count)?;
432433
}

tests/run-pass/hashmap.rs renamed to tests/run-pass-fullmir/hashmap.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
use std::collections::{self, HashMap};
22
use std::hash::BuildHasherDefault;
33

4-
// This disables the test completely:
5-
// ignore-stage1
6-
// TODO: The tests actually passes against rustc and miri with MIR-libstd, but right now, we cannot express that in the test flags
7-
84
fn main() {
95
let map : HashMap<String, i32, BuildHasherDefault<collections::hash_map::DefaultHasher>> = Default::default();
106
assert_eq!(map.values().fold(0, |x, y| x+y), 0);

0 commit comments

Comments
 (0)