-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-type-systemArea: Type systemArea: Type systemT-langRelevant to the language teamRelevant to the language team
Description
extern crate alloc;
extern crate libc;
fn main() {
let ptr = alloc::heap::EMPTY as *const libc::c_void;
let ptrref1 : &*const libc::c_void;
let ptrref2 : &*const u8;
{
ptrref1 = &ptr;
ptrref2 = &(ptr as *const u8);
}
}In this case, ptrref1 is able to be assigned to a ref of the pointer. However, ptrref2 cannot because of the cast. It appears the only way to work around this currently is with transmute:
ptrref2 : &*const u8 = std::mem::transmute(&ptr);$ rustc --version=verbose
rustc 0.13.0-nightly (8bca470c5 2014-12-08 00:12:30 +0000)
binary: rustc
commit-hash: 8bca470c5acf13aa20022a2c462a89f72de721fc
commit-date: 2014-12-08 00:12:30 +0000
host: x86_64-apple-darwin
release: 0.13.0-nightlyMetadata
Metadata
Assignees
Labels
A-type-systemArea: Type systemArea: Type systemT-langRelevant to the language teamRelevant to the language team