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

Stable ICE #83801

Closed
nanoqsh opened this issue Apr 3, 2021 · 2 comments
Closed

Stable ICE #83801

nanoqsh opened this issue Apr 3, 2021 · 2 comments
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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

@nanoqsh
Copy link

nanoqsh commented Apr 3, 2021

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

@nanoqsh nanoqsh 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 Apr 3, 2021
@JohnTitor JohnTitor added the A-codegen Area: Code generation label Apr 3, 2021
@JohnTitor
Copy link
Member

I think duplicate of #80291.

@jackh726
Copy link
Member

Fixed by #85499, closing since other tests cover this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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

4 participants