Tim McNamara
timclicks.dev
Tim McNamara
@timclicks.dev
Trainer and consultant on the Rust programming language. Author of Rust in Action. Team climate. Walkable neighbourhoods are nice, actually.

Signal: @timclicks.01
This is smart! Thank you :)
November 16, 2025 at 11:50 PM
Do you have any other productivity tips? Please let me know and I'll do my best to share widely :D
November 16, 2025 at 10:05 PM
Fish shell

export COMPLETIONS=~/.config/fish/completions
mkdir -p $COMPLETIONS
rustup completions fish >> $COMPLETIONS/rustup
rustup completions fish cargo >> $COMPLETIONS/cargo
November 16, 2025 at 10:05 PM
Bash (within homebrew)

export COMPLETIONS=$(brew --prefix)/etc/bash_completion.d
mkdir -p $COMPLETIONS
rustup completions bash >> $COMPLETIONS/rustup
rustup completions bash cargo >> $COMPLETIONS/cargo
November 16, 2025 at 10:05 PM
Bash:

export COMPLETIONS=~/.local/share/bash-completion/completions
mkdir -p $COMPLETIONS
rustup completions bash >> $COMPLETIONS/rustup
rustup completions bash cargo >> $COMPLETIONS/cargo
November 16, 2025 at 10:05 PM
If you're on YouTube, you can find this example there too! www.youtube.com/shorts/i2E9C...
Code challenge: Why does this #rustlang trigger undefined behavior?
YouTube video by timClicks
www.youtube.com
November 14, 2025 at 10:54 AM
I hope you've found this thread helpful!

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.
November 14, 2025 at 12:59 AM
You may be curious why the MaybeUninit::zeroed() method doesn't require unsafe to call.

That's because it's actually safe to create uninitialized values, and to write to them, but not to read from them.
November 14, 2025 at 12:59 AM
What happens when you execute code with undefined behavior?

Nothing good.

In my testing, the compiler generated code that provoked the CPU to fault due to an illegal instruction.
November 14, 2025 at 12:59 AM
When you use an unsafe block, you must be sure that you understand the safety preconditions.

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.
November 14, 2025 at 12:59 AM
That's why .assume_init() needs to be wrapped in an unsafe block.

The unsafe keyword shifts responsibility for upholding Rust's rules from the compiler to the programmer.
November 14, 2025 at 12:59 AM
Rust's references are not allowed to be null. That's why you'll never receive a null pointer exception when you work in the language.

The &i32 type is a reference to an integer.

So, when used with &32, MaybeUninit::zeroed() essentially creates a null pointer by design.
November 14, 2025 at 12:59 AM
The MaybeUninit type provides Rust programmers with a way to talk about values that might not be correctly initialized.

MaybeUninit::zeroed() fills that space with zero bits.

For many (most?) types, that's an excellent default. But...
November 14, 2025 at 12:59 AM
Following here is what I intended -- sorry, wrong verb :) -- but yes subscribing there would also be very appreciated.
November 12, 2025 at 9:05 PM
p.s.s. You can help feed the algorithm by subscribing to make the numbers go up. It helps!!
November 11, 2025 at 10:59 PM
p.s. I have begun to think about how to be more active on here. Is there questions that would be useful to talk or write about?
November 11, 2025 at 10:59 PM
It was added very recently (version 1.91.0). Try `rustup update`.
November 10, 2025 at 9:12 PM
And if you're curious about why "deny(...)" is on every line, it's because I find that this style works best with version control.
November 10, 2025 at 3:12 AM
Article with more info: www.patreon.com/posts/deny-...
November 9, 2025 at 11:34 PM