-
Couldn't load subscription status.
- Fork 13.9k
Open
Labels
A-ZSTArea: Zero-sized types (ZSTs).Area: Zero-sized types (ZSTs).A-arrayArea: `[T; N]`Area: `[T; N]`A-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
In the discussion of pull request #11839, which aims to check the representability of structs and enums properly in typeck, @huonw pointed out that the semantics for types that directly contain zero-length vectors of themselves are potentially still undecided.
Consider for example (play):
struct Foo { recur: [Foo; 0], } fn main() { }If typeck allows enum Foo { A([Foo; 0]) } or
struct Bar { x: [Bar; 0] } then there is an infinite recursion + stack overflow in trans::adt::represent_type, so I will amend #11839 to disallow these cases and add a FIXME referencing this issue.
To me, it seems more consistent to allow any zero-length vector than to allow only some, but the only use case I can think of is that it may make some macros simpler to write.
kornelski and schneiderfelipe
Metadata
Metadata
Assignees
Labels
A-ZSTArea: Zero-sized types (ZSTs).Area: Zero-sized types (ZSTs).A-arrayArea: `[T; N]`Area: `[T; N]`A-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.