use range assert when loading enum discriminant

Closes #4924
add range assert when loading bools
replace explicit loops with foldr
auto merge of #5044 : thestinger/rust/range, r=pcwalton

Closes #4924

There are some more `Load` calls that could use this, so it's not completely done yet.