1
Fork 0

rustc: Implement and enforce instance coherence

This commit is contained in:
Patrick Walton 2012-07-11 15:00:40 -07:00
parent b5729bd600
commit db020ab63c
111 changed files with 1746 additions and 526 deletions

View file

@ -148,7 +148,12 @@ mod v4 {
// the simple, old style numberic representation of
// ipv4
type ipv4_rep = { a: u8, b: u8, c: u8, d:u8 };
impl x for ipv4_rep {
trait as_unsafe_u32 {
unsafe fn as_u32() -> u32;
}
impl x of as_unsafe_u32 for ipv4_rep {
// this is pretty dastardly, i know
unsafe fn as_u32() -> u32 {
*((ptr::addr_of(self)) as *u32)