TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Rust 2021 Celebration and Thanks

39 pointsby vignesh_wararalmost 4 years ago

4 comments

steveklabnikalmost 4 years ago
If you&#x27;d like to learn more about what&#x27;s in Rust 2021, there will eventually be a blog post when it hits stable, but the edition guide has the details: <a href="https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;nightly&#x2F;edition-guide&#x2F;rust-2021&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;nightly&#x2F;edition-guide&#x2F;rust-2021&#x2F;in...</a><p>This edition is deliberately &quot;small&quot; compared to Rust 2018, which was very large. That doesn&#x27;t mean it wasn&#x27;t a ton of work, as you can obviously see from the number of people and work done in this post, but it is more &quot;quality of life changes&quot; than &quot;major new syntax and huge new features.&quot; More &quot;stuff I expected to work that used to not work now works&quot; and less &quot;I need to learn this new shiny thing.&quot; Those of you who have been waiting for Rust to slow down a bit, this is one example of how that&#x27;s happening.
stormbrewalmost 4 years ago
I <i>love</i> rust and working in rust has been an incredible experience for me, but I&#x27;m probably a really rare case in that I personally hope that the next edition (2023?) does a little weeding of what&#x27;s included in the prelude rather than being mostly additive.<p>Specifically, the various magical impls of From are a constant thorn in my side when writing practical rust. Specifically:<p>- Error messages if you screw something up with TryFrom tell you your problem was you implemented From&lt;&gt; wrong because of the magical `impl TryFrom&lt;T, Infallible&gt; for T where T: From` which is confusing as hell. I&#x27;m of the opinion this should be removed, and maybe add a macro for helping to implement it if you need&#x2F;want that.<p>- The magical behaviour of `collect` when given a collection of results to produce a result with a collection causes me to work harder overall because it confuses the type inference to the point that you need to throw a type declaration into the most awkward places. This also happens because of an `impl From` that you can&#x27;t get rid of. Sure, it&#x27;s nice that <i>occasionally</i> it does something useful quickly and cleanly, but then it makes things confusing the other 80% of the time. Should just be a separate function.
评论 #28409517 未加载
评论 #28409402 未加载
the_dukealmost 4 years ago
The 2021 edition, while a breaking change, will affect only a tiny amount of code. Most crates will be able to put `edition = &quot;2021&quot;` into Cargo.toml without any other modiciations. Only some relatively minor parsing and semantics changes were introduced. It&#x27;s not nearly as big as the 2018 edition, which brought big changes to the module and macro system.<p>Mostly some quality of life improvements.<p>Also note that the Rust compiler remains backwards compatible and continues to support all previous editions. (well, it&#x27;s only 2015 and 2018 for now)<p>Lot&#x27;s of work is put into the compiler, but a lot of it is refinement and plumbing at the moment. Big feature work has slowed down a lot (which is probably a good thing).<p>But as some positive news: GAT (generic associated types, a more restrictive variant of higher kinded types) are apparently nearing completion, which can also unblock some very important improvements for the async world (eg `async fn` in traits).<p>I do still really miss some big features though: async in traits, a more flexible dynamic trait system (multi-trait objects, downcasting), generators and specialization.
pjmlpalmost 4 years ago
Many thanks for the new edition.