This RFC does not proposing adding const
as part of patterns. AFAIK const
as part of patterns doesn't work yet (what would this even mean?), e.g.
struct A { a: i32, b: i32 }
let A{ a, b }: A = A{ a: 2, b: 3 }; // OK
const A{ a, b }: A = A { a: 2, b: 3 }; // ~ERROR
I can imagine that we might want to make that work someday though, so this RFC should not prevent that from happening.
From a syntactic point-of-view, if we ever get const
in patterns, we might be able to allow this in const
-function arguments without breaking backwards compatibility like this:
fn foo(const A{ a, b }: A) {}
The question is whether const
generics would play along. I have no idea.