Issue 5739 reborrowed slices

r? @catamorphism (just the last commit)

This is a minor patch to #3184 (which you also reviewed), needed for #5656