Skip to content
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

Merged
merged 1 commit into from
Apr 27, 2021
Merged

Conversation

matthiaskrgr
Copy link
Member

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.


changelog: fix index out of bounds access when checking rustc libstd

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.
@rust-highfive
Copy link

r? @llogiq

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 27, 2021
@llogiq
Copy link
Contributor

llogiq commented Apr 27, 2021

Good catch! @bors r+

@bors
Copy link
Contributor

bors commented Apr 27, 2021

📌 Commit 572c405 has been approved by llogiq

@bors
Copy link
Contributor

bors commented Apr 27, 2021

⌛ Testing commit 572c405 with merge ce37099...

@bors
Copy link
Contributor

bors commented Apr 27, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing ce37099 to master...

@bors bors merged commit ce37099 into rust-lang:master Apr 27, 2021
@@ -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;
Copy link
Contributor

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].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants