Can write to fields of uninitialized mutable struct #46791
Labels
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I'm not 100% sure this is a bug, but the behavior seems very strange to me. You can write to fields of an uninitialized mutable struct.
I tried this code:
I expected to see this happen: the assignment throws a compiler error.
Instead, this happened: no error is generated.
Alternatively, it would be ok to have the assignment work, but then I'd expect to be able to refer to it, like in the line below it.
Link to playground
The text was updated successfully, but these errors were encountered: