Closed
Description
I randomly noticed that self.ptr
of core::slice::Iter
may never be null (also because of unconditionally calling from_raw_parts
), but it's not contained in NonNull<T>
, so it isn't optimized.
I double checked for compiler internal Voodoo and it confirms the lack of optimization.
I was thinking about fixing it just for fun, but it occurred to me that the current code uses assume
at several places and maybe it'd be a good idea to rather add assume
into NonNull::as_ptr
to clean it up? Not sure, so I'm asking. (Also maybe add assume to <[T]>::as_ptr()
, but that's a different topic.)