Skip to content

ICE: glacier ./77218.rs : ice while adjusting.. #6250

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
matthiaskrgr opened this issue Oct 27, 2020 · 1 comment · Fixed by #6260
Closed

ICE: glacier ./77218.rs : ice while adjusting.. #6250

matthiaskrgr opened this issue Oct 27, 2020 · 1 comment · Fixed by #6260
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@matthiaskrgr
Copy link
Member

Code

pub struct Cache {
    data: Vec<i32>,
}

pub fn list_data(cache: &Cache, key: usize) {
    for reference in vec![1, 2, 3] {
        if /*let*/ Some(reference) = cache.data.get(key) {
            unimplemented!()
        }
    }
}

Meta

clippy 0.0.212 (ffa2e7a 2020-10-24)


rustc 1.46.0-nightly (f455e46ea 2020-06-20)
binary: rustc
commit-hash: f455e46eae1a227d735091091144601b467e1565
commit-date: 2020-06-20
host: x86_64-unknown-linux-gnu
release: 1.46.0-nightly
LLVM version: 10.0

Error output

error[E0601]: `main` function not found in crate `77218`
  --> ./77218.rs:1:1
   |
1  | / pub struct Cache {
2  | |     data: Vec<i32>,
3  | | }
4  | |
...  |
10 | |     }
11 | | }
   | |_^ consider adding a `main` function to `./77218.rs`

