Skip to content

Bus error when referencing a static variant #11587

Closed
@sehugg

Description

@sehugg

The following code leads to a Bus Error when executed. Function is Struct::new::h402a74079d4792bdD2aR::v0.0

rustc 0.10-pre (149fc76 2014-01-15 13:51:50 -0800)
host: x86_64-apple-darwin

Also repeatable on 0.9.

static NotPresent: Option<~int> = None;

pub struct Struct
{
  option: Option<~int>
}

impl Struct
{
   pub fn new() -> Struct { Struct {
     option: NotPresent
   } }
}

fn main()
{
    let dc = Struct::new();
    assert!(dc.option.is_none());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions