Skip to content

ICE: entered unreachable code: encountered 'Item(Item.. due to Some(ObligationCause ..  #124350

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

struct Node<const D: usize> {} impl Node<D> where SmallVec<{ D * 2 }>:, { fn new() -> Self { let mut node = Node::new(); (&a, 0)(); node } } struct SmallVec<T1, T2> {} 

original:

struct Node<const D: usize> { } impl<> Node<D> where SmallVec<{ D * 2 }>: { fn new() -> Self { let mut node = Node::new(); (&a, 0)(); node } } struct SmallVec<T1, T2> {}

Version information

rustc 1.79.0-nightly (7bb4f0889 2024-04-24) binary: rustc commit-hash: 7bb4f0889e8b133c5b03c46f31f2ae6432c00219 commit-date: 2024-04-24 host: x86_64-unknown-linux-gnu release: 1.79.0-nightly LLVM version: 18.1.4 

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0412]: cannot find type `D` in this scope --> /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:3:11 | 3 | impl Node<D> | ^ not found in this scope | help: you might be missing a type parameter | 3 | impl<D> Node<D> | +++ error[E0425]: cannot find value `D` in this scope --> /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:5:16 | 5 | SmallVec<{ D * 2 }>:, | ^ not found in this scope | help: you might be missing a const parameter | 3 | impl<const D: /* Type */> Node<D> | +++++++++++++++++++++ error[E0425]: cannot find value `a` in this scope --> /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:9:11 | 9 | (&a, 0)(); | ^ not found in this scope error[E0601]: `main` function not found in crate `mvce` --> /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:15:27 | 15 | struct SmallVec<T1, T2> {} | ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs` error[E0747]: unresolved item provided when a constant was expected --> /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:3:11 | 3 | impl Node<D> | ^ | help: if this generic argument was intended as a const parameter, surround it with braces | 3 | impl Node<{ D }> | + + error[E0107]: struct takes 2 generic arguments but 1 generic argument was supplied --> /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:5:5 | 5 | SmallVec<{ D * 2 }>:, | ^^^^^^^^ --------- supplied 1 generic argument | | | expected 2 generic arguments | note: struct defined here, with 2 generic parameters: `T1`, `T2` --> /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:15:8 | 15 | struct SmallVec<T1, T2> {} | ^^^^^^^^ -- -- help: add missing generic argument | 5 | SmallVec<{ D * 2 }, T2>:, | ++++ error[E0392]: type parameter `T1` is never used --> /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:15:17 | 15 | struct SmallVec<T1, T2> {} | ^^ unused type parameter | = help: consider removing `T1`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `T1` to be a const parameter, use `const T1: /* Type */` instead error[E0392]: type parameter `T2` is never used --> /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:15:21 | 15 | struct SmallVec<T1, T2> {} | ^^ unused type parameter | = help: consider removing `T2`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `T2` to be a const parameter, use `const T2: /* Type */` instead thread 'rustc' panicked at compiler/rustc_hir_typeck/src/method/suggest.rs:965:35: internal error: entered unreachable code: encountered `Item(Item { ident: SmallVec#0, owner_id: DefId(0:8 ~ mvce[ac98]::SmallVec), kind: Struct(Struct { fields: [], recovered: false }, Generics { params: [GenericParam { hir_id: HirId(DefId(0:8 ~ mvce[ac98]::SmallVec).1), def_id: DefId(0:9 ~ mvce[ac98]::SmallVec::T1), name: Plain(T1#0), span: /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:15:17: 15:19 (#0), pure_wrt_drop: false, kind: Type { default: None, synthetic: false }, colon_span: None, source: Generics }, GenericParam { hir_id: HirId(DefId(0:8 ~ mvce[ac98]::SmallVec).2), def_id: DefId(0:10 ~ mvce[ac98]::SmallVec::T2), name: Plain(T2#0), span: /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:15:21: 15:23 (#0), pure_wrt_drop: false, kind: Type { default: None, synthetic: false }, colon_span: None, source: Generics }], predicates: [], has_where_clause_predicates: false, where_clause_span: /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:15:24: 15:24 (#0), span: /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:15:16: 15:24 (#0) }), span: /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:15:1: 15:27 (#0), vis_span: /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:15:1: 15:1 (#0) })` due to `Some( ObligationCause { span: /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:8:30: 8:33 (#0), body_id: DefId(0:7 ~ mvce[ac98]::{impl#0}::new), code: BindingObligation( DefId(0:8 ~ mvce[ac98]::SmallVec), /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:15:17: 15:19 (#0), ), }, )` stack backtrace: 0: 0x7e1150095145 - std::backtrace_rs::backtrace::libunwind::trace::h86d426b17d4e2e3d at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5 1: 0x7e1150095145 - std::backtrace_rs::backtrace::trace_unsynchronized::h8c0ef1d148b9d940 at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7e1150095145 - std::sys_common::backtrace::_print_fmt::he2abce7aa62cdc3a at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/sys_common/backtrace.rs:68:5 3: 0x7e1150095145 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0c9241533158777f at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7e11500e421b - core::fmt::rt::Argument::fmt::h733dbde17a4a7d04 at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/core/src/fmt/rt.rs:165:63 5: 0x7e11500e421b - core::fmt::write::h03896a7fdcd4b82f at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/core/src/fmt/mod.rs:1157:21 6: 0x7e1150089d4f - std::io::Write::write_fmt::hd74e7c0305df2660 at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/io/mod.rs:1832:15 7: 0x7e1150094f1e - std::sys_common::backtrace::_print::hea8c9c28ab87b1b7 at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7e1150094f1e - std::sys_common::backtrace::print::hd4bb5623fa4b8de6 at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7e1150097889 - std::panicking::default_hook::{{closure}}::h4623b55631f16943 10: 0x7e11500975cd - std::panicking::default_hook::he5d3fa1d7e671103 at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/panicking.rs:298:9 11: 0x7e114ca456ab - std[73cef507c0358b10]::panicking::update_hook::<alloc[3ec83808c4b91c16]::boxed::Box<rustc_driver_impl[2d410f393cf62b06]::install_ice_hook::{closure#0}>>::{closure#0} 12: 0x7e1150097f86 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h8ef97572a456b9c7 at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/alloc/src/boxed.rs:2036:9 13: 0x7e1150097f86 - std::panicking::rust_panic_with_hook::h1e2384e63ce90283 at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/panicking.rs:799:13 14: 0x7e1150097d34 - std::panicking::begin_panic_handler::{{closure}}::h8399fde27d16fbcc at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/panicking.rs:664:13 15: 0x7e1150095609 - std::sys_common::backtrace::__rust_end_short_backtrace::hbc2e58d3e2bbc56f at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/sys_common/backtrace.rs:171:18 16: 0x7e1150097a67 - rust_begin_unwind at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/panicking.rs:652:5 17: 0x7e11500e06e3 - core::panicking::panic_fmt::h1b24b925c3ff40f0 at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/core/src/panicking.rs:72:14 18: 0x7e114cc6c689 - <rustc_hir_typeck[3cef36dd3b13bfec]::fn_ctxt::FnCtxt>::report_no_match_method_error 19: 0x7e114cc92e5a - <rustc_hir_typeck[3cef36dd3b13bfec]::fn_ctxt::FnCtxt>::report_method_error 20: 0x7e114e178c10 - <rustc_hir_typeck[3cef36dd3b13bfec]::fn_ctxt::FnCtxt>::check_expr_path 21: 0x7e114e15ab42 - <rustc_hir_typeck[3cef36dd3b13bfec]::fn_ctxt::FnCtxt>::check_call 22: 0x7e114e8bd674 - <rustc_hir_typeck[3cef36dd3b13bfec]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 23: 0x7e114e8aa95f - <rustc_hir_typeck[3cef36dd3b13bfec]::fn_ctxt::FnCtxt>::check_decl 24: 0x7e114e8a6391 - <rustc_hir_typeck[3cef36dd3b13bfec]::fn_ctxt::FnCtxt>::check_block_with_expected 25: 0x7e114e8bdd11 - <rustc_hir_typeck[3cef36dd3b13bfec]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 26: 0x7e114e1342d0 - rustc_hir_typeck[3cef36dd3b13bfec]::check::check_fn 27: 0x7e114e1293da - rustc_hir_typeck[3cef36dd3b13bfec]::typeck 28: 0x7e114e128dbd - rustc_query_impl[e8a6f5b0469e51af]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e8a6f5b0469e51af]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[65b49a3b5d6c0d49]::query::erase::Erased<[u8; 8usize]>> 29: 0x7e114e1e8531 - rustc_query_system[ccb87b148b9f71e3]::query::plumbing::try_execute_query::<rustc_query_impl[e8a6f5b0469e51af]::DynamicConfig<rustc_query_system[ccb87b148b9f71e3]::query::caches::VecCache<rustc_span[ec1f1d58828cad2c]::def_id::LocalDefId, rustc_middle[65b49a3b5d6c0d49]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[e8a6f5b0469e51af]::plumbing::QueryCtxt, false> 30: 0x7e114e1e725c - rustc_query_impl[e8a6f5b0469e51af]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace 31: 0x7e114e1e6e94 - <rustc_middle[65b49a3b5d6c0d49]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[4525919e9da128a7]::check_crate::{closure#4}>::{closure#0} 32: 0x7e114e1e5b8d - rustc_hir_analysis[4525919e9da128a7]::check_crate 33: 0x7e114e1ef507 - rustc_interface[b73225351c325ab5]::passes::analysis 34: 0x7e114e1ef055 - rustc_query_impl[e8a6f5b0469e51af]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e8a6f5b0469e51af]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[65b49a3b5d6c0d49]::query::erase::Erased<[u8; 1usize]>> 35: 0x7e114ebbe665 - rustc_query_system[ccb87b148b9f71e3]::query::plumbing::try_execute_query::<rustc_query_impl[e8a6f5b0469e51af]::DynamicConfig<rustc_query_system[ccb87b148b9f71e3]::query::caches::SingleCache<rustc_middle[65b49a3b5d6c0d49]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e8a6f5b0469e51af]::plumbing::QueryCtxt, false> 36: 0x7e114ebbe3c9 - rustc_query_impl[e8a6f5b0469e51af]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 37: 0x7e114ea45993 - rustc_interface[b73225351c325ab5]::interface::run_compiler::<core[dad89120088e7e02]::result::Result<(), rustc_span[ec1f1d58828cad2c]::ErrorGuaranteed>, rustc_driver_impl[2d410f393cf62b06]::run_compiler::{closure#0}>::{closure#1} 38: 0x7e114ea2f8e7 - std[73cef507c0358b10]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b73225351c325ab5]::util::run_in_thread_with_globals<rustc_interface[b73225351c325ab5]::util::run_in_thread_pool_with_globals<rustc_interface[b73225351c325ab5]::interface::run_compiler<core[dad89120088e7e02]::result::Result<(), rustc_span[ec1f1d58828cad2c]::ErrorGuaranteed>, rustc_driver_impl[2d410f393cf62b06]::run_compiler::{closure#0}>::{closure#1}, core[dad89120088e7e02]::result::Result<(), rustc_span[ec1f1d58828cad2c]::ErrorGuaranteed>>::{closure#0}, core[dad89120088e7e02]::result::Result<(), rustc_span[ec1f1d58828cad2c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[dad89120088e7e02]::result::Result<(), rustc_span[ec1f1d58828cad2c]::ErrorGuaranteed>> 39: 0x7e114ea2f6aa - <<std[73cef507c0358b10]::thread::Builder>::spawn_unchecked_<rustc_interface[b73225351c325ab5]::util::run_in_thread_with_globals<rustc_interface[b73225351c325ab5]::util::run_in_thread_pool_with_globals<rustc_interface[b73225351c325ab5]::interface::run_compiler<core[dad89120088e7e02]::result::Result<(), rustc_span[ec1f1d58828cad2c]::ErrorGuaranteed>, rustc_driver_impl[2d410f393cf62b06]::run_compiler::{closure#0}>::{closure#1}, core[dad89120088e7e02]::result::Result<(), rustc_span[ec1f1d58828cad2c]::ErrorGuaranteed>>::{closure#0}, core[dad89120088e7e02]::result::Result<(), rustc_span[ec1f1d58828cad2c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[dad89120088e7e02]::result::Result<(), rustc_span[ec1f1d58828cad2c]::ErrorGuaranteed>>::{closure#2} as core[dad89120088e7e02]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 40: 0x7e11500a1e1b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3679caeb60ab03c2 at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/alloc/src/boxed.rs:2022:9 41: 0x7e11500a1e1b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7e27b57c37e0ef1f at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/alloc/src/boxed.rs:2022:9 42: 0x7e11500a1e1b - std::sys::pal::unix::thread::Thread::new::thread_start::he8797429d1c20e6e at /rustc/7bb4f0889e8b133c5b03c46f31f2ae6432c00219/library/std/src/sys/pal/unix/thread.rs:108:17 43: 0x7e11498a955a - <unknown> 44: 0x7e1149926a3c - <unknown> 45: 0x0 - <unknown> error: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md note: please make sure that you have updated to the latest nightly note: rustc 1.79.0-nightly (7bb4f0889 2024-04-24) running on x86_64-unknown-linux-gnu query stack during panic: #0 [typeck] type-checking `<impl at /tmp/icemaker_global_tempdir.hlMXO2zd865n/rustc_testrunner_tmpdir_reporting.tjYcDgjhDnWm/mvce.rs:3:1: 5:26>::new` #1 [analysis] running analysis passes on this crate end of query stack error: aborting due to 8 previous errors Some errors have detailed explanations: E0107, E0392, E0412, E0425, E0601, E0747. For more information about an error, try `rustc --explain E0107`. 

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions