what's the argument for it not being a bug?
i wish @Esteban Küber had spelled their opinion here out more
maybe @Esteban Küber 's point wasn't about whether the current behavior is buggy
but rather about whether it would be better to DWIM here
If we change the impls of drain to accept this off by one case we can make it work as the original code intended, otherwise itd be much nicer for it to be a compile time error instead of a panic. If we want it to be a panic then the patch is minimal
so okay, that's definitely a T-libs call
The entire point of ..= existing is to avoid these off by one errors, after all :sweat_smile:
it should definitely panic if it compiles, yeah
there could be a lint for "statically out-of-bounds bounds" but I don't feel super strongly about that
I mean, there is in some sense -- if we detect it, we'll say something like "this code will panic at runtime" -- but I imagine we'll not get there for a long time :)
@Esteban Küber i fear that I am either not understanding your proposal or not communicating it properly
@Esteban Küber can you state what you mean, in the "DWIM" case here?
i.e., by "accept this off by one case", I take that to mean: "there is a sensible non-panicking and non-erroring semantics here. Use it."
but I would prefer if you wrote out your intention rather than have me attempt to infer it or reconstruct it.