6 #![allow(unused_unsafe)]
9 fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
11 fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {
12 //~^ ERROR: this function has too many arguments (8/7)
15 // don't lint extern fns
16 extern fn extern_fn(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
19 fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool);
20 fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ());
21 //~^ ERROR: this function has too many arguments (8/7)
29 fn good_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
30 fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
31 //~^ ERROR: this function has too many arguments (8/7)
34 // ok, we don’t want to warn implementations
36 fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
37 fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
39 fn ptr(p: *const u8) {
40 println!("{}", unsafe { *p });
41 //~^ ERROR: this public function dereferences a raw pointer but is not marked `unsafe`
42 println!("{:?}", unsafe { p.as_ref() });
43 //~^ ERROR: this public function dereferences a raw pointer but is not marked `unsafe`
44 unsafe { std::ptr::read(p) };
45 //~^ ERROR: this public function dereferences a raw pointer but is not marked `unsafe`
49 // NOT_UNSAFE_PTR_ARG_DEREF
51 fn private(p: *const u8) {
52 println!("{}", unsafe { *p });
55 pub fn public(p: *const u8) {
56 println!("{}", unsafe { *p });
57 //~^ ERROR: this public function dereferences a raw pointer but is not marked `unsafe`
58 println!("{:?}", unsafe { p.as_ref() });
59 //~^ ERROR: this public function dereferences a raw pointer but is not marked `unsafe`
60 unsafe { std::ptr::read(p) };
61 //~^ ERROR: this public function dereferences a raw pointer but is not marked `unsafe`
65 fn private(self, p: *const u8) {
66 println!("{}", unsafe { *p });
69 pub fn public(self, p: *const u8) {
70 println!("{}", unsafe { *p });
71 //~^ ERROR: this public function dereferences a raw pointer but is not marked `unsafe`
72 println!("{:?}", unsafe { p.as_ref() });
73 //~^ ERROR: this public function dereferences a raw pointer but is not marked `unsafe`
74 unsafe { std::ptr::read(p) };
75 //~^ ERROR: this public function dereferences a raw pointer but is not marked `unsafe`
78 pub fn public_ok(self, p: *const u8) {
84 pub unsafe fn public_unsafe(self, p: *const u8) {
85 println!("{}", unsafe { *p });
86 println!("{:?}", unsafe { p.as_ref() });