summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr
blob: 532c36abe51961fc6b31d9bebba0a03e034f92ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:5:59
   |
LL |         let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::null(), 0);
   |                                                           ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`
   |
   = note: `#[deny(clippy::invalid_null_ptr_usage)]` on by default

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:6:59
   |
LL |         let _slice: &[usize] = std::slice::from_raw_parts(std::ptr::null_mut(), 0);
   |                                                           ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:8:63
   |
LL |         let _slice: &[usize] = std::slice::from_raw_parts_mut(std::ptr::null_mut(), 0);
   |                                                               ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:10:33
   |
LL |         std::ptr::copy::<usize>(std::ptr::null(), std::ptr::NonNull::dangling().as_ptr(), 0);
   |                                 ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:11:73
   |
LL |         std::ptr::copy::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::null_mut(), 0);
   |                                                                         ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:13:48
   |
LL |         std::ptr::copy_nonoverlapping::<usize>(std::ptr::null(), std::ptr::NonNull::dangling().as_ptr(), 0);
   |                                                ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:14:88
   |
LL |         std::ptr::copy_nonoverlapping::<usize>(std::ptr::NonNull::dangling().as_ptr(), std::ptr::null_mut(), 0);
   |                                                                                        ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:19:36
   |
LL |         let _a: A = std::ptr::read(std::ptr::null());
   |                                    ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:20:36
   |
LL |         let _a: A = std::ptr::read(std::ptr::null_mut());
   |                                    ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:22:46
   |
LL |         let _a: A = std::ptr::read_unaligned(std::ptr::null());
   |                                              ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:23:46
   |
LL |         let _a: A = std::ptr::read_unaligned(std::ptr::null_mut());
   |                                              ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:25:45
   |
LL |         let _a: A = std::ptr::read_volatile(std::ptr::null());
   |                                             ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:26:45
   |
LL |         let _a: A = std::ptr::read_volatile(std::ptr::null_mut());
   |                                             ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:28:39
   |
LL |         let _a: A = std::ptr::replace(std::ptr::null_mut(), A);
   |                                       ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:30:69
   |
LL |         let _slice: *const [usize] = std::ptr::slice_from_raw_parts(std::ptr::null(), 0);
   |                                                                     ^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:31:69
   |
LL |         let _slice: *const [usize] = std::ptr::slice_from_raw_parts(std::ptr::null_mut(), 0);
   |                                                                     ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:33:73
   |
LL |         let _slice: *const [usize] = std::ptr::slice_from_raw_parts_mut(std::ptr::null_mut(), 0);
   |                                                                         ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:35:29
   |
LL |         std::ptr::swap::<A>(std::ptr::null_mut(), &mut A);
   |                             ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:36:37
   |
LL |         std::ptr::swap::<A>(&mut A, std::ptr::null_mut());
   |                                     ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:38:44
   |
LL |         std::ptr::swap_nonoverlapping::<A>(std::ptr::null_mut(), &mut A, 0);
   |                                            ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:39:52
   |
LL |         std::ptr::swap_nonoverlapping::<A>(&mut A, std::ptr::null_mut(), 0);
   |                                                    ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:41:25
   |
LL |         std::ptr::write(std::ptr::null_mut(), A);
   |                         ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:43:35
   |
LL |         std::ptr::write_unaligned(std::ptr::null_mut(), A);
   |                                   ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:45:34
   |
LL |         std::ptr::write_volatile(std::ptr::null_mut(), A);
   |                                  ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: pointer must be non-null
  --> $DIR/invalid_null_ptr_usage.rs:47:40
   |
LL |         std::ptr::write_bytes::<usize>(std::ptr::null_mut(), 42, 0);
   |                                        ^^^^^^^^^^^^^^^^^^^^ help: change this to: `core::ptr::NonNull::dangling().as_ptr()`

error: aborting due to 25 previous errors