-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ICE: this path should not cause illegal move #20801
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
FWIW, I get the same compiler bug when building my repo at the following commit: |
Bump? I'm finding this increasingly hard to (elegantly, at least) to work around in my FFI code. Any idea what's going on with this? |
This is now a full on blocker. Pausing until this is fixed. |
I've ran into this as well: pub struct Foo;
pub fn destroy(handle: *mut Foo) {
unsafe {
*handle;
}
}
rustc 1.0.0-nightly (1d00c54 2015-01-30 19:56:34 +0000) |
I hit this as well when playing with an example I found on Stack Overflow Playground half way through changing some type signatures from the SO example: http://is.gd/pBUABw pub extern "C" fn destroy(ptr:*mut Dramatic) {
// ...
let obj: Box<Dramatic> = unsafe { ::std::mem::transmute(*ptr) };
// ...
} |
I ran this error as well. Here is an MCVE that reproduces it. struct Foo;
fn foo(handle: &mut Foo) {
unsafe {
let temp: *mut Foo = &mut *handle;
*temp;
}
}
// This also causes the ICE.
/*
fn foo_immut(handle: & Foo) {
unsafe {
let temp: *const Foo = &*handle;
*temp;
}
}
*/
fn main() {
} Here is the output from
Here is the
|
Still in the latest nightly today: /* hans@yperman:~/proggies/th$ RUST_BACKTRACE=1 rustc --verbose src/main_crash.rs stack backtrace: hans@yperman: *_/ fn new(name:&str)-> i64{ pub fn main() { |
Note - While the ICE is a bug, the above code is already invalid. All versions attempt to move out of a raw pointer (which is invalid, in the same way as moving out of a &-ptr is). The correct way of "moving" out of a raw pointer is to use |
(i am fixing this to produce proper compiler error now. its a one line fix.) |
Add error message (i.e. do not ICE) when moving out of unsafe pointers. Fix rust-lang#20801.
Input:
Output:
The text was updated successfully, but these errors were encountered: