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

Segfault on trivial consumption of vector #4878

Closed
alexcrichton opened this issue Feb 10, 2013 · 2 comments
Closed

Segfault on trivial consumption of vector #4878

alexcrichton opened this issue Feb 10, 2013 · 2 comments
Labels
A-codegen Area: Code generation I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@alexcrichton
Copy link
Member

This program will cause a segfault:

fn main() {
  let a : ~[int] = ~[];
  do a.consume |_, _| {}
}

Although if the consumption is changed to vec::consume the segfault does not happen.

This may be a dup of #4318?

@brson
Copy link
Contributor

brson commented Feb 10, 2013

I've also noticed that the consume method doesn't work. As a workaround, the function, vec::consume does.

dotdash added a commit to dotdash/rust that referenced this issue Jun 2, 2013
For types that are passed by value, we can't just cast the value to a
pointer, but have to use an alloca and copy the value there. This
handling is already present for all other arguments, but was missing
for "self".

Fixes rust-lang#6682, rust-lang#4850 and rust-lang#4878
bors added a commit that referenced this issue Jun 3, 2013
For types that are passed by value, we can't just cast the value to a
pointer, but have to use an alloca and copy the value there. This
handling is already present for all other arguments, but was missing
for "self".

Fixes #6682 #4850 #4878
@alexcrichton
Copy link
Member Author

Closed by #6903

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation 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