Rust: The dbg! Macro Gets a Major Fix and Spring Cleaning Day
Today brought 20 merged pull requests with some fantastic improvements! The star of the show is a crucial fix to the dbg! macro that prevents premature dropping of temporary values, plus we got a shiny new hash_map! macro and tons of documentation improvements. The Rust team has been busy with both user-facing features and behind-the-scenes optimizations.
Duration: PT4M
Transcript
Hey there, Rustaceans! Welcome back to another episode of the Rust podcast. I'm your host, and wow, do we have a packed show for you today. March 30th brought us 20 merged pull requests, and let me tell you, there's some really exciting stuff in here that's going to make your Rust development experience even better.
Let's dive right into our biggest story of the day - a fix that's been a long time coming for the beloved dbg! macro. You know that feeling when you're debugging and you slap a dbg! around some expression, only to find out it's not working quite the way you expected? Well, dianne just merged a fantastic fix that prevents the dbg! macro from dropping arguments' temporaries prematurely. This was issue #153850, and honestly, it's one of those fixes that might seem small but will save so many of us from those head-scratching debugging sessions. Big shoutout to theemathas for helping with the macro engineering on this one!
Speaking of macros, we've got another treat - m4rch3n1ng just landed a reimplementation of the hash_map! macro. If you've been wanting a clean, ergonomic way to create hash maps, this is going to be a game-changer for your code. It's one of those features that just makes Rust feel more expressive and fun to write.
Now, I love seeing the kind of attention to detail that went into scrabsha's work on rustdoc. They added missing os, target, and target_env values for the cfg pretty printer. It might not sound glamorous, but good documentation tooling is what makes Rust such a joy to work with. When your docs are clear and complete, everyone wins.
The type system got some love too. chenyukang fixed an issue where you'd get invalid type suggestions for items nested in functions. You know those moments when the compiler is trying to be helpful but the suggestion just doesn't make sense? One less of those to worry about now. And jeanibarz added a regression test for a tricky recursive lazy type alias normalization ICE that was causing the compiler to crash. Now it properly reports an error instead - much better developer experience.
Here's something I find really thoughtful - fee1-dead updated the Zulip link in the std documentation. It's a tiny change, but it shows how much the team cares about keeping the community connected. They pointed folks to the right channel and even included a direct topic link since Zulip is world-viewable now.
On the performance front, nikic had to revert a FastISel patch that was causing compile-time regressions for debug builds. This is exactly the kind of vigilance we want to see - performance matters, and the team isn't afraid to roll back changes that don't meet the bar.
We also got some nice quality-of-life improvements in the collections. GrigorenkoPV added doc links to ExtractIf for BTreeSet, BTreeMap, and LinkedList, and made comparisons and Clone const for core::mem::Alignment. Jules-Bertholet improved MapWindows by removing unnecessary fusing. These might seem like small changes, but they add up to a much more polished experience.
Lars-Schumann fixed an important issue with Vec::const_make_global for zero capacity and zero-sized types. If you're doing low-level work with vectors, this fix probably just saved you some debugging time.
For today's focus, I want to encourage you to check out that dbg! macro fix. If you've ever had weird behavior with temporary values in your debug prints, take a look at the test cases in this PR. It's a great example of how subtle macro behavior can be, and understanding it will make you a better Rust developer.
Also, if you're using hash maps in your code, definitely explore that new hash_map! macro. Clean, readable initialization syntax is one of those things that just makes your code more maintainable.
That's a wrap on today's episode! Twenty pull requests, countless improvements, and another step forward for the Rust ecosystem. Keep coding, keep learning, and we'll catch you tomorrow with more Rust updates. Happy coding, everyone!