Questions tagged [generic-const-exprs]

3 questions
3
votes
0 answers

Convincing the compiler that a GAT has the same type as another GAT

I was playing with some code, trying to see how wild I can get. The basic idea came to me when implementing merge sort with a custom comparator. We need to pass down the comparator (impl FnMut), but we cannot pass it owned because we need to pass it…
Chayim Friedman
  • 47,971
  • 5
  • 48
  • 77
0
votes
1 answer

Workaround for no const generics in expressions

I'm struggling to work around the limitation that in Rust, you cannot use a const generic parameter in an expression to specify a type. I am still learning rust and am trying to make a matrix type where I calculate the determinant using Laplace…
Rotartsi
  • 527
  • 5
  • 19
0
votes
1 answer

Calling different generics in a loop

While this is a trivial example, I have multiple generic functions which need to work across a few dozen possible values. The actual value is not known until runtime, as it is provided as an argument. #![feature(generic_const_exprs)] fn…
fadedbee
  • 42,671
  • 44
  • 178
  • 308