Use slicing syntax instead of methods and add a feature gate

cc @aturon 

r? anyone?
Its because we can't take a mutable slice (because we do a mutable iter later) and we can't take an immutable slice of a mutable variable (#17293), so we need to get an immutable version of `right` and then let that go out of scope so that we can later get access to the mutable version again.