As of Rust 1.88, these two functions generate different code for the CPU I’m targeting.

pub const fn good(channel: usize) -> usize {
    const X: [usize; 32] = [
        3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12, 19, 18, 17, 16, 23, 22, 21, 20,
        27, 26, 25, 24, 31, 30, 29, 28,
    ];
    X[channel]
}

pub const fn bad(channel: usize) -> usize {
    [
        3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12, 19, 18, 17, 16, 23, 22, 21, 20,
        27, 26, 25, 24, 31, 30, 29, 28,
    ][channel]
}

I expected these to generate the same thing, so I’m curious why they’re treated differently. But until I learn more, I won’t forget const.