Yoshua Wuyts
blog.yoshuawuyts.com · Personal blog · on HN since 2019
Yoshua Wuyts, a Rust async working group member, writes about async Rust, error handling, effects, and language design ideas.
What HN saysCommenters discuss its Rust error handling overview and async posts, debating Rust's many error libraries versus Go's convention, and what async is for.
65HN people shared it
13linked it in comments
109stories submitted
1.5Kstory points
3 months agolast shared
2019people per year2026
Most-shared posts
- 1Overview of Rust error handling libraries6 people · 224 points · first shared 2019 · 79 comments on HN
- 2Why Async Rust?6 people · 20 points · first shared 2022 · 1 comments on HN
- 3Syntactic musings on match expressions in Rust5 people · 11 points · first shared 2025 · discussion on HN
- 4Extending Rust's Effect System4 people · 151 points · first shared 2024 · 24 comments on HN
- 5Ergonomic Self-Referential Types for Rust4 people · 16 points · first shared 2024 · discussion on HN
- 6Async Cancellation3 people · 123 points · first shared 2021 · 40 comments on HN
- 7Async Overloading3 people · 61 points · first shared 2021 · 48 comments on HN
- 8Placing Functions3 people · 20 points · first shared 2025 · 7 comments on HN
- 9A survey of every iterator variant in Rust3 people · 6 points · first shared 2025 · 1 comments on HN
- 10Rust should own its debugger experience3 people · 5 points · first shared 2023 · discussion on HN
- 11The gen auto-trait problem3 people · 4 points · first shared 2025 · discussion on HN
- 12An effect notation based on with-clauses and blocks3 people · 3 points · first shared 2026 · discussion on HN
- 13Futures Concurrency III3 people · 3 points · first shared 2022 · discussion on HN
- 14State Machines in Rust2 people · 301 points · first shared 2020 · 112 comments on HN
- 15Asynchronous Programming in Rust2 people · 153 points · first shared 2019 · 16 comments on HN
What HN people wrote when they linked it
yoshuaw · 2023-01-29
Rust Async WG member here: This question comes up pretty regularly when people first learn about async Rust. I suspect it’s because performance is often emphasized as the main benefit of async Rust.
In my opinion performance is always relative and dependent on the workload. Instead it’s worth looking more at which capabilities async Rust provides which aren’t present in non-async Rust. This includes ad-hoc cancellation, ad-hoc concurrency, and combining the two into things such as timeouts.
I wrote a post explaining this in detail a few months ago: https://blog.yoshuawuyts.com/why-async-rust/
adkadskhj · 2021-04-22
> You may not like Go's convention (indeed, I don't love it although I think it works fine in practice), but the only error handling mechanism in Go is `if err != nil { ... }`. On the other hand Rust has many. This is not incompatible with your observation of "a standardized Result type". Here is a survey of the error handling landscape circa 2019: https://blog.yoshuawuyts.com/error-handling-survey/
By this definition, Go has many too. Go has lots of libraries to wrap error types, combine errors, preserve error data, etcetc.
Errors are one of the more similar things between Rust and Go, honestly.
papaf · 2021-01-05
the type system simply does not allow you to ignore errors
Which is excellent.
the gold standard in error handling is Rust
Really? What library is in fashion this week for handling errors? I have so far used vanilla Rust, error-chain and Failure.
Seems like there is so much choice to improve the gold standard:
https://blog.yoshuawuyts.com/error-handling-survey/#libraries
throwaway894345 · 2021-04-22
> Not sure what's meant by this; Rust has a standardized Result type, with dedicated syntax for early-returning errors and type checks that make sure you handle them (or at least explicitly ignore them). Go, on the other hand, has a shaky error story and from what I've heard it's a constant problem due to enforcement-by-convention.
You may not like Go's convention (indeed, I don't love it although I think it works fine in practice), but the only error handling mechanism in Go is `if err != nil { ... }`. On the other hand Rust has many. This is not incompatible with your observation of "a standardized Result type". Here is a survey of the error handling landscape circa 2019: https://blog.yoshuawuyts.com/error-handling-survey/
> Not really sure what this means either... the owner of a value generally falls out naturally from how you're trying to use it. It's not really an either/or option
Or you have code which clones gratuitously out of convenience, often because some API unnecessarily asks for ownership of its arguments. Cloning is often just easier than battling the borrow checker, so in the real world with its deadlines, we tend to see a lot of clones because it's more convenient and performance is rarely a concern.
> I've seen generics make TypeScript codebases impenetrable, and I think there's a decent case to be made for not having them at all.
In fairness to TypeScript, I suspect much of this 'impenetrability' is because type annotations were added to existing…
the8472 · 2025-11-19
That would require an effects system[0] like Koka's[1]. Then one could not only express the absence of panics but also allocations, infinite loops and various other undesirable effects within some call-trees. This is a desirable feature, but an enormous undertaking.
Absent that there are hacks like no_panic[2]
[0] https://blog.yoshuawuyts.com/extending-rusts-effect-system/ [1] https://koka-lang.github.io/koka/doc/book.html#why-effects [2] https://crates.io/crates/no-panic
NobodyNada · 2025-04-22
Here's a semi-recent link (~a year ago) by one of the leaders of this initiative: https://blog.yoshuawuyts.com/extending-rusts-effect-system/
solidsnack9000 · 2025-02-21
I don't think a good conversation can be had if we start by arguing about whether or not "rust's strategy has to be the only way to achieve memory safety".
There are other ways to achieve memory safety. Java's strategy is definitely a valid one; it's just not as suitable for systems programming. The strength of Rust's approach ultimately stems from its basis in affine types -- it is a general purpose and relatively rigorous (though not perfect, see https://blog.yoshuawuyts.com/linearity-and-control/) approach to managing resources.
One implication of this is that a point you raised in a message above this one, that "rust's default heap allocation can't be trivially used", actually doesn't connect. All variables in Rust -- stack allocated, allocated on the heap, allocated using a custom allocator like the one in Postgres extensions -- benefit from affine typing.
vlovich123 · 2024-10-24
It’s hard to say. If you want to use green threads, you may want to look at the may crate [1]. The reason Rust prioritized stackless async just like C++ did is that it fits better the systems programming needs (i.e. it’s syntactic sugar for a state machine you could hand implement) while not preventing things like stackful coroutines.
If Rust manages to solve the coloring problem of async (e.g. by adopting effect systems [2] or alternatives), then stackful and stackless coroutines syntactic sugar could conceivably exist within the std language (perhaps leaving out stackless on nostd).
The reason you don’t see both stackless and stackful coroutines in a single language like Rust is the coloring problem is made 50% worse.
[1] https://crates.io/crates/may
[2] https://blog.yoshuawuyts.com/extending-rusts-effect-system/
mbStavola · 2023-07-23
I have good news for you then-- there already is some experimental[0] work towards this, under the name of "pattern types" (although I believe it's on pause at the moment). The idea seems to be to pull some of the pattern semantics into the type system, allowing for more than just range types, based on a series of blog posts[1] by the author of the PR. Additionally, Yoshua Wuyts has another blog post[2] which gives a decent intro on the concept and what it could be used for down the line.
[1]: https://github.com/rust-lang/rust/pull/107606
[2]: https://cohost.org/oli-obk/post/165584-ranged-integers-via
[3]: https://blog.yoshuawuyts.com/pattern-extensions/#pattern-types
swsieber · 2023-07-19
IIRC been some proposals floating around, but one major block is asncy drop. This is the article I'm thinking of specifically: https://blog.yoshuawuyts.com/tree-structured-concurrency/
FL33TW00D · 2022-02-22
Swift did some interesting work around Async, which I know is making its way into Rust now. Random example here: https://blog.yoshuawuyts.com/futures-concurrency-3/
sizediterable · 2021-10-30
> any blocking operation (a method where Ruby interpreter waits) is compatible with Async and will work asynchronously within Async code block with Ruby 3.0 and later.
That's pretty magical. Does this mean it would be possible to implement structured concurrency [0], but without the function coloring problem?
Regardless, I think I prefer how this looks from a code read/writeability perspective compared to Zig's or Swift's (and potentially future Rust's [2]) approaches.
[0] https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statemen…
[1] https://kristoff.it/blog/zig-colorblind-async-await/
[2] https://blog.yoshuawuyts.com/async-overloading/
steveklabnik · 2020-04-09
https://blog.yoshuawuyts.com/error-handling-survey/ is a good summary of what's out there.
I think current rough consensus is anyhow/thiserr depending on if you're writing an application or library. I haven't actually used them myself, though. You don't have to keep up with the cool new libraries.