Skip to content

ICE glacier ./77919.rs: encountered errors resolving bounds after type-checking #6252

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

trait TypeVal<T> {
    const VAL: T;
}
struct Five;
struct Multiply<N, M> {
    _n: PhantomData,
}
impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}

fn main() {
    [1; <Multiply<Five, Five>>::VAL];
}

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[E0412]: cannot find type `PhantomData` in this scope
 --> ./77919.rs:6:9
  |
6 |     _n: PhantomData,
  |         ^^^^^^^^^^^ not found in this scope
  |
help: consider importing this struct
  |
1 | use std::marker::PhantomData;
  |

error[E0412]: cannot find type `VAL` in this scope
 --> ./77919.rs:8:63
  |
8 | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
  |          -                                                    ^^^ not found in this scope
  |          |
  |          help: you might be missing a type parameter: `, VAL`

error[E0046]: not all trait items implemented, missing: `VAL`
 --> ./77919.rs:8:1
  |
2 |     const VAL: T;
  |     ------------- `VAL` from trait
...
8 | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation

error: internal compiler error: compiler/rustc_trait_selection/src/traits/codegen.rs:124:9: Encountered errors `[FulfillmentError(Obligation(predicate=TraitPredicate(<Five as TypeVal<[type error]>>), depth=1),Ambiguity)]` resolving bounds after type-checking

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 [codegen_fulfill_obligation] checking if `TypeVal` fulfills its obligations
#1 [resolve_instance] resolving instance `<Multiply<Five, Five> as TypeVal<usize>>::VAL`
end of query stack
error: aborting due to 4 previous errors
Backtrace

error[E0412]: cannot find type `PhantomData` in this scope
--> ./77919.rs:6:9
|
6 |     _n: PhantomData,
|         ^^^^^^^^^^^ not found in this scope
|
help: consider importing this struct
|
1 | use std::marker::PhantomData;
|

error[E0412]: cannot find type `VAL` in this scope
--> ./77919.rs:8:63
|
8 | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
|          -                                                    ^^^ not found in this scope
|          |
|          help: you might be missing a type parameter: `, VAL`

error[E0046]: not all trait items implemented, missing: `VAL`
--> ./77919.rs:8:1
|
2 |     const VAL: T;
|     ------------- `VAL` from trait
...
8 | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation

