Skip to content

Segmentation fault with rust 0.12.0 nightly : traits and references #15660

Closed

Description

@artella-coding

The following compiles fine, but gives a segmentation fault upon running (Ubuntu 14.04 64 bit) :

struct Stuff {
  items : [Box<int>,..3]
}

impl Index<uint,Box<int>> for Stuff {
  fn index<'a>(&'a self, i: &uint) -> &'a Box<int> {
    return &self.items[*i];
  }
}

fn main(){
  let val = Stuff {items:[box 0,box 1,box 2]};
  let val2 = val[1];
  let val2 = val[1];
  println!("{}",val2);
}

and I am using :

rustc 0.12.0-pre-nightly (3d70f50b2ce2e04bb8db934721eeaddb80a7cc27 2014-07-14 00:31:30 +0000)

Activity

  1. huonw commented on Jul 14, 2014

    @huonw
    Contributor

    Dupe of #15525. (Thanks for filing!)

  2. added a commit that references this issue on Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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