rust/tests/ui/lint/lint-deref-nullptr.stderr

69 lines
2.5 KiB
Plaintext
Raw Normal View History

2021-04-09 09:13:04 -05:00
error: dereferencing a null pointer
2021-04-10 08:40:07 -05:00
--> $DIR/lint-deref-nullptr.rs:15:18
2021-04-07 12:23:17 -05:00
|
LL | let ub = *(0 as *const i32);
2021-04-09 09:13:04 -05:00
| ^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
2021-04-07 12:23:17 -05:00
|
note: the lint level is defined here
--> $DIR/lint-deref-nullptr.rs:3:9
|
LL | #![deny(deref_nullptr)]
| ^^^^^^^^^^^^^
2021-04-09 09:13:04 -05:00
error: dereferencing a null pointer
2021-04-10 08:40:07 -05:00
--> $DIR/lint-deref-nullptr.rs:17:18
2021-04-07 12:23:17 -05:00
|
2021-04-10 08:40:07 -05:00
LL | let ub = *ptr::null::<i32>();
| ^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
2021-04-07 12:23:17 -05:00
2021-04-09 09:13:04 -05:00
error: dereferencing a null pointer
2021-04-10 08:40:07 -05:00
--> $DIR/lint-deref-nullptr.rs:19:18
2021-04-07 12:23:17 -05:00
|
2021-04-10 08:40:07 -05:00
LL | let ub = *ptr::null_mut::<i32>();
| ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
2021-04-07 12:23:17 -05:00
2021-04-09 09:13:04 -05:00
error: dereferencing a null pointer
2021-04-10 08:40:07 -05:00
--> $DIR/lint-deref-nullptr.rs:21:18
2021-04-07 12:23:17 -05:00
|
2021-04-10 08:40:07 -05:00
LL | let ub = *(ptr::null::<i16>() as *const i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
2021-04-07 12:23:17 -05:00
2021-04-09 09:13:04 -05:00
error: dereferencing a null pointer
2021-04-10 08:40:07 -05:00
--> $DIR/lint-deref-nullptr.rs:23:18
|
LL | let ub = *(ptr::null::<i16>() as *mut i32 as *mut usize as *const u8);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
error: dereferencing a null pointer
--> $DIR/lint-deref-nullptr.rs:25:19
2021-04-07 12:23:17 -05:00
|
2021-04-10 08:40:07 -05:00
LL | let ub = &*ptr::null::<i32>();
| ^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
2021-04-07 12:23:17 -05:00
2021-04-09 09:13:04 -05:00
error: dereferencing a null pointer
2021-04-10 09:17:09 -05:00
--> $DIR/lint-deref-nullptr.rs:27:19
|
LL | let ub = &*ptr::null_mut::<i32>();
| ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
error: dereferencing a null pointer
--> $DIR/lint-deref-nullptr.rs:29:23
2021-04-07 12:23:17 -05:00
|
2021-04-10 08:40:07 -05:00
LL | ptr::addr_of!(*ptr::null::<i32>());
| ^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
2021-04-07 12:23:17 -05:00
2021-04-09 09:13:04 -05:00
error: dereferencing a null pointer
2021-04-10 09:17:09 -05:00
--> $DIR/lint-deref-nullptr.rs:31:27
2021-04-07 12:23:17 -05:00
|
2021-04-10 08:40:07 -05:00
LL | ptr::addr_of_mut!(*ptr::null_mut::<i32>());
| ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
2021-04-07 12:23:17 -05:00
2021-04-09 09:13:04 -05:00
error: dereferencing a null pointer
2021-04-10 09:17:09 -05:00
--> $DIR/lint-deref-nullptr.rs:33:36
2021-04-07 12:23:17 -05:00
|
2021-04-10 08:40:07 -05:00
LL | let offset = ptr::addr_of!((*ptr::null::<Struct>()).field);
| ^^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
2021-04-07 12:23:17 -05:00
2021-04-10 09:17:09 -05:00
error: aborting due to 10 previous errors
2021-04-07 12:23:17 -05:00