Skip to content

Clippy triggers ICE but cargo build does not #6153

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

Closed
KillingSpark opened this issue Oct 10, 2020 · 3 comments · Fixed by #6154
Closed

Clippy triggers ICE but cargo build does not #6153

KillingSpark opened this issue Oct 10, 2020 · 3 comments · Fixed by #6154
Labels
I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@KillingSpark
Copy link

With the version Clippy version: clippy 0.0.212 (18bf6b4 2020-10-07) I hit a ICE when I run clippy on my project that I did not before. This suddenly made the CI fail, so I assume this was introduced in the new release for 0.0.212.

I am sorry I cant provide a minimal example but the project is hosted on github: https://github.com/KillingSpark/rustbus. If I can provide any additional info I'd be happy to do so.

Output with RUST_BACKTRACE=1
thread 'rustc' panicked at 'index out of bounds: the len is 2 but the index is 2', /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/src/librustc_infer/infer/canonical/substitute.rs:75:41
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: rustc_middle::ty::fold::<impl rustc_middle::ty::context::TyCtxt>::replace_escaping_bound_vars::{{closure}}
   4: <rustc_middle::ty::fold::BoundVarReplacer as rustc_middle::ty::fold::TypeFolder>::fold_region
   5: rustc_middle::ty::fold::TypeFoldable::fold_with
   6: rustc_middle::ty::fold::TypeFoldable::fold_with
   7: rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_fold_with
   8: <rustc_middle::ty::fold::BoundVarReplacer as rustc_middle::ty::fold::TypeFolder>::fold_ty
   9: rustc_middle::ty::fold::TypeFoldable::fold_with
  10: rustc_middle::ty::fold::TypeFoldable::fold_with
  11: rustc_middle::ty::fold::TypeFoldable::fold_with
  12: rustc_middle::ty::fold::<impl rustc_middle::ty::context::TyCtxt>::replace_escaping_bound_vars
  13: <rustc_middle::infer::canonical::Canonical<V> as rustc_infer::infer::canonical::substitute::CanonicalExt<V>>::substitute
  14: rustc_infer::infer::InferCtxtBuilder::enter_with_canonical
  15: rustc_traits::evaluate_obligation::evaluate_obligation
  16: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::evaluate_obligation>::compute
  17: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  18: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  19: rustc_data_structures::stack::ensure_sufficient_stack
  20: rustc_query_system::query::plumbing::get_query_impl
  21: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
  22: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  23: rustc_trait_selection::traits::type_known_to_meet_bound_modulo_regions
  24: rustc_infer::infer::InferCtxtBuilder::enter
  25: rustc_ty::common_traits::is_freeze_raw
  26: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::is_freeze_raw>::compute
  27: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  28: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  29: rustc_data_structures::stack::ensure_sufficient_stack
  30: rustc_query_system::query::plumbing::get_query_impl
  31: rustc_middle::ty::util::<impl rustc_middle::ty::TyS>::is_freeze
  32: clippy_lints::mut_key::is_mutable_type
  33: clippy_lints::mut_key::check_ty
  34: clippy_lints::mut_key::check_sig
  35: <rustc_lint::late::LateLintPassObjects as rustc_lint::passes::LateLintPass>::check_impl_item
  36: rustc_hir::intravisit::Visitor::visit_nested_impl_item
  37: rustc_hir::intravisit::walk_item
  38: rustc_hir::intravisit::Visitor::visit_nested_item
  39: rustc_hir::intravisit::walk_item
  40: rustc_hir::intravisit::Visitor::visit_nested_item
  41: rustc_hir::intravisit::walk_item
  42: rustc_hir::intravisit::Visitor::visit_nested_item
  43: rustc_hir::intravisit::walk_crate
  44: rustc_lint::late::late_lint_pass_crate
  45: rustc_lint::late::late_lint_crate
  46: rustc_data_structures::sync::join
  47: rustc_session::utils::<impl rustc_session::session::Session>::time
  48: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  49: rustc_session::utils::<impl rustc_session::session::Session>::time
  50: rustc_interface::passes::analysis
  51: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  52: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  53: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  54: rustc_data_structures::stack::ensure_sufficient_stack
  55: rustc_query_system::query::plumbing::get_query_impl
  56: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  57: rustc_span::with_source_map
  58: rustc_interface::interface::create_compiler_and_run
  59: 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 [evaluate_obligation] evaluating trait selection obligation `params::types::Base<'_>: std::marker::Freeze`
#1 [is_freeze_raw] computing whether `params::types::Base<'_>` is freeze
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `rustbus`.
@flip1995
Copy link
Member

This looks really similar to #6139. I asked about this on Zulip.

I now also think, that this might be a compiler bug... cc @ebroto

@flip1995 flip1995 added the I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ label Oct 10, 2020
@KillingSpark
Copy link
Author

KillingSpark commented Oct 10, 2020

I agree that this looks similar. Unfortunately the the repo is a bit bigger, so reducing it to a minimal example is kinda hard.

Edit: on second thought it might be not that similar. The error on rustbus is some kind of slice indexing error, where on amethyst_hello it panics with a Box...

I am just confused that clippy triggers this bug, but just building the project normally works without issues.

@flip1995
Copy link
Member

on second thought it might be not that similar.

the compiler internals that are producing this bug are the same.

I am just confused that clippy triggers this bug, but just building the project normally works without issues.

Clippy runs more checks, than cargo build, so there is more code, that con produce these bugs.

flip1995 added a commit to flip1995/rust-clippy that referenced this issue Oct 10, 2020
flip1995 added a commit to flip1995/rust-clippy that referenced this issue Oct 10, 2020
flip1995 added a commit to flip1995/rust-clippy that referenced this issue Oct 10, 2020
@bors bors closed this as completed in 7118d37 Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants