summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr')
-rw-r--r--src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr154
1 files changed, 154 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr b/src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr
new file mode 100644
index 000000000..532c36abe
--- /dev/null
+++ b/src/tools/clippy/tests/ui/invalid_null_ptr_usage.stderr
@@ -0,0 +1,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
+