This is just a silly observation I made, but...
#![feature(generic_const_items)]
const SOME_INT_PAIR<const N: usize>: Option<(usize, usize)> = Some((N, N));
almost mirrors the semantics of
pattern SomeIntPair n = Just (n, n)
This is just a silly observation I made, but...
#![feature(generic_const_items)]
const SOME_INT_PAIR<const N: usize>: Option<(usize, usize)> = Some((N, N));
almost mirrors the semantics of
pattern SomeIntPair n = Just (n, n)
This is because, like pattern aliases, rust constants can be used both in expressions and in patterns.
consts can have generic parameters??
Notice the feature flag. The tracking issue is Tracking issue for generic const items · Issue #113521 · rust-lang/rust · GitHub
This topic was automatically closed 540 days after the last reply. New replies are no longer allowed.