Skip to content
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

ICE: "unexpected path" when reporting type annotations needed #97820

Closed
Runi-c opened this issue Jun 7, 2022 · 3 comments
Closed

ICE: "unexpected path" when reporting type annotations needed #97820

Runi-c opened this issue Jun 7, 2022 · 3 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Runi-c
Copy link

Runi-c commented Jun 7, 2022

playground repro
Does not repro on beta or stable

Code

type HashMap<K, V> = hashbrown::HashMap<K, V, ahash::RandomState>;
fn main() {
    let vec = HashMap::new();
}

Meta

rustc --version --verbose:

rustc 1.63.0-nightly (50b00252a 2022-06-06)
binary: rustc
commit-hash: 50b00252aeb77b10db04d65dc9e12ce758def4b5
commit-date: 2022-06-06
host: x86_64-pc-windows-msvc
release: 1.63.0-nightly
LLVM version: 14.0.5

Error output

error: internal compiler error: compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs:856:33: unexpected path: def=hashbrown::HashMap substs=[_, _, ahash::RandomState, hashbrown::raw::alloc::inner::Global] path=Path { span: src/main.rs:3:15: 3:22 (#0), res: Def(TyAlias, DefId(0:3 ~ playground[3ae5]::HashMap)), segments: [PathSegment { ident: HashMap#0, hir_id: Some(HirId { owner: DefId(0:6 ~ playground[3ae5]::main), local_id: 2 }), res: Some(Err), args: None, infer_args: true }] }

Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/compiler/rustc_errors/src/lib.rs:1335:9
stack backtrace:
   0:     0x7fa474a1009d - std::backtrace_rs::backtrace::libunwind::trace::h2a8892c156585d66
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fa474a1009d - std::backtrace_rs::backtrace::trace_unsynchronized::h918c401bc86eed40
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fa474a1009d - std::sys_common::backtrace::_print_fmt::h2a52b4cb52dc84fb
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fa474a1009d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2f5ce3ea50e5b1d6
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fa474a6be2c - core::fmt::write::h48a5b18f44037270
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/core/src/fmt/mod.rs:1196:17
   5:     0x7fa474a01791 - std::io::Write::write_fmt::h1d1b08935a2fcf4b
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/io/mod.rs:1654:15
   6:     0x7fa474a12d75 - std::sys_common::backtrace::_print::h46d4f4f2d0dbcce0
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fa474a12d75 - std::sys_common::backtrace::print::h8334e6fa27a1dde4
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fa474a12d75 - std::panicking::default_hook::{{closure}}::hc13c7ff820b0fe22
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/panicking.rs:295:22
   9:     0x7fa474a12a96 - std::panicking::default_hook::h100ba67c99329739
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/panicking.rs:314:9
  10:     0x7fa4751e86c1 - rustc_driver[30390a19e428bc19]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fa474a1344a - std::panicking::rust_panic_with_hook::h0a6a04da5fd1d45f
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/panicking.rs:702:17
  12:     0x7fa476282d71 - std[41be3fa6aba1786e]::panicking::begin_panic::<rustc_errors[e8101b8b045aac39]::ExplicitBug>::{closure#0}
  13:     0x7fa476282786 - std[41be3fa6aba1786e]::sys_common::backtrace::__rust_end_short_backtrace::<std[41be3fa6aba1786e]::panicking::begin_panic<rustc_errors[e8101b8b045aac39]::ExplicitBug>::{closure#0}, !>
  14:     0x7fa4761ff036 - std[41be3fa6aba1786e]::panicking::begin_panic::<rustc_errors[e8101b8b045aac39]::ExplicitBug>
  15:     0x7fa4762254a6 - std[41be3fa6aba1786e]::panic::panic_any::<rustc_errors[e8101b8b045aac39]::ExplicitBug>
  16:     0x7fa476224f45 - <rustc_errors[e8101b8b045aac39]::HandlerInner>::bug::<&alloc[40ba6c0f2dbdab1e]::string::String>
  17:     0x7fa4762232a0 - <rustc_errors[e8101b8b045aac39]::Handler>::bug::<&alloc[40ba6c0f2dbdab1e]::string::String>
  18:     0x7fa47627fd4d - rustc_middle[70296c36ca3d2602]::ty::context::tls::with_opt::<rustc_middle[70296c36ca3d2602]::util::bug::opt_span_bug_fmt<rustc_span[db009ef5852f774a]::span_encoding::Span>::{closure#0}, ()>
  19:     0x7fa47627fe46 - rustc_middle[70296c36ca3d2602]::util::bug::opt_span_bug_fmt::<rustc_span[db009ef5852f774a]::span_encoding::Span>
  20:     0x7fa47627fdc3 - rustc_middle[70296c36ca3d2602]::util::bug::bug_fmt
  21:     0x7fa47615615b - <rustc_infer[9428db4faa363431]::infer::error_reporting::need_type_info::FindInferSourceVisitor>::path_inferred_subst_iter
  22:     0x7fa4761566e3 - <rustc_infer[9428db4faa363431]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[a412caeb98c40378]::intravisit::Visitor>::visit_expr
  23:     0x7fa47615656c - <rustc_infer[9428db4faa363431]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[a412caeb98c40378]::intravisit::Visitor>::visit_expr
  24:     0x7fa47616cc0c - rustc_hir[a412caeb98c40378]::intravisit::walk_local::<rustc_infer[9428db4faa363431]::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  25:     0x7fa4761561e8 - <rustc_infer[9428db4faa363431]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[a412caeb98c40378]::intravisit::Visitor>::visit_local
  26:     0x7fa47616ca57 - rustc_hir[a412caeb98c40378]::intravisit::walk_block::<rustc_infer[9428db4faa363431]::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  27:     0x7fa47615657e - <rustc_infer[9428db4faa363431]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[a412caeb98c40378]::intravisit::Visitor>::visit_expr
  28:     0x7fa476115284 - <rustc_infer[9428db4faa363431]::infer::InferCtxt>::emit_inference_failure_err
  29:     0x7fa476067d66 - <rustc_infer[9428db4faa363431]::infer::InferCtxt as rustc_trait_selection[d0fea7d99d927b2c]::traits::error_reporting::InferCtxtPrivExt>::maybe_report_ambiguity
  30:     0x7fa47605bd87 - <rustc_infer[9428db4faa363431]::infer::InferCtxt as rustc_trait_selection[d0fea7d99d927b2c]::traits::error_reporting::InferCtxtExt>::report_fulfillment_errors
  31:     0x7fa4767aa094 - <rustc_infer[9428db4faa363431]::infer::InferCtxtBuilder>::enter::<&rustc_middle[70296c36ca3d2602]::ty::context::TypeckResults, <rustc_typeck[a3bfe43d381eec93]::check::inherited::InheritedBuilder>::enter<rustc_typeck[a3bfe43d381eec93]::check::typeck_with_fallback<rustc_typeck[a3bfe43d381eec93]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[70296c36ca3d2602]::ty::context::TypeckResults>::{closure#0}>
  32:     0x7fa47673c2fa - rustc_typeck[a3bfe43d381eec93]::check::typeck
  33:     0x7fa476d616d4 - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::try_execute_query::<rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt, rustc_query_system[c8ac68b744dd57fa]::query::caches::DefaultCache<rustc_span[db009ef5852f774a]::def_id::LocalDefId, &rustc_middle[70296c36ca3d2602]::ty::context::TypeckResults>>
  34:     0x7fa476c8e03e - <rustc_query_impl[51e1f4158b96ee22]::Queries as rustc_middle[70296c36ca3d2602]::ty::query::QueryEngine>::typeck
  35:     0x7fa4767faf98 - <rustc_middle[70296c36ca3d2602]::hir::map::Map>::par_body_owners::<rustc_typeck[a3bfe43d381eec93]::check::typeck_item_bodies::{closure#0}>
  36:     0x7fa47760074c - rustc_typeck[a3bfe43d381eec93]::check::typeck_item_bodies
  37:     0x7fa47790bfbc - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::try_execute_query::<rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt, rustc_query_system[c8ac68b744dd57fa]::query::caches::DefaultCache<(), ()>>
  38:     0x7fa477936841 - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::get_query::<rustc_query_impl[51e1f4158b96ee22]::queries::typeck_item_bodies, rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt>
  39:     0x7fa477637133 - <rustc_session[f622d47d49ca7e5c]::session::Session>::time::<(), rustc_typeck[a3bfe43d381eec93]::check_crate::{closure#7}>
  40:     0x7fa477623d5b - rustc_typeck[a3bfe43d381eec93]::check_crate
  41:     0x7fa4773e11c7 - rustc_interface[30bf44ec34e2f97]::passes::analysis
  42:     0x7fa4779014ef - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::try_execute_query::<rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt, rustc_query_system[c8ac68b744dd57fa]::query::caches::DefaultCache<(), core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>>
  43:     0x7fa477948dfe - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::get_query::<rustc_query_impl[51e1f4158b96ee22]::queries::analysis, rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt>
  44:     0x7fa47739e547 - <rustc_interface[30bf44ec34e2f97]::passes::QueryContext>::enter::<rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>
  45:     0x7fa47738870f - <rustc_interface[30bf44ec34e2f97]::interface::Compiler>::enter::<rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}::{closure#2}, core[42e67a1b4ba6212c]::result::Result<core[42e67a1b4ba6212c]::option::Option<rustc_interface[30bf44ec34e2f97]::queries::Linker>, rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>
  46:     0x7fa4773b1d5f - rustc_span[db009ef5852f774a]::with_source_map::<core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>, rustc_interface[30bf44ec34e2f97]::interface::create_compiler_and_run<core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>, rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}>::{closure#1}>
  47:     0x7fa4773895a2 - <scoped_tls[2965e6335b4e6f3e]::ScopedKey<rustc_span[db009ef5852f774a]::SessionGlobals>>::set::<rustc_interface[30bf44ec34e2f97]::interface::run_compiler<core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>, rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}>::{closure#0}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>
  48:     0x7fa47739ebcf - std[41be3fa6aba1786e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[30bf44ec34e2f97]::util::run_in_thread_pool_with_globals<rustc_interface[30bf44ec34e2f97]::interface::run_compiler<core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>, rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}>::{closure#0}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>::{closure#0}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>
  49:     0x7fa47739ed39 - <<std[41be3fa6aba1786e]::thread::Builder>::spawn_unchecked_<rustc_interface[30bf44ec34e2f97]::util::run_in_thread_pool_with_globals<rustc_interface[30bf44ec34e2f97]::interface::run_compiler<core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>, rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}>::{closure#0}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>::{closure#0}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>::{closure#1} as core[42e67a1b4ba6212c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  50:     0x7fa474a1d373 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha070fd431c3387e9
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/alloc/src/boxed.rs:1951:9
  51:     0x7fa474a1d373 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd87ab2d0201316b5
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/alloc/src/boxed.rs:1951:9
  52:     0x7fa474a1d373 - std::sys::unix::thread::Thread::new::thread_start::ha32118aaa6c8a9be
                               at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/sys/unix/thread.rs:108:17
  53:     0x7fa474943609 - start_thread
  54:     0x7fa474866133 - clone
  55:                0x0 - <unknown>

note: 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: rustc 1.63.0-nightly (50b00252a 2022-06-06) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack

@Runi-c Runi-c added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 7, 2022
@Runi-c Runi-c changed the title ICE: "unexpected path" ICE: "unexpected path" when reporting type annotations needed Jun 7, 2022
@Runi-c
Copy link
Author

Runi-c commented Jun 7, 2022

maybe it's because I didn't know what I was looking for before, but I only just now found a couple other issues about this bug, this is probably a duplicate. My bad! Seems to be a shorter repro than the others though so that might be useful

@compiler-errors
Copy link
Member

Possibly fixed by #97703

@infiniwave
Copy link

infiniwave commented Jun 9, 2022

Likely duplicated by #97885, #97902, and #97806

@Runi-c Runi-c closed this as completed Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants