mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 21:53:23 +00:00
269 lines
8.5 KiB
Text
269 lines
8.5 KiB
Text
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:7:7
|
|
|
|
|
LL | f(&1u8 as *const _);
|
|
| ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&1u8)`
|
|
|
|
|
= note: `-D clippy::ref-as-ptr` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::ref_as_ptr)]`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:8:7
|
|
|
|
|
LL | f(&2u32 as *const u32);
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<u32>(&2u32)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:9:7
|
|
|
|
|
LL | f(&3.0f64 as *const f64);
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f64>(&3.0f64)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:11:7
|
|
|
|
|
LL | f(&4 as *const _ as *const f32);
|
|
| ^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&4)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:12:7
|
|
|
|
|
LL | f(&5.0f32 as *const f32 as *const u32);
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f32>(&5.0f32)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:14:7
|
|
|
|
|
LL | f(&mut 6u8 as *const _);
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut 6u8)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:15:7
|
|
|
|
|
LL | f(&mut 7u32 as *const u32);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<u32>(&mut 7u32)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:16:7
|
|
|
|
|
LL | f(&mut 8.0f64 as *const f64);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f64>(&mut 8.0f64)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:18:7
|
|
|
|
|
LL | f(&mut 9 as *const _ as *const f32);
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut 9)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:19:7
|
|
|
|
|
LL | f(&mut 10.0f32 as *const f32 as *const u32);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f32>(&mut 10.0f32)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:21:7
|
|
|
|
|
LL | f(&mut 11u8 as *mut _);
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(&mut 11u8)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:22:7
|
|
|
|
|
LL | f(&mut 12u32 as *mut u32);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<u32>(&mut 12u32)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:23:7
|
|
|
|
|
LL | f(&mut 13.0f64 as *mut f64);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<f64>(&mut 13.0f64)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:25:7
|
|
|
|
|
LL | f(&mut 14 as *mut _ as *const f32);
|
|
| ^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(&mut 14)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:26:7
|
|
|
|
|
LL | f(&mut 15.0f32 as *mut f32 as *const u32);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<f32>(&mut 15.0f32)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:28:7
|
|
|
|
|
LL | f(&1u8 as *const _);
|
|
| ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&1u8)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:29:7
|
|
|
|
|
LL | f(&2u32 as *const u32);
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<u32>(&2u32)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:30:7
|
|
|
|
|
LL | f(&3.0f64 as *const f64);
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f64>(&3.0f64)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:32:7
|
|
|
|
|
LL | f(&4 as *const _ as *const f32);
|
|
| ^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&4)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:33:7
|
|
|
|
|
LL | f(&5.0f32 as *const f32 as *const u32);
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<f32>(&5.0f32)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:36:7
|
|
|
|
|
LL | f(&val as *const _);
|
|
| ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:37:7
|
|
|
|
|
LL | f(&val as *const i32);
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<i32>(&val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:39:7
|
|
|
|
|
LL | f(&val as *const _ as *const f32);
|
|
| ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:40:7
|
|
|
|
|
LL | f(&val as *const i32 as *const f64);
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<i32>(&val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:43:7
|
|
|
|
|
LL | f(&mut val as *mut u8);
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<u8>(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:44:7
|
|
|
|
|
LL | f(&mut val as *mut _);
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:46:7
|
|
|
|
|
LL | f(&mut val as *const u8);
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<u8>(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:47:7
|
|
|
|
|
LL | f(&mut val as *const _);
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:49:7
|
|
|
|
|
LL | f(&mut val as *const u8 as *const f64);
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<u8>(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:50:28
|
|
|
|
|
LL | f::<*const Option<u8>>(&mut val as *const _ as *const _);
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(&mut val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:52:7
|
|
|
|
|
LL | f(&std::array::from_fn(|i| i * i) as *const [usize; 7]);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<[usize; 7]>(&std::array::from_fn(|i| i * i))`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:53:7
|
|
|
|
|
LL | f(&mut std::array::from_fn(|i| i * i) as *const [usize; 8]);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<[usize; 8]>(&mut std::array::from_fn(|i| i * i))`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:54:7
|
|
|
|
|
LL | f(&mut std::array::from_fn(|i| i * i) as *mut [usize; 9]);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<[usize; 9]>(&mut std::array::from_fn(|i| i * i))`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:76:7
|
|
|
|
|
LL | f(val as *const i32);
|
|
| ^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<i32>(val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:77:7
|
|
|
|
|
LL | f(mut_val as *mut i32);
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<i32>(mut_val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:81:7
|
|
|
|
|
LL | f(val as *const _);
|
|
| ^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:82:7
|
|
|
|
|
LL | f(val as *const [u8]);
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<[u8]>(val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:86:7
|
|
|
|
|
LL | f(val as *mut _);
|
|
| ^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:87:7
|
|
|
|
|
LL | f(val as *mut str);
|
|
| ^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<str>(val)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:94:9
|
|
|
|
|
LL | self.0 as *const _ as *const _
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:98:9
|
|
|
|
|
LL | self.0 as *const _ as *const _
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:106:9
|
|
|
|
|
LL | self.0 as *const _ as *const _
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:110:9
|
|
|
|
|
LL | self.0 as *const _ as *const _
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref(self.0)`
|
|
|
|
error: reference as raw pointer
|
|
--> tests/ui/ref_as_ptr.rs:114:9
|
|
|
|
|
LL | self.0 as *mut _ as *mut _
|
|
| ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_mut(self.0)`
|
|
|
|
error: aborting due to 44 previous errors
|
|
|