-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
When writing code similar to:
const A: u8 = 5u8;
fn main() {
let b = &mut [5u8];
match b {
[A] => (),
[_b] => panic!("??")
};
}
(playground)
A type inlay is shown on [A: <here>]
exactly like when matching a variable. They slightly differ in type (above [A: u8]
and [_b: &mut u8]
but is still confusing in my opinion.
Personally, I checked whether using a constant variable instead of a constant literal was allowed in this context because of this inlay.
I also don't think the inlay is particularly useful and omitting it would resolve the confusion and not loose any relevant information.
(my apologies if the terminology isn't correct, I hope it's understandable)