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 with associated type in trait constraint trait type parameter #18389

Closed
jeremyletang opened this issue Oct 28, 2014 · 1 comment · Fixed by #19780
Closed

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

jeremyletang opened this issue Oct 28, 2014 · 1 comment · Fixed by #19780
Labels
A-associated-items Area: Associated items (types, constants & functions) E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@jeremyletang
Copy link
Contributor

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
@soltanmm
Copy link

I haven't seen this kind of thing in any RFCs (that of using Self associated types in trait bounds on Self where the associated types are for the trait being declared). Is this supposed to be supported?

I mean, I'd like it to be. I just haven't seen it written anywhere.

@huonw huonw added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-associated-items Area: Associated items (types, constants & functions) labels Nov 20, 2014
@ghost ghost added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Dec 12, 2014
bors added a commit that referenced this issue Dec 18, 2014
Closes #5988.
Closes #10176.
Closes #10456.
Closes #12744.
Closes #13264.
Closes #13324.
Closes #14182.
Closes #15381.
Closes #15444.
Closes #15480.
Closes #15756.
Closes #16822.
Closes #16966.
Closes #17351.
Closes #17503.
Closes #17545.
Closes #17771.
Closes #17816.
Closes #17897.
Closes #17905.
Closes #18188.
Closes #18232.
Closes #18345.
Closes #18389.
Closes #18400.
Closes #18502.
Closes #18611.
Closes #18783.
Closes #19009.
Closes #19081.
Closes #19098.
Closes #19127.
Closes #19135.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants