On Tue Jun 2, 2026 at 11:17 PM JST, Gary Guo wrote:
> There have been a few cases where the programmer knows that the indices are
> in bounds but the compiler cannot deduce that. This is also
> compiler-version-dependent, so using build indexing here can be
> problematic. On the other hand, it is also not ideal to use the fallible
> variant, as it adds an error handling path that is never hit.
>
> Add a new panicking index projection for this scenario. Like all panicking
> operations, this should be used carefully only in cases where the user
> knows the index is going to be in bounds, and panicking would indicate
> something is catastrophically wrong.
>
> To signify this, require users to explicitly denote the type of index being
> used. The existing two types of index projections also gain the keyworded
> version, which will be the recommended way going forward.
>
> The keyworded syntax also paves the way of perhaps adding more flavors in
> the future, e.g. `unsafe` index projection. However, unless the code is
> extremely performance sensitive and bounds checking cannot be tolerated,
> the panicking variant is safer and should be preferred, so it will be left
> to the future when demand arises.
>
> Signed-off-by: Gary Guo <[email protected]>

Thanks for splitting the renaming part out!

Reviewed-by: Alexandre Courbot <[email protected]>

Reply via email to