Skip to content

ICE: find_associated_type_in_generics(): no self type #18819

Closed
@mitsuhiko

Description

@mitsuhiko
#![feature(associated_types)]

trait Foo {
    type Item;
}

struct X;

impl Foo for X {
    type Item = bool;
}

fn print_x(_: &Foo, extra: &str) {
    println!("{}", extra);
}

fn main() {
    print_x(X);
}

Dies with

test.rs:13:16: 13:19 error: internal compiler error: find_associated_type_in_generics(): no self type
test.rs:13 fn print_x(_: &Foo, extra: &str) {
                          ^~~
note: the compiler unexpectedly panicked. 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' panicked at 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/diagnostic.rs:116

stack backtrace:
   1:        0x10b17643f - rt::backtrace::imp::write::heab549955ca6934dpiq
   2:        0x10b1795c7 - failure::on_fail::h9750e46879097a56ezq
   3:        0x10b3d8ef5 - unwind::begin_unwind_inner::h0f87899b91f071e1NJd
   4:        0x10a8eb2b7 - unwind::begin_unwind::h6796486979632825738
   5:        0x10a8eb250 - unwind::begin_unwind::h6796486979632825738
   6:        0x107fafffd - driver::session::Session::span_bug::h26574e9841411f5bA7C
   7:        0x10843975d - middle::typeck::collect::find_associated_type_in_generics::he5ec036251e3e16bYwk
   8:        0x10850fa5c - middle::typeck::astconv::ast_path_substs::h8729390751104391384
   9:        0x1085106f1 - middle::typeck::astconv::ast_path_to_trait_ref::h13208595450406868388
  10:        0x108510046 - middle::typeck::astconv::mk_pointer::h12867263350824000013
  11:        0x10850bf12 - middle::typeck::astconv::ast_ty_to_ty::h1820939219922996803
  12:        0x108511b68 - middle::typeck::astconv::ty_of_method_or_bare_fn::closure.138616
  13:        0x10832c819 - iter::Iterator::collect::h13127179578553682480
  14:        0x10850a986 - middle::typeck::astconv::ty_of_method_or_bare_fn::h3377120847162563636
  15:        0x10840e330 - middle::typeck::collect::ty_of_item::h0b070528a4026772fnl
  16:        0x10840813b - middle::typeck::collect::convert::h74fbfcc18e80af91QUk
  17:        0x108401a33 - middle::typeck::collect::collect_item_types::h6ce4561091b9e880wUj
  18:        0x107e14d06 - util::common::time::h4852740920531154558
  19:        0x1085daea8 - middle::typeck::check_crate::hdfe03390a939e74fzEp
  20:        0x108642f5f - driver::driver::phase_3_run_analysis_passes::h684f8f33a4a89e34zoC
  21:        0x10863dd78 - driver::driver::compile_input::hc9734ea3ed69bc4ck5B
  22:        0x1086baf7d - driver::run_compiler::h4142c8bbe1826b6eBVF
  23:        0x1086b94ae - driver::run::closure.146451
  24:        0x107e2cfdb - task::TaskBuilder<S>::try_future::closure.104859
  25:        0x107e2ced3 - task::TaskBuilder<S>::spawn_internal::closure.104830
  26:        0x10a751bdd - task::NativeSpawner.Spawner::spawn::closure.8535
  27:        0x10b43754c - rust_try_inner
  28:        0x10b437536 - rust_try
  29:        0x10b3d66c7 - unwind::try::h49d13887fc603b6evyd
  30:        0x10b3d655c - task::Task::run::heafec7ab39920b98iKc
  31:        0x10a751a03 - task::NativeSpawner.Spawner::spawn::closure.8472
  32:        0x10b3d7d87 - thread::thread_start::h4573ff03e74d3553x5c
  33:     0x7fff9260c2fc - _pthread_body
  34:     0x7fff9260c279 - _pthread_body

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)A-trait-systemArea: Trait systemI-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