Skip to content

ICE in v1.50.0 that does not occur in v1.49.0 #6840

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
tdyas opened this issue Mar 4, 2021 · 9 comments · Fixed by #6866
Closed

ICE in v1.50.0 that does not occur in v1.49.0 #6840

tdyas opened this issue Mar 4, 2021 · 9 comments · Fixed by #6866
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@tdyas
Copy link

tdyas commented Mar 4, 2021

Code

The following crate in the Pants project triggers an ICE on v1.50.0 but not on v1.49.0 when running cargo clippy: https://github.com/pantsbuild/pants/tree/master/src/rust/engine/rule_graph

Meta

The ICE occurs in v1.50.0 and in a recent nightly. It does not occur v1.49.0.

rustc --version --verbose:

rustc 1.50.0 (cb75ad5db 2021-02-10)
binary: rustc
commit-hash: cb75ad5db02783e8b0222fee363c5f63f7e2cf5b
commit-date: 2021-02-10
host: x86_64-apple-darwin
release: 1.50.0

Occurs for this version of nightly as well:

rustc 1.52.0-nightly (98f8cce6d 2021-02-25)
binary: rustc
commit-hash: 98f8cce6db6c6c6660eeffee2b3903104e547ecf
commit-date: 2021-02-25
host: x86_64-apple-darwin
release: 1.52.0-nightly
LLVM version: 11.0.1

Error output

    Checking rule_graph v0.0.1 (/Users/tdyas/TC/pants/src/rust/engine/rule_graph)
error: internal compiler error: compiler/rustc_traits/src/normalize_erasing_regions.rs:43:32: could not fully normalize `std::collections::HashMap<<R as rules::Rule>::DependencyKey, std::vec::Vec<Entry<R>>>`

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
stack backtrace:
   0:        0x10a7dd0d4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h34f76b2ca42fab41
   1:        0x10a841ecd - core::fmt::write::h8f13d857463c51c1
   2:        0x10a7ce7c6 - std::io::Write::write_fmt::h0a6214ccb1a8468b
   3:        0x10a7e0d39 - std::panicking::default_hook::{{closure}}::hb14d90e928578cc7
   4:        0x10a7e08c0 - std::panicking::default_hook::h460969f1dc8f738d
   5:        0x10252a586 - clippy_driver::ICE_HOOK::{{closure}}::{{closure}}::he499fdb1f86260cf
   6:        0x10a7e151e - std::panicking::rust_panic_with_hook::h28bf9d6c3916221e
   7:        0x107402321 - std::panicking::begin_panic::{{closure}}::h0e87840b5c6a9c59
   8:        0x107402289 - std::sys_common::backtrace::__rust_end_short_backtrace::h8659a1b4220fd63a
   9:        0x10783f2f1 - std::panicking::begin_panic::hc47dd84e1beec546
  10:        0x107433d13 - rustc_errors::HandlerInner::bug::h6bbed7e088c34809
  11:        0x107432327 - rustc_errors::Handler::bug::h69a183c778d5ab5c
  12:        0x106e58f04 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h65cee2a5516e95bd
  13:        0x106e54a36 - rustc_middle::ty::context::tls::with_opt::{{closure}}::h3109336967579a63
  14:        0x106e549f3 - rustc_middle::ty::context::tls::with_opt::h747ffbbb3f367dd7
  15:        0x106e58e2b - rustc_middle::util::bug::opt_span_bug_fmt::h33901786874da521
  16:        0x10781edbf - rustc_middle::util::bug::bug_fmt::hb55b8e744ef28c0f
  17:        0x10513d21e - rustc_infer::infer::InferCtxtBuilder::enter::h2cfdf37c61932980
  18:        0x10519eed7 - rustc_traits::normalize_erasing_regions::normalize_generic_arg_after_erasing_regions::h34a19adfa4ea8ccb
  19:        0x10716276d - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h668ad73b318e5986
  20:        0x107057fb1 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h8ae3bb2e2c13f68f
  21:        0x106fad16e - rustc_data_structures::stack::ensure_sufficient_stack::hb580b2c1701cc3fe
  22:        0x1071fe046 - rustc_query_system::query::plumbing::get_query_impl::h2c2ee510ebdf4d2d
  23:        0x106eef03f - rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::normalize_erasing_regions::hf7aca71b8acc2e7d
  24:        0x1071c3211 - <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt> as rustc_target::abi::LayoutOf>::layout_of::h659901a2d3cebc10
  25:        0x106e6911b - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::h22e1bedf3e5ce9c0
  26:        0x106d26828 - <alloc::vec::Vec<T> as alloc::vec::SpecFromIter<T,I>>::from_iter::he4a23b1bf00774a8
  27:        0x106e6a385 - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::hab160f2b4ae62ed5
  28:        0x106d100ad - <alloc::vec::Vec<T> as alloc::vec::SpecFromIter<T,I>>::from_iter::h0153584db5033da9
  29:        0x1071b80b8 - rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt>::layout_raw_uncached::h03749ef38956bfe4
  30:        0x1071b4eea - rustc_middle::ty::layout::layout_raw::h3a998d81f76ca997
  31:        0x1071d6abf - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::layout_raw>::compute::h0a7ff71a7a87282f
  32:        0x10715deb8 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h2341d60a3c8b007c
  33:        0x107041c9d - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h2aa608c9e9b260d6
  34:        0x106fb2afb - rustc_data_structures::stack::ensure_sufficient_stack::he90b48f172d17b6b
  35:        0x1072398e0 - rustc_query_system::query::plumbing::get_query_impl::h71e6b1cd20fc6dbe
  36:        0x1071c32a7 - <rustc_middle::ty::layout::LayoutCx<rustc_middle::ty::context::TyCtxt> as rustc_target::abi::LayoutOf>::layout_of::h659901a2d3cebc10
  37:        0x1069126a5 - <rustc_lint::context::LateContext as rustc_target::abi::LayoutOf>::layout_of::h7b61f1a020637c14
  38:        0x10274a11a - <clippy_lints::zero_sized_map_values::ZeroSizedMapValues as rustc_lint::passes::LateLintPass>::check_ty::hdc4a67722d494acb
  39:        0x10692c963 - <rustc_lint::late::LateLintPassObjects as rustc_lint::passes::LateLintPass>::check
