this post was submitted on 20 Feb 2025
81 points (100.0% liked)

Rust

6397 readers
122 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS
top 7 comments
sorted by: hot top controversial new old

Adds Future and IntoFuture to the prelude.

Woo!

std::env::set_var, std::env::remove_var... are now unsafe functions.

That's unfortunate. I understand why it's unsafe, but it would be cool if they were atomic or something instead. I don't really want to clutter code with unsafe for things that are technically safe in context (e.g. unit tests for config parsing).

async closures

Baller.

Other cool stuff as usual, so I'll be updating soon. Congrats on the release!

[–] calcopiritus@lemmy.world 2 points 1 day ago

The const hash map is huge. It was always a pain the have const/static hash maps. Specially since most use cases don't need a DoS-resistant hash map. Will be migrating to 2024 as soon as possible.

[–] Rogue@feddit.uk 14 points 2 days ago (2 children)

For anyone like me who hasn't seen an edition change before, it's just a mechanism for bundling breaking changes together and making them opt-in.

We are excited to announce that the Rust 2024 Edition is now stable! Editions are a mechanism for opt-in changes that may otherwise pose a backwards compatibility risk.

[–] aljazmerzen@fosstodon.org 4 points 1 day ago (1 children)

@Rogue @snaggen Yeah, it's a setting in Cargo.toml that you have to update manually if you want to upgrade. It is set to latest edition in new projects. And the nice thing:

it's configurable per-crate, not per-compilation. So you can depend on crates that use different editions than your crate. Which avoids ecosystem fragmentation.

[–] Rogue@feddit.uk 1 points 1 day ago (1 children)

it's configurable per-crate, not per-compilation. So you can depend on crates that use different editions than your crate. Which avoids ecosystem fragmentation.

Thanks! That pre-empted my next question of how quickly crates typically update to newer editions. I guess it doesn't matter

[–] taladar@sh.itjust.works 1 points 16 hours ago

There is also cargo fix --edition which can update your code in a very conservative way automatically. The result might not be as idiomatic but errs on the side of having semantics that do not change.

[–] thingsiplay@beehaw.org 1 points 1 day ago

You can think of the Rust Editions as updates to the language, that would break compatibility with previous versions. But the key here is, that you can mix crates with older versions and the new one in one project and cargo will figure out which one to use for each crate (based on the cargo.toml file). That means breaking changes without breaking compatibility of existing libraries and crates, unlike in other languages.