Change:
Input: Output:
FWIW, I get the same compiler bug when building my repo at the following commit: Workaround applied with the subsequent 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: rustc 1.0.0-nightly ( 2015-01-30 19:56:34 +0000)
I hit this as well when playing with an example I found on Playground half way through changing some type signatures from the SO example:
I ran this error as well. Here is an MCVE that reproduces it. Here is the output from : Here is the version:
Still in the latest nightly today: / Output is: hans RUSTBACKTRACE=1 rustc --verbose 48:32 error: internal compiler error: this path should not cause illegal move x=((())); ^~ note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: note: run with for a backtrace thread 'rustc' panicked at 'Box<Any', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc- stack backtrace: 1: 0x7fce722a2e80 - sys::backtrace::write::h84a1347ec8a3d425Aru 2: 0x7fce722c64a0 - failure::onfail::h1cb2299eb5e255ae9GB 3: 0x7fce722312d0 - rt::unwind::beginunwindinner::ha34a1c7f0630f466IlB 4: 0x7fce6f663bf0 - rt::unwind::beginunwind::h12804436560652988965 5: 0x7fce6f663b80 - diagnostic::SpanHandler::spanbug::h7782d96edbc369daAME 6: 0x7fce7016d860 - session::Session::spanbug::hdac738587fe4342308p 7: 0x7fce71442720 - borrowck::buildborrowckdataflowdata::h9045861811b22014EVe 8: 0x7fce7143f1c0 - borrowck::borrowckfn::h36353c72fe383ef91Se 9: 0x7fce714401b0 - borrowck::borrowckitem::hb95afd845c4698caZRe 10: 0x7fce71440850 - borrowck::checkcrate::hfcab8da4b1fb581bRMe 11: 0x7fce72833710 - driver::phase3runanalysispasses::h198ed79d6101094dtGa 12: 0x7fce7281a2b0 - driver::compileinput::h08caf95be513bd6bBba 13: 0x7fce728e4dd0 - runcompiler::hf1a36c26381910e09ac 14: 0x7fce728e3460 - thunk::F.Invoke<A, R::invoke::h6996223324138754953 15: 0x7fce728e2390 - rt::unwind::try::tryfn::h16059966258548481805 16: 0x7fce72331910 - rusttryinner 17: 0x7fce72331900 - rusttry 18: 0x7fce728e2640 - thunk::F.Invoke<A, R::invoke::h12998514134271589737 19: 0x7fce722b2ca0 - sys::thread::threadstart::h756cedb2df1b4200Pnx 20: 0x7fce6c4e8a80 - startthread 21: 0x0 - <unknownhans uname -a Linux yperman 3.16.0-0.bpo.4-amd64 SMP Debian 3.16.7-ckt2-1~bpo70+1 (2014-12-08) x8664 GNU/Linux hans rustc --version rustc 1.0.0-nightly ( 2015-02-02 15:04:54 +0000) / static mut someMap: std::option::Option<mut std::collections::HashMap<String,i64=None; fn new(name:&str)-i64{ let x; unsafe{ x=((())); } return 0; } 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.)

Discussion:
match move_from.cat { mc::cat_deref(_, _, mc::BorrowedPtr(..)) | mc::cat_deref(_, _, mc::Implicit(..)) | <ins> mc::cat_deref(_, _, mc::UnsafePtr(..)) | </ins> mc::cat_static_item => { bccx.span_err(move_from.span, &format!("cannot move out of {}",

<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // We used to ICE when moving out of a `*mut T` or `*const T`. struct T(u8); static mut GLOBAL_MUT_T: T = T(0); static GLOBAL_T: T = T(0); fn imm_ref() -> &'static T { unsafe { &GLOBAL_T } } fn mut_ref() -> &'static mut T { unsafe { &mut GLOBAL_MUT_T } } fn mut_ptr() -> *mut T { unsafe { 0u8 as *mut T } } fn const_ptr() -> *const T { unsafe { 0u8 as *const T } } pub fn main() { let a = unsafe { *mut_ref() }; //~^ ERROR cannot move out of dereference of borrowed content let b = unsafe { *imm_ref() }; //~^ ERROR cannot move out of dereference of borrowed content let c = unsafe { *mut_ptr() }; //~^ ERROR cannot move out of dereference of unsafe pointer let d = unsafe { *const_ptr() }; //~^ ERROR cannot move out of dereference of unsafe pointer } </ins>