Fixes for rustc master

I'm submitting this PR for feedback, but it's not yet ready to merge.  The following PRs on upstream projects need to land first:

- https://github.com/rust-lang/rust/pull/16843
- https://github.com/servo/rust-url/pull/22
- https://github.com/docopt/docopt.rs/pull/15
- https://github.com/lifthrasiir/rust-encoding/pull/39

Once these land I will update Cargo.lock and add it to the PR