register snapshots
remove obsolete `foreach` keyword

this has been replaced by `for`
auto merge of #8264 : thestinger/rust/snapshot, r=cmr