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

panicked at 'index out of bounds: the len is 1 but the index is 1', src/tools/clippy/clippy_lints/src/repeat_once.rs:44:93 #6147

Closed
sdroege opened this issue Oct 9, 2020 · 7 comments

Comments

@sdroege
Copy link

sdroege commented Oct 9, 2020

This worked fine with 1.46 but not anymore after the update to 1.47 (clippy 0.0.212 (18bf6b4 2020-10-07))

Happens when running

cargo clippy -- -A clippy::redundant_pattern_matching -A clippy::single_match -A clippy::cast_lossless -A clippy::missing_safety_doc -D warnings

in gstreamer-sdp at https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/

Full backtrace:

thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', src/tools/clippy/clippy_lints/src/repeat_once.rs:44:93
stack backtrace:
   0: rust_begin_unwind
             at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:475
   1: core::panicking::panic_fmt
             at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/panicking.rs:85
   2: core::panicking::panic_bounds_check
             at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/panicking.rs:62
   3: <clippy_lints::repeat_once::RepeatOnce as rustc_lint::passes::LateLintPass>::check_expr
   4: <rustc_lint::late::LateLintPassObjects as rustc_lint::passes::LateLintPass>::check_expr
   5: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_expr
   6: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_expr
   7: rustc_hir::intravisit::walk_expr
   8: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_expr
   9: rustc_hir::intravisit::walk_expr
  10: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_expr
  11: rustc_hir::intravisit::walk_expr
  12: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_expr
  13: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_nested_body
  14: <rustc_lint::late::LateContextAndPass<T> as rustc_hir::intravisit::Visitor>::visit_fn
  15: rustc_hir::intravisit::walk_impl_item
  16: rustc_hir::intravisit::Visitor::visit_nested_impl_item
  17: rustc_hir::intravisit::walk_item
  18: rustc_hir::intravisit::Visitor::visit_nested_item
  19: rustc_hir::intravisit::walk_item
  20: rustc_hir::intravisit::Visitor::visit_nested_item
  21: rustc_hir::intravisit::walk_crate
  22: rustc_lint::late::late_lint_pass_crate
  23: rustc_lint::late::late_lint_crate
  24: rustc_data_structures::sync::join
  25: rustc_session::utils::<impl rustc_session::session::Session>::time
  26: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  27: rustc_session::utils::<impl rustc_session::session::Session>::time
  28: rustc_interface::passes::analysis
  29: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  30: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  31: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  32: rustc_data_structures::stack::ensure_sufficient_stack
  33: rustc_query_system::query::plumbing::get_query_impl
  34: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  35: rustc_span::with_source_map
  36: rustc_interface::interface::create_compiler_and_run
  37: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.0.212 (18bf6b4 2020-10-07)

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `gstreamer-sdp`.
@sdroege
Copy link
Author

sdroege commented Oct 9, 2020

This was fixed by #5948 but it unfortunately did not end up in 1.47.

@flip1995
Copy link
Member

flip1995 commented Oct 9, 2020

Closing since it was already fixed, so nothing we can do here.

A Clippy ICE is not enough to do a point release of rust stable. But if there should be one, we'll try to get the fix in.

@flip1995 flip1995 closed this as completed Oct 9, 2020
@sdroege
Copy link
Author

sdroege commented Oct 9, 2020

Well, it's annoying because it prevents me from updating CI configurations to 1.47 :) And especially annoying because beta and nightly never failed with this.

@sdroege
Copy link
Author

sdroege commented Oct 9, 2020

Just to be sure, I realize that doing a point release is a lot of work and it probably doesn't matter for such a thing but I'm probably also not the only one running into this. Sucks, but that's life :)

Is there a way to disable running that lint completely btw? -A clippy::repeat_once still runs it.

@flip1995
Copy link
Member

flip1995 commented Oct 9, 2020

Just to be sure, I realize that doing a point release is a lot of work and it probably doesn't matter for such a thing but I'm probably also not the only one running into this.

Yeah, this bug slipped through, but sadly now it's too late. I think there is a point release planned, since also a regression fix in the compiler is planned. But there isn't an ETA yet.

Is there a way to disable running that lint completely btw?

No sadly not. Renaming the repeat method fixes the issue, which would be a workaround. But I don't know if that is applicable for you. Sorry for the inconvenience!

@sdroege
Copy link
Author

sdroege commented Oct 9, 2020

Yeah, this bug slipped through, but sadly now it's too late. I think there is a point release planned, since also a regression fix in the compiler is planned. But there isn't an ETA yet.

That's good to know, thanks :)

No sadly not. Renaming the repeat method fixes the issue, which would be a workaround. But I don't know if that is applicable for you.

Unfortunately not as that would be an API change.

Sorry for the inconvenience!

No worries, such things happen. Annoying for everybody involved but that's just how it is :)

@flip1995
Copy link
Member

flip1995 commented Oct 9, 2020

I prepared a stable backport in rust-lang/rust#77750. So if there is a point release, this should get backported 👍

Rigellute added a commit to Rigellute/spotify-tui that referenced this issue Oct 11, 2020
Clippy is failing on CI with

```
panicked at 'index out of bounds: the len is 1 but the index is 1', src/tools/clippy/clippy_lints/src/repeat_once.rs:44:93
```

This has been fixed in clippy itself, but was missed in the 1.47.0
release (rust-lang/rust-clippy#6147).
Rigellute added a commit to Rigellute/spotify-tui that referenced this issue Oct 11, 2020
* Fix new clippy warnings

* Temp downgrade clippy toolchain

Clippy is failing on CI with

```
panicked at 'index out of bounds: the len is 1 but the index is 1', src/tools/clippy/clippy_lints/src/repeat_once.rs:44:93
```

This has been fixed in clippy itself, but was missed in the 1.47.0
release (rust-lang/rust-clippy#6147).
lanej pushed a commit to lanej/spotify-tui that referenced this issue Jul 13, 2021
* Fix new clippy warnings

* Temp downgrade clippy toolchain

Clippy is failing on CI with

```
panicked at 'index out of bounds: the len is 1 but the index is 1', src/tools/clippy/clippy_lints/src/repeat_once.rs:44:93
```

This has been fixed in clippy itself, but was missed in the 1.47.0
release (rust-lang/rust-clippy#6147).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants