Implement missing TrustedLen and FusedIterator for core and alloc types - #160838
Implement missing TrustedLen and FusedIterator for core and alloc types#160838fereidani wants to merge 7 commits into
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Implement missing TrustedLen and FusedIterator for core and alloc types
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (9a3fc0e): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (secondary -1.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 454.914s -> 461.019s (1.34%) |
While working on #160813 I noticed TrustedLen is missing for the LinkedList, I suspected that other modules are missing the implementation too, so I wrote a small script to scan the project and found these candidates which implement ExactSizeIterator but not the TrustedLen, Reviewed the code just to make sure they are actually meet TrustedLen requirement and then I've added missing implementations.
While editting I found out there are instances of FusedIterator missing too, So I've added them too.
I think most important missing one is the
impl<I: TrustedLen + ?Sized, A: Allocator> TrustedLen for Box<I, A>which inheritsTrustedLenfor aBoxto aTrustedLenimplementer.I did this only for
coreandalloc, I ignored script reports for thestdbut I think it worth looking into, specially for theHashMap:This is related to #37572