Is there any specific reason why _ isn't allowed in array types to infer the length?
let a = [1, 2, 3]; // works let b: [u32; _] = [1, 2, 3]; // extremely surprised but this doesn't work
today's compiler treats it as a separate inference context, iirc, but I believe lang recently discussed this as part of the _ for array-typed consts rfc and decided that at least for lets it's a 'definitely should work' -- but I may be misrepresenting, and definitely it wasn't full attendance from lang in that meeting
okay, so presumably this doesn't need an RFC and some sort of pushing for it to eventually be added to the lang, given that other people are already talking about it
It does need some sort of push.
I think for lets though we felt that we could likely land with a PR?
Maybe I'm misremembering :)
That's definitely my opinion -- I think const items are the harder question
ooh cool but the rfc is already done
Yeah, it's more obvious for
let, since you can already infer the entire type.
I'm more eager to have it for
const, where you have to specify the type.
Yes -- I think consts are not a "no duh" case due to potential interaction with "global inference" and it being perhaps somewhat tough to specify exactly to what extent we avoid that (though maybe not, not sure -- seems like it could be hard but may not be). But
let seems to be, IMO there's it's more so "just a bug" in some sense
Also see https://github.com/rust-lang/rust/issues/70754 for the more general case with const generics.
Last this came up in a meeting I think we said that for
lets in particular, this (or something very similar) is expected to happen as part of the const generics work, but that we wouldn't push for specific situations of it before then.
But thanks for the reminder, I forgot to do a follow-up from a previous design meeting about