1 // We used to ICE when moving out of a `*mut T` or `*const T`.
5 static mut GLOBAL_MUT_T
: T
= T(0);
7 static GLOBAL_T
: T
= T(0);
9 fn imm_ref() -> &'
static T
{
13 fn mut_ref() -> &'
static mut T
{
14 unsafe { &mut GLOBAL_MUT_T }
17 fn mut_ptr() -> *mut T
{
18 unsafe { core::ptr::null_mut() }
21 fn const_ptr() -> *const T
{
22 unsafe { core::ptr::null() }
26 let a
= unsafe { *mut_ref() }
;
27 //~^ ERROR cannot move out of a mutable reference
29 let b
= unsafe { *imm_ref() }
;
30 //~^ ERROR cannot move out of a shared reference
32 let c
= unsafe { *mut_ptr() }
;
33 //~^ ERROR cannot move out of a raw pointer
35 let d
= unsafe { *const_ptr() }
;
36 //~^ ERROR cannot move out of a raw pointer