Closed
Description
..
ranges are [inclusive, exclusive)
and index access is normally bounds checked, e.g. slice[slice.len()+100..]
or slice[slice.len()]
panics, however slice[slice.len()..]
/slice[slice.len()..slice.len()]
is an exception, it just returns an empty slice despite the first inclusive index being out of bounds.
I agree this is convenient and I guess this was implemented intentionally, and we can't silently break this now, but it at least needs to be 1) documented as intentional behavior, 2) tested as intentional behavior.
So far I haven't found neither documentation, nor tests, nor design rationale in the range indexing RFCs and their implementations.
Metadata
Metadata
Assignees
Labels
No labels