Skip to content

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

New issue

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

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

Already on GitHub? # to your account

Closed
artella-coding opened this issue Jul 14, 2014 · 1 comment
Closed

Comments

@artella-coding
Copy link

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)
@huonw
Copy link
Member

huonw commented Jul 14, 2014

Dupe of #15525. (Thanks for filing!)

@huonw huonw closed this as completed Jul 14, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 13, 2023
…albasi

minor: hover_simple refactor

A minor refactor of `hover_simple` opportunity I noticed while skimming through the code.

- `if let`s -> `match`
- `iter::once(x).cycle` -> `iter::repeat`
- `classify_token` -> `classify_node`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants