Prevent failure when using fail! with invalid utf8.

Closes #16877.
auto merge of #16940 : treeman/rust/fail-non-utf8, r=pnkfelix

Closes #16877.