Skip to content

Commit 0b5c758

Browse files
committed
Use a real unsafe expr for the unsafe test
1 parent bf31e76 commit 0b5c758

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_ensure.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use std::fmt::Debug;
1111
use std::iter;
1212
use std::marker::PhantomData;
1313
use std::ops::Add;
14+
use std::ptr;
1415

1516
struct S;
1617

@@ -262,10 +263,11 @@ fn test_atom() {
262263
"Condition failed: `S + async move { 1 } == true` (false vs true)",
263264
);
264265

265-
let test = || Ok(ensure!(S + unsafe { 1 } == true));
266+
let x = &1;
267+
let test = || Ok(ensure!(S + unsafe { ptr::read(x) } == true));
266268
assert_err(
267269
test,
268-
"Condition failed: `S + unsafe { 1 } == true` (false vs true)",
270+
"Condition failed: `S + unsafe { ptr::read(x) } == true` (false vs true)",
269271
);
270272
}
271273

0 commit comments

Comments
 (0)