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 1.62.0

226 pointsby cautionalmost 3 years ago

12 comments

dthulalmost 3 years ago
It's very cool that mutexes on Linux don't require an allocation anymore! A very common pattern is to use an Arc<Mutex<T>> for sharing ownership across threads and as far as I can tell this will now only require one allocation instead of two.
评论 #31937188 未加载
评论 #31937065 未加载
评论 #31936434 未加载
pachicoalmost 3 years ago
I can't really understand why I'm fluent in various languages but not Rust... I might have found my intellectual glass ceiling...
评论 #31936476 未加载
评论 #31936621 未加载
评论 #31936448 未加载
评论 #31937752 未加载
评论 #31937056 未加载
评论 #31936368 未加载
评论 #31936520 未加载
评论 #31936329 未加载
评论 #31937077 未加载
评论 #31936429 未加载
评论 #31936403 未加载
评论 #31936782 未加载
评论 #31936607 未加载
评论 #31937000 未加载
评论 #31936590 未加载
评论 #31937100 未加载
brundolfalmost 3 years ago
`cargo add` is such a small thing, but I'm so excited about it. Many tiny instances of friction as you have to open your browser and manually google a crate to find the latest version number so you can copy and paste it into your Cargo.toml
legerdemainalmost 3 years ago
Dang: &quot;On HN, we handle this [release announcements] by treating submissions of the same-ish story as dupes for a year or so&quot; <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23071428" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=23071428</a><p>Dang deleting Tauri&#x27;s 1.0 announcement on the basis of this guideline: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31764015#31790125" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31764015#31790125</a><p>Meanwhile:<p>- this thread<p>- 1.61.0 <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31434936" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31434936</a><p>- 1.60.0 <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30944709" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30944709</a><p>- 1.59.0 <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30457261" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30457261</a><p>- 1.58.0 <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29923390" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29923390</a><p>- 1.57.0 <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29416915" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29416915</a><p>- 1.56.0 <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28945420" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28945420</a><p>- 1.55.0 <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28945420" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=28945420</a><p>...
评论 #31941236 未加载
评论 #31940654 未加载
ridiculous_fishalmost 3 years ago
Edit: Rust 1.62 uses futexes directly; ParkingLot is a thing but not backing mutex on Linux. Thanks to ibraheemdev for the correction.<p>I&#x27;m working to understand how Rust 1.62 avoid allocations for futex-based locks. I think the summary is this:<p>1. A mutex is a u8. The mutex fast path is locking via atomic ops to set a bit.<p>2. Contention is resolved by adding the blocked thread into a wait queue. The queue is allocated&#x2F;discovered via a global hash table, keyed by the address of the mutex. The mutex keeps a stable address while locked, as the lock holds shared ownership and so the mutex cannot be moved for the duration.<p>I ported a POSIX semaphore wrapper from C++ to Rust, and needed an extra allocation for the same reason, to get an int with a stable address. Unfortunately this technique won&#x27;t work for semaphores, they need to be async-signal safe. So I&#x27;m still stuck with `Pin&lt;Box&lt;UnsafeCell&lt;sem_t&gt;&gt;&gt;` where in C++ it&#x27;s just `sem_t` and a deleted move constructor.<p>Anyways this is a lot of hoops to jump through to avoid non-movable types, hope it&#x27;s worth it!
评论 #31937179 未加载
评论 #31937255 未加载
monocasaalmost 3 years ago
Neat, although the blog post doesn&#x27;t make this explicit, the new x86_64-unknown-none target disables the red zone, truly making it useful in kernels where otherwise an incoming interrupt would corrupt your stack.
评论 #31938253 未加载
tempusralmost 3 years ago
The new cargo add feature is a great QoL update.
评论 #31942128 未加载
cercatrovaalmost 3 years ago
Generic associated types were supposed to be stabilized in 1.62 but there has been a recent backlash in the PR of what exactly to stabilize [0]. I posted it as its own separate post here [1].<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust&#x2F;pull&#x2F;96709" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust&#x2F;pull&#x2F;96709</a><p>[1] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31939077" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31939077</a>
nixpulvisalmost 3 years ago
Total ordering on floats! Does this mean we can sort &amp;mut [f32] now!?
评论 #31936672 未加载
评论 #31936958 未加载
评论 #31936686 未加载
评论 #31936856 未加载
loegalmost 3 years ago
derive(Default) for enums is cool, I like that.
stuntalmost 3 years ago
Happy<p>Compiler<p>Happy<p>Life
eventhorizonplalmost 3 years ago
Rust is the language that makes me look forward to the next day at work.