]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/functions.rs
Apply `not_unsafe_ptr_arg_deref` to type aliases
[rust.git] / tests / ui / functions.rs
index 7e2e083e29884332aef77d10e974e4eeaccf4df2..5521870eaecf761af9b0f50bdbdd941d63aaa551 100644 (file)
@@ -31,12 +31,12 @@ fn bad_multiline(
 extern "C" fn extern_fn(
     _one: u32,
     _two: u32,
-    _three: &str,
+    _three: *const u8,
     _four: bool,
     _five: f32,
     _six: f32,
     _seven: bool,
-    _eight: (),
+    _eight: *const std::ffi::c_void,
 ) {
 }
 
@@ -78,6 +78,14 @@ pub fn public(p: *const u8) {
     unsafe { std::ptr::read(p) };
 }
 
+type Alias = *const u8;
+
+pub fn type_alias(p: Alias) {
+    println!("{}", unsafe { *p });
+    println!("{:?}", unsafe { p.as_ref() });
+    unsafe { std::ptr::read(p) };
+}
+
 impl Bar {
     fn private(self, p: *const u8) {
         println!("{}", unsafe { *p });