rust/tests/ui/transmuting_null.stderr
Félix Fischer 069957a8ad Add TransmutingNull Lint
* Late Lint pass, catches:
  * One liner: 0 -> null -> transmute
  * One liner: std:null() -> transmute
  * Const (which resolves to null) -> transmute
* UI Test case for Lint
* Updated test for issue 3849, because now the lint that code generated is in Clippy.
* Expanded `const.rs` miri-based Constant Folding code, to cover
  raw pointers
2019-04-02 11:39:43 -03:00

23 lines
797 B
Plaintext

error: transmuting a known null pointer into a reference.
--> $DIR/transmuting_null.rs:10:23
|
LL | let _: &u64 = std::mem::transmute(0 as *const u64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::transmuting-null` implied by `-D warnings`
error: transmuting a known null pointer into a reference.
--> $DIR/transmuting_null.rs:11:23
|
LL | let _: &u64 = std::mem::transmute(std::ptr::null::<u64>());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: transmuting a known null pointer into a reference.
--> $DIR/transmuting_null.rs:21:23
|
LL | let _: &u64 = std::mem::transmute(ZPTR);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors