You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fixed array sizes: a negative size becomes 0, and absurd sizes are accepted #170
struct S {
a: u8[-3] // builds, as u8[0]
b: u8[9223372036854775807] // builds
}
TypeRef::from_grammar clamps a negative size with .max(0), so u8[-3] silently becomes u8[0]. Nothing caps a fixed size, so a field can declare more elements than any target can hold.
Fix: a negative size is an error, and so is an exact length of 0. Cap fixed sizes at u32::MAX, with each target's ceiling checked when generating. Both are part of the bounds design (core#98; issues 4 and 32 in docs' Proposal D).
Activity