News for hackers. Stuff that matters.
Re:Rust 1.50 by staticassertion on Thursday February 11, 2021 @10:37AM (#26102624)
const generics are a feature I've been looking forward to since 1.0, really cool to see that work making it to stable.

This solves another of the ergonomic issues in Rust. It really feels like within 2021 Rust will hit a point where it feels totally consistent.

Re:Rust 1.50 by CodesInChaos on Thursday February 11, 2021 @10:51AM (#26102877)
Unfortunately the version of const generics stabilized in 1.51 has many limitations. The core problem seems to be that evaluating const functions can panic, while generics should only produce errors when constraints are not met, not when instantiating them.

The current limitation I find the most annoying is that you can't use associated constants in generics.

Re:Rust 1.50 by est31 on Thursday February 11, 2021 @10:41AM (#26102698)
const generics themselves will only become stable in the upcoming release, 1.51. This release only adds implementations of specific traits to arrays of all lengths. Users themselves can't declare types yet that are generic on numbers or write impl blocks generic on numbers.
Re:Rust 1.50 by felipellrocha on Thursday February 11, 2021 @02:51PM (#26106239)
I hit this limitation recently, and although it was a bummer, it’s good to hear that a solution is being worked on
Re:Rust 1.50 by staticassertion on Thursday February 11, 2021 @11:35AM (#26103593)
Ah! Bummer, but also, that's enough to deal with what felt like a big inconsistency in Rust - inability to work well with arrays.
Re:Rust 1.50 by conradludgate on Thursday February 11, 2021 @01:06PM (#26104982)
I'm already using them in nightly and they are amazing.

The only thing left that I want with generics is variadics/tuples. The only way currently to implement a trait over a generic tuple is to write a macro and call it for however many sized tuples you want. I've not seen any convincing RFCs about it yet though so I'm not confident we'll get them any time soon

Re:Rust 1.50 by remexre on Thursday February 11, 2021 @06:08PM (#26108717)
I use https://docs.rs/frunk/0.3.1/frunk/ to get around this in the meantime.
Re:Rust 1.50 by PoignardAzur on Friday February 12, 2021 @05:32PM (#26119306)
I wouldn't call it a convincing RFC, but I did recently write an analysis on the subject:

https://gist.github.com/PoignardAzur/aea33f28e2c58ffe1a93b8f...