Add NaNs, infinities and overflows support to sum

Stats::sum handles NaNs and infinities as
elements in the list.
In addition to that, it also detects overflows.

Note: Stats::sum is using std::vec_ng:Vec to
improve its performance.
auto merge of #12355 : g3xzh/rust/stats-sum, r=huonw

Stats::sum handles `NaNs` and `Infinities` as elements in the list.
In addition to that, it also detects overflows.

@huonw - your review, please. :-)

Attempting to fix https://github.com/mozilla/rust/issues/11059

(BTW, thanks to @cmr, @sfackler, dybt, @bjz, huon, eibwen for the support on the IRC)