Fix https://github.com/rust-lang/rust/pull/18827 related issues.

Fixes https://github.com/rust-lang/rust/pull/18827 related issues.