_ty::h21ed627ebdadbe89
  40:        0x102f1cbdf - rustc_hir::intravisit::walk_item::h2ae69716c8c2069e
  41:        0x102f6810e - rustc_hir::intravisit::Visitor::visit_nested_item::h84d22f6cf02015e5
  42:        0x102f1775d - rustc_hir::intravisit::walk_crate::h17661615033e32b9
  43:        0x102f54001 - rustc_lint::late::late_lint_pass_crate::h2dafafeb69042f14
  44:        0x102f5755d - rustc_session::utils::<impl rustc_session::session::Session>::time::h305d03b2a994fc40
  45:        0x102fae795 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h792b8ac53a32a736
  46:        0x102f59ecb - rustc_session::utils::<impl rustc_session::session::Session>::time::hf3082bae09b596ae
  47:        0x102f8e9fb - rustc_interface::passes::analysis::h4f77077d0d32c92e
  48:        0x102df830a - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::h751d24ab2e450beb
  49:        0x102dfa1c4 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::he6976e5544ffecfa
  50:        0x102d7c0ee - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h88d3b296bfb5ed36
  51:        0x102dc096e - rustc_data_structures::stack::ensure_sufficient_stack::hd0a9f62ff4f35515
  52:        0x102d6a570 - rustc_query_system::query::plumbing::get_query_impl::h1fa86c7589ee7005
  53:        0x102dfa5aa - rustc_interface::passes::QueryContext::enter::hdda9d64e1568ae83
  54:        0x102dd65a1 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h23c3663acd2f252b
  55:        0x102db58be - rustc_span::with_source_map::had6878a53046d568
  56:        0x102dd7584 - rustc_interface::interface::create_compiler_and_run::he48253d83781cb39
  57:        0x102dc1a84 - std::sys_common::backtrace::__rust_begin_short_backtrace::hfb8be6fd991a375d
  58:        0x102d57c19 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h898af6dc0dda933c
  59:        0x10a7ee5cd - std::sys::unix::thread::Thread::new::thread_start::he19012de44640be6
  60:     0x7fff20533950 - __pthread_start

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 (cb75ad5d 2021-02-10)

query stack during panic:
#0 [normalize_generic_arg_after_erasing_regions] normalizing `std::collections::HashMap<<R as rules::Rule>::DependencyKey, std::vec::Vec<Entry<R>>>`
rust-lang/rust#1 [layout_raw] computing layout of `RuleEdges<R>`
rust-lang/rust#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error
@osa1
Copy link
Contributor

osa1 commented Mar 4, 2021

@rustbot label +E-needs-mcve +regression-from-stable-to-stable

@apiraino
Copy link

apiraino commented Mar 4, 2021

Note: their CI runs cargo clippy --all

It's the --all parameter that triggers the ICE. Without that param clippy runs just fine.

I've tried bisecting this by removing this file that hardcodes 1.49 rustc and with 1.50 this is what I see:

$ cargo +nightly-2020-12-21 clippy => does not reproduce (commit: c609b2eaf)
$ cargo +nightly-2020-12-22 clippy => reproduce (commit: 11c94a197)

does that help? @rustbot ping icebreakers-cleanup-crew

@rustbot
Copy link
Collaborator

rustbot commented Mar 4, 2021

@smmalis37
Copy link

smmalis37 commented Mar 4, 2021

Likely in this rollup rust-lang/rust@15d1f81 I think. The other commits in that range don't seem related to types at all to me. Of note is there's a Clippy update in there with 114 commits: https://github.com/rust-lang/rust/pull/80239/commits. Anyone able to bisect those?

@JohnTitor
Copy link
Member

Looking at the backtrace, #6218 is possibly the cause.

@JohnTitor
Copy link
Member

JohnTitor commented Mar 4, 2021

Looks like Clippy has a fix for it already: #6539
Anyway, I don't think we should track this issue here if it's a Clippy ICE.

@SNCPlay42
Copy link

SNCPlay42 commented Mar 4, 2021

Reduced:

use std::collections::HashMap;

pub trait Rule {
    type DependencyKey;
}

pub struct RuleEdges<R: Rule> {
  dependencies: R::DependencyKey,
}
type RuleDependencyEdges<R> = HashMap<u32, RuleEdges<R>>;

This does indeed look like a duplicate of #6539.

@JohnTitor
Copy link
Member

Thanks @SNCPlay42! It shows this isn't a duplicate but a Clippy ICE actually, I'd transfer this issue to the Clippy repo. cc @rust-lang/clippy could someone transfer this issue?

@flip1995
Copy link
Member

flip1995 commented Mar 4, 2021

While this issue is related to #6539, it wasn't fixed by rust-lang/rust@feee45c. So yes, this issue should be moved to rust-lang/rust-clippy. (I can't move it myself)

@oli-obk oli-obk transferred this issue from rust-lang/rust Mar 4, 2021
@flip1995 flip1995 added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Mar 4, 2021
bors added a commit that referenced this issue Mar 9, 2021
Fix ICE 6840 - make is_normalizable more strict

fixes #6840

make `is_normalizable` more strict, which should catch this ICE and related cases

changelog:
@bors bors closed this as completed in 8a5f98a Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants