Allow 'const _'?

I don’t mind this idea.

However, in today’s Rust, _ is permitted in two different contexts with two different meanings:

  1. In type contexts it means “please infer the type”.
  2. In patterns _ means “I don’t care / match anything”.

If we permit const _, then that makes for another 3rd context, which is quite ad-hoc. If instead we could bring const closer to let bindings, then we could support const $pat and things such as:

const (FOO, BAR): (usize, usize) = (1, 2);

In that case, const _ falls out naturally because _ is a pattern.

4 Likes