-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Closed
Labels
A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Description
Code
trait Borrowed<'a> {
type Type: Default;
}
impl<'a> Borrowed<'a> for i32 {
type Type = i32;
}
fn g<T, F>(f: F)
where
T: for<'a> Borrowed<'a>,
F: Fn(<T as Borrowed>::Type),
{
f(Default::default())
}
fn main() {
g::<i32, _>(|_| ());
}Meta
Crashes on 1.51, beta and nightly
rustc --version --verbose:
rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-unknown-linux-gnu
release: 1.51.0
LLVM version: 11.0.1
Error output
error: internal compiler error: compiler/rustc_trait_selection/src/traits/codegen.rs:78:17: Encountered error `OutputTypeParameterMismatch(Binder(<[closure@src/main.rs:18:17: 18:23] as std::ops::Fn<(<i32 as Borrowed<'_>>::Type,)>>), Binder(<[closure@src/main.rs:18:17: 18:23] as std::ops::Fn<(i32,)>>), Sorts(ExpectedFound { expected: i32, found: <i32 as Borrowed<'_>>::Type }))` selecting `Binder(<[closure@src/main.rs:18:17: 18:23] as std::ops::Fn<(i32,)>>)` during codegen
Backtrace
thread 'rustc' panicked at 'Box<Any>', /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panic.rs:59:5
stack backtrace:
0: std::panicking::begin_panic
1: std::panic::panic_any
2: rustc_errors::HandlerInner::bug
3: rustc_errors::Handler::bug
4: rustc_middle::ty::context::tls::with_opt
5: rustc_middle::util::bug::opt_span_bug_fmt
6: rustc_middle::util::bug::bug_fmt
7: rustc_infer::infer::InferCtxtBuilder::enter
8: rustc_trait_selection::traits::codegen::codegen_fulfill_obligation
9: 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
10: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
11: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
12: rustc_data_structures::stack::ensure_sufficient_stack
13: rustc_query_system::query::plumbing::force_query_with_job
14: rustc_query_system::query::plumbing::get_query_impl
15: rustc_ty_utils::instance::inner_resolve_instance
16: rustc_ty_utils::instance::resolve_instance
17: 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
18: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
19: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
20: rustc_data_structures::stack::ensure_sufficient_stack
21: rustc_query_system::query::plumbing::force_query_with_job
22: rustc_query_system::query::plumbing::get_query_impl
23: rustc_middle::ty::instance::Instance::resolve_opt_const_arg
24: rustc_middle::ty::instance::Instance::resolve
25: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_terminator
26: rustc_mir::monomorphize::collector::collect_neighbours
27: rustc_mir::monomorphize::collector::collect_items_rec
28: rustc_mir::monomorphize::collector::collect_items_rec
29: rustc_session::utils::<impl rustc_session::session::Session>::time
30: rustc_mir::monomorphize::collector::collect_crate_mono_items
31: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
32: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute
33: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
34: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
35: rustc_data_structures::stack::ensure_sufficient_stack
36: rustc_query_system::query::plumbing::force_query_with_job
37: rustc_query_system::query::plumbing::get_query_impl
38: rustc_codegen_ssa::base::codegen_crate
39: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
40: rustc_session::utils::<impl rustc_session::session::Session>::time
41: rustc_interface::passes::QueryContext::enter
42: rustc_interface::queries::Queries::ongoing_codegen
43: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
44: rustc_span::with_source_map
45: rustc_interface::interface::create_compiler_and_run
46: rustc_span::with_session_globals
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.