Signal: @timclicks.01
If you have questions, do ask them :)
p.s. If you've discovered the thread through the algorithm, you're welcome to follow me for more info on programming with Rust and more.
If you have questions, do ask them :)
p.s. If you've discovered the thread through the algorithm, you're welcome to follow me for more info on programming with Rust and more.
That's because it's actually safe to create uninitialized values, and to write to them, but not to read from them.
That's because it's actually safe to create uninitialized values, and to write to them, but not to read from them.
Nothing good.
In my testing, the compiler generated code that provoked the CPU to fault due to an illegal instruction.
Nothing good.
In my testing, the compiler generated code that provoked the CPU to fault due to an illegal instruction.
If you make a mistake, Rust will trust you. That's a problem, as it will make decisions about what code to generate based on the assumption that undefined behavior is impossible.
If you make a mistake, Rust will trust you. That's a problem, as it will make decisions about what code to generate based on the assumption that undefined behavior is impossible.
The unsafe keyword shifts responsibility for upholding Rust's rules from the compiler to the programmer.
The unsafe keyword shifts responsibility for upholding Rust's rules from the compiler to the programmer.
The &i32 type is a reference to an integer.
So, when used with &32, MaybeUninit::zeroed() essentially creates a null pointer by design.
The &i32 type is a reference to an integer.
So, when used with &32, MaybeUninit::zeroed() essentially creates a null pointer by design.
MaybeUninit::zeroed() fills that space with zero bits.
For many (most?) types, that's an excellent default. But...
MaybeUninit::zeroed() fills that space with zero bits.
For many (most?) types, that's an excellent default. But...
But remember when you were "fighting the borrow checker". It was frustrating and development slow. After a while, things got easier. After some time, you started appreciating the check.
But remember when you were "fighting the borrow checker". It was frustrating and development slow. After a while, things got easier. After some time, you started appreciating the check.
#![deny(deref_nullptr)]
#![deny(integer_to_ptr_transmutes)]
#![deny(invalid_value)]
#![deny(invalid_from_utf8)]
#![deny(never_type_fallback_flowing_into_unsafe)]
#![deny(ptr_to_integer_transmute_in_consts)]
#![deny(static_mut_refs)]
#![deny(deref_nullptr)]
#![deny(integer_to_ptr_transmutes)]
#![deny(invalid_value)]
#![deny(invalid_from_utf8)]
#![deny(never_type_fallback_flowing_into_unsafe)]
#![deny(ptr_to_integer_transmute_in_consts)]
#![deny(static_mut_refs)]
This is much more serious than it sounds because it'll probably happen as soon as you don't want it to.
This is much more serious than it sounds because it'll probably happen as soon as you don't want it to.
#![deny(warnings)
Cargo also respects the RUSTFLAGS environment variable. This is the most general purpose solution.
RUSTFLAGS= -D warnings
#![deny(warnings)
Cargo also respects the RUSTFLAGS environment variable. This is the most general purpose solution.
RUSTFLAGS= -D warnings