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: Error encountered resolving bounds after type-checking #73229

Closed
The0x539 opened this issue Jun 11, 2020 · 1 comment · Fixed by #78295
Closed

ICE: Error encountered resolving bounds after type-checking #73229

The0x539 opened this issue Jun 11, 2020 · 1 comment · Fixed by #78295
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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

@The0x539
Copy link

Code

fn any<T>() -> T { loop {} }

trait Foo { type V; }

trait Callback<T: Foo>: Fn(&T, &T::V) {}
impl<T: Foo, F: Fn(&T, &T::V)> Callback<T> for F {}

struct Bar<T: Foo> {
    callback: Box<dyn Callback<T>>,
}

impl<T: Foo> Bar<T> {
    fn event(&self) {
        (self.callback)(any(), any());
    }
}

struct A;
struct B;
impl Foo for A { type V = B; }

fn main() {
    let foo = Bar::<A> {
        callback: Box::new(|_: &A, _: &B| ()),
    };
    foo.event();
}

Meta

rustc --version --verbose:

rustc 1.46.0-nightly (feb3536eb 2020-06-09)
binary: rustc
commit-hash: feb3536eba10c2e4585d066629598f03d5ddc7c6
commit-date: 2020-06-09
host: x86_64-unknown-linux-gnu
release: 1.46.0-nightly
LLVM version: 10.0

Error output

error: internal compiler error: src/librustc_trait_selection/traits/codegen/mod.rs:108: Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<dyn for<'r, 's> Callback<A, Output = ()> as std::ops::Fn<(&A, &B)>>)), depth=1),Unimplemented)]` resolving bounds after type-checking
Backtrace

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:907: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:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   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:481
  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_trait_selection::traits::codegen::drain_fulfillment_cx_or_panic
  21: rustc_middle::ty::context::GlobalCtxt::enter_local
  22: rustc_trait_selection::traits::codegen::codegen_fulfill_obligation
  23: 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
  24: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  25: rustc_data_structures::stack::ensure_sufficient_stack
  26: rustc_query_system::query::plumbing::get_query_impl
  27: rustc_ty::instance::resolve_instance
  28: 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
  29: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  30: rustc_data_structures::stack::ensure_sufficient_stack
  31: rustc_query_system::query::plumbing::get_query_impl
  32: rustc_middle::ty::instance::Instance::resolve
  33: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_terminator_kind
  34: rustc_mir::monomorphize::collector::collect_neighbours
  35: rustc_data_structures::stack::ensure_sufficient_stack
  36: rustc_mir::monomorphize::collector::collect_items_rec
  37: rustc_mir::monomorphize::collector::collect_items_rec
  38: rustc_mir::monomorphize::collector::collect_crate_mono_items
  39: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  40: 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
  41: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  42: rustc_query_system::query::plumbing::get_query_impl
  43: rustc_codegen_ssa::base::codegen_crate
  44: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  45: rustc_interface::passes::start_codegen
  46: rustc_middle::ty::context::tls::enter_global
  47: rustc_interface::queries::Queries::ongoing_codegen
  48: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  49: rustc_span::with_source_map
  50: rustc_interface::interface::run_compiler_in_existing_thread_pool
  51: scoped_tls::ScopedKey<T>::set

@The0x539 The0x539 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 11, 2020
@jonas-schievink jonas-schievink added the A-codegen Area: Code generation label Jun 11, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 17, 2020
@JohnTitor
Copy link
Member

Triage: It's no longer ICE with the latest nightly, I think it's fixed by #77720.

@JohnTitor JohnTitor added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 23, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Oct 26, 2020
@camelid camelid assigned camelid and unassigned camelid Oct 26, 2020
@bors bors closed this as completed in 75bbd80 Oct 26, 2020
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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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

Successfully merging a pull request may close this issue.

5 participants