-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
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.)
hellow554 and cuviper
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.