error: internal compiler error: compiler/rustc_trait_selection/src/traits/codegen.rs:124:9: Encountered errors `[FulfillmentError(Obligation(predicate=TraitPredicate(<Five as TypeVal<[type error]>>), depth=1),Ambiguity)]` resolving bounds after type-checking

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
stack backtrace:
 0:     0x7f7690d30a20 - std::backtrace_rs::backtrace::libunwind::trace::h303a626d53553a64
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
 1:     0x7f7690d30a20 - std::backtrace_rs::backtrace::trace_unsynchronized::h6abb882733c3f18c
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
 2:     0x7f7690d30a20 - std::sys_common::backtrace::_print_fmt::h57829321f1d9217a
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:67:5
 3:     0x7f7690d30a20 - <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:     0x7f7690d9fe9c - core::fmt::write::h1857a60b204f1b6a
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/core/src/fmt/mod.rs:1076:17
 5:     0x7f7690d22642 - std::io::Write::write_fmt::h6453b28c8b27c6ea
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/io/mod.rs:1516:15
 6:     0x7f7690d359d5 - std::sys_common::backtrace::_print::h15cc4b3923cc9bc0
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:49:5
 7:     0x7f7690d359d5 - std::sys_common::backtrace::print::h953c7be178c0674d
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:36:9
 8:     0x7f7690d359d5 - std::panicking::default_hook::{{closure}}::h635d667f571198f0
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:208:50
 9:     0x7f7690d35678 - std::panicking::default_hook::h3bc2efb48060abaa
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:227:9
10:     0x55bac9273491 - clippy_driver::report_clippy_ice::h76ee1ad508e689ae
11:     0x7f7690d36216 - std::panicking::rust_panic_with_hook::h887eb0c89f46b8b2
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:581:17
12:     0x7f76945aaa2d - std::panicking::begin_panic::{{closure}}::hc1d905d2374ce0cc
13:     0x7f76945aa936 - std::sys_common::backtrace::__rust_end_short_backtrace::ha1feaa73cb1e05ce
14:     0x7f76945aa99f - std::panicking::begin_panic::h09616460625efa25
15:     0x7f76945e1380 - rustc_errors::HandlerInner::bug::hbb6554bd4fbc8852
16:     0x7f76945dfe60 - rustc_errors::Handler::bug::h4feefeec7bb726ca
17:     0x7f7694051bc4 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::h22b92ed7b73b8340
18:     0x7f769404ae0b - rustc_middle::ty::context::tls::with_opt::{{closure}}::h32bfd9cf0b0a9393
19:     0x7f769404adb2 - rustc_middle::ty::context::tls::with_opt::h762464f893de2d96
20:     0x7f7694051ae9 - rustc_middle::util::bug::opt_span_bug_fmt::h05648c19bbf99518
21:     0x7f7694051a5e - rustc_middle::util::bug::bug_fmt::h5d4f7ed12a8f1d0d
22:     0x7f769399f197 - rustc_trait_selection::traits::codegen::drain_fulfillment_cx_or_panic::h3f52fb12c2950510
23:     0x7f7693925eb8 - rustc_infer::infer::InferCtxtBuilder::enter::h01f99a054e2c6826
24:     0x7f769399f08f - rustc_trait_selection::traits::codegen::codegen_fulfill_obligation::h8c62356c0806a699
25:     0x7f7691c03d5b - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::codegen_fulfill_obligation>::compute::hefe471f0a925acc4
26:     0x7f7691bf85f8 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hf4530b83498803c3
27:     0x7f7691c1ced6 - rustc_data_structures::stack::ensure_sufficient_stack::h4db328fea788c014
28:     0x7f7691bb1222 - rustc_query_system::query::plumbing::get_query_impl::h6cfa69942c8993e0
29:     0x7f7691c0c77e - rustc_ty::instance::inner_resolve_instance::h4b94964ecacf9b43
30:     0x7f7691c0c3da - rustc_ty::instance::resolve_instance::h819cc241406dcae3
31:     0x7f7693fc1f9a - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::resolve_instance>::compute::h64bed5e69e6122e9
32:     0x7f769449bc50 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::ha946802e15273a73
33:     0x7f76940732c6 - rustc_data_structures::stack::ensure_sufficient_stack::h8ec9950b3db03e09
34:     0x7f7693e330fb - rustc_query_system::query::plumbing::get_query_impl::h49577106ce241824
35:     0x7f7693fb9a54 - rustc_middle::ty::instance::Instance::resolve_opt_const_arg::hd4a0ddde60dbe3f3
36:     0x7f769414083e - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve::hca0967fe0f4dba85
37:     0x7f7693b5a8fb - <rustc_trait_selection::traits::query::normalize::QueryNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const::hb42ce7cf2ab5c3db
38:     0x7f7691cd896d - <rustc_infer::infer::at::At as rustc_trait_selection::traits::query::normalize::AtExt>::normalize::h515321bc2fdce534
39:     0x7f7691cd5366 - rustc_infer::infer::InferCtxtBuilder::enter::h78f7b9c6a79122d0
40:     0x7f7691cfaaa4 - rustc_traits::normalize_erasing_regions::normalize_generic_arg_after_erasing_regions::hcdac52a51e1f3bad
41:     0x7f76944a6462 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hd3143aaaf553f1e6
42:     0x7f7694075ec8 - rustc_data_structures::stack::ensure_sufficient_stack::haa7417220b38dfd1
43:     0x7f7693e20610 - rustc_query_system::query::plumbing::get_query_impl::h3be1903f77b17a0c
44:     0x7f769444d31b - <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::TypeFolder>::fold_const::hb8944a4334ab3461
45:     0x7f7692b9cd05 - rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::subst_and_normalize_erasing_regions::h17c6d5d6c74290ff
46:     0x7f7692d3a199 - rustc_mir::interpret::eval_context::InterpCx<M>::push_stack_frame::h94d390cf4f88e073
47:     0x7f7692c9abda - rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider::hdbcc3206940fc1d2
48:     0x7f7692c301d4 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_allocation_raw>::compute::h7e75c91ceded4946
49:     0x7f7692c5147c - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h0841db549cb81a61
50:     0x7f7692c780b3 - rustc_data_structures::stack::ensure_sufficient_stack::h985c8929d767037e
51:     0x7f7692aa5564 - rustc_query_system::query::plumbing::get_query_impl::hbf34a445616c0f81
52:     0x7f7692c99f11 - rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider::h64c6c9052b7193d4
53:     0x7f769417939a - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute::hc62dbfafdbcf6b6f
54:     0x7f76944ad855 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::he90856ba60867bd1
55:     0x7f769406471b - rustc_data_structures::stack::ensure_sufficient_stack::h057904aa47d6d3a3
56:     0x7f7693ea7d2d - rustc_query_system::query::plumbing::get_query_impl::hf0e91baf3f0c7cba
57:     0x7f7694140b2f - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id::hb50b9bb506785d22
58:     0x7f769414089f - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve::hca0967fe0f4dba85
59:     0x7f7693cb71c3 - rustc_infer::infer::InferCtxt::const_eval_resolve::h8b79e805e4743d96
60:     0x7f7693b2659c - rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable::hf8777753623dc0af
61:     0x7f7693a6be00 - rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations::h2020dfafb477c00f
62:     0x7f7693af9239 - rustc_data_structures::obligation_forest::ObligationForest<O>::process_obligations::h1d11017f52bfdd95
63:     0x7f7693a6b2e4 - <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible::hf96074721833b16c
64:     0x7f7692051084 - rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::select_obligations_where_possible::h5a7844f4370dc933
65:     0x7f76922c984f - rustc_infer::infer::InferCtxtBuilder::enter::h6881f9376e4471a9
66:     0x7f7692380158 - rustc_typeck::check::typeck::h7936b5f86fffb913
67:     0x7f769226198e - 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
68:     0x7f769222b647 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h2605dda46e394e9a
69:     0x7f76921a5a31 - rustc_data_structures::stack::ensure_sufficient_stack::hefd48e3d1b00a42f
70:     0x7f7692096329 - rustc_query_system::query::plumbing::get_query_impl::h3a9e7fcf130ad31d
71:     0x7f76921023fd - rustc_query_system::query::plumbing::ensure_query_impl::h7982f7a407c81650
72:     0x7f7692384b36 - rustc_typeck::check::typeck_item_bodies::h64dc12efcaea9221
73:     0x7f769221813e - 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
74:     0x7f7692237857 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::ha57625619acaac80
75:     0x7f76921a1534 - rustc_data_structures::stack::ensure_sufficient_stack::h9c1970be50e3794d
76:     0x7f7692085f25 - rustc_query_system::query::plumbing::get_query_impl::h086a494db0b3fd1b
77:     0x7f7692280e73 - rustc_typeck::check_crate::h19e2dfbdd8ea5557
78:     0x7f7691843d95 - rustc_interface::passes::analysis::hf34e525a2b31f7c0
79:     0x7f769157dd7b - 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
80:     0x7f769161c057 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h7178e9f1ddee6943
81:     0x7f76916173df - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::h4025824db8759ceb
82:     0x7f76915a8f10 - rustc_query_system::query::plumbing::get_query_impl::h29928f066778d4c4
83:     0x7f769158012b - rustc_interface::passes::QueryContext::enter::h0705343d8e4a95be
84:     0x7f76916194a2 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h6eb07f11eba80bd6
85:     0x7f76915e02a2 - rustc_span::with_source_map::h3820d41b3a036910
86:     0x7f769161a9c2 - rustc_interface::interface::create_compiler_and_run::h08ad396f4e7721e0
87:     0x7f7691602d5a - scoped_tls::ScopedKey<T>::set::hd425a36fbe06985e
88:     0x7f769161f9b5 - std::sys_common::backtrace::__rust_begin_short_backtrace::h23925571219dbc63
89:     0x7f769159d3ce - core::ops::function::FnOnce::call_once{{vtable.shim}}::h43b61b9af30b3669
90:     0x7f7690d4521a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h88864ee659ddb161
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/alloc/src/boxed.rs:1042:9
91:     0x7f7690d4521a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h9f03cbdc7ab33431
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/alloc/src/boxed.rs:1042:9
92:     0x7f7690d4521a - std::sys::unix::thread::Thread::new::thread_start::h5979dd5560a11418
                             at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys/unix/thread.rs:89:17
93:     0x7f7690c2a3e9 - start_thread
94:     0x7f7690a12293 - __GI___clone
95:                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 [codegen_fulfill_obligation] checking if `TypeVal` fulfills its obligations
#1 [resolve_instance] resolving instance `<Multiply<Five, Five> as TypeVal<usize>>::VAL`
#2 [normalize_generic_arg_after_erasing_regions] normalizing `<Multiply<Five, Five> as TypeVal<usize>>::VAL`
#3 [eval_to_allocation_raw] const-evaluating + checking `main::{constant#0}`
#4 [eval_to_const_value_raw] simplifying constant for the type system `main::{constant#0}`
#5 [typeck] type-checking `main`
#6 [typeck_item_bodies] type-checking all item bodies
#7 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0046, E0412.
For more information about an error, try `rustc --explain E0046`.

@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 ./77919.rs ICE glacier ./77919.rs: encountered errors resolving bounds after type-checking Oct 27, 2020
@ebroto
Copy link
Member

ebroto commented Oct 28, 2020

Does not seem to trigger in current nightly/master (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