Implement range syntax

Closes #19794

r? @aturon for the first patch
r? @nikomatsakis for the rest
I guess T should be u64 for u64/i64 and we require T=uint for to implement iterator. We need the snapshot for that, but hopefully it can happen before this lands