mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
069957a8ad
* 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
15 lines
341 B
Rust
15 lines
341 B
Rust
#![allow(dead_code)]
|
|
#![allow(clippy::zero_ptr)]
|
|
#![allow(clippy::transmute_ptr_to_ref)]
|
|
#![allow(clippy::transmuting_null)]
|
|
|
|
pub const ZPTR: *const usize = 0 as *const _;
|
|
|
|
fn main() {
|
|
unsafe {
|
|
#[clippy::author]
|
|
let _: &i32 = std::mem::transmute(ZPTR);
|
|
let _: &i32 = std::mem::transmute(0 as *const i32);
|
|
}
|
|
}
|