Skip to content
Myr

Use a real unsafe expr for the unsafe test

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent bf31e76 · Browse files · 1 file+4 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−2 removed

  • tests:+4 added−2 removed

1 file+4 added−2 removed

modified:tests/test_ensure.rs+4 added-2 removed
9 unmodified lines
10use std::fmt::Debug;11use std::iter;12use std::marker::PhantomData;13use std::ops::Add;14use std::ptr;1516struct S;1718impl<T> Add<T> for S {
243 unmodified lines
262 test,263 "Condition failed: `S + async move { 1 } == true` (false vs true)",264 );265266 let x = &1;265 let test = || Ok(ensure!(S + unsafe { 1 } == true));267 let test = || Ok(ensure!(S + unsafe { ptr::read(x) } == true));268 assert_err(269 test,268 "Condition failed: `S + unsafe { 1 } == true` (false vs true)",270 "Condition failed: `S + unsafe { ptr::read(x) } == true` (false vs true)",271 );272}273274#[test]
123 unmodified lines