Closed
Description
Here's a minimized version of the code I'm working with:
#[derive(Clone, Copy)]
#[allow(non_snake_case)]
struct Entry {
Δ: u16,
_θ: u16,
_μ: u8,
}
static TABLE: [Entry; 1] = [Entry { Δ: 0, _θ: 0, _μ: 0 }];
pub mod inner {
pub fn f(k: usize) -> u16 {
let super::Entry { Δ, _θ, _μ } = super::TABLE[k]; /* here */
Δ
}
}
Compiling this on stable or nightly gives a non_snake_case
warning on the indicated line, despite the allow(non_snake_case)
attribute on struct Entry
. A similar issue was reported before in #66362, and addressed in a follow-up PR #66660, but it seems to be cropping up again here, maybe because a non-ASCII field name is involved. It was agreed in #66362 that punning of non-snake-case fields in patterns should not produce an additional warning, so I think this is a bona fide bug. (Incidentally, on stable the same warning appears twice in the compiler output, but this duplication seems to be fixed on nightly.)