core::slice::Iter and core::slice::IterMut aren't NonNull-optimized #67228
Labels
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
I-heavy
Issue: Problems and improvements with respect to binary size of generated code.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
I randomly noticed that
self.ptr
ofcore::slice::Iter
may never be null (also because of unconditionally callingfrom_raw_parts
), but it's not contained inNonNull<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 addassume
intoNonNull::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.)The text was updated successfully, but these errors were encountered: