Closed as not planned
Description
I tried this code:
pub fn type_casting() {
let something: u8 = 255;
let something_i8 = something as i8;
println!("{}", something_i8);
println!("{}", something);
}
I expected to see this happen: i was expecting somekind of error, not even runtime error
Instead, this happened: *i get
-1
255
as output this may cause bugs in application
*
Meta
rustc --version --verbose
:
<version>
rustc 1.85.0 (4d91de4 2025-02-17)
binary: rustc
commit-hash: 4d91de4
commit-date: 2025-02-17
host: x86_64-pc-windows-msvc
release: 1.85.0
LLVM version: 19.1.7
Backtrace
<backtrace>