Skip to content

ICE with associated type in trait constraint trait type parameter #18389

Closed
@jeremyletang

Description

@jeremyletang

Hi,

I have an ICE with associated type and traits types parameter. Here is the code which make the ICE:

#![feature(unboxed_closures)]
#![feature(associated_types)]

use std::any::Any;
use std::intrinsics::TypeId;

pub trait Pt {}
pub trait Rt {}

trait Private<P: Pt, R: Rt> {
    fn call(&self, p: P, r: R);
}
pub trait Public: Private< <Self as Public>::P, <Self as Public>::R> {
    type P;
    type R;

    fn call_inner(&self);
}

fn main() {}

Here is the error:

error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'No def'n found for DefId { krate: 0, node: 52 } in tcx.impl_or_trait_items', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc/middle/ty.rs:4045

And the backtrace:

stack backtrace:
   1:        0x10ea1c449 - rt::backtrace::imp::write::h9ef15559a8ab15acklq
   2:        0x10ea1f727 - failure::on_fail::h2c624eec61273dd2TBq
   3:        0x10ec81dd5 - unwind::begin_unwind_inner::h9b53584d2b2a04abuJd
   4:        0x10ec81aa0 - unwind::begin_unwind_fmt::hfeb45fefb5f89034WGd
   5:        0x10ba16db0 - middle::ty::impl_or_trait_item::h5647870d220dd48dRyJ
   6:        0x10be8c4d8 - middle::typeck::astconv::associated_ty_to_ty::h16367986389000391518
   7:        0x10be76e76 - middle::typeck::astconv::ast_ty_to_ty::h711177843661714102
   8:        0x10bcca47f - iter::Iterator::collect::h15375321657273984973
   9:        0x10be79598 - middle::typeck::astconv::ast_path_substs::h1309767547822478877
  10:        0x10be78ab5 - middle::typeck::astconv::ast_path_to_trait_ref::h14934150251062436313
  11:        0x10be8c7ad - middle::typeck::collect::conv_param_bounds::closure.136540
  12:        0x10bdea784 - iter::Iterator::collect::h5260861383003533849
  13:        0x10bda430f - middle::typeck::collect::trait_def_of_item::h443e0c062e25ab1eIQi
  14:        0x10bd9fcfe - middle::typeck::collect::collect_item_types::h8e837d96c3fa1910Duh
  15:        0x10b7cce66 - util::common::time::h6426555137378661470
  16:        0x10bf54ed8 - middle::typeck::check_crate::h0a022cac844ad54a2gn
  17:        0x10bfbdb1f - driver::driver::phase_3_run_analysis_passes::h6990fe5bffeac231mVz
  18:        0x10bfb83ad - driver::driver::compile_input::hef5c826020afb7d67Bz
  19:        0x10c0367cf - driver::run_compiler::hc0a4e8928d29f9d9ipD
  20:        0x10c0349d6 - driver::run::closure.144600
  21:        0x10b7e569b - task::TaskBuilder<S>::try_future::closure.103029
  22:        0x10b7e5593 - task::TaskBuilder<S>::spawn_internal::closure.103000
  23:        0x10b7677cd - task::NativeSpawner.Spawner::spawn::closure.8544
  24:        0x10ece7f4c - rust_try_inner
  25:        0x10ece7f36 - rust_try
  26:        0x10ec7f467 - unwind::try::h8fbc818092646037cyd
  27:        0x10ec7f2fc - task::Task::run::h86bb0e257a4c218dZJc
  28:        0x10b7675f3 - task::NativeSpawner.Spawner::spawn::closure.8481
  29:        0x10ec80c57 - thread::thread_start::h887b36ec0072bfebe5c
  30:     0x7fff8ffdc899 - _pthread_body
  31:     0x7fff8ffdc72a - _pthread_struct_init

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions