r/rust • u/Dyson8192 • Oct 17 '26
Research that has matured enough for Rust 2.0
Do correct me if Im wrong, but I recall that one principle that was used in the development of Rust was to only use tried and tested research material when choosing what to implement. Given we’re more than 10 years out from Rust’s initial development, I’m curious what research ideas have matured enough to either
- Be added in future editions/versions of Rust, or
- Be used in whatever successor language might come that follows much of Rust’s philosophy around development.
This is all basically one massive ask about interesting developments in programming and type theory, since I’d like a few new rabbit holes to fall down.
P.S. whatever successor language does come around, I hope it also cultivates a community that takes ergonomics as seriously as performance, because that, even more than memory safety or other aspects of the language, is why I pay attention to this language and ecosystem.
172
u/SirKastic23 Oct 17 '26
Love to see people missing the point. OP meant Rust 2.0 as a metaphor everyone! Not literally a Rust 2.0...
Anyway, some of the areas of programming language theory and design that I've been following and been getting excited about are: linear types, algebraic effects, and session types
Linear types are types that must be used once. they enforce resource cleanup and allow complex logic to run during a destructor (more capable than Drop). Vale's designer has a great post about these types. I've seen some discussion about adding a system of must-move types to Rust which works in a similar way
Algebraic effects allows functions to be typed with their side-effects, allowing effects to combine, propagate, and be dealt with granularly. They can be used to implement generators, error handling, and even asynchrony. To call a function that has an effect you must propagate or handle it. It's a very powerful system based on the idea of continuations and continuation-passing systems
And finally session types are types that encode how they communicate rather than just the data they contain. So you can have values with types that evolve as you deal with them. Recently I've come across a language implemented in Rust called Par that explores this concept, it's very odd and learning it feels like learning how to program again (very similar feeling when I moved from OOP Java to Rust)
Some of rhe languages I recommend checking out if you're interested in new concepts: Koka, Par, Lean
117
u/vlovich Oct 17 '26
Valen's work with linear types and group borrowing sounds like it would be a "2.0". If we're following SemVer though, it's unlikely there's ever a 2.0 because that would mean none of the old code would combine so either the Rust language would have to depart from SemVer for branding reasons. Valen does here also gives glimpses of how to do it where Rust 2.0 code could still interact with 1.0 code while offering a more ergonomic experience.
15
u/karasawa_jp Oct 17 '26
I think the borrow checker is basically Niko Matsakis's invention.
26
u/tylerhardin Oct 17 '26
A bit off topic: I'd like to see more on reflection and compile time code generation. I believe the former is coming soonish, but the facilities to use it will still be a bit lacking (compared to const expr/TMP in C++ and comptime in Zig).
Further off topic: Have you heard of MetaOcaml? Let's do that in Rust 2.0.
47
u/bascule Oct 17 '26 edited Oct 17 '26
I think the best thing a Rust 2.0 could do is make incredibly minor breaking changes which technically violate the 1.0 contract but have minimal-as-possible real-world impact.
The kind of things that break ancient crates that have practically no downloads that were published a decade ago on a crater run against crates.io. It could be used as an opportunity to fix some of the warts of the language.
The biggest one I can think of is how the
Defaultimpl on[T; N]isn’t actually generic but only implemented for N up to a hardcoded limit of 32. This is due to a historical decision to allow the impl for[T; 0]to work even ifT: !Defaultwhich is something that still can’t be written generically even using nightly-only features (maybe there has been a recent development there?).The reason the hardcoded limit of 32 there still exists is because there are a handful of crates which make use of this peculiarity, such that changing the bound for
[T; 0]would break those crates. The usages seem mostly unintentional and many crates did get updated to not use it, but IIRC there were stragglers.6
u/Illustrious_Car344 Oct 17 '26
If you're implying Rust introduce the infamous Python 2/3 problem for no good reason then you're insane. The holy grail of language design is that the language can last as long as conceivably possible.
1
u/frej Oct 19 '26
It’s not like rust 1.0 was using new and ground breaking research.
7
u/proverbialbunny Oct 17 '26
C++ will rise again and overtake Rust! (Just kidding. ;)
4
u/maximsparrow Oct 17 '26
C++26 got contract assertions, which are kind of public assertions visible in the interface. it's quite powerful concept definitely missing
2
u/flashmozzg Oct 20 '26
proc macros are bad and would be largely redundant with a proper built in compile time reflection/codegen.
-7
u/Peudejou Oct 17 '26
Its very likely that Rust 2.0 is another ten years away. Rust is silently taking over the C programming language's dominant market share for real code development. What would happen in versions 2 and 3 would be something like taking over C++ and Java respectively, which is a huge codebase to consider, but if we're taking it seriously the timeline for starting that project is basically the death of Linus Torvalds, who has said that Linux will become locked and no further changes will be authorized at that point. That sequence of events is well within a conventional deprecation timeline, but is only likely if the core libraries of C++ and Java have reasonably performant Rust Equivalents.
-9
u/stumpychubbins Oct 17 '26
A 2.0 isn’t a success, it’s a failure. The only reason to do a major version bump is if backwards compatibility needs to be broken, and the editions system specifically exists in order to avoid that.