# pre-RFC \`const\` function arguments

**URL:** <https://internals.rust-lang.org/t/pre-rfc-const-function-arguments/6709>\
**Category:** language design\
**Created:** [February 5, 2018, 4:58pm UTC](https://internals.rust-lang.org/t/pre-rfc-const-function-arguments/6709 "2018-02-05T16:58:38Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![gnzlbg](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/gnzlbg/32/3858_2.png) [@gnzlbg](https://internals.rust-lang.org/u/gnzlbg)\
**Post date:** [February 5, 2018, 9:13pm UTC](https://internals.rust-lang.org/t/pre-rfc-const-function-arguments/6709/22 "2018-02-05T21:13:11Z")

</div>

> [@scottmcm](#):
>
> Curiosity: fn foo(const X: usize) makes it look like this is adding const as part of patterns. Can I also do match x { const y =\> ... }?

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.

```rust
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:

```rust
fn foo(const A{ a, b }: A) {}

```

The question is whether `const` generics would play along. I have no idea.

---

_[View the full topic](https://internals.rust-lang.org/t/pre-rfc-const-function-arguments/6709)._
