Fix compilation after extern mod -> extern crate

Make it compile again after latest rust updates.  Replace "extern mod" with "extern crate", and remove `ptr::to_unsafe_ptr` after it disappeared from rust master.