diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/from_raw_with_void_ptr.rs')
-rw-r--r-- | src/tools/clippy/tests/ui/from_raw_with_void_ptr.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/from_raw_with_void_ptr.rs b/src/tools/clippy/tests/ui/from_raw_with_void_ptr.rs index 95ef6425f..81472070e 100644 --- a/src/tools/clippy/tests/ui/from_raw_with_void_ptr.rs +++ b/src/tools/clippy/tests/ui/from_raw_with_void_ptr.rs @@ -9,6 +9,7 @@ fn main() { // must lint let ptr = Box::into_raw(Box::new(42usize)) as *mut c_void; let _ = unsafe { Box::from_raw(ptr) }; + //~^ ERROR: creating a `Box` from a void raw pointer // shouldn't be linted let _ = unsafe { Box::from_raw(ptr as *mut usize) }; @@ -20,16 +21,20 @@ fn main() { // must lint let ptr = Rc::into_raw(Rc::new(42usize)) as *mut c_void; let _ = unsafe { Rc::from_raw(ptr) }; + //~^ ERROR: creating a `Rc` from a void raw pointer // must lint let ptr = Arc::into_raw(Arc::new(42usize)) as *mut c_void; let _ = unsafe { Arc::from_raw(ptr) }; + //~^ ERROR: creating a `Arc` from a void raw pointer // must lint let ptr = std::rc::Weak::into_raw(Rc::downgrade(&Rc::new(42usize))) as *mut c_void; let _ = unsafe { std::rc::Weak::from_raw(ptr) }; + //~^ ERROR: creating a `Weak` from a void raw pointer // must lint let ptr = std::sync::Weak::into_raw(Arc::downgrade(&Arc::new(42usize))) as *mut c_void; let _ = unsafe { std::sync::Weak::from_raw(ptr) }; + //~^ ERROR: creating a `Weak` from a void raw pointer } |