I did a bad git rebase before merging #5283, which reverted it to an earlier version. This PR has the actual implementation of RFC #5397.