-
Notifications
You must be signed in to change notification settings - Fork 13.3k
for
loops allow moving out of references
#16205
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
Comments
From what I'm seeing here(debugger wise) the problem looks to stem from the call to Inside |
Can you describe the system that you're running on as well as the cargo/rustc versions you're using? I've been unable to reproduce the segfault on the most recent nightly on both linux and osx. |
Oh sorry, I'm running Windows here. Latest installer version.
After restarting into Xubuntu and updating I recompiled there and got a segfault.
I'm running off of a Toshiba Satellite L875D-S7210 with an AMD A6-4400M APU. |
for
loops allow moving out of fixed size arrays
Ah, found it. Nominating and cc @pcwalton, this seems bad and related to the recent removal of for-loop desugaring. |
Assigning P-backcompat-lang, 1.0 milestone. |
Simpler reproduction (it's not related to fixed sized arrays, updating title): fn main() {
let x = Some(box 1i);
for &a in x.iter() {
}
} |
for
loops allow moving out of fixed size arraysfor
loops allow moving out of references
If you want to see a segfault you have to do something in the loop and iterate twice: fn main() {
let x = [box 1i, box 2i];
for &a in x.iter() {
println!("{}", a);
}
for &a in x.iter() {
println!("{}", a);
}
} This prints 1 and 2, then stalls a bit, then segfaults. |
`for` loop heads. This breaks code like: let x = Some(box 1i); for &a in x.iter() { } Change this code to obey the borrow checking rules. For example: let x = Some(box 1i); for &ref a in x.iter() { } Closes rust-lang#16205. [breaking-change]
`for` loop heads. This breaks code like: let x = Some(box 1i); for &a in x.iter() { } Change this code to obey the borrow checking rules. For example: let x = Some(box 1i); for &ref a in x.iter() { } Closes #16205. [breaking-change] r? @nikomatsakis
Updated description
for
loops allow moving out of fixed size arrays. This code compiles and should not compile.Original description
segfault with channels
I don't know how to make this test case smaller, but...
steveklabnik/dining_philosophers@52ca036
This commit introduces a segfault.
Seems bad.
The text was updated successfully, but these errors were encountered: