Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Use Case]: scope based normalization of const generics #51

Open
BoxyUwU opened this issue Jun 8, 2023 · 1 comment
Open

[Use Case]: scope based normalization of const generics #51

BoxyUwU opened this issue Jun 8, 2023 · 1 comment
Labels
A-generic-exprs Generic const expressions C-use-case Category: This is a use case for a feature

Comments

@BoxyUwU
Copy link
Member

BoxyUwU commented Jun 8, 2023

Code description

fn concrete(input: [u32; 10]) {
    // ...
}

fn generic<const N: usize>(input: [u32; N]) {
    match N {
        10 => concrete(input),
        _ => panic!("invalid input size"),
    }
}

Some people have wanted this to compile, this has some overlap with pattern types I expect cc @oli-obk

@BoxyUwU BoxyUwU added A-generic-exprs Generic const expressions C-use-case Category: This is a use case for a feature labels Jun 8, 2023
@jyn514
Copy link
Member

jyn514 commented Jun 8, 2023

this looks like type flow analysis: https://www.typescriptlang.org/docs/handbook/2/narrowing.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-generic-exprs Generic const expressions C-use-case Category: This is a use case for a feature
Projects
None yet
Development

No branches or pull requests

2 participants