rust/tests/ui/lint/invalid_null_args.stderr

331 lines
18 KiB
Plaintext

error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:8:5
|
LL | / ptr::write(
LL | |
LL | | ptr::null_mut() as *mut u32,
| | --------------- null pointer originates from here
LL | | mem::transmute::<[u8; 4], _>([0, 0, 0, 255]),
LL | | );
| |_____^
|
= 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>
= note: `#[deny(invalid_null_arguments)]` on by default
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:15:5
|
LL | / ptr::write(
LL | |
LL | | null_ptr as *mut u32,
LL | | mem::transmute::<[u8; 4], _>([0, 0, 0, 255]),
LL | | );
| |_____^
|
= 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>
note: null pointer originates from here
--> $DIR/invalid_null_args.rs:14:20
|
LL | let null_ptr = ptr::null_mut();
| ^^^^^^^^^^^^^^^
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:21:23
|
LL | let _: &[usize] = std::slice::from_raw_parts(ptr::null(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:23:23
|
LL | let _: &[usize] = std::slice::from_raw_parts(ptr::null_mut(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:25:23
|
LL | let _: &[usize] = std::slice::from_raw_parts(0 as *mut _, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^-^^^^^^^^^^^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:27:23
|
LL | let _: &[usize] = std::slice::from_raw_parts(mem::transmute(0usize), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------^^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:30:23
|
LL | let _: &[usize] = std::slice::from_raw_parts_mut(ptr::null_mut(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:33:5
|
LL | ptr::copy::<usize>(ptr::null(), ptr::NonNull::dangling().as_ptr(), 0);
| ^^^^^^^^^^^^^^^^^^^-----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:35:5
|
LL | ptr::copy::<usize>(ptr::NonNull::dangling().as_ptr(), ptr::null_mut(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:38:5
|
LL | ptr::copy_nonoverlapping::<usize>(ptr::null(), ptr::NonNull::dangling().as_ptr(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:40:5
|
LL | / ptr::copy_nonoverlapping::<usize>(
LL | |
LL | | ptr::NonNull::dangling().as_ptr(),
LL | | ptr::null_mut(),
| | --------------- null pointer originates from here
LL | | 0,
LL | | );
| |_____^
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:51:17
|
LL | let _a: A = ptr::read(ptr::null());
| ^^^^^^^^^^-----------^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:53:17
|
LL | let _a: A = ptr::read(ptr::null_mut());
| ^^^^^^^^^^---------------^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:56:17
|
LL | let _a: A = ptr::read_unaligned(ptr::null());
| ^^^^^^^^^^^^^^^^^^^^-----------^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:58:17
|
LL | let _a: A = ptr::read_unaligned(ptr::null_mut());
| ^^^^^^^^^^^^^^^^^^^^---------------^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:61:17
|
LL | let _a: A = ptr::read_volatile(ptr::null());
| ^^^^^^^^^^^^^^^^^^^-----------^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:63:17
|
LL | let _a: A = ptr::read_volatile(ptr::null_mut());
| ^^^^^^^^^^^^^^^^^^^---------------^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:66:17
|
LL | let _a: A = ptr::replace(ptr::null_mut(), v);
| ^^^^^^^^^^^^^---------------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:69:5
|
LL | ptr::swap::<A>(ptr::null_mut(), &mut v);
| ^^^^^^^^^^^^^^^---------------^^^^^^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:71:5
|
LL | ptr::swap::<A>(&mut v, ptr::null_mut());
| ^^^^^^^^^^^^^^^^^^^^^^^---------------^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:74:5
|
LL | ptr::swap_nonoverlapping::<A>(ptr::null_mut(), &mut v, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^^^^^^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:76:5
|
LL | ptr::swap_nonoverlapping::<A>(&mut v, ptr::null_mut(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:79:5
|
LL | ptr::write(ptr::null_mut(), v);
| ^^^^^^^^^^^---------------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:82:5
|
LL | ptr::write_unaligned(ptr::null_mut(), v);
| ^^^^^^^^^^^^^^^^^^^^^---------------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:85:5
|
LL | ptr::write_volatile(ptr::null_mut(), v);
| ^^^^^^^^^^^^^^^^^^^^---------------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:88:5
|
LL | ptr::write_bytes::<usize>(ptr::null_mut(), 42, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:93:18
|
LL | let _a: u8 = ptr::read(const_ptr);
| ^^^^^^^^^^^^^^^^^^^^
|
= 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>
note: null pointer originates from here
--> $DIR/invalid_null_args.rs:14:20
|
LL | let null_ptr = ptr::null_mut();
| ^^^^^^^^^^^^^^^
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:100:5
|
LL | std::slice::from_raw_parts::<()>(ptr::null(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:102:5
|
LL | std::slice::from_raw_parts::<Zst>(ptr::null(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:104:5
|
LL | std::slice::from_raw_parts_mut::<()>(ptr::null_mut(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
| |
| null pointer originates from here
|
= 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>
error: calling this function with a null pointer is undefined behavior, even if the result of the function is unused
--> $DIR/invalid_null_args.rs:106:5
|
LL | std::slice::from_raw_parts_mut::<Zst>(ptr::null_mut(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^^^^
| |
| null pointer originates from here
|
= 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>
error: aborting due to 31 previous errors