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

Certain uses of polymorphic lifetimes seems to trigger an internal compiler error. #79463

Closed
andersrein opened this issue Nov 27, 2020 · 1 comment
Labels
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

@andersrein
Copy link

andersrein commented Nov 27, 2020

Code

trait Foo<'t> {
    type Inner;
}


fn foo<T>(_f: for<'f> fn(<T as Foo<'f>>::Inner))
    where T: for<'t> Foo<'t>
{ }

impl<'t> Foo<'t> for i32 {
    type Inner = &'t i32;
}

fn main() { foo::<i32>(|_inner| { }); }

Meta

rustc --version --verbose:

rustc 1.44.1 (c7087fe00 2020-06-17)
binary: rustc
commit-hash: c7087fe00d2ba919df1d813c040a5d47e43b0fe7
commit-date: 2020-06-17
host: x86_64-unknown-linux-gnu
release: 1.44.1
LLVM version: 9.0

Error output

   Compiling minimal_compiler_crash v0.1.0 (/home/are/source/rust_playground/minimal_compiler_crash)
error: internal compiler error: src/librustc_trait_selection/traits/codegen/mod.rs:61: Encountered error `OutputTypeParameterMismatch(Binder(<[closure@src/main.rs:14:24: 14:36] as std::ops::FnMut<(<i32 as Foo<'_>>::Inner,)>>), Binder(<[closure@src/main.rs:14:24: 14:36] as std::ops::FnMut<(&i32,)>>), Sorts(ExpectedFound { expected: &i32, found: <i32 as Foo<'_>>::Inner }))` selecting `Binder(<[closure@src/main.rs:14:24: 14:36] as std::ops::FnMut<(&i32,)>>)` during codegen

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:904:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.1 (c7087fe00 2020-06-17) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

error: aborting due to previous error

error: could not compile `minimal_compiler_crash`.
Backtrace

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:904:9
stack backtrace:
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:904:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1069
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1504
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:515
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::bug
  14: rustc_errors::Handler::bug
  15: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
  16: rustc_middle::ty::context::tls::with_opt::{{closure}}
  17: rustc_middle::ty::context::tls::with_opt
  18: rustc_middle::util::bug::opt_span_bug_fmt
  19: rustc_middle::util::bug::bug_fmt
  20: rustc_middle::ty::context::tls::with_context::{{closure}}
  21: rustc_trait_selection::traits::codegen::codegen_fulfill_obligation
  22: 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
  23: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  24: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  25: rustc_query_system::query::plumbing::get_query
  26: rustc_ty::instance::resolve_instance
  27: 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
  28: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  29: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  30: rustc_query_system::query::plumbing::get_query
  31: rustc_middle::ty::instance::Instance::resolve
  32: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_terminator_kind
  33: rustc_mir::monomorphize::collector::collect_items_rec
  34: rustc_mir::monomorphize::collector::collect_items_rec
  35: rustc_mir::monomorphize::collector::collect_crate_mono_items
  36: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  37: 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
  38: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  39: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  40: rustc_query_system::query::plumbing::get_query
  41: rustc_codegen_ssa::base::codegen_crate
  42: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  43: rustc_session::utils::<impl rustc_session::session::Session>::time
  44: rustc_interface::passes::start_codegen
  45: rustc_middle::ty::context::tls::enter_global
  46: rustc_interface::queries::Queries::ongoing_codegen
  47: rustc_interface::interface::run_compiler_in_existing_thread_pool
  48: scoped_tls::ScopedKey<T>::set
  49: rustc_ast::attr::with_globals

@andersrein andersrein 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 Nov 27, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Dec 12, 2020
@jackh726
Copy link
Member

Closing as duplicate of #62529

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. 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

3 participants