Fixes to allow compilation against current version of rust.

I'm new to rust, so I'm sure most of this is pretty terrible, but at least it gets it building. Works against rust@0ede2ea.