Use the new thread-locals.

cf. https://github.com/rust-lang/rust/commit/bad1062caaaefe0963d7b8513786c8283e74f1e7