error: internal compiler error: compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:308:25: while adjusting Expr { hir_id: HirId { owner: DefId(0:5 ~ 77218[317d]::list_data), local_id: 61 }, kind: Path(Resolved(None, Path { span: ./77218.rs:7:38: 7:43 (#0), res: Local(HirId { owner: DefId(0:5 ~ 77218[317d]::list_data), local_id: 1 }), segments: [PathSegment { ident: cache#0, hir_id: Some(HirId { owner: DefId(0:5 ~ 77218[317d]::list_data), local_id: 60 }), res: Some(Local(HirId { owner: DefId(0:5 ~ 77218[317d]::list_data), local_id: 1 })), args: None, infer_args: true }] })), attrs: ThinVec(None), span: ./77218.rs:7:38: 7:43 (#0) }, can't compose [Deref(None) -> Cache] and [Deref(None) -> Cache]

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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 (ffa2e7a 2020-10-24)

query stack during panic:
#0 [typeck] type-checking `list_data`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0601`.
Backtrace

error[E0601]: `main` function not found in crate `77218`
--> ./77218.rs:1:1
 |
1  | / pub struct Cache {
2  | |     data: Vec<i32>,
3  | | }
4  | |
...  |
10 | |     }
11 | | }
 | |_^ consider adding a `main` function to `./77218.rs`

error: internal compiler error: compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:308:25: while adjusting Expr { hir_id: HirId { owner: DefId(0:5 ~ 77218[317d]::list_data), local_id: 61 }, kind: Path(Resolved(None, Path { span: ./77218.rs:7:38: 7:43 (#0), res: Local(HirId { owner: DefId(0:5 ~ 77218[317d]::list_data), local_id: 1 }), segments: [PathSegment { ident: cache#0, hir_id: Some(HirId { owner: DefId(0:5 ~ 77218[317d]::list_data), local_id: 60 }), res: Some(Local(HirId { owner: DefId(0:5 ~ 77218[317d]::list_data), local_id: 1 })), args: None, infer_args: true }] })), attrs: ThinVec(None), span: ./77218.rs:7:38: 7:43 (#0) }, can't compose [Deref(None) -> Cache] and [Deref(None) -> Cache]

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
stack backtrace:
 0:     0x7f37aa74fa20 - std::backtrace_rs::backtrace::libunwind::trace::h303a626d53553a64
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
 1:     0x7f37aa74fa20 - std::backtrace_rs::backtrace::trace_unsynchronized::h6abb882733c3f18c
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
 2:     0x7f37aa74fa20 - std::sys_common::backtrace::_print_fmt::h57829321f1d9217a
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:67:5
 3:     0x7f37aa74fa20 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h400b66a054640aac
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:46:22
 4:     0x7f37aa7bee9c - core::fmt::write::h1857a60b204f1b6a
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/core/src/fmt/mod.rs:1076:17
 5:     0x7f37aa741642 - std::io::Write::write_fmt::h6453b28c8b27c6ea
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/io/mod.rs:1516:15
 6:     0x7f37aa7549d5 - std::sys_common::backtrace::_print::h15cc4b3923cc9bc0
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:49:5
 7:     0x7f37aa7549d5 - std::sys_common::backtrace::print::h953c7be178c0674d
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:36:9
 8:     0x7f37aa7549d5 - std::panicking::default_hook::{{closure}}::h635d667f571198f0
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:208:50
 9:     0x7f37aa754678 - std::panicking::default_hook::h3bc2efb48060abaa
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:227:9
10:     0x55ee45171491 - clippy_driver::report_clippy_ice::h76ee1ad508e689ae
11:     0x7f37aa755216 - std::panicking::rust_panic_with_hook::h887eb0c89f46b8b2
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:581:17
12:     0x7f37adfc9a2d - std::panicking::begin_panic::{{closure}}::hc1d905d2374ce0cc
13:     0x7f37adfc9936 - std::sys_common::backtrace::__rust_end_short_backtrace::ha1feaa73cb1e05ce
14:     0x7f37adfc999f - std::panicking::begin_panic::h09616460625efa25
15:     0x7f37ae000380 - rustc_errors::HandlerInner::bug::hbb6554bd4fbc8852
16:     0x7f37adffee60 - rustc_errors::Handler::bug::h4feefeec7bb726ca
17:     0x7f37ada70bc4 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h22b92ed7b73b8340
18:     0x7f37ada69e0b - rustc_middle::ty::context::tls::with_opt::{{closure}}::h32bfd9cf0b0a9393
19:     0x7f37ada69db2 - rustc_middle::ty::context::tls::with_opt::h762464f893de2d96
20:     0x7f37ada70ae9 - rustc_middle::util::bug::opt_span_bug_fmt::h05648c19bbf99518
21:     0x7f37ada70a5e - rustc_middle::util::bug::bug_fmt::h5d4f7ed12a8f1d0d
22:     0x7f37aba6d7c4 - rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::apply_adjustments::h9a6882260f2814c9
23:     0x7f37aba6b03b - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_field::hf715acfb0435b376
24:     0x7f37aba603d8 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
25:     0x7f37aba5f3a0 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
26:     0x7f37aba5f98b - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
27:     0x7f37aba5f3a0 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
28:     0x7f37aba5f1f2 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_coercable_to_type::h556ab61bb1110bf1
29:     0x7f37aba620af - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
30:     0x7f37aba5f3a0 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
31:     0x7f37aba5f945 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
32:     0x7f37aba5f3a0 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
33:     0x7f37aba4a084 - rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_match::hbfd2c80b01fc57c2
34:     0x7f37aba6037a - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
35:     0x7f37aba5f3a0 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
36:     0x7f37aba7848c - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected::heaf04a8a0c47c91a
37:     0x7f37aba600a5 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
38:     0x7f37aba5f3a0 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
39:     0x7f37aba77bb5 - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt::h8c3b1cf29c1b9146
40:     0x7f37aba7845b - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected::heaf04a8a0c47c91a
41:     0x7f37aba7814d - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_no_value::h086b878f3e20d7e0
42:     0x7f37aba60efd - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
43:     0x7f37aba5f3a0 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
44:     0x7f37aba4ae32 - rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_match::hbfd2c80b01fc57c2
45:     0x7f37aba6037a - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
46:     0x7f37aba5f3a0 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
47:     0x7f37aba5f945 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
48:     0x7f37aba5f3a0 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
49:     0x7f37aba7848c - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected::heaf04a8a0c47c91a
50:     0x7f37aba600a5 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h85571b792e4e29aa
51:     0x7f37aba5f3a0 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h3d0ee6ad6d48cede
52:     0x7f37aba67e8a - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr::h600e7dc6197fad7f
53:     0x7f37abb73298 - rustc_typeck::check::check::check_fn::h3f68f05a04d05804
54:     0x7f37abce8553 - rustc_infer::infer::InferCtxtBuilder::enter::h6881f9376e4471a9
55:     0x7f37abd9f158 - rustc_typeck::check::typeck::h7936b5f86fffb913
56:     0x7f37abc8098e - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute::hcea92138ac9e28bb
57:     0x7f37abc4a647 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h2605dda46e394e9a
58:     0x7f37abbc4a31 - rustc_data_structures::stack::ensure_sufficient_stack::hefd48e3d1b00a42f
59:     0x7f37abab5329 - rustc_query_system::query::plumbing::get_query_impl::h3a9e7fcf130ad31d
60:     0x7f37abb213fd - rustc_query_system::query::plumbing::ensure_query_impl::h7982f7a407c81650
61:     0x7f37abda3b36 - rustc_typeck::check::typeck_item_bodies::h64dc12efcaea9221
62:     0x7f37abc3713e - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_item_bodies>::compute::h9834b15ef9ab2a9b
63:     0x7f37abc56857 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::ha57625619acaac80
64:     0x7f37abbc0534 - rustc_data_structures::stack::ensure_sufficient_stack::h9c1970be50e3794d
65:     0x7f37abaa4f25 - rustc_query_system::query::plumbing::get_query_impl::h086a494db0b3fd1b
66:     0x7f37abc9fe73 - rustc_typeck::check_crate::h19e2dfbdd8ea5557
67:     0x7f37ab262d95 - rustc_interface::passes::analysis::hf34e525a2b31f7c0
68:     0x7f37aaf9cd7b - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::h23cb841af51f0584
69:     0x7f37ab03b057 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h7178e9f1ddee6943
70:     0x7f37ab0363df - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::h4025824db8759ceb
71:     0x7f37aafc7f10 - rustc_query_system::query::plumbing::get_query_impl::h29928f066778d4c4
72:     0x7f37aaf9f12b - rustc_interface::passes::QueryContext::enter::h0705343d8e4a95be
73:     0x7f37ab0384a2 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h6eb07f11eba80bd6
74:     0x7f37aafff2a2 - rustc_span::with_source_map::h3820d41b3a036910
75:     0x7f37ab0399c2 - rustc_interface::interface::create_compiler_and_run::h08ad396f4e7721e0
76:     0x7f37ab021d5a - scoped_tls::ScopedKey<T>::set::hd425a36fbe06985e
77:     0x7f37ab03e9b5 - std::sys_common::backtrace::__rust_begin_short_backtrace::h23925571219dbc63
78:     0x7f37aafbc3ce - core::ops::function::FnOnce::call_once{{vtable.shim}}::h43b61b9af30b3669
79:     0x7f37aa76421a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h88864ee659ddb161
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/alloc/src/boxed.rs:1042:9
80:     0x7f37aa76421a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h9f03cbdc7ab33431
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/alloc/src/boxed.rs:1042:9
81:     0x7f37aa76421a - std::sys::unix::thread::Thread::new::thread_start::h5979dd5560a11418
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys/unix/thread.rs:89:17
82:     0x7f37aa6493e9 - start_thread
83:     0x7f37aa431293 - __GI___clone
84:                0x0 - <unknown>

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 (ffa2e7a 2020-10-24)

query stack during panic:
#0 [typeck] type-checking `list_data`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0601`.

@matthiaskrgr matthiaskrgr added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Oct 27, 2020
@matthiaskrgr matthiaskrgr changed the title ICE: glacier ./77218.rs ICE: glacier ./77218.rs : ice while adjusting.. Oct 27, 2020
@ebroto
Copy link
Member

ebroto commented Oct 28, 2020

This one crashes in beta but not in nightly. Latest Clippy seems to work fine. playground

matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Oct 28, 2020
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Oct 28, 2020
bors added a commit that referenced this issue Oct 30, 2020
add a couple of ICE testcases

Fixes #6250
Fixes #6251
Fixes #6252
Fixes #6255
Fixes #6256

changelog: none
@bors bors closed this as completed in abd64d7 Oct 30, 2020
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.

2 participants