-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Rusti crashes on my system when I type "let mut a = 4;" into it. #7732
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
So it turns out that this is a fairly subtle problem. When generating JIT code, we also generate glue code for destroying things like What this means is that the drop glue which must get invoked is stored off in JIT memory away from the actual main program. Let's then assume that being a responsible individual, you free your LLVM resources as soon as you're done using them (basically when the JIT code finishes). You can then quickly see how this becomes a problem. If the JIT code is deallocated, then when task exit comes around and tries to run the drop glue... segfault! To illustrate this, here's a minimal program: struct A { a: Option<@mut A> }
fn main() {
let a = @mut A { a: None };
a.a = Some(a);
} Note the circular reference to force the box to stay alive until the annihilator runs. Now running this code in the JIT:
So what this means is that immediately after I'll get a patch for this soon. |
…ffen Make `doc_unsafe` warn on unsafe traits as well Fixes rust-lang#7732 changelog: Make [`doc_unsafe`] warn on unsafe traits as well
Rust is e95fcfa .
uname -a
->Linux vi-notebook 3.8.3 #12 SMP Thu Apr 4 15:08:07 FET 2013 i686 GNU/Linux
The text was updated successfully, but these errors were encountered: