Add slice::{from_ptr_range, from_mut_ptr_range} by ibraheemdev · Pull Request #89793 · rust-lang/rust (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies.

This looks good to me.

There is just one issue that worries me: There have been (incomplete) plans for quite a while to replace Range by two types: One that is Copy, and one that is an iterator. Using Range in signatures like this makes that change a little bit harder than it already is. Of course, the existing (and stable) .as_ptr_range() already has this problem as it uses Range as its return type. Still, I'm worried about making a potential change to Range even harder by adding the functions in this PR.

That doesn't have to stand in the way of adding these as unstable. I have added this as an unresolved question to the tracking issue, so we can make sure to address it before stabilizing this.

If you can fix the merge conflict, this is ready to merge.