]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr
Rollup merge of #105602 - RalfJung:read-convenience, r=oli-obk
[rust.git] / src / tools / clippy / tests / ui / invalid_null_ptr_usage.stderr
1 error: pointer must be non-null
2   --> $DIR/invalid_null_ptr_usage.rs:5:59
3    |
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    |
7    = note: `#[deny(clippy::invalid_null_ptr_usage)]` on by default
8
9 error: pointer must be non-null
10   --> $DIR/invalid_null_ptr_usage.rs:6:59
11    |
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
15 error: pointer must be non-null
16   --> $DIR/invalid_null_ptr_usage.rs:8:63
17    |
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
21 error: pointer must be non-null
22   --> $DIR/invalid_null_ptr_usage.rs:10:33
23    |
24 LL |         std::ptr::copy::<usize>(std::ptr::null(), std::ptr::NonNull::dangling().as_ptr(), 0);
25    |                                 ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
26
27 error: pointer must be non-null
28   --> $DIR/invalid_null_ptr_usage.rs:11:73
29    |
30 LL |         std::ptr::copy::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::null_mut(), 0);
31    |                                                                         ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
32
33 error: pointer must be non-null
34   --> $DIR/invalid_null_ptr_usage.rs:13:48
35    |
36 LL |         std::ptr::copy_nonoverlapping::<usize>(std::ptr::null(), std::ptr::NonNull::dangling().as_ptr(), 0);
37    |                                                ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
38
39 error: pointer must be non-null
40   --> $DIR/invalid_null_ptr_usage.rs:14:88
41    |
42 LL |         std::ptr::copy_nonoverlapping::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::null_mut(), 0);
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:19:36
47    |
48 LL |         let _a: A = std::ptr::read(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:20:36
53    |
54 LL |         let _a: A = std::ptr::read(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:22:46
59    |
60 LL |         let _a: A = std::ptr::read_unaligned(std::ptr::null());
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:23:46
65    |
66 LL |         let _a: A = std::ptr::read_unaligned(std::ptr::null_mut());
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:25:45
71    |
72 LL |         let _a: A = std::ptr::read_volatile(std::ptr::null());
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:26:45
77    |
78 LL |         let _a: A = std::ptr::read_volatile(std::ptr::null_mut());
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:28:39
83    |
84 LL |         let _a: A = std::ptr::replace(std::ptr::null_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:30:69
89    |
90 LL |         let _slice: *const [usize] = std::ptr::slice_from_raw_parts(std::ptr::null(), 0);
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:31:69
95    |
96 LL |         let _slice: *const [usize] = std::ptr::slice_from_raw_parts(std::ptr::null_mut(), 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:33:73
101    |
102 LL |         let _slice: *const [usize] = std::ptr::slice_from_raw_parts_mut(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:35:29
107    |
108 LL |         std::ptr::swap::<A>(std::ptr::null_mut(), &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:36:37
113    |
114 LL |         std::ptr::swap::<A>(&mut A, std::ptr::null_mut());
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:38:44
119    |
120 LL |         std::ptr::swap_nonoverlapping::<A>(std::ptr::null_mut(), &mut A, 0);
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:39:52
125    |
126 LL |         std::ptr::swap_nonoverlapping::<A>(&mut A, std::ptr::null_mut(), 0);
127    |                                                    ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
128
129 error: pointer must be non-null
130   --> $DIR/invalid_null_ptr_usage.rs:41:25
131    |
132 LL |         std::ptr::write(std::ptr::null_mut(), A);
133    |                         ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
134
135 error: pointer must be non-null
136   --> $DIR/invalid_null_ptr_usage.rs:43:35
137    |
138 LL |         std::ptr::write_unaligned(std::ptr::null_mut(), A);
139    |                                   ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
140
141 error: pointer must be non-null
142   --> $DIR/invalid_null_ptr_usage.rs:45:34
143    |
144 LL |         std::ptr::write_volatile(std::ptr::null_mut(), A);
145    |                                  ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
146
147 error: pointer must be non-null
148   --> $DIR/invalid_null_ptr_usage.rs:47:40
149    |
150 LL |         std::ptr::write_bytes::<usize>(std::ptr::null_mut(), 42, 0);
151    |                                        ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
152
153 error: aborting due to 25 previous errors
154