Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struct initializers allow missing fields #3892

Closed
brson opened this issue Oct 31, 2012 · 2 comments
Closed

Struct initializers allow missing fields #3892

brson opened this issue Oct 31, 2012 · 2 comments
Assignees
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@brson
Copy link
Contributor

brson commented Oct 31, 2012

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

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

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

This will crash

@brson
Copy link
Contributor Author

brson commented Oct 31, 2012

There is code for this in check_struct_or_variant_fields that doesn't seem to be working. There aren't tests.

@ghost ghost assigned brson Oct 31, 2012
@brson
Copy link
Contributor Author

brson commented Oct 31, 2012

This is more or less the same bug as #3486, different manifestations.

@brson brson closed this as completed in cb4de73 Oct 31, 2012
RalfJung pushed a commit to RalfJung/rust that referenced this issue Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

1 participant