Issue #731: S {} for a struct whose fields all have defaults does not parse

Open and answer this issue on GitHub.

decision · opened 2026-10-20 · updated 2026-10-20 · 0 comments

Found while building #704 (0.0.1106).

Part I says a struct literal may leave out any field that has a default (ADR-331 D5, ADR-318). Taken literally, a struct whose fields all have defaults could be written Page {}. The parser does not read that as a struct literal: it needs at least one field, and otherwise reads Page followed by an empty block. Before 0.0.1106 this was silently accepted and then failed in rustc. Now it is refused as NK1230, a type named as a value.

The question is whether S {} is a struct literal. The {} can also be a block, in the same places where Rust restricts struct literals, such as the head of an if or a for. This has to be prepared with an introduction from zero before it is put to the owner:

Back to Open Issues