-
Notifications
You must be signed in to change notification settings - Fork 1.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
fix ice when checking rustc libstd #7140
Conversation
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', src/tools/clippy/clippy_lints/src/matches.rs:1595:53 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace I don't have a minimised testcase because I don't have time to reduce libstd down to a few lines right now.
r? @llogiq (rust-highfive has picked a reviewer for you, use r? to override) |
Good catch! @bors r+ |
📌 Commit 572c405 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
@@ -1590,9 +1590,9 @@ fn is_none_arm(cx: &LateContext<'_>, arm: &Arm<'_>) -> bool { | |||
// Checks if arm has the form `Some(ref v) => Some(v)` (checks for `ref` and `ref mut`) | |||
fn is_ref_some_arm(cx: &LateContext<'_>, arm: &Arm<'_>) -> Option<BindingAnnotation> { | |||
if_chain! { | |||
if let PatKind::TupleStruct(ref qpath, pats, _) = arm.pat.kind; | |||
if let PatKind::TupleStruct(ref qpath, [first_pat, ..], _) = arm.pat.kind; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was puzzling me at first but now I believe the reproduction case is Some(..)
.
Also FWIW, this could be [pat]
.
I don't have a minimised testcase because I don't have time to reduce libstd down to a few lines right now.
changelog: fix index out of bounds access when checking rustc libstd