mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 19:23:50 +00:00
17 lines
563 B
Rust
17 lines
563 B
Rust
#![warn(clippy::transmute_int_to_char)]
|
|
#![allow(clippy::missing_transmute_annotations)]
|
|
|
|
fn int_to_char() {
|
|
let _: char = unsafe { std::mem::transmute(0_u32) };
|
|
//~^ ERROR: transmute from a `u32` to a `char`
|
|
//~| NOTE: `-D clippy::transmute-int-to-char` implied by `-D warnings`
|
|
let _: char = unsafe { std::mem::transmute(0_i32) };
|
|
//~^ ERROR: transmute from a `i32` to a `char`
|
|
|
|
// These shouldn't warn
|
|
const _: char = unsafe { std::mem::transmute(0_u32) };
|
|
const _: char = unsafe { std::mem::transmute(0_i32) };
|
|
}
|
|
|
|
fn main() {}
|