Skip to content

Do not show type inlay on constant slice pattern match #14124

@HurricanKai

Description

@HurricanKai

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions