Skip to content

Commit d712d48

Browse files
committed
bless output for changed lint
1 parent 308ff4d commit d712d48

File tree

2 files changed

+12
-63
lines changed

2 files changed

+12
-63
lines changed

tests/ui/lint/invalid_null_args.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ unsafe fn null_ptr() {
5858
let _a: A = ptr::read_unaligned(ptr::null_mut());
5959
//~^ ERROR calling this function with a null pointer is undefined behavior
6060

61-
let _a: A = ptr::read_volatile(ptr::null());
62-
//~^ ERROR calling this function with a null pointer is undefined behavior
63-
let _a: A = ptr::read_volatile(ptr::null_mut());
64-
//~^ ERROR calling this function with a null pointer is undefined behavior
65-
6661
let _a: A = ptr::replace(ptr::null_mut(), v);
6762
//~^ ERROR calling this function with a null pointer is undefined behavior
6863

@@ -82,12 +77,6 @@ unsafe fn null_ptr() {
8277
ptr::write_unaligned(ptr::null_mut(), v);
8378
//~^ ERROR calling this function with a null pointer is undefined behavior
8479

85-
ptr::write_volatile(ptr::null_mut(), v);
86-
//~^ ERROR calling this function with a null pointer is undefined behavior
87-
88-
ptr::write_bytes::<usize>(ptr::null_mut(), 42, 0);
89-
//~^ ERROR calling this function with a null pointer is undefined behavior
90-
9180
// with indirections
9281
let const_ptr = null_ptr as *const u8;
9382
let _a: u8 = ptr::read(const_ptr);

tests/ui/lint/invalid_null_args.stderr

Lines changed: 12 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -166,26 +166,6 @@ LL | let _a: A = ptr::read_unaligned(ptr::null_mut());
166166
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
167167
--> $DIR/invalid_null_args.rs:61:17
168168
|
169-
LL | let _a: A = ptr::read_volatile(ptr::null());
170-
| ^^^^^^^^^^^^^^^^^^^-----------^
171-
| |
172-
| null pointer originates from here
173-
|
174-
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
175-
176-
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
177-
--> $DIR/invalid_null_args.rs:63:17
178-
|
179-
LL | let _a: A = ptr::read_volatile(ptr::null_mut());
180-
| ^^^^^^^^^^^^^^^^^^^---------------^
181-
| |
182-
| null pointer originates from here
183-
|
184-
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
185-
186-
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
187-
--> $DIR/invalid_null_args.rs:66:17
188-
|
189169
LL | let _a: A = ptr::replace(ptr::null_mut(), v);
190170
| ^^^^^^^^^^^^^---------------^^^^
191171
| |
@@ -194,7 +174,7 @@ LL | let _a: A = ptr::replace(ptr::null_mut(), v);
194174
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
195175

196176
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
197-
--> $DIR/invalid_null_args.rs:69:5
177+
--> $DIR/invalid_null_args.rs:64:5
198178
|
199179
LL | ptr::swap::<A>(ptr::null_mut(), &mut v);
200180
| ^^^^^^^^^^^^^^^---------------^^^^^^^^^
@@ -204,7 +184,7 @@ LL | ptr::swap::<A>(ptr::null_mut(), &mut v);
204184
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
205185

206186
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
207-
--> $DIR/invalid_null_args.rs:71:5
187+
--> $DIR/invalid_null_args.rs:66:5
208188
|
209189
LL | ptr::swap::<A>(&mut v, ptr::null_mut());
210190
| ^^^^^^^^^^^^^^^^^^^^^^^---------------^
@@ -214,7 +194,7 @@ LL | ptr::swap::<A>(&mut v, ptr::null_mut());
214194
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
215195

216196
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
217-
--> $DIR/invalid_null_args.rs:74:5
197+
--> $DIR/invalid_null_args.rs:69:5
218198
|
219199
LL | ptr::swap_nonoverlapping::<A>(ptr::null_mut(), &mut v, 0);
220200
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^^^^^^^^^
@@ -224,7 +204,7 @@ LL | ptr::swap_nonoverlapping::<A>(ptr::null_mut(), &mut v, 0);
224204
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
225205

226206
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
227-
--> $DIR/invalid_null_args.rs:76:5
207+
--> $DIR/invalid_null_args.rs:71:5
228208
|
229209
LL | ptr::swap_nonoverlapping::<A>(&mut v, ptr::null_mut(), 0);
230210
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
@@ -234,7 +214,7 @@ LL | ptr::swap_nonoverlapping::<A>(&mut v, ptr::null_mut(), 0);
234214
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
235215

236216
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
237-
--> $DIR/invalid_null_args.rs:79:5
217+
--> $DIR/invalid_null_args.rs:74:5
238218
|
239219
LL | ptr::write(ptr::null_mut(), v);
240220
| ^^^^^^^^^^^---------------^^^^
@@ -244,7 +224,7 @@ LL | ptr::write(ptr::null_mut(), v);
244224
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
245225

246226
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
247-
--> $DIR/invalid_null_args.rs:82:5
227+
--> $DIR/invalid_null_args.rs:77:5
248228
|
249229
LL | ptr::write_unaligned(ptr::null_mut(), v);
250230
| ^^^^^^^^^^^^^^^^^^^^^---------------^^^^
@@ -254,27 +234,7 @@ LL | ptr::write_unaligned(ptr::null_mut(), v);
254234
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
255235

256236
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
257-
--> $DIR/invalid_null_args.rs:85:5
258-
|
259-
LL | ptr::write_volatile(ptr::null_mut(), v);
260-
| ^^^^^^^^^^^^^^^^^^^^---------------^^^^
261-
| |
262-
| null pointer originates from here
263-
|
264-
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
265-
266-
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
267-
--> $DIR/invalid_null_args.rs:88:5
268-
|
269-
LL | ptr::write_bytes::<usize>(ptr::null_mut(), 42, 0);
270-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^^^^^
271-
| |
272-
| null pointer originates from here
273-
|
274-
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
275-
276-
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
277-
--> $DIR/invalid_null_args.rs:93:18
237+
--> $DIR/invalid_null_args.rs:82:18
278238
|
279239
LL | let _a: u8 = ptr::read(const_ptr);
280240
| ^^^^^^^^^^^^^^^^^^^^
@@ -287,7 +247,7 @@ LL | let null_ptr = ptr::null_mut();
287247
| ^^^^^^^^^^^^^^^
288248

289249
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
290-
--> $DIR/invalid_null_args.rs:100:5
250+
--> $DIR/invalid_null_args.rs:89:5
291251
|
292252
LL | std::slice::from_raw_parts::<()>(ptr::null(), 0);
293253
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^
@@ -297,7 +257,7 @@ LL | std::slice::from_raw_parts::<()>(ptr::null(), 0);
297257
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
298258

299259
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
300-
--> $DIR/invalid_null_args.rs:102:5
260+
--> $DIR/invalid_null_args.rs:91:5
301261
|
302262
LL | std::slice::from_raw_parts::<Zst>(ptr::null(), 0);
303263
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^
@@ -307,7 +267,7 @@ LL | std::slice::from_raw_parts::<Zst>(ptr::null(), 0);
307267
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
308268

309269
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
310-
--> $DIR/invalid_null_args.rs:104:5
270+
--> $DIR/invalid_null_args.rs:93:5
311271
|
312272
LL | std::slice::from_raw_parts_mut::<()>(ptr::null_mut(), 0);
313273
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
@@ -317,7 +277,7 @@ LL | std::slice::from_raw_parts_mut::<()>(ptr::null_mut(), 0);
317277
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
318278

319279
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
320-
--> $DIR/invalid_null_args.rs:106:5
280+
--> $DIR/invalid_null_args.rs:95:5
321281
|
322282
LL | std::slice::from_raw_parts_mut::<Zst>(ptr::null_mut(), 0);
323283
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
@@ -326,5 +286,5 @@ LL | std::slice::from_raw_parts_mut::<Zst>(ptr::null_mut(), 0);
326286
|
327287
= help: for more information, visit <https://doc.rust-lang.org/std/ptr/index.html> and <https://doc.rust-lang.org/reference/behavior-considered-undefined.html>
328288

329-
error: aborting due to 31 previous errors
289+
error: aborting due to 27 previous errors
330290

0 commit comments

Comments
 (0)