std: Change str::from_bytes to raise a condition on invalid input

As per #4765
auto merge of #6920 : catamorphism/rust/issue-4765, r=bstrie

r? anybody As per #4765