Don't warn about unsafe functions which don't need to be unsafe
auto merge of #5978 : alexcrichton/rust/issue-5954, r=catamorphism

Closes #5954