Skip to content

Invalid parse on array size expr inference #3879

Open
@CohenArthur

Description

@CohenArthur

In this code

#[allow(unused)]
macro_rules! simd_shuffle {
    ($x:expr, $y:expr, $idx:expr $(,)?) => {{
        simd_shuffle(
            $x,
            $y,
            const {
                let v: [u32; _] = $idx;
                v
            },
        )
    }};
}

and more specifically on the following statement:

let v: [u32; _] = $idx;

we get the following error:

test.rs:9:18: error: use of ‘_’ is not allowed on the right-side of an assignment
    9 |     let a: [u32; _] = [15u32];
      |                  ^

an easy testcase is this one:

fn main() {
    let a: [u32; _] = [15u32];
}

Note that this is technically hidden behind #![feature(generic_arg_infer)]

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions