-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve panic messages for Vec methods #70524
Comments
@Centril Does triaging mean a green light for this suggestion? |
@IgorPerikov No, I just apply the relevant labels. :) |
@IgorPerikov Though this is a small change with little time required to fix, so I'd just make the PR if I were you. :) |
Note: #70558 uses the same kind of assertion in Depending on which PR lands first, we should make sure it gets the same panic message as the others. |
@RalfJung I think it makes sense to follow the message, that is being currently printed, when trying to access element out of bounds via |
I've spotted, that
remove()
panic message could've provided details on what values led to this panic, instead of mentioning condition only. Generally speaking this and some otherassert!
s in Vec could've been more detailed. If it's okay to step in, I'd like to offer my help.In case of
remove
I'd suggest calling this insteadI find this more informative than
assertion failed: index < len
Candidates for improval:
aforementioned
remove
:rust/src/liballoc/vec.rs
Line 1034 in 5f13820
insert
:rust/src/liballoc/vec.rs
Line 994 in 5f13820
drain
:rust/src/liballoc/vec.rs
Lines 1292 to 1293 in 5f13820
split_off
:rust/src/liballoc/vec.rs
Line 1383 in 5f13820
The text was updated successfully, but these errors were encountered: