Closed
Description
Code
type A = ();
pub struct B(());
enum Thing {}
type FnAlias<R = B> = fn(A, &[B], R);
impl From<FnAlias<()>> for Thing {
fn from(_: FnAlias) -> Self {}
}
Meta
rustc --version --verbose
:
rustc 1.58.0-nightly (e249ce6b2 2021-10-30)
binary: rustc
commit-hash: e249ce6b2345587d6e11052779c86adbad626dff
commit-date: 2021-10-30
host: x86_64-unknown-linux-gnu
release: 1.58.0-nightly
LLVM version: 13.0.0
Also get this using stable:
rustc 1.56.0 (09c42c458 2021-10-18)
binary: rustc
commit-hash: 09c42c45858d5f3aedfa670698275303a3d19afa
commit-date: 2021-10-18
host: x86_64-unknown-linux-gnu
release: 1.56.0
LLVM version: 13.0.0
You can see it on the playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3249dfb3850d684ed13b10623e3dfa60
Error output
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_typeck/src/check/compare_method.rs:485:31
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
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.56.0 (09c42c458 2021-10-18) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [check_mod_item_types] checking item types in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
Backtrace
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_typeck/src/check/compare_method.rs:485:31
stack backtrace:
0: rust_begin_unwind
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/panicking.rs:517:5
1: core::panicking::panic_fmt
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/panicking.rs:101:14
2: core::panicking::panic
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/panicking.rs:50:5
3: rustc_typeck::check::compare_method::extract_spans_for_error_reporting
4: rustc_infer::infer::InferCtxtBuilder::enter
5: rustc_typeck::check::compare_method::compare_impl_method
6: rustc_typeck::check::check::check_item_type
7: rustc_middle::hir::map::Map::visit_item_likes_in_module
8: rustc_typeck::check::check::check_mod_item_types
9: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
10: rustc_data_structures::stack::ensure_sufficient_stack
11: rustc_query_system::query::plumbing::force_query_with_job
12: rustc_query_system::query::plumbing::get_query_impl
13: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
14: rustc_session::utils::<impl rustc_session::session::Session>::time
15: rustc_typeck::check_crate
16: rustc_interface::passes::analysis
17: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
18: rustc_data_structures::stack::ensure_sufficient_stack
19: rustc_query_system::query::plumbing::force_query_with_job
20: rustc_query_system::query::plumbing::get_query_impl
21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
22: rustc_interface::passes::QueryContext::enter
23: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
24: rustc_span::with_source_map
25: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: internal compiler error: unexpected panic