|
1 | 1 | error: pointer must be non-null
|
2 |
| - --> $DIR/invalid_null_ptr_usage.rs:4:64 |
| 2 | + --> $DIR/invalid_null_ptr_usage.rs:5:59 |
3 | 3 | |
|
4 |
| -LL | let _slice: &[usize] = unsafe { std::slice::from_raw_parts(std::ptr::null(), 0) }; |
5 |
| - | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 4 | +LL | let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::null(), 0); |
| 5 | + | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
6 | 6 | |
|
7 | 7 | = note: `#[deny(clippy::invalid_null_ptr_usage)]` on by default
|
8 | 8 |
|
9 | 9 | error: pointer must be non-null
|
10 |
| - --> $DIR/invalid_null_ptr_usage.rs:5:64 |
| 10 | + --> $DIR/invalid_null_ptr_usage.rs:6:59 |
11 | 11 | |
|
12 |
| -LL | let _slice: &[usize] = unsafe { std::slice::from_raw_parts(core::ptr::null(), 0) }; |
13 |
| - | ^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 12 | +LL | let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::null_mut(), 0); |
| 13 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
14 | 14 |
|
15 | 15 | error: pointer must be non-null
|
16 |
| - --> $DIR/invalid_null_ptr_usage.rs:6:64 |
| 16 | + --> $DIR/invalid_null_ptr_usage.rs:8:63 |
17 | 17 | |
|
18 |
| -LL | let _slice: &[usize] = unsafe { std::slice::from_raw_parts(std::ptr::null_mut(), 0) }; |
19 |
| - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 18 | +LL | let _slice: &[usize] = std::slice::from_raw_parts_mut(std::ptr::null_mut(), 0); |
| 19 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
20 | 20 |
|
21 | 21 | error: pointer must be non-null
|
22 |
| - --> $DIR/invalid_null_ptr_usage.rs:7:64 |
| 22 | + --> $DIR/invalid_null_ptr_usage.rs:19:36 |
23 | 23 | |
|
24 |
| -LL | let _slice: &[usize] = unsafe { std::slice::from_raw_parts(core::ptr::null_mut(), 0) }; |
25 |
| - | ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 24 | +LL | let _a: A = std::ptr::read(std::ptr::null()); |
| 25 | + | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
26 | 26 |
|
27 | 27 | error: pointer must be non-null
|
28 |
| - --> $DIR/invalid_null_ptr_usage.rs:9:68 |
| 28 | + --> $DIR/invalid_null_ptr_usage.rs:20:36 |
29 | 29 | |
|
30 |
| -LL | let _slice: &[usize] = unsafe { std::slice::from_raw_parts_mut(std::ptr::null_mut(), 0) }; |
31 |
| - | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 30 | +LL | let _a: A = std::ptr::read(std::ptr::null_mut()); |
| 31 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
32 | 32 |
|
33 | 33 | error: pointer must be non-null
|
34 |
| - --> $DIR/invalid_null_ptr_usage.rs:10:68 |
| 34 | + --> $DIR/invalid_null_ptr_usage.rs:22:46 |
35 | 35 | |
|
36 |
| -LL | let _slice: &[usize] = unsafe { std::slice::from_raw_parts_mut(core::ptr::null_mut(), 0) }; |
37 |
| - | ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 36 | +LL | let _a: A = std::ptr::read_unaligned(std::ptr::null()); |
| 37 | + | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
38 | 38 |
|
39 |
| -error: aborting due to 6 previous errors |
| 39 | +error: pointer must be non-null |
| 40 | + --> $DIR/invalid_null_ptr_usage.rs:23:46 |
| 41 | + | |
| 42 | +LL | let _a: A = std::ptr::read_unaligned(std::ptr::null_mut()); |
| 43 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 44 | + |
| 45 | +error: pointer must be non-null |
| 46 | + --> $DIR/invalid_null_ptr_usage.rs:25:45 |
| 47 | + | |
| 48 | +LL | let _a: A = std::ptr::read_volatile(std::ptr::null()); |
| 49 | + | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 50 | + |
| 51 | +error: pointer must be non-null |
| 52 | + --> $DIR/invalid_null_ptr_usage.rs:26:45 |
| 53 | + | |
| 54 | +LL | let _a: A = std::ptr::read_volatile(std::ptr::null_mut()); |
| 55 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 56 | + |
| 57 | +error: pointer must be non-null |
| 58 | + --> $DIR/invalid_null_ptr_usage.rs:28:39 |
| 59 | + | |
| 60 | +LL | let _a: A = std::ptr::replace(std::ptr::null_mut(), A); |
| 61 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 62 | + |
| 63 | +error: pointer must be non-null |
| 64 | + --> $DIR/invalid_null_ptr_usage.rs:30:69 |
| 65 | + | |
| 66 | +LL | let _slice: *const [usize] = std::ptr::slice_from_raw_parts(std::ptr::null(), 0); |
| 67 | + | ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 68 | + |
| 69 | +error: pointer must be non-null |
| 70 | + --> $DIR/invalid_null_ptr_usage.rs:31:69 |
| 71 | + | |
| 72 | +LL | let _slice: *const [usize] = std::ptr::slice_from_raw_parts(std::ptr::null_mut(), 0); |
| 73 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 74 | + |
| 75 | +error: pointer must be non-null |
| 76 | + --> $DIR/invalid_null_ptr_usage.rs:33:73 |
| 77 | + | |
| 78 | +LL | let _slice: *const [usize] = std::ptr::slice_from_raw_parts_mut(std::ptr::null_mut(), 0); |
| 79 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 80 | + |
| 81 | +error: pointer must be non-null |
| 82 | + --> $DIR/invalid_null_ptr_usage.rs:35:29 |
| 83 | + | |
| 84 | +LL | std::ptr::swap::<A>(std::ptr::null_mut(), &mut A); |
| 85 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 86 | + |
| 87 | +error: pointer must be non-null |
| 88 | + --> $DIR/invalid_null_ptr_usage.rs:36:37 |
| 89 | + | |
| 90 | +LL | std::ptr::swap::<A>(&mut A, std::ptr::null_mut()); |
| 91 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 92 | + |
| 93 | +error: pointer must be non-null |
| 94 | + --> $DIR/invalid_null_ptr_usage.rs:38:44 |
| 95 | + | |
| 96 | +LL | std::ptr::swap_nonoverlapping::<A>(std::ptr::null_mut(), &mut A, 0); |
| 97 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 98 | + |
| 99 | +error: pointer must be non-null |
| 100 | + --> $DIR/invalid_null_ptr_usage.rs:39:52 |
| 101 | + | |
| 102 | +LL | std::ptr::swap_nonoverlapping::<A>(&mut A, std::ptr::null_mut(), 0); |
| 103 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 104 | + |
| 105 | +error: pointer must be non-null |
| 106 | + --> $DIR/invalid_null_ptr_usage.rs:41:25 |
| 107 | + | |
| 108 | +LL | std::ptr::write(std::ptr::null_mut(), A); |
| 109 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 110 | + |
| 111 | +error: pointer must be non-null |
| 112 | + --> $DIR/invalid_null_ptr_usage.rs:43:35 |
| 113 | + | |
| 114 | +LL | std::ptr::write_unaligned(std::ptr::null_mut(), A); |
| 115 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 116 | + |
| 117 | +error: pointer must be non-null |
| 118 | + --> $DIR/invalid_null_ptr_usage.rs:45:34 |
| 119 | + | |
| 120 | +LL | std::ptr::write_volatile(std::ptr::null_mut(), A); |
| 121 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 122 | + |
| 123 | +error: pointer must be non-null |
| 124 | + --> $DIR/invalid_null_ptr_usage.rs:47:40 |
| 125 | + | |
| 126 | +LL | std::ptr::write_bytes::<usize>(std::ptr::null_mut(), 42, 0); |
| 127 | + | ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()` |
| 128 | + |
| 129 | +error: aborting due to 21 previous errors |
40 | 130 |
|
0 commit comments