# Implicit widening, polymorphic indexing, and similar ideas

**URL:** <https://internals.rust-lang.org/t/implicit-widening-polymorphic-indexing-and-similar-ideas/1141>\
**Category:** ideas (deprecated)\
**Created:** [December 31, 2014, 6:50pm UTC](https://internals.rust-lang.org/t/implicit-widening-polymorphic-indexing-and-similar-ideas/1141 "2014-12-31T18:50:06Z")\
**Posts on this page:** 1\
**Showing post:** 26

<div class="post-metadata">

**Author:** ![petrochenkov](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/petrochenkov/32/2784_2.png) [@petrochenkov](https://internals.rust-lang.org/u/petrochenkov)\
**Post date:** [January 3, 2015, 3:33pm UTC](https://internals.rust-lang.org/t/implicit-widening-polymorphic-indexing-and-similar-ideas/1141/26 "2015-01-03T15:33:53Z")

</div>

Indeed. If the checks are performed on the signed indexes after sign-extending and reinterpreting them as unsigned numbers, then the length of indexable containers should be limited by int::MAX. Currently it seems to be true for containers using continuous memory, but not necessarily true for bit containers, containers of zero-sized objects or non-continuous indexable containers (like deque). Although it may be a sane constraint to impose.

---

_[View the full topic](https://internals.rust-lang.org/t/implicit-widening-polymorphic-indexing-and-similar-ideas/1141)._
