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

Pointer can be accessed after ownership was transfered and segfaults #11481

Closed
lassej opened this issue Jan 11, 2014 · 1 comment
Closed

Pointer can be accessed after ownership was transfered and segfaults #11481

lassej opened this issue Jan 11, 2014 · 1 comment
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@lassej
Copy link

lassej commented Jan 11, 2014

This code segfaults on Mac OS X 10.8.5 with Rust 0.9:

struct Number {
  n: i64
}

impl ToStr for Number {
  fn to_str( &self) -> ~str {
    self.n.to_str()
  }
}

struct List {
  list: ~[~ToStr]
}

impl List {
  fn push( &mut self, n: ~ToStr) {
    self.list.push( n);
  }
}

fn main() {
  let n = ~Number{ n: 42 };
  let mut l = ~List{ list: ~[] };
  l.push( n);
  println!( "n: {}", n.to_str());
}
@alexcrichton
Copy link
Member

cc @luqmana and @pcwalton, looks like this is a problem with implicit trait coercions.

bors added a commit that referenced this issue Jan 14, 2014
Fixes 2 annoying issues with implicit trait object coercion: #11481 & #11197.
flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 25, 2023
Add missing tests for configuration options

I noticed that a lot of lints didn't have test(s) for their configuration. This leads to issues like rust-lang#11481 where the lint just does nothing with it.

This PR adds tests for *almost*[^1] all of the lints with a configuration that didn't have a test in ui-toml.
The tests that I wrote here are usually two cases: one for where it's right above or under the limit set by the config where it shouldn't lint and another one for right above where it should.

changelog: none

[^1]: allow-one-hash-in-raw-strings is ignored by needless_raw_string_hashes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

2 participants