Skip to content

Struct initializers allow missing fields #3892

Closed
@brson

Description

@brson
struct BuildData {
    foo: int,
    bar: ~int
}

fn main() {
    let foo = BuildData {
        foo: 0
    };

    debug!("%?", foo.bar);
}

This will crash

Metadata

Metadata

Assignees

Labels

E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions