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
f-string width/align/precision on a bool, enum, struct or collection interpolant formats garbage (FMT_BUF_WRITE_FMT treats every non-numeric value as str) #1565
Found while implementing D61 (#1480); predates it.
validate_fstring_spec rejects mode/type mismatches ({p:x}), but a width or alignment with no mode passes for any type: {flag:>5}, {opt:<10}, {point:>8}, {vec:>4}. Codegen (gen_fmt_buf_write_fmt, gen_fmt_with_spec) handles integer and float LLVM values and treats everything else as a str header (build_str_ref_from_value(val)), so a bool prints 1/0 and an enum or struct is read as a str header — garbage, not a diagnostic. §15.4.6 says only ? mode and width/alignment are valid on bool; the spec does not say what width means for an enum or aggregate.
Expected: Sema rejects width/align/precision on types that have no display (or defines them), and bool with width pads true/false.
Activity