Build fixes

This includes work by engstad for cargo compatibility and rustc updates and then some updates by me for rustc updates on top of that. There isn't any new functionality.
Is `Rc` required? It may be useful in future but I've thought Rc is not strictly necessary for the current example.