Skip to content

Commit

Permalink
fix warnings with cfg(miri)
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Dec 7, 2019
1 parent ca2ffe3 commit ab73d10
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/libcore/tests/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,16 @@ fn test_writer_hasher() {
let ptr = 5_usize as *mut i32;
assert_eq!(hash(&ptr), 5);

if cfg!(miri) { // Miri cannot hash pointers
return;
}

let cs: &mut [u8] = &mut [1, 2, 3];
let ptr = cs.as_ptr();
let slice_ptr = cs as *const [u8];
#[cfg(not(miri))] // Miri cannot hash pointers
assert_eq!(hash(&slice_ptr), hash(&ptr) + cs.len() as u64);

let slice_ptr = cs as *mut [u8];
#[cfg(not(miri))] // Miri cannot hash pointers
assert_eq!(hash(&slice_ptr), hash(&ptr) + cs.len() as u64);
}

Expand Down
13 changes: 10 additions & 3 deletions src/libcore/tests/num/dec2flt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ fn ordinary() {
test_literal!(0.1);
test_literal!(12345.);
test_literal!(0.9999999);
#[cfg(not(miri))] // Miri is too slow

if cfg!(miri) { // Miri is too slow
return;
}

test_literal!(2.2250738585072014e-308);
}

Expand Down Expand Up @@ -77,9 +81,12 @@ fn infinity() {
fn zero() {
test_literal!(0.0);
test_literal!(1e-325);
#[cfg(not(miri))] // Miri is too slow

if cfg!(miri) { // Miri is too slow
return;
}

test_literal!(1e-326);
#[cfg(not(miri))] // Miri is too slow
test_literal!(1e-500);
}

Expand Down

0 comments on commit ab73d10

Please sign in to comment.